xref: /haiku/src/apps/processcontroller/Preferences.h (revision 1214ef1b2100f2b3299fc9d8d6142e46f70a4c3f)
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 
25 #ifndef _Preferences_H_
26 #define _Preferences_H_
27 
28 #include <Window.h>
29 #include <Message.h>
30 #include <Locker.h>
31 
32 class GebsPreferences : public BMessage, public BLocker {
33 
34 public:
35 				GebsPreferences (const char* thename, const char* thesignature=NULL, bool doSave=true);
36 				GebsPreferences (const entry_ref &ref, const char* thesignature=NULL, bool doSave=true);
37 				~GebsPreferences ();
38 	status_t	MakeEmpty ();
39 	void		SaveWindowPosition (BWindow* window, const char* name);
40 	void		LoadWindowPosition (BWindow* window, const char* name);
41 	void		SaveWindowFrame (BWindow* window, const char* name);
42 	void		LoadWindowFrame (BWindow* window, const char* name);
43 	void		SaveInt32 (int32 val, const char* name);
44 	bool		ReadInt32 (int32 &val, const char* name);
45 	void		SaveFloat (float val, const char* name);
46 	bool		ReadFloat (float &val, const char* name);
47 	void		SaveRect (BRect &rect, const char* name);
48 	BRect&		ReadRect (BRect &rect, const char* name);
49 	void		SaveString (BString &string, const char* name);
50 	void		SaveString (const char* string, const char* name);
51 	bool		ReadString (BString &string, const char* name);
52 	bool		fNewPreferences;
53 	bool		fSavePreferences;
54 	char		*fName;
55 	char		*fSignature;
56 	entry_ref	*fSettingsFile;
57 };
58 
59 extern GebsPreferences gPreferences;
60 
61 // ggPreferences.LoadWindowPosition(this, kPosPrefName);
62 // ggPreferences.SaveWindowPosition(this, kPosPrefName);
63 
64 // ggPreferences.LoadWindowFrame(this, frame);
65 // ggPreferences.SaveWindowFrame(this, frame);
66 
67 #endif // _Preferences_H_
68