xref: /haiku/src/preferences/screen/ScreenMode.h (revision d25503d3dbd8e3f526fd0a9bdd884b8e43c1b794)
1 /*
2  * Copyright 2005, Haiku.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Axel Dörfler, axeld@pinc-software.de
7  */
8 #ifndef SCREEN_MODE_H
9 #define SCREEN_MODE_H
10 
11 
12 #include <Screen.h>
13 
14 
15 typedef enum {
16 	kCombineDisable,
17 	kCombineHorizontally,
18 	kCombineVertically
19 } combine_mode;
20 
21 struct screen_mode {
22 	int32			width;		// these reflect the corrected width/height,
23 	int32			height;		// taking the combine mode into account
24 	color_space		space;
25 	float			refresh;
26 	combine_mode	combine;
27 	bool			swap_displays;
28 	bool			use_laptop_panel;
29 	uint32			tv_standard;
30 
31 	void SetTo(display_mode& mode);
32 	int32 BitsPerPixel() const;
33 
34 	bool operator==(const screen_mode &otherMode) const;
35 	bool operator!=(const screen_mode &otherMode) const;
36 };
37 
38 
39 class ScreenMode {
40 public:
41 							ScreenMode(BWindow* window);
42 							~ScreenMode();
43 
44 			status_t		Set(const screen_mode& mode, int32 workspace = ~0);
45 			status_t		Get(screen_mode& mode, int32 workspace = ~0) const;
46 			status_t		GetOriginalMode(screen_mode &mode,
47 								int32 workspace = ~0) const;
48 
49 			status_t		Revert();
50 			void			UpdateOriginalModes();
51 
52 			bool			SupportsColorSpace(const screen_mode& mode,
53 								color_space space);
54 			status_t		GetRefreshLimits(const screen_mode& mode,
55 								float& min, float& max);
56 			status_t		GetMonitorInfo(monitor_info& info,
57 								float* _diagonalInches = NULL);
58 
59 			screen_mode		ModeAt(int32 index);
60 			int32			CountModes();
61 
62 private:
63 			bool			_GetDisplayMode(const screen_mode& mode,
64 								display_mode& displayMode);
65 
66 			BWindow*		fWindow;
67 			display_mode*	fModeList;
68 			uint32			fModeCount;
69 
70 			bool			fUpdatedModes;
71 			display_mode	fOriginalDisplayMode[32];
72 			screen_mode		fOriginal[32];
73 };
74 
75 #endif	/* SCREEN_MODE_H */
76