xref: /haiku/src/preferences/screen/ScreenWindow.h (revision 5f4f984a94d150153bcb00a2ed780d0437859543)
1 /*
2  * Copyright 2001-2014 Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Stefano Ceccherini, burton666@libero.it
7  *		Axel Dörfler, axeld@pinc-software.de
8  *		Thomas Kurschel
9  *		Rafael Romo
10  *		John Scipione, jscipione@gmail.com
11  */
12 #ifndef SCREEN_WINDOW_H
13 #define SCREEN_WINDOW_H
14 
15 
16 #include <Window.h>
17 
18 #include "ScreenMode.h"
19 
20 
21 class BBox;
22 class BPopUpMenu;
23 class BMenuField;
24 class BSlider;
25 class BSpinner;
26 class BStringView;
27 
28 class RefreshWindow;
29 class MonitorView;
30 class ScreenSettings;
31 
32 
33 class ScreenWindow : public BWindow {
34 public:
35 							ScreenWindow(ScreenSettings *settings);
36 	virtual					~ScreenWindow();
37 
38 	virtual	bool			QuitRequested();
39 	virtual	void			MessageReceived(BMessage *message);
40 	virtual	void			WorkspaceActivated(int32 ws, bool state);
41 	virtual	void			ScreenChanged(BRect frame, color_space mode);
42 
43 private:
44 			void			_BuildSupportedColorSpaces();
45 
46 			void			_CheckApplyEnabled();
47 			void			_CheckResolutionMenu();
48 			void			_CheckColorMenu();
49 			void			_CheckRefreshMenu();
50 
51 			void			_UpdateActiveMode();
52 			void			_UpdateActiveMode(int32 workspace);
53 			void			_UpdateWorkspaceButtons();
54 			void			_UpdateRefreshControl();
55 			void			_UpdateMonitorView();
56 			void			_UpdateControls();
57 			void			_UpdateOriginal();
58 			void			_UpdateMonitor();
59 			void			_UpdateColorLabel();
60 
61 			void			_Apply();
62 
63 			status_t		_WriteVesaModeFile(const screen_mode& mode) const;
64 			bool			_IsVesa() const { return fIsVesa; }
65 
66 private:
67 			ScreenSettings*	fSettings;
68 			bool			fIsVesa;
69 			bool			fBootWorkspaceApplied;
70 
71 			BStringView*	fMonitorInfo;
72 			BStringView*	fDeviceInfo;
73 			MonitorView*	fMonitorView;
74 			BMenuItem*		fAllWorkspacesItem;
75 
76 			BSpinner*		fColumnsControl;
77 			BSpinner*		fRowsControl;
78 
79 			uint32			fSupportedColorSpaces;
80 			BMenuItem*		fUserSelectedColorSpace;
81 
82 			BPopUpMenu*		fResolutionMenu;
83 			BMenuField*		fResolutionField;
84 			BPopUpMenu*		fColorsMenu;
85 			BMenuField*		fColorsField;
86 			BPopUpMenu*		fRefreshMenu;
87 			BMenuField*		fRefreshField;
88 			BMenuItem*		fOtherRefresh;
89 
90 			BPopUpMenu*		fCombineMenu;
91 			BMenuField*		fCombineField;
92 			BPopUpMenu*		fSwapDisplaysMenu;
93 			BMenuField*		fSwapDisplaysField;
94 			BPopUpMenu*		fUseLaptopPanelMenu;
95 			BMenuField*		fUseLaptopPanelField;
96 			BPopUpMenu*		fTVStandardMenu;
97 			BMenuField*		fTVStandardField;
98 
99 			BSlider*		fBrightnessSlider;
100 
101 			BButton*		fDefaultsButton;
102 			BButton*		fApplyButton;
103 			BButton*		fRevertButton;
104 
105 			BButton*		fBackgroundsButton;
106 
107 			ScreenMode		fScreenMode;
108 			ScreenMode		fUndoScreenMode;
109 				// screen modes for all workspaces
110 
111 			screen_mode		fActive, fSelected, fOriginal;
112 				// screen modes for the current workspace
113 
114 			uint32			fOriginalWorkspacesColumns;
115 			uint32			fOriginalWorkspacesRows;
116 			float			fOriginalBrightness;
117 			bool			fModified;
118 };
119 
120 #endif	/* SCREEN_WINDOW_H */
121