xref: /haiku/src/servers/app/DesktopSettings.h (revision 220d04022750f40f8bac8f01fa551211e28d04f2)
1 /*
2  * Copyright 2001-2013, Haiku.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Axel Dörfler, axeld@pinc-software.de
7  *		Andrej Spielmann, <andrej.spielmann@seh.ox.ac.uk>
8  */
9 #ifndef DESKTOP_SETTINGS_H
10 #define DESKTOP_SETTINGS_H
11 
12 
13 #include <InterfaceDefs.h>
14 #include <Menu.h>
15 #include <Message.h>
16 
17 
18 class Desktop;
19 class DesktopSettingsPrivate;
20 class ServerFont;
21 
22 
23 static const int32 kMaxWorkspaces = 32;
24 
25 enum {
26 	kAllSettings		= 0xff,
27 	kWorkspacesSettings	= 0x01,
28 	kFontSettings		= 0x02,
29 	kAppearanceSettings	= 0x04,
30 	kMouseSettings		= 0x08,
31 	kDraggerSettings	= 0x10,
32 };
33 
34 
35 class DesktopSettings {
36 public:
37 								DesktopSettings(Desktop* desktop);
38 
39 			status_t			Save(uint32 mask = kAllSettings);
40 
41 			void				GetDefaultPlainFont(ServerFont& font) const;
42 			void				GetDefaultBoldFont(ServerFont& font) const;
43 			void				GetDefaultFixedFont(ServerFont& font) const;
44 
45 			void				GetScrollBarInfo(scroll_bar_info& info) const;
46 			void				GetMenuInfo(menu_info& info) const;
47 
48 			mode_mouse			MouseMode() const;
49 			mode_focus_follows_mouse FocusFollowsMouseMode() const;
50 
51 			bool				NormalMouse() const
52 									{ return MouseMode() == B_NORMAL_MOUSE; }
53 			bool				FocusFollowsMouse() const
54 									{ return MouseMode()
55 										== B_FOCUS_FOLLOWS_MOUSE; }
56 			bool				ClickToFocusMouse() const
57 									{ return MouseMode()
58 										== B_CLICK_TO_FOCUS_MOUSE; }
59 
60 			bool				AcceptFirstClick() const;
61 
62 			bool				ShowAllDraggers() const;
63 
64 			int32				WorkspacesCount() const;
65 			int32				WorkspacesColumns() const;
66 			int32				WorkspacesRows() const;
67 			const BMessage*		WorkspacesMessage(int32 index) const;
68 
69 			rgb_color			UIColor(color_which which) const;
70 
71 			bool				SubpixelAntialiasing() const;
72 			uint8				Hinting() const;
73 			uint8				SubpixelAverageWeight() const;
74 			bool				IsSubpixelOrderingRegular() const;
75 
76 protected:
77 			DesktopSettingsPrivate*	fSettings;
78 };
79 
80 
81 class LockedDesktopSettings : public DesktopSettings {
82 public:
83 								LockedDesktopSettings(Desktop* desktop);
84 								~LockedDesktopSettings();
85 
86 			void				SetDefaultPlainFont(const ServerFont& font);
87 			void				SetDefaultBoldFont(const ServerFont& font);
88 			void				SetDefaultFixedFont(const ServerFont& font);
89 
90 			void				SetScrollBarInfo(const scroll_bar_info& info);
91 			void				SetMenuInfo(const menu_info& info);
92 
93 			void				SetMouseMode(mode_mouse mode);
94 			void				SetFocusFollowsMouseMode(
95 									mode_focus_follows_mouse mode);
96 			void				SetAcceptFirstClick(bool acceptFirstClick);
97 
98 			void				SetShowAllDraggers(bool show);
99 
100 			void				SetUIColor(color_which which,
101 									const rgb_color color);
102 
103 			void				SetSubpixelAntialiasing(bool subpix);
104 			void				SetHinting(uint8 hinting);
105 			void				SetSubpixelAverageWeight(uint8 averageWeight);
106 			void				SetSubpixelOrderingRegular(
107 									bool subpixelOrdering);
108 
109 private:
110 			Desktop*			fDesktop;
111 };
112 
113 
114 #endif	/* DESKTOP_SETTINGS_H */
115