xref: /haiku/src/servers/app/DesktopSettingsPrivate.h (revision 97dfeb96704e5dbc5bec32ad7b21379d0125e031)
1 /*
2  * Copyright 2005-2015, 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  *		Joseph Groover <looncraz@looncraz.net>
9  */
10 #ifndef DESKTOP_SETTINGS_PRIVATE_H
11 #define DESKTOP_SETTINGS_PRIVATE_H
12 
13 
14 #include "DesktopSettings.h"
15 
16 #include <Locker.h>
17 
18 #include "ServerFont.h"
19 
20 
21 struct server_read_only_memory;
22 
23 
24 class DesktopSettingsPrivate {
25 public:
26 								DesktopSettingsPrivate(
27 									server_read_only_memory* shared);
28 								~DesktopSettingsPrivate();
29 
30 			status_t			Save(uint32 mask = kAllSettings);
31 
32 			void				SetDefaultPlainFont(const ServerFont& font);
33 			const ServerFont&	DefaultPlainFont() const;
34 
35 			void				SetDefaultBoldFont(const ServerFont& font);
36 			const ServerFont&	DefaultBoldFont() const;
37 
38 			void				SetDefaultFixedFont(const ServerFont& font);
39 			const ServerFont&	DefaultFixedFont() const;
40 
41 			void				SetScrollBarInfo(const scroll_bar_info &info);
42 			const scroll_bar_info& ScrollBarInfo() const;
43 
44 			void				SetMenuInfo(const menu_info &info);
45 			const menu_info&	MenuInfo() const;
46 
47 			void				SetMouseMode(mode_mouse mode);
48 			mode_mouse			MouseMode() const;
49 			void				SetFocusFollowsMouseMode(
50 									mode_focus_follows_mouse mode);
51 			mode_focus_follows_mouse FocusFollowsMouseMode() const;
52 			bool				NormalMouse() const
53 									{ return MouseMode() == B_NORMAL_MOUSE; }
54 			bool				FocusFollowsMouse() const
55 									{ return MouseMode()
56 										== B_FOCUS_FOLLOWS_MOUSE; }
57 			bool				ClickToFocusMouse() const
58 									{ return MouseMode()
59 										== B_CLICK_TO_FOCUS_MOUSE; }
60 			void				SetAcceptFirstClick(bool acceptFirstClick);
61 			bool				AcceptFirstClick() const;
62 
63 			void				SetShowAllDraggers(bool show);
64 			bool				ShowAllDraggers() const;
65 
66 			void				SetWorkspacesLayout(int32 columns, int32 rows);
67 			int32				WorkspacesCount() const;
68 			int32				WorkspacesColumns() const;
69 			int32				WorkspacesRows() const;
70 
71 			void				SetWorkspacesMessage(int32 index,
72 									BMessage& message);
73 			const BMessage*		WorkspacesMessage(int32 index) const;
74 
75 			void				SetUIColor(color_which which,
76 									const rgb_color color,
77 									bool* changed = NULL);
78 			void				SetUIColors(const BMessage& colors,
79 									bool* changed = NULL);
80 									// changed must be boolean array equal in
81 									// size to colors' size
82 
83 			rgb_color			UIColor(color_which which) const;
84 
85 			void				SetSubpixelAntialiasing(bool subpix);
86 			bool				SubpixelAntialiasing() const;
87 			void				SetHinting(uint8 hinting);
88 			uint8				Hinting() const;
89 			void				SetSubpixelAverageWeight(uint8 averageWeight);
90 			uint8				SubpixelAverageWeight() const;
91 			void				SetSubpixelOrderingRegular(
92 									bool subpixelOrdering);
93 			bool				IsSubpixelOrderingRegular() const;
94 
95 private:
96 			void				_SetDefaults();
97 			status_t			_Load();
98 			status_t			_GetPath(BPath& path);
99 			void				_ValidateWorkspacesLayout(int32& columns,
100 									int32& rows) const;
101 
102 			ServerFont			fPlainFont;
103 			ServerFont			fBoldFont;
104 			ServerFont			fFixedFont;
105 
106 			scroll_bar_info		fScrollBarInfo;
107 			menu_info			fMenuInfo;
108 			mode_mouse			fMouseMode;
109 			mode_focus_follows_mouse	fFocusFollowsMouseMode;
110 			bool				fAcceptFirstClick;
111 			bool				fShowAllDraggers;
112 			int32				fWorkspacesColumns;
113 			int32				fWorkspacesRows;
114 			BMessage			fWorkspaceMessages[kMaxWorkspaces];
115 
116 			server_read_only_memory& fShared;
117 };
118 
119 #endif	/* DESKTOP_SETTINGS_PRIVATE_H */
120