btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / private / screen_saver / ScreenSaverSettings.h
blob78257ccd6bedc72c60389ee35f64dcf4a37a8f7a
1 /*
2 * Copyright 2003-2006, Michael Phipps. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef SCREEN_SAVER_SETTINGS_H
6 #define SCREEN_SAVER_SETTINGS_H
9 #include <Message.h>
10 #include <Path.h>
11 #include <String.h>
14 enum screen_corner {
15 NO_CORNER = -1,
16 UP_LEFT_CORNER,
17 UP_RIGHT_CORNER,
18 DOWN_RIGHT_CORNER,
19 DOWN_LEFT_CORNER,
20 CENTER_CORNER
23 // time flags
24 enum {
25 ENABLE_SAVER = 0x01,
26 ENABLE_DPMS_STAND_BY = 0x02,
27 ENABLE_DPMS_SUSPEND = 0x04,
28 ENABLE_DPMS_OFF = 0x08,
30 ENABLE_DPMS_MASK
31 = ENABLE_DPMS_STAND_BY | ENABLE_DPMS_SUSPEND | ENABLE_DPMS_OFF
34 #define SCREEN_BLANKER_SIG "application/x-vnd.Haiku.screenblanker"
37 class ScreenSaverSettings {
38 public:
39 ScreenSaverSettings();
41 bool Load();
42 void Save();
43 void Defaults();
44 BPath& Path() { return fSettingsPath; }
46 // General screen saver settings
47 int32 TimeFlags() const { return fTimeFlags; }
48 bigtime_t BlankTime() const { return fBlankTime; }
49 bigtime_t StandByTime() const { return fStandByTime; }
50 bigtime_t SuspendTime() const { return fSuspendTime; }
51 bigtime_t OffTime() const { return fOffTime; }
53 screen_corner BlankCorner() const { return fBlankCorner; }
54 screen_corner NeverBlankCorner() const { return fNeverBlankCorner; }
55 bool LockEnable() const { return fLockEnabled; }
56 bigtime_t PasswordTime() const { return fPasswordTime; }
57 const char* Password() { return fPassword.String(); }
58 const char* LockMethod() { return fLockMethod.String(); }
59 bool IsNetworkPassword()
60 { return strcmp(fLockMethod.String(), "custom")
61 != 0; }
63 const char* ModuleName() { return fModuleName.String(); }
64 status_t GetModuleState(const char* name,
65 BMessage* stateMessage);
67 void SetTimeFlags(uint32 flags)
68 { fTimeFlags = flags; }
69 void SetBlankTime(bigtime_t time)
70 { fBlankTime = time; }
71 void SetStandByTime(bigtime_t time)
72 { fStandByTime = time; }
73 void SetSuspendTime(bigtime_t time)
74 { fSuspendTime = time; }
75 void SetOffTime(bigtime_t intime)
76 { fOffTime = intime; }
77 void SetBlankCorner(screen_corner in)
78 { fBlankCorner = in; }
79 void SetNeverBlankCorner(screen_corner in)
80 { fNeverBlankCorner = in; }
81 void SetLockEnable(bool enable)
82 { fLockEnabled = enable; }
83 void SetPasswordTime(bigtime_t time)
84 { fPasswordTime = time; }
85 void SetPassword(const char* password)
86 { fPassword = password; }
87 // Cannot set network password from here.
88 void SetLockMethod(const char* method)
89 { fLockMethod = method; }
90 void SetModuleName(const char* name)
91 { fModuleName = name; }
92 void SetModuleState(const char* name,
93 BMessage* stateMessage);
95 // ScreenSaver preferences settings
96 BRect WindowFrame() const { return fWindowFrame; }
97 int32 WindowTab() const { return fWindowTab; }
99 void SetWindowFrame(const BRect& frame)
100 { fWindowFrame = frame; }
101 void SetWindowTab(int32 tab)
102 { fWindowTab = tab; }
104 BMessage& Message();
106 private:
107 int32 fTimeFlags;
108 bigtime_t fBlankTime;
109 bigtime_t fStandByTime;
110 bigtime_t fSuspendTime;
111 bigtime_t fOffTime;
112 screen_corner fBlankCorner;
113 screen_corner fNeverBlankCorner;
114 bool fLockEnabled;
115 bigtime_t fPasswordTime;
116 BString fPassword;
117 BString fModuleName;
118 BString fLockMethod;
120 BRect fWindowFrame;
121 int32 fWindowTab;
123 BMessage fSettings;
124 BPath fSettingsPath;
127 #endif // SCREEN_SAVER_SETTINGS_H