xref: /haiku/src/apps/icon-o-matic/document/Document.h (revision 25dc253d6ab28ce204fa4de2d3e7a27d167fc817)
1 /*
2  * Copyright 2006-2007, Haiku.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Stephan Aßmus <superstippi@gmx.de>
7  */
8 #ifndef DOCUMENT_H
9 #define DOCUMENT_H
10 
11 
12 #include "IconBuild.h"
13 #include "Observable.h"
14 #include "RWLocker.h"
15 
16 #include <String.h>
17 
18 
19 struct entry_ref;
20 
21 _BEGIN_ICON_NAMESPACE
22 	class Icon;
23 _END_ICON_NAMESPACE
24 
25 class CommandStack;
26 class DocumentSaver;
27 class Selection;
28 
29 class Document : public RWLocker,
30 				 public Observable {
31  public:
32 								Document(const char* name = NULL);
33 	virtual						~Document();
34 
CommandStack()35 	inline	::CommandStack*		CommandStack() const
36 									{ return fCommandStack; }
37 
Selection()38 	inline	::Selection*		Selection() const
39 									{ return fSelection; }
40 
41 			void				SetName(const char* name);
42 			const char*			Name() const;
43 
44 			void				SetNativeSaver(::DocumentSaver* saver);
NativeSaver()45 	inline	::DocumentSaver*	NativeSaver() const
46 									{ return fNativeSaver; }
47 
48 			void				SetExportSaver(::DocumentSaver* saver);
ExportSaver()49 	inline	::DocumentSaver*	ExportSaver() const
50 									{ return fExportSaver; }
51 
52 			void				SetIcon(_ICON_NAMESPACE Icon* icon);
Icon()53 	inline	_ICON_NAMESPACE Icon* Icon() const
54 									{ return fIcon; }
55 
56 			void				MakeEmpty(bool includingSavers = true);
57 
58 			bool				IsEmpty() const;
59 
60  private:
61 			_ICON_NAMESPACE Icon* fIcon;
62 			::CommandStack*		fCommandStack;
63 			::Selection*		fSelection;
64 
65 			BString				fName;
66 
67 			::DocumentSaver*	fNativeSaver;
68 			::DocumentSaver*	fExportSaver;
69 };
70 
71 #endif // DOCUMENT_H
72