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