version bump
[blackbox.git] / src / BlackboxResource.hh
blobd7184fc39aeed6474f7eb3d434c5911c7181771c
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 // BlackboxResource.hh for Blackbox - an X11 Window manager
3 // Copyright (c) 2001 - 2005 Sean 'Shaleh' Perry <shaleh@debian.org>
4 // Copyright (c) 1997 - 2000, 2002 - 2005
5 // Bradley T Hughes <bhughes at trolltech.com>
6 //
7 // Permission is hereby granted, free of charge, to any person obtaining a
8 // copy of this software and associated documentation files (the "Software"),
9 // to deal in the Software without restriction, including without limitation
10 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 // and/or sell copies of the Software, and to permit persons to whom the
12 // Software is furnished to do so, subject to the following conditions:
14 // The above copyright notice and this permission notice shall be included in
15 // all copies or substantial portions of the Software.
17 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 // DEALINGS IN THE SOFTWARE.
25 #ifndef __BlackboxResource_hh
26 #define __BlackboxResource_hh
28 #include "ScreenResource.hh"
30 #include <Timer.hh>
31 #include <Util.hh>
33 class Blackbox;
35 enum FocusModel {
36 SloppyFocusModel,
37 ClickToFocusModel
40 enum WindowPlacementPolicy {
41 RowSmartPlacement = 400,
42 ColSmartPlacement,
43 CenterPlacement,
44 CascadePlacement,
45 LeftRight,
46 RightLeft,
47 TopBottom,
48 BottomTop
51 struct Cursors {
52 Cursor pointer;
53 Cursor move;
54 Cursor resize_top_left;
55 Cursor resize_bottom_left;
56 Cursor resize_top_right;
57 Cursor resize_bottom_right;
60 class BlackboxResource: public bt::NoCopy {
61 private:
62 ScreenResource *screen_resources;
64 Cursors _cursors;
66 std::string menu_file, style_file, rc_file;
67 Time double_click_interval;
68 bt::timeval auto_raise_delay;
70 FocusModel focus_model;
71 int window_placement_policy;
72 int row_direction, col_direction;
73 bool ignore_shaded;
74 bool auto_raise;
75 bool click_raise;
76 bool opaque_move;
77 bool opaque_resize;
78 bool full_max;
79 bool focus_new_windows;
80 bool focus_last_window_on_workspace;
81 bool allow_scroll_lock;
82 bool change_workspace_with_mouse_wheel;
83 bool shade_window_with_mouse_wheel;
84 bool toolbar_actions_with_mouse_wheel;
85 unsigned int edge_snap_threshold;
86 unsigned int window_snap_threshold;
88 public:
89 BlackboxResource(const std::string& rc);
90 ~BlackboxResource(void);
92 void load(Blackbox& blackbox);
93 void save(Blackbox& blackbox);
95 inline ScreenResource &screenResource(unsigned int screen)
96 { return screen_resources[screen]; }
98 inline const Cursors &cursors(void) const
99 { return _cursors; }
101 inline const char* rcFilename(void) const
102 { return rc_file.c_str(); }
103 inline const char* menuFilename(void) const
104 { return menu_file.c_str(); }
105 inline const char* styleFilename(void) const
106 { return style_file.c_str(); }
108 inline void saveStyleFilename(const std::string& name)
109 { style_file = name; }
111 inline Time doubleClickInterval(void) const
112 { return double_click_interval; }
113 inline const bt::timeval& autoRaiseDelay(void) const
114 { return auto_raise_delay; }
116 // window focus model
117 inline FocusModel focusModel(void) const
118 { return focus_model; }
119 inline void setFocusModel(FocusModel fm)
120 { focus_model = fm; }
122 inline bool autoRaise(void) const
123 { return auto_raise; }
124 inline void setAutoRaise(bool b = true)
125 { auto_raise = b; }
127 inline bool clickRaise(void) const
128 { return click_raise; }
129 inline void setClickRaise(bool b = true)
130 { click_raise = b; }
132 // window placement
133 inline int windowPlacementPolicy(void) const
134 { return window_placement_policy; }
135 inline void setWindowPlacementPolicy(int p)
136 { window_placement_policy = p; }
138 inline int rowPlacementDirection(void) const
139 { return row_direction; }
140 inline void setRowPlacementDirection(int d)
141 { row_direction = d; }
143 inline int colPlacementDirection(void) const
144 { return col_direction; }
145 inline void setColPlacementDirection(int d)
146 { col_direction = d; }
148 inline bool placementIgnoresShaded(void) const
149 { return ignore_shaded; }
150 inline void setPlacementIgnoresShaded(bool f)
151 { ignore_shaded = f; }
153 // other window options
154 inline bool opaqueMove(void) const
155 { return opaque_move; }
156 inline void setOpaqueMove(bool b = true)
157 { opaque_move = b; }
159 inline bool opaqueResize(void) const
160 { return opaque_resize; }
161 inline void setOpaqueResize(bool b = true)
162 { opaque_resize = b; }
164 inline bool fullMaximization(void) const
165 { return full_max; }
166 inline void setFullMaximization(bool b = true)
167 { full_max = b; }
169 inline bool focusNewWindows(void) const
170 { return focus_new_windows; }
171 inline void setFocusNewWindows(bool b = true)
172 { focus_new_windows = b; }
174 inline bool focusLastWindowOnWorkspace(void) const
175 { return focus_last_window_on_workspace; }
176 inline void setFocusLastWindowOnWorkspace(bool b = true)
177 { focus_last_window_on_workspace = b; }
179 inline bool changeWorkspaceWithMouseWheel(void) const
180 { return change_workspace_with_mouse_wheel; }
181 inline void setChangeWorkspaceWithMouseWheel(bool b = true)
182 { change_workspace_with_mouse_wheel = b; }
184 inline bool shadeWindowWithMouseWheel(void) const
185 { return shade_window_with_mouse_wheel; }
186 inline void setShadeWindowWithMouseWheel(bool b = true)
187 { shade_window_with_mouse_wheel = b; }
189 inline bool toolbarActionsWithMouseWheel(void) const
190 { return toolbar_actions_with_mouse_wheel; }
191 inline void setToolbarActionsWithMouseWheel(bool b = true)
192 { toolbar_actions_with_mouse_wheel = b; }
194 inline bool allowScrollLock(void) const
195 { return allow_scroll_lock; }
196 inline void setAllowScrollLock(bool a)
197 { allow_scroll_lock = a; }
199 inline unsigned int edgeSnapThreshold(void) const
200 { return edge_snap_threshold; }
201 inline void setEdgeSnapThreshold(unsigned int t)
202 { edge_snap_threshold = t; }
204 inline unsigned int windowSnapThreshold(void) const
205 { return window_snap_threshold; }
206 inline void setWindowSnapThreshold(unsigned int t)
207 { window_snap_threshold = t; }
210 #endif