xref: /haiku/src/apps/deskbar/PreferencesWindow.h (revision 02354704729d38c3b078c696adc1bbbd33cbcf72)
1 /*
2  * Copyright 2009 Haiku, Inc.
3  * All Rights Reserved. Distributed under the terms of the MIT License.
4  */
5 #ifndef _PREFERENCES_WINDOW_H
6 #define _PREFERENCES_WINDOW_H
7 
8 
9 #include <Window.h>
10 
11 #include "BarSettings.h"
12 
13 
14 const uint32 kConfigShow			= 'PrSh';
15 const uint32 kConfigQuit			= 'PrQt';
16 const uint32 kUpdateRecentCounts	= 'upct';
17 const uint32 kEditInTracker			= 'etrk';
18 
19 const uint32 kTrackerFirst			= 'TkFt';
20 const uint32 kSortRunningApps		= 'SAps';
21 const uint32 kSuperExpando			= 'SprE';
22 const uint32 kExpandNewTeams		= 'ExTm';
23 const uint32 kHideLabels			= 'hLbs';
24 const uint32 kResizeTeamIcons		= 'RTIs';
25 const uint32 kAutoRaise				= 'AtRs';
26 const uint32 kAutoHide				= 'AtHd';
27 
28 const uint32 kDefaults				= 'dflt';
29 const uint32 kRevert				= 'rvrt';
30 
31 
32 class BCheckBox;
33 class BFile;
34 class BMessage;
35 class BRadioButton;
36 class BSlider;
37 class BSpinner;
38 
39 class PreferencesWindow : public BWindow
40 {
41 public:
42 							PreferencesWindow(BRect frame);
43 							~PreferencesWindow();
44 
45 	virtual	void			MessageReceived(BMessage* message);
46 	virtual	bool			QuitRequested();
47 	virtual	void			Show();
48 
49 private:
50 			void			_EnableDisableDependentItems();
51 
52 			bool			_IsDefaultable();
53 			bool			_IsRevertable();
54 
55 			status_t		_InitSettingsFile(BFile* file, bool write);
56 			status_t		_LoadSettings(BMessage* settings);
57 			status_t		_SaveSettings(BMessage* settings);
58 
59 			void			_SetInitialSettings();
60 
61 			void			_UpdateButtons();
62 			void			_UpdatePreferences(desk_settings* settings);
63 			void			_UpdateRecentCounts();
64 
65 private:
66 			BCheckBox*		fMenuRecentDocuments;
67 			BCheckBox*		fMenuRecentApplications;
68 			BCheckBox*		fMenuRecentFolders;
69 
70 			BSpinner*		fMenuRecentDocumentCount;
71 			BSpinner*		fMenuRecentApplicationCount;
72 			BSpinner*		fMenuRecentFolderCount;
73 
74 			BCheckBox*		fAppsSort;
75 			BCheckBox*		fAppsSortTrackerFirst;
76 			BCheckBox*		fAppsShowExpanders;
77 			BCheckBox*		fAppsExpandNew;
78 			BCheckBox*		fAppsHideLabels;
79 			BSlider*		fAppsIconSizeSlider;
80 
81 			BCheckBox*		fWindowAlwaysOnTop;
82 			BCheckBox*		fWindowAutoRaise;
83 			BCheckBox*		fWindowAutoHide;
84 
85 			BButton*		fDefaultsButton;
86 			BButton*		fRevertButton;
87 
88 private:
89 			desk_settings	fSettings;
90 };
91 
92 
93 #endif	// _PREFERENCES_WINDOW_H
94