xref: /haiku/src/apps/processcontroller/Preferences.h (revision 21258e2674226d6aa732321b6f8494841895af5f)
1 /*
2 
3 	Preferences.h
4 
5 	ProcessController
6 	(c) 2000, Georges-Edouard Berenger, All Rights Reserved.
7 	Copyright (C) 2004 beunited.org
8 
9 	This library is free software; you can redistribute it and/or
10 	modify it under the terms of the GNU Lesser General Public
11 	License as published by the Free Software Foundation; either
12 	version 2.1 of the License, or (at your option) any later version.
13 
14 	This library is distributed in the hope that it will be useful,
15 	but WITHOUT ANY WARRANTY; without even the implied warranty of
16 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 	Lesser General Public License for more details.
18 
19 	You should have received a copy of the GNU Lesser General Public
20 	License along with this library; if not, write to the Free Software
21 	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22 
23 */
24 #ifndef PREFERENCES_H
25 #define PREFERENCES_H
26 
27 #include <Locker.h>
28 #include <Message.h>
29 #include <Window.h>
30 
31 
32 class Preferences : public BMessage, public BLocker {
33 	public:
34 		Preferences(const char* thename, const char* thesignature = NULL, bool doSave = true);
35 		Preferences(const entry_ref& ref, const char* thesignature = NULL, bool doSave = true);
36 		~Preferences();
37 		status_t	MakeEmpty();
38 		void		SaveWindowPosition(BWindow* window, const char* name);
39 		void		LoadWindowPosition(BWindow* window, const char* name);
40 		void		SaveWindowFrame(BWindow* window, const char* name);
41 		void		LoadWindowFrame(BWindow* window, const char* name);
42 		void		SaveInt32(int32 val, const char* name);
43 		bool		ReadInt32(int32& val, const char* name);
44 		void		SaveFloat(float val, const char* name);
45 		bool		ReadFloat(float& val, const char* name);
46 		void		SaveRect(BRect& rect, const char* name);
47 		BRect&		ReadRect(BRect& rect, const char* name);
48 		void		SaveString(BString& string, const char* name);
49 		void		SaveString(const char* string, const char* name);
50 		bool		ReadString(BString& string, const char* name);
51 
52 	private:
53 		bool		fNewPreferences;
54 		bool		fSavePreferences;
55 		char*		fName;
56 		char*		fSignature;
57 		entry_ref*	fSettingsFile;
58 };
59 
60 extern Preferences gPreferences;
61 
62 // ggPreferences.LoadWindowPosition(this, kPosPrefName);
63 // ggPreferences.SaveWindowPosition(this, kPosPrefName);
64 
65 // ggPreferences.LoadWindowFrame(this, frame);
66 // ggPreferences.SaveWindowFrame(this, frame);
67 
68 #endif // PREFERENCES_H
69