1/*
2 * Copyright 2001-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_H
11#define DESKTOP_SETTINGS_H
12
13
14#include <InterfaceDefs.h>
15#include <Menu.h>
16#include <Message.h>
17
18#include <ServerProtocolStructs.h>
19
20
21class Desktop;
22class DesktopSettingsPrivate;
23class ServerFont;
24
25
26static const int32 kMaxWorkspaces = 32;
27
28enum {
29	kAllSettings		= 0xff,
30	kWorkspacesSettings	= 0x01,
31	kFontSettings		= 0x02,
32	kAppearanceSettings	= 0x04,
33	kMouseSettings		= 0x08,
34	kDraggerSettings	= 0x10,
35};
36
37
38class DesktopSettings {
39public:
40								DesktopSettings(Desktop* desktop);
41
42			status_t			Save(uint32 mask = kAllSettings);
43
44			void				GetDefaultPlainFont(ServerFont& font) const;
45			void				GetDefaultBoldFont(ServerFont& font) const;
46			void				GetDefaultFixedFont(ServerFont& font) const;
47
48			void				GetScrollBarInfo(scroll_bar_info& info) const;
49			void				GetMenuInfo(menu_info& info) const;
50
51			mode_mouse			MouseMode() const;
52			mode_focus_follows_mouse FocusFollowsMouseMode() const;
53
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
63			bool				AcceptFirstClick() const;
64
65			bool				ShowAllDraggers() const;
66
67			int32				WorkspacesCount() const;
68			int32				WorkspacesColumns() const;
69			int32				WorkspacesRows() const;
70			const BMessage*		WorkspacesMessage(int32 index) const;
71
72			rgb_color			UIColor(color_which which) const;
73
74			bool				SubpixelAntialiasing() const;
75			uint8				Hinting() const;
76			uint8				SubpixelAverageWeight() const;
77			bool				IsSubpixelOrderingRegular() const;
78
79			const BString&		ControlLook() const;
80
81protected:
82			DesktopSettingsPrivate*	fSettings;
83};
84
85
86class LockedDesktopSettings : public DesktopSettings {
87public:
88								LockedDesktopSettings(Desktop* desktop);
89								~LockedDesktopSettings();
90
91			void				SetDefaultPlainFont(const ServerFont& font);
92			void				SetDefaultBoldFont(const ServerFont& font);
93			void				SetDefaultFixedFont(const ServerFont& font);
94
95			void				SetScrollBarInfo(const scroll_bar_info& info);
96			void				SetMenuInfo(const menu_info& info);
97
98			void				SetMouseMode(mode_mouse mode);
99			void				SetFocusFollowsMouseMode(
100									mode_focus_follows_mouse mode);
101			void				SetAcceptFirstClick(bool acceptFirstClick);
102
103			void				SetShowAllDraggers(bool show);
104
105			void				SetUIColors(const BMessage& colors,
106									bool* changed = NULL);
107
108			void				SetSubpixelAntialiasing(bool subpix);
109			void				SetHinting(uint8 hinting);
110			void				SetSubpixelAverageWeight(uint8 averageWeight);
111			void				SetSubpixelOrderingRegular(
112									bool subpixelOrdering);
113
114			status_t			SetControlLook(const char* path);
115
116private:
117			Desktop*			fDesktop;
118};
119
120
121#endif	/* DESKTOP_SETTINGS_H */
122