summaryrefslogtreecommitdiff
path: root/src/FbWinFrame.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbWinFrame.hh')
-rw-r--r--src/FbWinFrame.hh59
1 files changed, 36 insertions, 23 deletions
diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh
index 3d61860..6d8249a 100644
--- a/src/FbWinFrame.hh
+++ b/src/FbWinFrame.hh
@@ -95,25 +95,38 @@ public:
95 DECOR_TAB = DECORM_BORDER|DECORM_MENU|DECORM_TAB 95 DECOR_TAB = DECORM_BORDER|DECORM_MENU|DECORM_TAB
96 }; 96 };
97 97
98 typedef struct SizeHints { 98 class SizeHints {
99 public:
100 SizeHints():
101 min_width(1), max_width(0), min_height(1), max_height(0),
102 width_inc(1), height_inc(1), base_width(0), base_height(0),
103 min_aspect_x(0), max_aspect_x(0),
104 min_aspect_y(0), max_aspect_y(0) { }
105
99 void apply(unsigned int &w, unsigned int &h, 106 void apply(unsigned int &w, unsigned int &h,
100 bool maximizing = false) const; 107 bool maximizing = false) const;
101 bool valid(unsigned int width, unsigned int height) const; 108 bool valid(unsigned int width, unsigned int height) const;
102 void displaySize(unsigned int &i, unsigned int &j, 109 void displaySize(unsigned int &i, unsigned int &j,
103 unsigned int width, unsigned int height) const; 110 unsigned int width, unsigned int height) const;
104 unsigned int min_width; 111
105 unsigned int max_width; 112 unsigned int min_width, max_width, min_height, max_height,
106 unsigned int min_height; 113 width_inc, height_inc, base_width, base_height,
107 unsigned int max_height; 114 min_aspect_x, max_aspect_x, min_aspect_y, max_aspect_y;
108 unsigned int width_inc; 115 };
109 unsigned int height_inc; 116
110 unsigned int min_aspect_x; 117 class State {
111 unsigned int max_aspect_x; 118 public:
112 unsigned int min_aspect_y; 119 State():
113 unsigned int max_aspect_y; 120 size_hints(),
114 unsigned int base_width; 121 deco_mask(DECOR_NORMAL),
115 unsigned int base_height; 122 focused(false),
116 } SizeHints; 123 shaded(false), fullscreen(false), maximized(0) { }
124
125 SizeHints size_hints;
126 unsigned int deco_mask;
127 bool focused, shaded, fullscreen;
128 int maximized;
129 };
117 130
118 /// create a top level window 131 /// create a top level window
119 FbWinFrame(BScreen &screen, FocusableTheme<FbWinFrameTheme> &theme, 132 FbWinFrame(BScreen &screen, FocusableTheme<FbWinFrameTheme> &theme,
@@ -162,6 +175,9 @@ public:
162 175
163 /// set focus/unfocus style 176 /// set focus/unfocus style
164 void setFocus(bool newvalue); 177 void setFocus(bool newvalue);
178 void setFullscreen(bool value) { m_state.fullscreen = value; }
179 void setMaximized(int value) { m_state.maximized = value; }
180
165 void setFocusTitle(const std::string &str) { m_label.setText(str); } 181 void setFocusTitle(const std::string &str) { m_label.setText(str); }
166 bool setTabMode(TabMode tabmode); 182 bool setTabMode(TabMode tabmode);
167 void updateTabProperties() { alignTabs(); } 183 void updateTabProperties() { alignTabs(); }
@@ -205,14 +221,14 @@ public:
205 /// remove any handler for the windows 221 /// remove any handler for the windows
206 void removeEventHandler(); 222 void removeEventHandler();
207 223
208 const SizeHints &sizeHints() const { return m_size_hints; } 224 const SizeHints &sizeHints() const { return m_state.size_hints; }
209 void setSizeHints(const SizeHints &hint) { m_size_hints = hint; } 225 void setSizeHints(const SizeHints &hint) { m_state.size_hints = hint; }
210 226
211 void applySizeHints(unsigned int &width, unsigned int &height, 227 void applySizeHints(unsigned int &width, unsigned int &height,
212 bool maximizing = false) const; 228 bool maximizing = false) const;
213 void displaySize(unsigned int width, unsigned int height) const; 229 void displaySize(unsigned int width, unsigned int height) const;
214 230
215 void setDecorationMask(unsigned int mask) { m_decoration_mask = mask; } 231 void setDecorationMask(unsigned int mask) { m_state.deco_mask = mask; }
216 void applyDecorations(); 232 void applyDecorations();
217 233
218 // this function translates its arguments according to win_gravity 234 // this function translates its arguments according to win_gravity
@@ -271,8 +287,8 @@ public:
271 FbTk::FbWindow &gripLeft() { return m_grip_left; } 287 FbTk::FbWindow &gripLeft() { return m_grip_left; }
272 const FbTk::FbWindow &gripRight() const { return m_grip_right; } 288 const FbTk::FbWindow &gripRight() const { return m_grip_right; }
273 FbTk::FbWindow &gripRight() { return m_grip_right; } 289 FbTk::FbWindow &gripRight() { return m_grip_right; }
274 bool focused() const { return m_focused; } 290 bool focused() const { return m_state.focused; }
275 bool isShaded() const { return m_shaded; } 291 bool isShaded() const { return m_state.shaded; }
276 FocusableTheme<FbWinFrameTheme> &theme() const { return m_theme; } 292 FocusableTheme<FbWinFrameTheme> &theme() const { return m_theme; }
277 /// @return titlebar height 293 /// @return titlebar height
278 unsigned int titlebarHeight() const { return (m_use_titlebar?m_titlebar.height()+m_titlebar.borderWidth():0); } 294 unsigned int titlebarHeight() const { return (m_use_titlebar?m_titlebar.height()+m_titlebar.borderWidth():0); }
@@ -370,11 +386,9 @@ private:
370 m_buttons_right; ///< buttons to the right 386 m_buttons_right; ///< buttons to the right
371 typedef std::list<FbTk::TextButton *> LabelList; 387 typedef std::list<FbTk::TextButton *> LabelList;
372 int m_bevel; ///< bevel between titlebar items and titlebar 388 int m_bevel; ///< bevel between titlebar items and titlebar
373 unsigned int m_decoration_mask; ///< bitmask of applied decorations
374 bool m_use_titlebar; ///< if we should use titlebar 389 bool m_use_titlebar; ///< if we should use titlebar
375 bool m_use_tabs; ///< if we should use tabs (turns them off in external mode only) 390 bool m_use_tabs; ///< if we should use tabs (turns them off in external mode only)
376 bool m_use_handle; ///< if we should use handle 391 bool m_use_handle; ///< if we should use handle
377 bool m_focused; ///< focused/unfocused mode
378 bool m_visible; ///< if we are currently showing 392 bool m_visible; ///< if we are currently showing
379 ///< do we use screen or window alpha settings ? (0 = window, 1 = default, 2 = default and window never set) 393 ///< do we use screen or window alpha settings ? (0 = window, 1 = default, 2 = default and window never set)
380 394
@@ -419,12 +433,11 @@ private:
419 // last gravity that this window was *actively* placed with 433 // last gravity that this window was *actively* placed with
420 int m_active_gravity; 434 int m_active_gravity;
421 unsigned int m_active_orig_client_bw; 435 unsigned int m_active_orig_client_bw;
422 SizeHints m_size_hints; 436 State m_state;
423 437
424 bool m_need_render; 438 bool m_need_render;
425 int m_button_size; ///< size for all titlebar buttons 439 int m_button_size; ///< size for all titlebar buttons
426 unsigned int m_height_before_shade; ///< height before shade, so we can restore it when we unshade 440 unsigned int m_height_before_shade; ///< height before shade, so we can restore it when we unshade
427 bool m_shaded; ///< wheter we're shaded or not
428 /// alpha values 441 /// alpha values
429 typedef FbTk::ConstObjectAccessor<unsigned char, FbWinFrameTheme> AlphaAcc; 442 typedef FbTk::ConstObjectAccessor<unsigned char, FbWinFrameTheme> AlphaAcc;
430 FbTk::DefaultValue<unsigned char, AlphaAcc> m_focused_alpha; 443 FbTk::DefaultValue<unsigned char, AlphaAcc> m_focused_alpha;