diff options
author | simonb <simonb> | 2006-03-20 11:31:24 (GMT) |
---|---|---|
committer | simonb <simonb> | 2006-03-20 11:31:24 (GMT) |
commit | f2d3fff4d4db7677814379139dcec3e31fc68047 (patch) | |
tree | 95bd9dc99986104613acc37945895b0812e63801 /src/FbWinFrame.hh | |
parent | eba0040373179cc6d34f8ee132209f2fa01c2889 (diff) | |
download | fluxbox-f2d3fff4d4db7677814379139dcec3e31fc68047.zip fluxbox-f2d3fff4d4db7677814379139dcec3e31fc68047.tar.bz2 |
external tabs
Diffstat (limited to 'src/FbWinFrame.hh')
-rw-r--r-- | src/FbWinFrame.hh | 62 |
1 files changed, 50 insertions, 12 deletions
diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh index bc4c1be..5b6b287 100644 --- a/src/FbWinFrame.hh +++ b/src/FbWinFrame.hh | |||
@@ -30,6 +30,8 @@ | |||
30 | #include "FbTk/Observer.hh" | 30 | #include "FbTk/Observer.hh" |
31 | #include "FbTk/Color.hh" | 31 | #include "FbTk/Color.hh" |
32 | #include "FbTk/FbPixmap.hh" | 32 | #include "FbTk/FbPixmap.hh" |
33 | #include "FbTk/XLayerItem.hh" | ||
34 | #include "FbTk/TextButton.hh" | ||
33 | #include "Container.hh" | 35 | #include "Container.hh" |
34 | 36 | ||
35 | #include <vector> | 37 | #include <vector> |
@@ -39,6 +41,7 @@ | |||
39 | 41 | ||
40 | class Shape; | 42 | class Shape; |
41 | class FbWinFrameTheme; | 43 | class FbWinFrameTheme; |
44 | class BScreen; | ||
42 | 45 | ||
43 | namespace FbTk { | 46 | namespace FbTk { |
44 | class TextButton; | 47 | class TextButton; |
@@ -46,27 +49,30 @@ class ImageControl; | |||
46 | class Command; | 49 | class Command; |
47 | class Button; | 50 | class Button; |
48 | class Texture; | 51 | class Texture; |
52 | class XLayer; | ||
49 | } | 53 | } |
50 | 54 | ||
51 | /// holds a window frame with a client window | 55 | /// holds a window frame with a client window |
52 | /// (see: <a href="fluxbox_fbwinframe.png">image</a>) | 56 | /// (see: <a href="fluxbox_fbwinframe.png">image</a>) |
53 | class FbWinFrame:public FbTk::EventHandler { | 57 | class FbWinFrame:public FbTk::EventHandler { |
54 | public: | 58 | public: |
55 | enum TabMode { INTERNAL = 1, EXTERNAL }; | 59 | // STRICTINTERNAL means it doesn't go external automatically when no titlebar |
60 | enum TabMode { NOTSET = 0, INTERNAL = 1, EXTERNAL }; | ||
56 | 61 | ||
57 | typedef FbTk::TextButton *ButtonId; ///< defines a button id | 62 | typedef FbTk::TextButton *ButtonId; ///< defines a button id |
58 | 63 | ||
59 | /// create a top level window | 64 | /// create a top level window |
60 | FbWinFrame(FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl, | 65 | FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl, |
66 | FbTk::XLayer &layer, | ||
61 | int x, int y, | 67 | int x, int y, |
62 | unsigned int width, unsigned int height); | 68 | unsigned int width, unsigned int height); |
63 | 69 | ||
64 | /// create a frame window inside another FbWindow, NOT IMPLEMENTED! | 70 | /* /// create a frame window inside another FbWindow, NOT IMPLEMENTED! |
65 | FbWinFrame(FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl, | 71 | FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl, |
66 | const FbTk::FbWindow &parent, | 72 | const FbTk::FbWindow &parent, |
67 | int x, int y, | 73 | int x, int y, |
68 | unsigned int width, unsigned int height); | 74 | unsigned int width, unsigned int height); |
69 | 75 | */ | |
70 | /// destroy frame | 76 | /// destroy frame |
71 | ~FbWinFrame(); | 77 | ~FbWinFrame(); |
72 | 78 | ||
@@ -94,6 +100,10 @@ public: | |||
94 | unsigned int width, unsigned int height, | 100 | unsigned int width, unsigned int height, |
95 | bool move = true, bool resize = true, int win_gravity=ForgetGravity); | 101 | bool move = true, bool resize = true, int win_gravity=ForgetGravity); |
96 | 102 | ||
103 | // move without transparency or special effects (generally when dragging) | ||
104 | void quietMoveResize(int x, int y, | ||
105 | unsigned int width, unsigned int height); | ||
106 | |||
97 | /// some outside move/resize happened, and we need to notify all of our windows | 107 | /// some outside move/resize happened, and we need to notify all of our windows |
98 | /// in case of transparency | 108 | /// in case of transparency |
99 | void notifyMoved(bool clear); | 109 | void notifyMoved(bool clear); |
@@ -101,7 +111,9 @@ public: | |||
101 | 111 | ||
102 | /// set focus/unfocus style | 112 | /// set focus/unfocus style |
103 | void setFocus(bool newvalue); | 113 | void setFocus(bool newvalue); |
114 | inline void setFocusTitle(const std::string &str) { m_label.setText(str); } | ||
104 | void setDoubleClickTime(unsigned int time); | 115 | void setDoubleClickTime(unsigned int time); |
116 | bool setTabMode(TabMode tabmode); | ||
105 | 117 | ||
106 | /// add a button to the left of the label | 118 | /// add a button to the left of the label |
107 | void addLeftButton(FbTk::Button *btn); | 119 | void addLeftButton(FbTk::Button *btn); |
@@ -138,6 +150,8 @@ public: | |||
138 | // these return true/false for if something changed | 150 | // these return true/false for if something changed |
139 | bool hideTitlebar(); | 151 | bool hideTitlebar(); |
140 | bool showTitlebar(); | 152 | bool showTitlebar(); |
153 | bool hideTabs(); | ||
154 | bool showTabs(); | ||
141 | bool hideHandle(); | 155 | bool hideHandle(); |
142 | bool showHandle(); | 156 | bool showHandle(); |
143 | bool hideAllDecorations(); | 157 | bool hideAllDecorations(); |
@@ -172,6 +186,13 @@ public: | |||
172 | inline int y() const { return m_window.y(); } | 186 | inline int y() const { return m_window.y(); } |
173 | inline unsigned int width() const { return m_window.width(); } | 187 | inline unsigned int width() const { return m_window.width(); } |
174 | inline unsigned int height() const { return m_window.height(); } | 188 | inline unsigned int height() const { return m_window.height(); } |
189 | |||
190 | // extra bits for tabs | ||
191 | inline int xOffset() const { return 0; } | ||
192 | int yOffset() const; | ||
193 | inline int widthOffset() const { return 0; } | ||
194 | int heightOffset() const; | ||
195 | |||
175 | inline const FbTk::FbWindow &window() const { return m_window; } | 196 | inline const FbTk::FbWindow &window() const { return m_window; } |
176 | inline FbTk::FbWindow &window() { return m_window; } | 197 | inline FbTk::FbWindow &window() { return m_window; } |
177 | /// @return titlebar window | 198 | /// @return titlebar window |
@@ -201,6 +222,10 @@ public: | |||
201 | unsigned int titlebarHeight() const { return m_titlebar.height(); } | 222 | unsigned int titlebarHeight() const { return m_titlebar.height(); } |
202 | /// @return size of button | 223 | /// @return size of button |
203 | unsigned int buttonHeight() const; | 224 | unsigned int buttonHeight() const; |
225 | bool externalTabMode() const { return m_tabmode == EXTERNAL; } | ||
226 | |||
227 | inline const FbTk::XLayerItem &layerItem() const { return m_layeritem; } | ||
228 | inline FbTk::XLayerItem &layerItem() { return m_layeritem; } | ||
204 | 229 | ||
205 | //@} | 230 | //@} |
206 | 231 | ||
@@ -216,7 +241,7 @@ private: | |||
216 | void renderAll(); | 241 | void renderAll(); |
217 | void renderTitlebar(); | 242 | void renderTitlebar(); |
218 | void renderHandles(); | 243 | void renderHandles(); |
219 | void renderLabelButtons(); | 244 | void renderTabContainer(); // and labelbuttons |
220 | 245 | ||
221 | void renderButtons(); // subset of renderTitlebar - don't call directly | 246 | void renderButtons(); // subset of renderTitlebar - don't call directly |
222 | 247 | ||
@@ -233,7 +258,7 @@ private: | |||
233 | void applyAll(); | 258 | void applyAll(); |
234 | void applyTitlebar(); | 259 | void applyTitlebar(); |
235 | void applyHandles(); | 260 | void applyHandles(); |
236 | void applyLabelButtons(); | 261 | void applyTabContainer(); // and label buttons |
237 | void applyFocusLabel(FbTk::TextButton &button); | 262 | void applyFocusLabel(FbTk::TextButton &button); |
238 | void applyUnfocusLabel(FbTk::TextButton &button); | 263 | void applyUnfocusLabel(FbTk::TextButton &button); |
239 | void applyActiveLabel(FbTk::TextButton &button); | 264 | void applyActiveLabel(FbTk::TextButton &button); |
@@ -246,11 +271,15 @@ private: | |||
246 | 271 | ||
247 | /// initiate inserted button for current theme | 272 | /// initiate inserted button for current theme |
248 | void applyButton(FbTk::Button &btn); | 273 | void applyButton(FbTk::Button &btn); |
274 | |||
275 | void alignTabs(); | ||
249 | //@} | 276 | //@} |
250 | 277 | ||
251 | /// initiate some commont variables | 278 | /// initiate some commont variables |
252 | void init(); | 279 | void init(); |
253 | 280 | ||
281 | BScreen &m_screen; | ||
282 | |||
254 | FbWinFrameTheme &m_theme; ///< theme to be used | 283 | FbWinFrameTheme &m_theme; ///< theme to be used |
255 | FbTk::ImageControl &m_imagectrl; ///< Image control for rendering | 284 | FbTk::ImageControl &m_imagectrl; ///< Image control for rendering |
256 | /** | 285 | /** |
@@ -258,9 +287,12 @@ private: | |||
258 | */ | 287 | */ |
259 | //@{ | 288 | //@{ |
260 | FbTk::FbWindow m_window; ///< base window that holds each decorations (ie titlebar, handles) | 289 | FbTk::FbWindow m_window; ///< base window that holds each decorations (ie titlebar, handles) |
290 | // want this deleted before the windows in it | ||
291 | FbTk::XLayerItem m_layeritem; | ||
292 | |||
261 | FbTk::FbWindow m_titlebar; ///< titlebar window | 293 | FbTk::FbWindow m_titlebar; ///< titlebar window |
262 | Container m_tab_container; ///< Holds tabs | 294 | Container m_tab_container; ///< Holds tabs |
263 | FbTk::FbWindow m_label; ///< holds title | 295 | FbTk::TextButton m_label; ///< holds title |
264 | FbTk::FbWindow m_handle; ///< handle between grips | 296 | FbTk::FbWindow m_handle; ///< handle between grips |
265 | FbTk::FbWindow m_grip_right, ///< rightgrip | 297 | FbTk::FbWindow m_grip_right, ///< rightgrip |
266 | m_grip_left; ///< left grip | 298 | m_grip_left; ///< left grip |
@@ -274,6 +306,7 @@ private: | |||
274 | std::string m_titletext; ///< text to be displayed int m_label | 306 | std::string m_titletext; ///< text to be displayed int m_label |
275 | int m_bevel; ///< bevel between titlebar items and titlebar | 307 | int m_bevel; ///< bevel between titlebar items and titlebar |
276 | bool m_use_titlebar; ///< if we should use titlebar | 308 | bool m_use_titlebar; ///< if we should use titlebar |
309 | bool m_use_tabs; ///< if we should use tabs (turns them off in external mode only) | ||
277 | bool m_use_handle; ///< if we should use handle | 310 | bool m_use_handle; ///< if we should use handle |
278 | bool m_focused; ///< focused/unfocused mode | 311 | bool m_focused; ///< focused/unfocused mode |
279 | bool m_visible; ///< if we are currently showing | 312 | bool m_visible; ///< if we are currently showing |
@@ -285,17 +318,22 @@ private: | |||
285 | Pixmap m_title_focused_pm; ///< pixmap for focused title | 318 | Pixmap m_title_focused_pm; ///< pixmap for focused title |
286 | FbTk::Color m_title_focused_color; ///< color for focused title | 319 | FbTk::Color m_title_focused_color; ///< color for focused title |
287 | Pixmap m_title_unfocused_pm; ///< pixmap for unfocused title | 320 | Pixmap m_title_unfocused_pm; ///< pixmap for unfocused title |
288 | FbTk::Color m_title_unfocused_color; ///< color for unfocued title | 321 | FbTk::Color m_title_unfocused_color; ///< color for unfocused title |
289 | 322 | ||
290 | Pixmap m_label_focused_pm; ///< pixmap for focused label | 323 | Pixmap m_label_focused_pm; ///< pixmap for focused label (only visible with external tabs) |
291 | FbTk::Color m_label_focused_color; ///< color for focused label | 324 | FbTk::Color m_label_focused_color; ///< color for focused label |
292 | Pixmap m_label_unfocused_pm; ///< pixmap for unfocused label | 325 | Pixmap m_label_unfocused_pm; ///< pixmap for unfocused label |
293 | FbTk::Color m_label_unfocused_color; ///< color for unfocued label | 326 | FbTk::Color m_label_unfocused_color; ///< color for unfocused label |
327 | |||
328 | Pixmap m_tabcontainer_focused_pm; ///< pixmap for focused tab container | ||
329 | FbTk::Color m_tabcontainer_focused_color; ///< color for focused tab container | ||
330 | Pixmap m_tabcontainer_unfocused_pm; ///< pixmap for unfocused tab container | ||
331 | FbTk::Color m_tabcontainer_unfocused_color; ///< color for unfocused tab container | ||
294 | 332 | ||
295 | Pixmap m_labelbutton_focused_pm; ///< pixmap for focused label | 333 | Pixmap m_labelbutton_focused_pm; ///< pixmap for focused label |
296 | FbTk::Color m_labelbutton_focused_color; ///< color for focused label | 334 | FbTk::Color m_labelbutton_focused_color; ///< color for focused label |
297 | Pixmap m_labelbutton_unfocused_pm; ///< pixmap for unfocused label | 335 | Pixmap m_labelbutton_unfocused_pm; ///< pixmap for unfocused label |
298 | FbTk::Color m_labelbutton_unfocused_color; ///< color for unfocued label | 336 | FbTk::Color m_labelbutton_unfocused_color; ///< color for unfocused label |
299 | Pixmap m_labelbutton_active_pm; ///< pixmap for active label | 337 | Pixmap m_labelbutton_active_pm; ///< pixmap for active label |
300 | FbTk::Color m_labelbutton_active_color; ///< color for active label | 338 | FbTk::Color m_labelbutton_active_color; ///< color for active label |
301 | 339 | ||