aboutsummaryrefslogtreecommitdiff
path: root/src/Toolbar.hh
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-08-11 15:56:10 (GMT)
committerfluxgen <fluxgen>2003-08-11 15:56:10 (GMT)
commit586f78c56e9c4fd8b13788695bf7030f16d410a9 (patch)
tree63d0606d2354afc0376b741922b5ad898ec0dfd2 /src/Toolbar.hh
parent4ae7cd5384f363f6f7f1358ac017218eadb700ab (diff)
downloadfluxbox-586f78c56e9c4fd8b13788695bf7030f16d410a9.zip
fluxbox-586f78c56e9c4fd8b13788695bf7030f16d410a9.tar.bz2
first stage width new toolbar items
Diffstat (limited to 'src/Toolbar.hh')
-rw-r--r--src/Toolbar.hh115
1 files changed, 55 insertions, 60 deletions
diff --git a/src/Toolbar.hh b/src/Toolbar.hh
index 70b30e2..f18afad 100644
--- a/src/Toolbar.hh
+++ b/src/Toolbar.hh
@@ -22,13 +22,15 @@
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.39 2003/07/19 11:55:49 rathnor Exp $ 25// $Id: Toolbar.hh,v 1.40 2003/08/11 15:54:24 fluxgen Exp $
26 26
27#ifndef TOOLBAR_HH 27#ifndef TOOLBAR_HH
28#define TOOLBAR_HH 28#define TOOLBAR_HH
29 29
30#include "Timer.hh" 30#include "Timer.hh"
31#include "ToolbarTheme.hh" 31#include "ToolbarTheme.hh"
32#include "ToolTheme.hh"
33
32#include "EventHandler.hh" 34#include "EventHandler.hh"
33#include "FbWindow.hh" 35#include "FbWindow.hh"
34#include "ArrowButton.hh" 36#include "ArrowButton.hh"
@@ -42,16 +44,19 @@
42 44
43class BScreen; 45class BScreen;
44class Strut; 46class Strut;
45class IconBar; 47class Container;
48class IconButton;
46class Shape; 49class Shape;
50class ToolbarItem;
47 51
48namespace FbTk { 52namespace FbTk {
49class ImageControl; 53class ImageControl;
50}; 54};
51 55
56typedef Container IconBar;
52/// The toolbar. 57/// The toolbar.
53/// Handles iconbar, workspace name view and clock view 58/// Handles iconbar, workspace name view and clock view
54class Toolbar : public FbTk::TimeoutHandler, public FbTk::EventHandler { 59class Toolbar: public FbTk::EventHandler, public FbTk::Observer {
55public: 60public:
56 61
57 /// Toolbar placement on the screen 62 /// Toolbar placement on the screen
@@ -80,10 +85,40 @@ public:
80 void disableIconBar(); 85 void disableIconBar();
81 void raise(); 86 void raise();
82 void lower(); 87 void lower();
88 void toggleHidden();
83 89
84 void enableUpdates(); 90 void enableUpdates();
85 void disableUpdates(); 91 void disableUpdates();
86 92
93
94 void moveToLayer(int layernum);
95
96 void saveOnHead(int head);
97
98 /**
99 @name eventhandlers
100 */
101 //@{
102 void buttonPressEvent(XButtonEvent &be);
103 void buttonReleaseEvent(XButtonEvent &be);
104 void enterNotifyEvent(XCrossingEvent &ce);
105 void leaveNotifyEvent(XCrossingEvent &ce);
106 void exposeEvent(XExposeEvent &ee);
107 void keyPressEvent(XKeyEvent &ke);
108 //@}
109
110 void redrawWindowLabel(bool redraw= false);
111 void redrawWorkspaceLabel(bool redraw= false);
112 /// enter edit mode on workspace label
113 void edit();
114 void reconfigure();
115 void setPlacement(Placement where);
116 void checkClock(bool redraw = false, bool date = false);
117
118 void update(FbTk::Subject *subj);
119
120 FbTk::XLayerItem &layerItem() { return m_layeritem; }
121
87 inline const FbTk::Menu &menu() const { return m_toolbarmenu; } 122 inline const FbTk::Menu &menu() const { return m_toolbarmenu; }
88 inline FbTk::Menu &menu() { return m_toolbarmenu; } 123 inline FbTk::Menu &menu() { return m_toolbarmenu; }
89 inline FbTk::Menu &placementMenu() { return m_placementmenu; } 124 inline FbTk::Menu &placementMenu() { return m_placementmenu; }
@@ -92,10 +127,6 @@ public:
92 inline FbTk::Menu &layermenu() { return m_layermenu; } 127 inline FbTk::Menu &layermenu() { return m_layermenu; }
93 inline const FbTk::Menu &layermenu() const { return m_layermenu; } 128 inline const FbTk::Menu &layermenu() const { return m_layermenu; }
94 129
95 void moveToLayer(int layernum);
96
97 FbTk::XLayerItem &layerItem() { return m_layeritem; }
98
99 /// are we in workspacename editing? 130 /// are we in workspacename editing?
100 inline bool isEditing() const { return m_editing; } 131 inline bool isEditing() const { return m_editing; }
101 /// are we hidden? 132 /// are we hidden?
@@ -119,32 +150,9 @@ public:
119 bool isVertical() const; 150 bool isVertical() const;
120 151
121 inline int getOnHead() const { return *m_rc_on_head; } 152 inline int getOnHead() const { return *m_rc_on_head; }
122 void saveOnHead(int head);
123
124 /**
125 @name eventhandlers
126 */
127 //@{
128 void buttonPressEvent(XButtonEvent &be);
129 void buttonReleaseEvent(XButtonEvent &be);
130 void enterNotifyEvent(XCrossingEvent &ce);
131 void leaveNotifyEvent(XCrossingEvent &ce);
132 void exposeEvent(XExposeEvent &ee);
133 void keyPressEvent(XKeyEvent &ke);
134 //@}
135
136 void redrawWindowLabel(bool redraw= false);
137 void redrawWorkspaceLabel(bool redraw= false);
138 /// enter edit mode on workspace label
139 void edit();
140 void reconfigure();
141 void setPlacement(Placement where);
142 void checkClock(bool redraw = false, bool date = false);
143
144 virtual void timeout();
145
146 153
147private: 154private:
155 void updateIconbarGraphics();
148 void setupMenus(); 156 void setupMenus();
149 void clearStrut(); 157 void clearStrut();
150 void updateStrut(); 158 void updateStrut();
@@ -157,51 +165,35 @@ private:
157 Frame(FbTk::EventHandler &evh, int screen_num); 165 Frame(FbTk::EventHandler &evh, int screen_num);
158 ~Frame(); 166 ~Frame();
159 167
160 Pixmap base, label, wlabel, clk, button, pbutton; 168 Pixmap base, label;
161 FbTk::FbWindow window, workspace_label, window_label, clock; 169 FbTk::FbWindow window, window_label;
162 ArrowButton psbutton, nsbutton, pwbutton, nwbutton;
163 170
164 int x, y, x_hidden, y_hidden, hour, minute, grab_x, grab_y; 171 int x, y, x_hidden, y_hidden, grab_x, grab_y;
165 unsigned int width, height, window_label_w, workspace_label_w, clock_w, 172 unsigned int width, height, window_label_w, bevel_w, label_h;
166 button_w, bevel_w, label_h;
167 } frame; 173 } frame;
168 174
169 class HideHandler : public FbTk::TimeoutHandler { 175 Pixmap m_icon_focused_pm, m_icon_unfocused_pm;
170 public: 176 FbTk::Color m_icon_focused_color, m_icon_unfocused_color;
171 Toolbar *toolbar;
172
173 virtual void timeout();
174 } hide_handler;
175
176 friend class HideHandler;
177 177
178 BScreen &m_screen; ///< screen connection 178 BScreen &m_screen; ///< screen connection
179 179
180 FbTk::Timer m_clock_timer; ///< timer to update clock
181 FbTk::Timer m_hide_timer; ///< timer to for auto hide toolbar 180 FbTk::Timer m_hide_timer; ///< timer to for auto hide toolbar
182 FbTk::Menu &m_toolbarmenu; 181 FbTk::Menu &m_toolbarmenu;
183 FbTk::Menu m_placementmenu; 182 FbTk::Menu m_placementmenu;
184 LayerMenu<Toolbar> m_layermenu; 183 LayerMenu<Toolbar> m_layermenu;
185 std::auto_ptr<IconBar> m_iconbar; 184
185 // icon stuff
186 std::auto_ptr<Container> m_iconbar;
187 typedef std::map<FluxboxWindow *, IconButton *> Icon2WinMap;
188 Icon2WinMap m_icon2winmap;
186 189
187 std::string m_new_workspace_name; ///< temp variable in edit workspace name mode 190 std::string m_new_workspace_name; ///< temp variable in edit workspace name mode
188 191
189 ToolbarTheme m_theme; 192 ToolbarTheme m_theme;
190 193
191 //!! TODO this is just temporary
192 class ThemeListener: public FbTk::Observer {
193 public:
194 ThemeListener(Toolbar &tb):m_tb(tb) { }
195 void update(FbTk::Subject *subj) {
196 m_tb.reconfigure();
197 }
198 private:
199 Toolbar &m_tb;
200 };
201
202 ThemeListener m_themelistener;
203
204 FbTk::XLayerItem m_layeritem; 194 FbTk::XLayerItem m_layeritem;
195 typedef std::list<ToolbarItem *> ItemList;
196 ItemList m_item_list;
205 197
206 Strut *m_strut; ///< created and destroyed by BScreen 198 Strut *m_strut; ///< created and destroyed by BScreen
207 // resources 199 // resources
@@ -211,6 +203,9 @@ private:
211 FbTk::Resource<int> m_rc_on_head; 203 FbTk::Resource<int> m_rc_on_head;
212 FbTk::Resource<Placement> m_rc_placement; 204 FbTk::Resource<Placement> m_rc_placement;
213 std::auto_ptr<Shape> m_shape; 205 std::auto_ptr<Shape> m_shape;
206
207 ToolTheme m_tool_theme;
208
214}; 209};
215 210
216 211