xref: /haiku/src/apps/icon-o-matic/document/Document.h (revision 0c93c0a807b27096abbfad677436afb7d1712d4a)
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 "Observable.h"
13 #include "RWLocker.h"
14 
15 #include <String.h>
16 
17 struct entry_ref;
18 
19 namespace BPrivate {
20 namespace Icon {
21 
22 class Icon;
23 
24 }	// namespace Icon
25 }	// namespace BPrivate
26 
27 class CommandStack;
28 class DocumentSaver;
29 class Selection;
30 
31 class Document : public RWLocker,
32 				 public Observable {
33  public:
34 								Document(const char* name = NULL);
35 	virtual						~Document();
36 
37 	inline	::CommandStack*		CommandStack() const
38 									{ return fCommandStack; }
39 
40 	inline	::Selection*		Selection() const
41 									{ return fSelection; }
42 
43 			void				SetName(const char* name);
44 			const char*			Name() const;
45 
46 			void				SetNativeSaver(::DocumentSaver* saver);
47 	inline	::DocumentSaver*	NativeSaver() const
48 									{ return fNativeSaver; }
49 
50 			void				SetExportSaver(::DocumentSaver* saver);
51 	inline	::DocumentSaver*	ExportSaver() const
52 									{ return fExportSaver; }
53 
54 			void				SetIcon(BPrivate::Icon::Icon* icon);
55 	inline	BPrivate::Icon::Icon* Icon() const
56 									{ return fIcon; }
57 
58 			void				MakeEmpty(bool includingSavers = true);
59 
60  private:
61 			BPrivate::Icon::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