xref: /haiku/src/apps/webpositive/SettingsWindow.h (revision 44d19f4d32b8f7e9c01f00294c87ca5cc2e057f7)
1 /*
2  * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
3  *
4  * All rights reserved. Distributed under the terms of the MIT License.
5  */
6 #ifndef SETTINGS_WINDOW_H
7 #define SETTINGS_WINDOW_H
8 
9 #include <Window.h>
10 
11 class BButton;
12 class BCheckBox;
13 class BMenu;
14 class BMenuField;
15 class BMenuItem;
16 class BSpinner;
17 class BTextControl;
18 class FontSelectionView;
19 class SettingsMessage;
20 
21 
22 class SettingsWindow : public BWindow {
23 public:
24 								SettingsWindow(BRect frame,
25 									SettingsMessage* settings);
26 	virtual						~SettingsWindow();
27 
28 	virtual	void				MessageReceived(BMessage* message);
29 	virtual	bool				QuitRequested();
30 
31 	virtual	void				Show();
32 
33 private:
34 			BView*				_CreateGeneralPage(float spacing);
35 			BView*				_CreateFontsPage(float spacing);
36 			BView*				_CreateProxyPage(float spacing);
37 			void				_BuildSizesMenu(BMenu* menu,
38 									uint32 messageWhat);
39 			void				_SetupFontSelectionView(
40 									FontSelectionView* view,
41 									BMessage* message);
42 
43 			bool				_CanApplySettings() const;
44 			void				_ApplySettings();
45 			void				_RevertSettings();
46 			void				_ValidateControlsEnabledStatus();
47 
48 			uint32				_NewWindowPolicy() const;
49 			uint32				_NewTabPolicy() const;
50 
51 			void				_SetSizesMenuValue(BMenu* menu, int32 value);
52 			int32				_SizesMenuValue(BMenu* menu) const;
53 
54 			BFont				_FindDefaultSerifFont() const;
55 
56 			uint32				_ProxyPort() const;
57 
58 private:
59 			SettingsMessage*	fSettings;
60 
61 			BTextControl*		fStartPageControl;
62 			BTextControl*		fSearchPageControl;
63 			BTextControl*		fDownloadFolderControl;
64 
65 			BMenuField*			fNewWindowBehaviorMenu;
66 			BMenuItem*			fNewWindowBehaviorOpenHomeItem;
67 			BMenuItem*			fNewWindowBehaviorOpenSearchItem;
68 			BMenuItem*			fNewWindowBehaviorOpenBlankItem;
69 
70 			BMenuField*			fNewTabBehaviorMenu;
71 			BMenuItem*			fNewTabBehaviorCloneCurrentItem;
72 			BMenuItem*			fNewTabBehaviorOpenHomeItem;
73 			BMenuItem*			fNewTabBehaviorOpenSearchItem;
74 			BMenuItem*			fNewTabBehaviorOpenBlankItem;
75 
76 			BSpinner*			fDaysInHistory;
77 			BCheckBox*			fShowTabsIfOnlyOnePage;
78 			BCheckBox*			fAutoHideInterfaceInFullscreenMode;
79 			BCheckBox*			fAutoHidePointer;
80 			BCheckBox*			fShowHomeButton;
81 
82 			FontSelectionView*	fStandardFontView;
83 			FontSelectionView*	fSerifFontView;
84 			FontSelectionView*	fSansSerifFontView;
85 			FontSelectionView*	fFixedFontView;
86 
87 			BCheckBox*			fUseProxyCheckBox;
88 			BTextControl*		fProxyAddressControl;
89 			BTextControl*		fProxyPortControl;
90 			BCheckBox*			fUseProxyAuthCheckBox;
91 			BTextControl*		fProxyUsernameControl;
92 			BTextControl*		fProxyPasswordControl;
93 
94 			BButton*			fApplyButton;
95 			BButton*			fCancelButton;
96 			BButton*			fRevertButton;
97 
98 			BMenuField*			fStandardSizesMenu;
99 			BMenuField*			fFixedSizesMenu;
100 };
101 
102 
103 #endif // SETTINGS_WINDOW_H
104 
105