xref: /haiku/src/apps/autoraise/settings.h (revision 079eccf655ba39812b421ae1b87a727d41b50354)
1 #ifndef SETTINGS_H
2 #define SETTINGS_H
3 
4 
5 /***************************************************
6 	settings.h
7 	Mechanisms for managing the settings setting/retireval for AutoRaise
8 
9 	2002 mmu_man
10 	from Deskscope:
11 	2000 Shamyl Zakariya
12 ***************************************************/
13 #include "common.h"
14 
15 /****************************************
16 	AutoRaiseSettings
17 	Simple class for getting and setting prefs.
18 	Instantiating will open up settings file
19 	Destroying will write settings plus any changes
20 	back into the file.
21 
22 	Settings file won't be updated until AutoRaiseSettings
23 	destructor is called. Doens't matter if it's allocated off
24 	heap or stack. I recommend stack, though, to keep likelyhood
25 	of race conditions down.
26 
27 	File is defined in common.h as SETTINGS_FILE
28 
29 ****************************************/
30 
31 // make adding configuration fields easier
32 #define CONF_ADDPROP(_type, _name) \
33 protected:\
34 		_type _conf##_name;\
35 public:\
36 		void Set##_name(_type value);\
37 		_type _name();
38 
39 class AutoRaiseSettings
40 {
41 	protected:
42 		BFile _settingsFile;
43 //		BPath _appPath;
44 
45 		BMessage _settingsMessage;
46 
47 
48 
49 		BMessage openSettingsFile();
50 		void closeSettingsFile();
51 
52 	public:
53 		AutoRaiseSettings();
54 		~AutoRaiseSettings();
55 
56 CONF_ADDPROP(bool, Active)
57 CONF_ADDPROP(bigtime_t, Delay)
58 CONF_ADDPROP(int32, Mode)
59 //CONF_ADDPROP(BPath, AppPath)
60 CONF_ADDPROP(entry_ref, AppPath)
61 
62 };
63 
64 #undef CONF_ADDPROP
65 
66 #define AR_APP_PATH "ar:app_path"
67 
68 #endif
69