xref: /haiku/src/apps/webpositive/SettingsWindow.h (revision 83b1a68c52ba3e0e8796282759f694b7fdddf06d)
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 BTextControl;
17 class FontSelectionView;
18 class SettingsMessage;
19 
20 
21 class SettingsWindow : public BWindow {
22 public:
23 								SettingsWindow(BRect frame,
24 									SettingsMessage* settings);
25 	virtual						~SettingsWindow();
26 
27 	virtual	void				MessageReceived(BMessage* message);
28 	virtual	bool				QuitRequested();
29 
30 	virtual	void				Show();
31 
32 private:
33 			BView*				_CreateGeneralPage(float spacing);
34 			BView*				_CreateFontsPage(float spacing);
35 			BView*				_CreateProxyPage(float spacing);
36 			void				_BuildSizesMenu(BMenu* menu,
37 									uint32 messageWhat);
38 			void				_SetupFontSelectionView(
39 									FontSelectionView* view,
40 									BMessage* message);
41 
42 			bool				_CanApplySettings() const;
43 			void				_ApplySettings();
44 			void				_RevertSettings();
45 			void				_ValidateControlsEnabledStatus();
46 
47 			uint32				_NewWindowPolicy() const;
48 			uint32				_NewTabPolicy() const;
49 			int32				_MaxHistoryAge() 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 			BTextControl*		fDaysInHistoryMenuControl;
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