haiku/src/servers/app/DesktopSettings.h
Axel Dörfler a17c3a48b8 Changed the way DesktopSettings work:
* Removed the DesktopSettings lock itself - it's not really needed at all,
  and causes some trouble with a clean locking design. This may even have
  fixed bug #757, at least I couldn't reproduce it anymore.
* There is now a class for read-only access that requires you to have locked
  the desktop (either read or write).
* There is now another class LockedDesktopSettings that allows you to set
  settings (and only that) - when you're changing the settings, you must not
  have read locked the desktop (ie. hold the single window lock). The class
  will obtain a write lock, but write locks can be nested.
* Moved SetWorkspacesCount() into the Desktop class.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18646 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-08-26 15:13:08 +00:00

78 lines
1.6 KiB
C++

/*
* Copyright 2001-2005, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* Axel Dörfler, axeld@pinc-software.de
*/
#ifndef DESKTOP_SETTINGS_H
#define DESKTOP_SETTINGS_H
#include <InterfaceDefs.h>
#include <Menu.h>
#include <Message.h>
class Desktop;
class DesktopSettingsPrivate;
class ServerFont;
static const int32 kMaxWorkspaces = 32;
enum {
kAllSettings = 0xff,
kWorkspacesSettings = 0x01,
kFontSettings = 0x02,
kAppearanceSettings = 0x04,
kMouseSettings = 0x08,
};
class DesktopSettings {
public:
DesktopSettings(Desktop* desktop);
status_t Save(uint32 mask = kAllSettings);
void GetDefaultPlainFont(ServerFont& font) const;
void GetDefaultBoldFont(ServerFont& font) const;
void GetDefaultFixedFont(ServerFont& font) const;
void GetScrollBarInfo(scroll_bar_info& info) const;
void GetMenuInfo(menu_info& info) const;
mode_mouse MouseMode() const;
bool FocusFollowsMouse() const;
int32 WorkspacesCount() const;
const BMessage* WorkspacesMessage(int32 index) const;
private:
// friend class Desktop;
DesktopSettingsPrivate* fSettings;
};
class LockedDesktopSettings {
public:
LockedDesktopSettings(Desktop* desktop);
~LockedDesktopSettings();
void SetDefaultPlainFont(const ServerFont& font);
void SetDefaultBoldFont(const ServerFont& font);
void SetDefaultFixedFont(const ServerFont& font);
void SetScrollBarInfo(const scroll_bar_info& info);
void SetMenuInfo(const menu_info& info);
void SetMouseMode(mode_mouse mode);
private:
// friend class Desktop;
DesktopSettingsPrivate* fSettings;
Desktop* fDesktop;
};
#endif /* DESKTOP_SETTINGS_H */