xref: /haiku/src/apps/processcontroller/Preferences.h (revision 99d1318ec02694fc520a0dc38ae38565db7e8c3c)
1 /*
2  * Copyright 2000, Georges-Edouard Berenger. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef PREFERENCES_H
6 #define PREFERENCES_H
7 
8 #include <Locker.h>
9 #include <Message.h>
10 #include <Window.h>
11 
12 
13 class Preferences : public BMessage, public BLocker {
14 	public:
15 		Preferences(const char* thename, const char* thesignature = NULL, bool doSave = true);
16 		Preferences(const entry_ref& ref, const char* thesignature = NULL, bool doSave = true);
17 		~Preferences();
18 		status_t	MakeEmpty();
19 		void		SaveWindowPosition(BWindow* window, const char* name);
20 		void		LoadWindowPosition(BWindow* window, const char* name);
21 		void		SaveWindowFrame(BWindow* window, const char* name);
22 		void		LoadWindowFrame(BWindow* window, const char* name);
23 		void		SaveInt32(int32 val, const char* name);
24 		bool		ReadInt32(int32& val, const char* name);
25 		void		SaveFloat(float val, const char* name);
26 		bool		ReadFloat(float& val, const char* name);
27 		void		SaveRect(BRect& rect, const char* name);
28 		BRect&		ReadRect(BRect& rect, const char* name);
29 		void		SaveString(BString& string, const char* name);
30 		void		SaveString(const char* string, const char* name);
31 		bool		ReadString(BString& string, const char* name);
32 
33 	private:
34 		bool		fNewPreferences;
35 		bool		fSavePreferences;
36 		char*		fName;
37 		char*		fSignature;
38 		entry_ref*	fSettingsFile;
39 };
40 
41 extern Preferences gPreferences;
42 
43 // ggPreferences.LoadWindowPosition(this, kPosPrefName);
44 // ggPreferences.SaveWindowPosition(this, kPosPrefName);
45 
46 // ggPreferences.LoadWindowFrame(this, frame);
47 // ggPreferences.SaveWindowFrame(this, frame);
48 
49 #endif // PREFERENCES_H
50