xref: /haiku/src/preferences/screen/ScreenWindow.h (revision 99d027cd0238c1d86da86d7c3f4200509ccc61a6)
1 /*
2  * Copyright 2001-2009, Haiku.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Rafael Romo
7  *		Stefano Ceccherini (burton666@libero.it)
8  *		Thomas Kurschel
9  *		Axel Dörfler, axeld@pinc-software.de
10  */
11 #ifndef SCREEN_WINDOW_H
12 #define SCREEN_WINDOW_H
13 
14 
15 #include <Window.h>
16 
17 #include "ScreenMode.h"
18 
19 
20 class BBox;
21 class BPopUpMenu;
22 class BMenuField;
23 class BStringView;
24 class BTextControl;
25 
26 class RefreshWindow;
27 class MonitorView;
28 class ScreenSettings;
29 
30 
31 class ScreenWindow : public BWindow {
32 public:
33 							ScreenWindow(ScreenSettings *settings);
34 	virtual					~ScreenWindow();
35 
36 	virtual	bool			QuitRequested();
37 	virtual	void			MessageReceived(BMessage *message);
38 	virtual	void			WorkspaceActivated(int32 ws, bool state);
39 	virtual	void			ScreenChanged(BRect frame, color_space mode);
40 
41 private:
42 			BButton*		_CreateColumnRowButton(bool columns, bool plus);
43 			BButton*		_GetColumnRowButton(bool columns, bool plus);
44 
45 			void			_BuildSupportedColorSpaces();
46 
47 			void			_CheckApplyEnabled();
48 			void			_CheckResolutionMenu();
49 			void			_CheckColorMenu();
50 			void			_CheckRefreshMenu();
51 
52 			void			_UpdateActiveMode();
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 			MonitorView*	fMonitorView;
73 			BMenuItem*		fAllWorkspacesItem;
74 
75 			BTextControl*	fColumnsControl;
76 			BTextControl*	fRowsControl;
77 			BButton*		fWorkspacesButtons[4];
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 			BButton*		fDefaultsButton;
100 			BButton*		fApplyButton;
101 			BButton*		fRevertButton;
102 
103 			BButton*		fBackgroundsButton;
104 
105 			ScreenMode		fScreenMode;
106 			ScreenMode		fUndoScreenMode;
107 				// screen modes for all workspaces
108 
109 			screen_mode		fActive, fSelected, fOriginal;
110 				// screen modes for the current workspace
111 
112 			uint32			fOriginalWorkspacesColumns;
113 			uint32			fOriginalWorkspacesRows;
114 			bool			fModified;
115 };
116 
117 #endif	/* SCREEN_WINDOW_H */
118