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 21 class Desktop; 22 class DesktopSettingsPrivate; 23 class ServerFont; 24 25 26 static const int32 kMaxWorkspaces = 32; 27 28 enum { 29 kAllSettings = 0xff, 30 kWorkspacesSettings = 0x01, 31 kFontSettings = 0x02, 32 kAppearanceSettings = 0x04, 33 kMouseSettings = 0x08, 34 kDraggerSettings = 0x10, 35 }; 36 37 38 class DesktopSettings { 39 public: 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 protected: 80 DesktopSettingsPrivate* fSettings; 81 }; 82 83 84 class LockedDesktopSettings : public DesktopSettings { 85 public: 86 LockedDesktopSettings(Desktop* desktop); 87 ~LockedDesktopSettings(); 88 89 void SetDefaultPlainFont(const ServerFont& font); 90 void SetDefaultBoldFont(const ServerFont& font); 91 void SetDefaultFixedFont(const ServerFont& font); 92 93 void SetScrollBarInfo(const scroll_bar_info& info); 94 void SetMenuInfo(const menu_info& info); 95 96 void SetMouseMode(mode_mouse mode); 97 void SetFocusFollowsMouseMode( 98 mode_focus_follows_mouse mode); 99 void SetAcceptFirstClick(bool acceptFirstClick); 100 101 void SetShowAllDraggers(bool show); 102 103 void SetUIColors(const BMessage& colors, 104 bool* changed = NULL); 105 106 void SetSubpixelAntialiasing(bool subpix); 107 void SetHinting(uint8 hinting); 108 void SetSubpixelAverageWeight(uint8 averageWeight); 109 void SetSubpixelOrderingRegular( 110 bool subpixelOrdering); 111 112 private: 113 Desktop* fDesktop; 114 }; 115 116 117 #endif /* DESKTOP_SETTINGS_H */ 118