xref: /haiku/src/apps/webpositive/SettingsWindow.h (revision 820dca4df6c7bf955c46e8f6521b9408f50b2900)
1 /*
2  * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
3  *
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
16  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
19  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 #ifndef SETTINGS_WINDOW_H
28 #define SETTINGS_WINDOW_H
29 
30 #include <Window.h>
31 
32 class BButton;
33 class BCheckBox;
34 class BMenu;
35 class BMenuField;
36 class BMenuItem;
37 class BTextControl;
38 class FontSelectionView;
39 class SettingsMessage;
40 
41 
42 class SettingsWindow : public BWindow {
43 public:
44 								SettingsWindow(BRect frame,
45 									SettingsMessage* settings);
46 	virtual						~SettingsWindow();
47 
48 	virtual	void				MessageReceived(BMessage* message);
49 	virtual	bool				QuitRequested();
50 
51 	virtual	void				Show();
52 
53 private:
54 			BView*				_CreateGeneralPage(float spacing);
55 			BView*				_CreateFontsPage(float spacing);
56 			BView*				_CreateProxyPage(float spacing);
57 			void				_BuildSizesMenu(BMenu* menu,
58 									uint32 messageWhat);
59 			void				_SetupFontSelectionView(
60 									FontSelectionView* view,
61 									BMessage* message);
62 
63 			bool				_CanApplySettings() const;
64 			void				_ApplySettings();
65 			void				_RevertSettings();
66 			void				_ValidateControlsEnabledStatus();
67 
68 			uint32				_NewWindowPolicy() const;
69 			uint32				_NewTabPolicy() const;
70 			int32				_MaxHistoryAge() const;
71 
72 			void				_SetSizesMenuValue(BMenu* menu, int32 value);
73 			int32				_SizesMenuValue(BMenu* menu) const;
74 
75 			BFont				_FindDefaultSerifFont() const;
76 
77 			uint32				_ProxyPort() const;
78 
79 private:
80 			SettingsMessage*	fSettings;
81 
82 			BTextControl*		fStartPageControl;
83 			BTextControl*		fSearchPageControl;
84 			BTextControl*		fDownloadFolderControl;
85 
86 			BMenuField*			fNewWindowBehaviorMenu;
87 			BMenuItem*			fNewWindowBehaviorOpenHomeItem;
88 			BMenuItem*			fNewWindowBehaviorOpenSearchItem;
89 			BMenuItem*			fNewWindowBehaviorOpenBlankItem;
90 
91 			BMenuField*			fNewTabBehaviorMenu;
92 			BMenuItem*			fNewTabBehaviorCloneCurrentItem;
93 			BMenuItem*			fNewTabBehaviorOpenHomeItem;
94 			BMenuItem*			fNewTabBehaviorOpenSearchItem;
95 			BMenuItem*			fNewTabBehaviorOpenBlankItem;
96 
97 			BTextControl*		fDaysInHistoryMenuControl;
98 			BCheckBox*			fShowTabsIfOnlyOnePage;
99 			BCheckBox*			fAutoHideInterfaceInFullscreenMode;
100 			BCheckBox*			fAutoHidePointer;
101 			BCheckBox*			fShowHomeButton;
102 
103 			FontSelectionView*	fStandardFontView;
104 			FontSelectionView*	fSerifFontView;
105 			FontSelectionView*	fSansSerifFontView;
106 			FontSelectionView*	fFixedFontView;
107 
108 			BCheckBox*			fUseProxyCheckBox;
109 			BTextControl*		fProxyAddressControl;
110 			BTextControl*		fProxyPortControl;
111 
112 			BButton*			fApplyButton;
113 			BButton*			fCancelButton;
114 			BButton*			fRevertButton;
115 
116 			BMenuField*			fStandardSizesMenu;
117 			BMenuField*			fFixedSizesMenu;
118 };
119 
120 
121 #endif // SETTINGS_WINDOW_H
122 
123