xref: /haiku/src/servers/app/DesktopSettings.h (revision 239222b2369c39dc52df52b0a7cdd6cc0a91bc92)
1 /*
2  * Copyright 2001-2009, 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 class Desktop;
18 class DesktopSettingsPrivate;
19 class ServerFont;
20 
21 
22 static const int32 kMaxWorkspaces = 32;
23 
24 enum {
25 	kAllSettings		= 0xff,
26 	kWorkspacesSettings	= 0x01,
27 	kFontSettings		= 0x02,
28 	kAppearanceSettings	= 0x04,
29 	kMouseSettings		= 0x08,
30 	kDraggerSettings	= 0x10,
31 };
32 
33 class DesktopSettings {
34 	public:
35 		DesktopSettings(Desktop* desktop);
36 
37 		status_t		Save(uint32 mask = kAllSettings);
38 
39 		void			GetDefaultPlainFont(ServerFont& font) const;
40 		void			GetDefaultBoldFont(ServerFont& font) const;
41 		void			GetDefaultFixedFont(ServerFont& font) const;
42 
43 		void			GetScrollBarInfo(scroll_bar_info& info) const;
44 		void			GetMenuInfo(menu_info& info) const;
45 
46 		mode_mouse		MouseMode() const;
47 		mode_focus_follows_mouse FocusFollowsMouseMode() const;
48 		bool			FocusFollowsMouse() const;
49 		bool			AcceptFirstClick() const;
50 
51 		bool			ShowAllDraggers() const;
52 
53 		int32			WorkspacesCount() const;
54 		int32			WorkspacesColumns() const;
55 		int32			WorkspacesRows() const;
56 		const BMessage*	WorkspacesMessage(int32 index) const;
57 
58 		rgb_color		UIColor(color_which which) const;
59 
60 		bool			SubpixelAntialiasing() const;
61 		uint8			Hinting() const;
62 		uint8			SubpixelAverageWeight() const;
63 		bool			IsSubpixelOrderingRegular() const;
64 
65 	protected:
66 		DesktopSettingsPrivate*	fSettings;
67 };
68 
69 class LockedDesktopSettings : public DesktopSettings {
70 	public:
71 		LockedDesktopSettings(Desktop* desktop);
72 		~LockedDesktopSettings();
73 
74 		void			SetDefaultPlainFont(const ServerFont& font);
75 		void			SetDefaultBoldFont(const ServerFont& font);
76 		void			SetDefaultFixedFont(const ServerFont& font);
77 
78 		void			SetScrollBarInfo(const scroll_bar_info& info);
79 		void			SetMenuInfo(const menu_info& info);
80 
81 		void			SetMouseMode(mode_mouse mode);
82 		void			SetFocusFollowsMouseMode(
83 							mode_focus_follows_mouse mode);
84 		void			SetAcceptFirstClick(bool acceptFirstClick);
85 
86 		void			SetShowAllDraggers(bool show);
87 
88 		void			SetUIColor(color_which which, const rgb_color color);
89 
90 		void			SetSubpixelAntialiasing(bool subpix);
91 		void			SetHinting(uint8 hinting);
92 		void			SetSubpixelAverageWeight(uint8 averageWeight);
93 		void			SetSubpixelOrderingRegular(bool subpixelOrdering);
94 
95 	private:
96 		Desktop*		fDesktop;
97 };
98 
99 #endif	/* DESKTOP_SETTINGS_H */
100