aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-05-07 20:41:59 (GMT)
committerPavel Labath <pavelo@centrum.sk>2011-05-10 11:00:46 (GMT)
commit57acca0b601277982e63fa34eb78ae7881873e09 (patch)
treea8f83a2a954b4bf2c8247683b61c25ac94f32cf2
parent79d526b968b0e8cec31a66b0eafa8ddeb32cc16e (diff)
downloadfluxbox_paul-57acca0b601277982e63fa34eb78ae7881873e09.zip
fluxbox_paul-57acca0b601277982e63fa34eb78ae7881873e09.tar.bz2
Convert ToolbarItem::resizeSig to FbTk::Signal
-rw-r--r--src/ClockTool.cc4
-rw-r--r--src/SystemTray.cc6
-rw-r--r--src/Toolbar.cc8
-rw-r--r--src/Toolbar.hh2
-rw-r--r--src/ToolbarItem.hh8
-rw-r--r--src/WorkspaceNameTool.cc2
6 files changed, 11 insertions, 19 deletions
diff --git a/src/ClockTool.cc b/src/ClockTool.cc
index 6642985..95176a2 100644
--- a/src/ClockTool.cc
+++ b/src/ClockTool.cc
@@ -260,7 +260,7 @@ void ClockTool::themeReconfigured() {
260 translateSize(orientation(), new_width, new_height); 260 translateSize(orientation(), new_width, new_height);
261 if (new_width != m_button.width() || new_height != m_button.height()) { 261 if (new_width != m_button.width() || new_height != m_button.height()) {
262 resize(new_width, new_height); 262 resize(new_width, new_height);
263 resizeSig().notify(); 263 resizeSig().emit();
264 } 264 }
265 265
266} 266}
@@ -305,7 +305,7 @@ void ClockTool::updateTime() {
305 unsigned int new_width = m_theme->font().textWidth(time_string, time_string_len) + 2; 305 unsigned int new_width = m_theme->font().textWidth(time_string, time_string_len) + 2;
306 if (new_width > m_button.width()) { 306 if (new_width > m_button.width()) {
307 resize(new_width, m_button.height()); 307 resize(new_width, m_button.height());
308 resizeSig().notify(); 308 resizeSig().emit();
309 } 309 }
310#else // dont have strftime so we have to set it to hour:minut 310#else // dont have strftime so we have to set it to hour:minut
311 // sprintf(time_string, "%d:%d", ); 311 // sprintf(time_string, "%d:%d", );
diff --git a/src/SystemTray.cc b/src/SystemTray.cc
index 66e350f..846181f 100644
--- a/src/SystemTray.cc
+++ b/src/SystemTray.cc
@@ -246,7 +246,7 @@ void SystemTray::resize(unsigned int width, unsigned int height) {
246 m_window.resize(width, height); 246 m_window.resize(width, height);
247 if (m_num_visible_clients) 247 if (m_num_visible_clients)
248 rearrangeClients(); 248 rearrangeClients();
249 resizeSig().notify(); 249 resizeSig().emit();
250 } 250 }
251} 251}
252 252
@@ -257,7 +257,7 @@ void SystemTray::moveResize(int x, int y,
257 m_window.moveResize(x, y, width, height); 257 m_window.moveResize(x, y, width, height);
258 if (m_num_visible_clients) 258 if (m_num_visible_clients)
259 rearrangeClients(); 259 rearrangeClients();
260 resizeSig().notify(); 260 resizeSig().emit();
261 } else { 261 } else {
262 move(x, y); 262 move(x, y);
263 } 263 }
@@ -435,7 +435,7 @@ void SystemTray::handleEvent(XEvent &event) {
435 (*it)->sendConfigureNotify(0, 0, (*it)->width(), (*it)->height()); 435 (*it)->sendConfigureNotify(0, 0, (*it)->width(), (*it)->height());
436 // so toolbar know that we changed size 436 // so toolbar know that we changed size
437 // done inside this loop, because otherwise we can get into nasty looping 437 // done inside this loop, because otherwise we can get into nasty looping
438 resizeSig().notify(); 438 resizeSig().emit();
439 } 439 }
440 } 440 }
441 441
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index 9c2d2bf..a8b2c5b 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.cc
@@ -51,7 +51,6 @@
51#include "FbTk/BoolMenuItem.hh" 51#include "FbTk/BoolMenuItem.hh"
52#include "FbTk/IntMenuItem.hh" 52#include "FbTk/IntMenuItem.hh"
53#include "FbTk/Shape.hh" 53#include "FbTk/Shape.hh"
54#include "FbTk/SimpleObserver.hh"
55#include "FbTk/MemFun.hh" 54#include "FbTk/MemFun.hh"
56#include "FbTk/STLUtil.hh" 55#include "FbTk/STLUtil.hh"
57#include "FbTk/Util.hh" 56#include "FbTk/Util.hh"
@@ -227,8 +226,6 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::Layer &layer, size_t width):
227 m_shape(new FbTk::Shape(frame.window, 0)), 226 m_shape(new FbTk::Shape(frame.window, 0)),
228 m_resize_lock(false) { 227 m_resize_lock(false) {
229 _FB_USES_NLS; 228 _FB_USES_NLS;
230 // NOTE: first subject is always the rearrangeItem !
231 m_observers.push_back(makeObserver(*this, &Toolbar::rearrangeItems));
232 229
233 // get this on antialias change 230 // get this on antialias change
234 m_signal_tracker.join(screen().reconfigureSig(), 231 m_signal_tracker.join(screen().reconfigureSig(),
@@ -425,9 +422,8 @@ void Toolbar::reconfigure() {
425 if (item == 0) 422 if (item == 0)
426 continue; 423 continue;
427 m_item_list.push_back(item); 424 m_item_list.push_back(item);
428 // attach to first observer ( which must be rearrangeItems ) 425 m_signal_tracker.join(item->resizeSig(),
429 item->resizeSig().attach(m_observers[0]); 426 FbTk::MemFun(*this, &Toolbar::rearrangeItems));
430
431 } 427 }
432 // show all items 428 // show all items
433 frame.window.showSubwindows(); 429 frame.window.showSubwindows();
diff --git a/src/Toolbar.hh b/src/Toolbar.hh
index 3c9d048..9f737b4 100644
--- a/src/Toolbar.hh
+++ b/src/Toolbar.hh
@@ -197,8 +197,6 @@ private:
197 StringList m_tools; 197 StringList m_tools;
198 198
199 bool m_resize_lock; ///< to lock rearrangeItems or not 199 bool m_resize_lock; ///< to lock rearrangeItems or not
200 /// observers for various signals
201 std::vector<FbTk::Observer*> m_observers;
202 FbTk::SignalTracker m_signal_tracker; 200 FbTk::SignalTracker m_signal_tracker;
203}; 201};
204 202
diff --git a/src/ToolbarItem.hh b/src/ToolbarItem.hh
index f5d1a2a..bd5b38f 100644
--- a/src/ToolbarItem.hh
+++ b/src/ToolbarItem.hh
@@ -23,7 +23,7 @@
23#ifndef TOOLBARITEM_HH 23#ifndef TOOLBARITEM_HH
24#define TOOLBARITEM_HH 24#define TOOLBARITEM_HH
25 25
26#include "FbTk/Subject.hh" 26#include "FbTk/Signal.hh"
27#include "FbTk/Orientation.hh" 27#include "FbTk/Orientation.hh"
28 28
29/// An item in the toolbar that has either fixed or relative size to the toolbar 29/// An item in the toolbar that has either fixed or relative size to the toolbar
@@ -62,7 +62,7 @@ public:
62 // just update theme items that affect the size 62 // just update theme items that affect the size
63 virtual void updateSizing() = 0; 63 virtual void updateSizing() = 0;
64 64
65 FbTk::Subject &resizeSig() { return m_resize_sig; } 65 FbTk::Signal<> &resizeSig() { return m_resize_sig; }
66 66
67 void setType(Type type) { m_type = type; } 67 void setType(Type type) { m_type = type; }
68 Type type() const { return m_type; } 68 Type type() const { return m_type; }
@@ -70,14 +70,12 @@ public:
70 FbTk::Orientation orientation() const { return m_orientation; } 70 FbTk::Orientation orientation() const { return m_orientation; }
71 virtual void setOrientation(FbTk::Orientation orient) { m_orientation = orient; } 71 virtual void setOrientation(FbTk::Orientation orient) { m_orientation = orient; }
72 72
73 class ToolbarItemSubject : public FbTk::Subject {};
74
75private: 73private:
76 Type m_type; 74 Type m_type;
77 75
78 FbTk::Orientation m_orientation; 76 FbTk::Orientation m_orientation;
79 77
80 ToolbarItemSubject m_resize_sig; 78 FbTk::Signal<> m_resize_sig;
81}; 79};
82 80
83#endif // TOOLBARITEM_HH 81#endif // TOOLBARITEM_HH
diff --git a/src/WorkspaceNameTool.cc b/src/WorkspaceNameTool.cc
index 6451a0a..84f62e5 100644
--- a/src/WorkspaceNameTool.cc
+++ b/src/WorkspaceNameTool.cc
@@ -74,7 +74,7 @@ void WorkspaceNameTool::update() {
74 m_button.setText(m_screen.currentWorkspace()->name()); 74 m_button.setText(m_screen.currentWorkspace()->name());
75 if (m_button.width() != width()) { 75 if (m_button.width() != width()) {
76 resize(width(), height()); 76 resize(width(), height());
77 resizeSig().notify(); 77 resizeSig().emit();
78 } 78 }
79 reRender(); 79 reRender();
80 m_button.clear(); 80 m_button.clear();