diff options
author | fluxgen <fluxgen> | 2002-03-19 14:30:43 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-03-19 14:30:43 (GMT) |
commit | 95aeda26271cce3061a46a3ca0b122bc13c8f5c8 (patch) | |
tree | aaa01d20e77a2445a20a0522d86296b981049b8e /src/Toolbar.hh | |
parent | 1871169b06d8b9909ff26b761d24a40a65ef18f9 (diff) | |
download | fluxbox_pavel-95aeda26271cce3061a46a3ca0b122bc13c8f5c8.zip fluxbox_pavel-95aeda26271cce3061a46a3ca0b122bc13c8f5c8.tar.bz2 |
Xinerama support
Diffstat (limited to 'src/Toolbar.hh')
-rw-r--r-- | src/Toolbar.hh | 217 |
1 files changed, 118 insertions, 99 deletions
diff --git a/src/Toolbar.hh b/src/Toolbar.hh index d2d4016..1a70a48 100644 --- a/src/Toolbar.hh +++ b/src/Toolbar.hh | |||
@@ -1,3 +1,6 @@ | |||
1 | // Toolbar.hh for Fluxbox | ||
2 | // Copyright (c) 2002 Henrik Kinnunen (fluxgen@linuxmail.org) | ||
3 | // | ||
1 | // Toolbar.hh for Blackbox - an X11 Window manager | 4 | // Toolbar.hh for Blackbox - an X11 Window manager |
2 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) | 5 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) |
3 | // | 6 | // |
@@ -19,148 +22,164 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
21 | 24 | ||
22 | // $Id: Toolbar.hh,v 1.8 2002/03/19 00:12:36 fluxgen Exp $ | 25 | // $Id: Toolbar.hh,v 1.9 2002/03/19 14:30:42 fluxgen Exp $ |
23 | 26 | ||
24 | #ifndef TOOLBAR_HH | 27 | #ifndef TOOLBAR_HH |
25 | #define TOOLBAR_HH | 28 | #define TOOLBAR_HH |
26 | 29 | ||
27 | #include <X11/Xlib.h> | 30 | #include <X11/Xlib.h> |
28 | #ifndef _BASEMENU_HH_ | ||
29 | #include "Basemenu.hh" | 31 | #include "Basemenu.hh" |
30 | #endif | ||
31 | #ifndef _TIMER_HH_ | ||
32 | #include "Timer.hh" | 32 | #include "Timer.hh" |
33 | #endif | ||
34 | #ifndef _ICONBAR_HH_ | ||
35 | #include "IconBar.hh" | 33 | #include "IconBar.hh" |
36 | #endif | ||
37 | |||
38 | 34 | ||
39 | // forward declaration | 35 | // forward declaration |
40 | class Toolbar; | 36 | class Toolbar; |
41 | 37 | ||
42 | class Toolbarmenu : public Basemenu { | 38 | class Toolbarmenu : public Basemenu { |
43 | private: | 39 | private: |
44 | class Placementmenu : public Basemenu { | 40 | class Placementmenu : public Basemenu { |
45 | private: | 41 | private: |
46 | Toolbarmenu *toolbarmenu; | 42 | Toolbarmenu *toolbarmenu; |
43 | |||
44 | protected: | ||
45 | virtual void itemSelected(int, int); | ||
46 | |||
47 | public: | ||
48 | Placementmenu(Toolbarmenu *); | ||
49 | }; | ||
47 | 50 | ||
48 | protected: | 51 | #ifdef XINERAMA |
49 | virtual void itemSelected(int, int); | 52 | class Headmenu : public Basemenu { |
53 | public: | ||
54 | Headmenu(Toolbarmenu *); | ||
55 | private: | ||
56 | Toolbarmenu *toolbarmenu; | ||
50 | 57 | ||
51 | public: | 58 | protected: |
52 | Placementmenu(Toolbarmenu *); | 59 | virtual void itemSelected(int, int); |
53 | }; | 60 | }; |
61 | #endif // XINERAMA | ||
62 | |||
54 | 63 | ||
55 | Toolbar *toolbar; | 64 | Toolbar *toolbar; |
56 | Placementmenu *placementmenu; | 65 | Placementmenu *placementmenu; |
66 | #ifdef XINERAMA | ||
67 | Headmenu *headmenu; | ||
68 | friend class Headmenu; | ||
69 | #endif // XINERAMA | ||
57 | 70 | ||
58 | friend class Placementmenu; | 71 | friend class Placementmenu; |
59 | friend class Toolbar; | 72 | friend class Toolbar; |
60 | 73 | ||
61 | 74 | ||
62 | protected: | 75 | protected: |
63 | virtual void itemSelected(int, int); | 76 | virtual void itemSelected(int, int); |
64 | virtual void internal_hide(void); | 77 | virtual void internal_hide(void); |
65 | 78 | ||
66 | public: | 79 | public: |
67 | Toolbarmenu(Toolbar *); | 80 | Toolbarmenu(Toolbar *); |
68 | ~Toolbarmenu(void); | 81 | ~Toolbarmenu(void); |
82 | #ifdef XINERAMA | ||
83 | inline Basemenu *getHeadmenu(void) { return headmenu; } | ||
84 | #endif // XINERAMA | ||
69 | 85 | ||
70 | inline Basemenu *getPlacementmenu(void) { return placementmenu; } | 86 | inline Basemenu *getPlacementmenu(void) { return placementmenu; } |
71 | 87 | ||
72 | void reconfigure(void); | 88 | void reconfigure(void); |
73 | }; | 89 | }; |
74 | 90 | ||
75 | 91 | ||
76 | class Toolbar : public TimeoutHandler { | 92 | class Toolbar : public TimeoutHandler { |
77 | private: | 93 | private: |
78 | Bool on_top, editing, hidden, do_auto_hide; | 94 | Bool on_top, editing, hidden, do_auto_hide; |
79 | Display *display; | 95 | Display *display; |
80 | 96 | ||
81 | struct frame { | 97 | struct frame { |
82 | unsigned long button_pixel, pbutton_pixel; | 98 | unsigned long button_pixel, pbutton_pixel; |
83 | Pixmap base, label, wlabel, clk, button, pbutton; | 99 | Pixmap base, label, wlabel, clk, button, pbutton; |
84 | Window window, workspace_label, window_label, clock, psbutton, nsbutton, | 100 | Window window, workspace_label, window_label, clock, psbutton, nsbutton, |
85 | pwbutton, nwbutton; | 101 | pwbutton, nwbutton; |
86 | 102 | ||
87 | int x, y, x_hidden, y_hidden, hour, minute, grab_x, grab_y; | 103 | int x, y, x_hidden, y_hidden, hour, minute, grab_x, grab_y; |
88 | unsigned int width, height, window_label_w, workspace_label_w, clock_w, | 104 | unsigned int width, height, window_label_w, workspace_label_w, clock_w, |
89 | button_w, bevel_w, label_h; | 105 | button_w, bevel_w, label_h; |
90 | } frame; | 106 | } frame; |
91 | 107 | ||
92 | class HideHandler : public TimeoutHandler { | 108 | class HideHandler : public TimeoutHandler { |
93 | public: | 109 | public: |
94 | Toolbar *toolbar; | 110 | Toolbar *toolbar; |
95 | 111 | ||
96 | virtual void timeout(void); | 112 | virtual void timeout(void); |
97 | } hide_handler; | 113 | } hide_handler; |
98 | 114 | ||
99 | Fluxbox *fluxbox; | 115 | Fluxbox *fluxbox; |
100 | BScreen *screen; | 116 | BScreen *screen; |
101 | BImageControl *image_ctrl; | 117 | BImageControl *image_ctrl; |
102 | BTimer clock_timer, *hide_timer; | 118 | BTimer clock_timer, *hide_timer; |
103 | Toolbarmenu *toolbarmenu; | 119 | Toolbarmenu *toolbarmenu; |
104 | class IconBar *iconbar; | 120 | class IconBar *iconbar; |
105 | 121 | ||
106 | std::string new_workspace_name; | 122 | std::string new_workspace_name; |
107 | 123 | ||
108 | friend class HideHandler; | 124 | friend class HideHandler; |
109 | friend class Toolbarmenu; | 125 | friend class Toolbarmenu; |
110 | friend class Toolbarmenu::Placementmenu; | 126 | friend class Toolbarmenu::Placementmenu; |
127 | #ifdef XINERAMA | ||
128 | friend class Toolbarmenu::Headmenu; | ||
129 | #endif // XINERAMA | ||
111 | 130 | ||
112 | 131 | ||
113 | public: | 132 | public: |
114 | Toolbar(BScreen *); | 133 | Toolbar(BScreen *); |
115 | virtual ~Toolbar(void); | 134 | virtual ~Toolbar(void); |
116 | void addIcon(FluxboxWindow *w); | 135 | void addIcon(FluxboxWindow *w); |
117 | void delIcon(FluxboxWindow *w); | 136 | void delIcon(FluxboxWindow *w); |
118 | 137 | ||
119 | inline Toolbarmenu *getMenu(void) { return toolbarmenu; } | 138 | inline Toolbarmenu *getMenu(void) { return toolbarmenu; } |
120 | //inline Window getWindowLabel(void) { return frame.window_label; } | 139 | //inline Window getWindowLabel(void) { return frame.window_label; } |
121 | inline const Bool &isEditing(void) const { return editing; } | 140 | inline const Bool &isEditing(void) const { return editing; } |
122 | inline const Bool &isOnTop(void) const { return on_top; } | 141 | inline const Bool &isOnTop(void) const { return on_top; } |
123 | inline const Bool &isHidden(void) const { return hidden; } | 142 | inline const Bool &isHidden(void) const { return hidden; } |
124 | inline const Bool &doAutoHide(void) const { return do_auto_hide; } | 143 | inline const Bool &doAutoHide(void) const { return do_auto_hide; } |
125 | 144 | ||
126 | inline const Window &getWindowID(void) const { return frame.window; } | 145 | inline const Window &getWindowID(void) const { return frame.window; } |
127 | 146 | ||
128 | inline const unsigned int &getWidth(void) const { return frame.width; } | 147 | inline const unsigned int &getWidth(void) const { return frame.width; } |
129 | inline const unsigned int &getHeight(void) const { return frame.height; } | 148 | inline const unsigned int &getHeight(void) const { return frame.height; } |
130 | inline const unsigned int &getExposedHeight(void) const | 149 | inline const unsigned int &getExposedHeight(void) const |
131 | { return ((do_auto_hide) ? frame.bevel_w : frame.height); } | 150 | { return ((do_auto_hide) ? frame.bevel_w : frame.height); } |
132 | inline const int &getX(void) const | 151 | inline const int &getX(void) const |
133 | { return ((hidden) ? frame.x_hidden : frame.x); } | 152 | { return ((hidden) ? frame.x_hidden : frame.x); } |
134 | inline const int &getY(void) const | 153 | inline const int &getY(void) const |
135 | { return ((hidden) ? frame.y_hidden : frame.y); } | 154 | { return ((hidden) ? frame.y_hidden : frame.y); } |
136 | inline IconBar *getIconBar(void) { return iconbar; } | 155 | inline IconBar *getIconBar(void) { return iconbar; } |
137 | 156 | ||
138 | void buttonPressEvent(XButtonEvent *); | 157 | void buttonPressEvent(XButtonEvent *); |
139 | void buttonReleaseEvent(XButtonEvent *); | 158 | void buttonReleaseEvent(XButtonEvent *); |
140 | void enterNotifyEvent(XCrossingEvent *); | 159 | void enterNotifyEvent(XCrossingEvent *); |
141 | void leaveNotifyEvent(XCrossingEvent *); | 160 | void leaveNotifyEvent(XCrossingEvent *); |
142 | void exposeEvent(XExposeEvent *); | 161 | void exposeEvent(XExposeEvent *); |
143 | void keyPressEvent(XKeyEvent *); | 162 | void keyPressEvent(XKeyEvent *); |
144 | 163 | ||
145 | void redrawWindowLabel(Bool = False); | 164 | void redrawWindowLabel(Bool = False); |
146 | void redrawWorkspaceLabel(Bool = False); | 165 | void redrawWorkspaceLabel(Bool = False); |
147 | void redrawPrevWorkspaceButton(Bool = False, Bool = False); | 166 | void redrawPrevWorkspaceButton(Bool = False, Bool = False); |
148 | void redrawNextWorkspaceButton(Bool = False, Bool = False); | 167 | void redrawNextWorkspaceButton(Bool = False, Bool = False); |
149 | void redrawPrevWindowButton(Bool = False, Bool = False); | 168 | void redrawPrevWindowButton(Bool = False, Bool = False); |
150 | void redrawNextWindowButton(Bool = False, Bool = False); | 169 | void redrawNextWindowButton(Bool = False, Bool = False); |
151 | void edit(void); | 170 | void edit(void); |
152 | void reconfigure(void); | 171 | void reconfigure(void); |
153 | 172 | ||
154 | #ifdef HAVE_STRFTIME | 173 | #ifdef HAVE_STRFTIME |
155 | void checkClock(Bool = False); | 174 | void checkClock(Bool = False); |
156 | #else // HAVE_STRFTIME | 175 | #else // HAVE_STRFTIME |
157 | void checkClock(Bool = False, Bool = False); | 176 | void checkClock(Bool = False, Bool = False); |
158 | #endif // HAVE_STRFTIME | 177 | #endif // HAVE_STRFTIME |
159 | 178 | ||
160 | virtual void timeout(void); | 179 | virtual void timeout(void); |
161 | 180 | ||
162 | enum Placement{ TOPLEFT = 1, BOTTOMLEFT, TOPCENTER, | 181 | enum Placement{ TOPLEFT = 1, BOTTOMLEFT, TOPCENTER, |
163 | BOTTOMCENTER, TOPRIGHT, BOTTOMRIGHT }; | 182 | BOTTOMCENTER, TOPRIGHT, BOTTOMRIGHT }; |
164 | }; | 183 | }; |
165 | 184 | ||
166 | 185 | ||