xref: /haiku/src/preferences/screen/ScreenWindow.h (revision e5d65858f2361fe0552495b61620c84dcee6bc00)
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			_UpdateActiveMode(int32 workspace);
54 			void			_UpdateWorkspaceButtons();
55 			void			_UpdateRefreshControl();
56 			void			_UpdateMonitorView();
57 			void			_UpdateControls();
58 			void			_UpdateOriginal();
59 			void			_UpdateMonitor();
60 			void			_UpdateColorLabel();
61 
62 			void			_Apply();
63 
64 			status_t		_WriteVesaModeFile(const screen_mode& mode) const;
65 			bool			_IsVesa() const { return fIsVesa; }
66 
67 private:
68 			ScreenSettings*	fSettings;
69 			bool			fIsVesa;
70 			bool			fBootWorkspaceApplied;
71 
72 			BStringView*	fMonitorInfo;
73 			MonitorView*	fMonitorView;
74 			BMenuItem*		fAllWorkspacesItem;
75 
76 			BTextControl*	fColumnsControl;
77 			BTextControl*	fRowsControl;
78 			BButton*		fWorkspacesButtons[4];
79 
80 			uint32			fSupportedColorSpaces;
81 			BMenuItem*		fUserSelectedColorSpace;
82 
83 			BPopUpMenu*		fResolutionMenu;
84 			BMenuField*		fResolutionField;
85 			BPopUpMenu*		fColorsMenu;
86 			BMenuField*		fColorsField;
87 			BPopUpMenu*		fRefreshMenu;
88 			BMenuField*		fRefreshField;
89 			BMenuItem*		fOtherRefresh;
90 
91 			BPopUpMenu*		fCombineMenu;
92 			BMenuField*		fCombineField;
93 			BPopUpMenu*		fSwapDisplaysMenu;
94 			BMenuField*		fSwapDisplaysField;
95 			BPopUpMenu*		fUseLaptopPanelMenu;
96 			BMenuField*		fUseLaptopPanelField;
97 			BPopUpMenu*		fTVStandardMenu;
98 			BMenuField*		fTVStandardField;
99 
100 			BButton*		fDefaultsButton;
101 			BButton*		fApplyButton;
102 			BButton*		fRevertButton;
103 
104 			BButton*		fBackgroundsButton;
105 
106 			ScreenMode		fScreenMode;
107 			ScreenMode		fUndoScreenMode;
108 				// screen modes for all workspaces
109 
110 			screen_mode		fActive, fSelected, fOriginal;
111 				// screen modes for the current workspace
112 
113 			uint32			fOriginalWorkspacesColumns;
114 			uint32			fOriginalWorkspacesRows;
115 			bool			fModified;
116 };
117 
118 #endif	/* SCREEN_WINDOW_H */
119