aboutsummaryrefslogtreecommitdiff
path: root/src/Toolbar.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/Toolbar.hh')
-rw-r--r--src/Toolbar.hh180
1 files changed, 103 insertions, 77 deletions
diff --git a/src/Toolbar.hh b/src/Toolbar.hh
index 1f3ba8f..7cc08b1 100644
--- a/src/Toolbar.hh
+++ b/src/Toolbar.hh
@@ -22,20 +22,39 @@
22// 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
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Toolbar.hh,v 1.10 2002/04/03 12:08:54 fluxgen Exp $ 25// $Id: Toolbar.hh,v 1.11 2002/08/04 15:55:13 fluxgen Exp $
26 26
27#ifndef TOOLBAR_HH 27#ifndef TOOLBAR_HH
28#define TOOLBAR_HH 28#define TOOLBAR_HH
29 29
30#include <X11/Xlib.h>
31#include "Basemenu.hh" 30#include "Basemenu.hh"
32#include "Timer.hh" 31#include "Timer.hh"
33#include "IconBar.hh" 32#include "IconBar.hh"
34 33
35// forward declaration 34
36class Toolbar; 35class Toolbar;
37 36
38class Toolbarmenu : public Basemenu { 37/**
38 Menu for toolbar.
39 @see Toolbar
40*/
41class Toolbarmenu:public Basemenu {
42public:
43 explicit Toolbarmenu(Toolbar *tb);
44 ~Toolbarmenu();
45 #ifdef XINERAMA
46 inline Basemenu *getHeadmenu() { return headmenu; }
47 #endif // XINERAMA
48
49 inline Basemenu *getPlacementmenu() { return placementmenu; }
50 inline const Basemenu *getPlacementmenu() const { return placementmenu; }
51
52 void reconfigure();
53
54protected:
55 virtual void itemSelected(int button, unsigned int index);
56 virtual void internal_hide();
57
39private: 58private:
40 class Placementmenu : public Basemenu { 59 class Placementmenu : public Basemenu {
41 private: 60 private:
@@ -71,28 +90,88 @@ private:
71 friend class Placementmenu; 90 friend class Placementmenu;
72 friend class Toolbar; 91 friend class Toolbar;
73 92
93};
74 94
75protected: 95/**
76 virtual void itemSelected(int button, unsigned int index); 96 the toolbar.
77 virtual void internal_hide(void); 97*/
78 98class Toolbar : public TimeoutHandler {
79public: 99public:
80 Toolbarmenu(Toolbar *); 100 /**
81 ~Toolbarmenu(void); 101 Toolbar placement on the screen
82 #ifdef XINERAMA 102 */
83 inline Basemenu *getHeadmenu(void) { return headmenu; } 103 enum Placement{ TOPLEFT = 1, BOTTOMLEFT, TOPCENTER,
84 #endif // XINERAMA 104 BOTTOMCENTER, TOPRIGHT, BOTTOMRIGHT };
85 105
86 inline Basemenu *getPlacementmenu(void) { return placementmenu; } 106 explicit Toolbar(BScreen *screen);
107 virtual ~Toolbar();
87 108
88 void reconfigure(void); 109 /// add icon to iconbar
89}; 110 void addIcon(FluxboxWindow *w);
111 /// remove icon from iconbar
112 void delIcon(FluxboxWindow *w);
113
114 inline Toolbarmenu *getMenu() { return toolbarmenu; }
115 inline const Toolbarmenu *getMenu() const { return toolbarmenu; }
116
117 //inline Window getWindowLabel(void) { return frame.window_label; }
118
119 /// are we in workspacename editing?
120 inline bool isEditing() const { return editing; }
121 /// always on top?
122 inline bool isOnTop() const { return on_top; }
123 /// are we hidden?
124 inline bool isHidden() const { return hidden; }
125 /// do we auto hide the toolbar?
126 inline bool doAutoHide() const { return do_auto_hide; }
127 /**
128 @return X window of the toolbar
129 */
130 inline Window getWindowID() const { return frame.window; }
131
132 inline unsigned int getWidth() const { return frame.width; }
133 inline unsigned int getHeight() const { return frame.height; }
134 inline unsigned int getExposedHeight() const { return ((do_auto_hide) ? frame.bevel_w : frame.height); }
135 inline int getX() const { return ((hidden) ? frame.x_hidden : frame.x); }
136 inline int getY() const { return ((hidden) ? frame.y_hidden : frame.y); }
137 inline IconBar *getIconBar() { return iconbar; }
138 /**
139 @name eventhandlers
140 */
141 //@{
142 void buttonPressEvent(XButtonEvent *be);
143 void buttonReleaseEvent(XButtonEvent *be);
144 void enterNotifyEvent(XCrossingEvent *ce);
145 void leaveNotifyEvent(XCrossingEvent *ce);
146 void exposeEvent(XExposeEvent *ee);
147 void keyPressEvent(XKeyEvent *ke);
148 //@}
149
150 void redrawWindowLabel(bool redraw= false);
151 void redrawWorkspaceLabel(bool redraw= false);
152 void redrawPrevWorkspaceButton(bool pressed = false, bool redraw = false);
153 void redrawNextWorkspaceButton(bool pressed = false, bool redraw = false);
154 void redrawPrevWindowButton(bool pressed = false, bool redraw = false);
155 void redrawNextWindowButton(bool pressed = false, bool redraw = false);
156 /// enter edit mode on workspace label
157 void edit();
158 void reconfigure();
159
160#ifdef HAVE_STRFTIME
161 void checkClock(bool redraw = false);
162#else // HAVE_STRFTIME
163 void checkClock(bool redraw = false, bool date = false);
164#endif // HAVE_STRFTIME
90 165
166 virtual void timeout();
91 167
92class Toolbar : public TimeoutHandler { 168
93private: 169private:
94 Bool on_top, editing, hidden, do_auto_hide; 170 bool on_top; ///< always on top
95 Display *display; 171 bool editing; ///< edit workspace label mode
172 bool hidden; ///< hidden state
173 bool do_auto_hide; ///< do we auto hide
174 Display *display; ///< display connection
96 175
97 struct frame { 176 struct frame {
98 unsigned long button_pixel, pbutton_pixel; 177 unsigned long button_pixel, pbutton_pixel;
@@ -112,14 +191,14 @@ private:
112 virtual void timeout(void); 191 virtual void timeout(void);
113 } hide_handler; 192 } hide_handler;
114 193
115 Fluxbox *fluxbox; 194 Fluxbox *fluxbox; ///< obsolete
116 BScreen *screen; 195 BScreen *screen; ///< screen on wich this toolbar exist
117 BImageControl *image_ctrl; 196 BImageControl *image_ctrl;
118 BTimer clock_timer, *hide_timer; 197 BTimer clock_timer, *hide_timer;
119 Toolbarmenu *toolbarmenu; 198 Toolbarmenu *toolbarmenu;
120 class IconBar *iconbar; 199 IconBar *iconbar;
121 200
122 std::string new_workspace_name; 201 std::string new_workspace_name; ///< temp variable in edit mode
123 202
124 friend class HideHandler; 203 friend class HideHandler;
125 friend class Toolbarmenu; 204 friend class Toolbarmenu;
@@ -127,60 +206,7 @@ private:
127 #ifdef XINERAMA 206 #ifdef XINERAMA
128 friend class Toolbarmenu::Headmenu; 207 friend class Toolbarmenu::Headmenu;
129 #endif // XINERAMA 208 #endif // XINERAMA
130
131
132public:
133 Toolbar(BScreen *);
134 virtual ~Toolbar(void);
135 void addIcon(FluxboxWindow *w);
136 void delIcon(FluxboxWindow *w);
137
138 inline Toolbarmenu *getMenu(void) { return toolbarmenu; }
139 //inline Window getWindowLabel(void) { return frame.window_label; }
140 inline const Bool &isEditing(void) const { return editing; }
141 inline const Bool &isOnTop(void) const { return on_top; }
142 inline const Bool &isHidden(void) const { return hidden; }
143 inline const Bool &doAutoHide(void) const { return do_auto_hide; }
144
145 inline const Window &getWindowID(void) const { return frame.window; }
146
147 inline const unsigned int &getWidth(void) const { return frame.width; }
148 inline const unsigned int &getHeight(void) const { return frame.height; }
149 inline const unsigned int &getExposedHeight(void) const
150 { return ((do_auto_hide) ? frame.bevel_w : frame.height); }
151 inline const int &getX(void) const
152 { return ((hidden) ? frame.x_hidden : frame.x); }
153 inline const int &getY(void) const
154 { return ((hidden) ? frame.y_hidden : frame.y); }
155 inline IconBar *getIconBar(void) { return iconbar; }
156
157 void buttonPressEvent(XButtonEvent *);
158 void buttonReleaseEvent(XButtonEvent *);
159 void enterNotifyEvent(XCrossingEvent *);
160 void leaveNotifyEvent(XCrossingEvent *);
161 void exposeEvent(XExposeEvent *);
162 void keyPressEvent(XKeyEvent *);
163
164 void redrawWindowLabel(Bool = False);
165 void redrawWorkspaceLabel(Bool = False);
166 void redrawPrevWorkspaceButton(Bool = False, Bool = False);
167 void redrawNextWorkspaceButton(Bool = False, Bool = False);
168 void redrawPrevWindowButton(Bool = False, Bool = False);
169 void redrawNextWindowButton(Bool = False, Bool = False);
170 void edit(void);
171 void reconfigure(void);
172
173#ifdef HAVE_STRFTIME
174 void checkClock(Bool = False);
175#else // HAVE_STRFTIME
176 void checkClock(Bool = False, Bool = False);
177#endif // HAVE_STRFTIME
178
179 virtual void timeout(void);
180
181 enum Placement{ TOPLEFT = 1, BOTTOMLEFT, TOPCENTER,
182 BOTTOMCENTER, TOPRIGHT, BOTTOMRIGHT };
183}; 209};
184 210
185 211
186#endif // __Toolbar_hh 212#endif // TOOLBAR_HH