xref: /haiku/src/preferences/screen/ScreenWindow.h (revision 2cad94c1c30b6223ad8c08710b26e071d32e9979)
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 BSpinner;
25 class BStringView;
26 
27 class RefreshWindow;
28 class MonitorView;
29 class ScreenSettings;
30 
31 
32 class ScreenWindow : public BWindow {
33 public:
34 							ScreenWindow(ScreenSettings *settings);
35 	virtual					~ScreenWindow();
36 
37 	virtual	bool			QuitRequested();
38 	virtual	void			MessageReceived(BMessage *message);
39 	virtual	void			WorkspaceActivated(int32 ws, bool state);
40 	virtual	void			ScreenChanged(BRect frame, color_space mode);
41 
42 private:
43 			void			_BuildSupportedColorSpaces();
44 
45 			void			_CheckApplyEnabled();
46 			void			_CheckResolutionMenu();
47 			void			_CheckColorMenu();
48 			void			_CheckRefreshMenu();
49 
50 			void			_UpdateActiveMode();
51 			void			_UpdateActiveMode(int32 workspace);
52 			void			_UpdateWorkspaceButtons();
53 			void			_UpdateRefreshControl();
54 			void			_UpdateMonitorView();
55 			void			_UpdateControls();
56 			void			_UpdateOriginal();
57 			void			_UpdateMonitor();
58 			void			_UpdateColorLabel();
59 
60 			void			_Apply();
61 
62 			status_t		_WriteVesaModeFile(const screen_mode& mode) const;
63 			bool			_IsVesa() const { return fIsVesa; }
64 
65 private:
66 			ScreenSettings*	fSettings;
67 			bool			fIsVesa;
68 			bool			fBootWorkspaceApplied;
69 
70 			BStringView*	fMonitorInfo;
71 			BStringView*	fDeviceInfo;
72 			MonitorView*	fMonitorView;
73 			BMenuItem*		fAllWorkspacesItem;
74 
75 			BSpinner*		fColumnsControl;
76 			BSpinner*		fRowsControl;
77 
78 			uint32			fSupportedColorSpaces;
79 			BMenuItem*		fUserSelectedColorSpace;
80 
81 			BPopUpMenu*		fResolutionMenu;
82 			BMenuField*		fResolutionField;
83 			BPopUpMenu*		fColorsMenu;
84 			BMenuField*		fColorsField;
85 			BPopUpMenu*		fRefreshMenu;
86 			BMenuField*		fRefreshField;
87 			BMenuItem*		fOtherRefresh;
88 
89 			BPopUpMenu*		fCombineMenu;
90 			BMenuField*		fCombineField;
91 			BPopUpMenu*		fSwapDisplaysMenu;
92 			BMenuField*		fSwapDisplaysField;
93 			BPopUpMenu*		fUseLaptopPanelMenu;
94 			BMenuField*		fUseLaptopPanelField;
95 			BPopUpMenu*		fTVStandardMenu;
96 			BMenuField*		fTVStandardField;
97 
98 			BButton*		fDefaultsButton;
99 			BButton*		fApplyButton;
100 			BButton*		fRevertButton;
101 
102 			BButton*		fBackgroundsButton;
103 
104 			ScreenMode		fScreenMode;
105 			ScreenMode		fUndoScreenMode;
106 				// screen modes for all workspaces
107 
108 			screen_mode		fActive, fSelected, fOriginal;
109 				// screen modes for the current workspace
110 
111 			uint32			fOriginalWorkspacesColumns;
112 			uint32			fOriginalWorkspacesRows;
113 			bool			fModified;
114 };
115 
116 #endif	/* SCREEN_WINDOW_H */
117