Convert ToolbarItem::resizeSig to FbTk::Signal
This commit is contained in:
parent
79d526b968
commit
57acca0b60
6 changed files with 11 additions and 19 deletions
|
@ -260,7 +260,7 @@ void ClockTool::themeReconfigured() {
|
|||
translateSize(orientation(), new_width, new_height);
|
||||
if (new_width != m_button.width() || new_height != m_button.height()) {
|
||||
resize(new_width, new_height);
|
||||
resizeSig().notify();
|
||||
resizeSig().emit();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ void ClockTool::updateTime() {
|
|||
unsigned int new_width = m_theme->font().textWidth(time_string, time_string_len) + 2;
|
||||
if (new_width > m_button.width()) {
|
||||
resize(new_width, m_button.height());
|
||||
resizeSig().notify();
|
||||
resizeSig().emit();
|
||||
}
|
||||
#else // dont have strftime so we have to set it to hour:minut
|
||||
// sprintf(time_string, "%d:%d", );
|
||||
|
|
|
@ -246,7 +246,7 @@ void SystemTray::resize(unsigned int width, unsigned int height) {
|
|||
m_window.resize(width, height);
|
||||
if (m_num_visible_clients)
|
||||
rearrangeClients();
|
||||
resizeSig().notify();
|
||||
resizeSig().emit();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,7 +257,7 @@ void SystemTray::moveResize(int x, int y,
|
|||
m_window.moveResize(x, y, width, height);
|
||||
if (m_num_visible_clients)
|
||||
rearrangeClients();
|
||||
resizeSig().notify();
|
||||
resizeSig().emit();
|
||||
} else {
|
||||
move(x, y);
|
||||
}
|
||||
|
@ -435,7 +435,7 @@ void SystemTray::handleEvent(XEvent &event) {
|
|||
(*it)->sendConfigureNotify(0, 0, (*it)->width(), (*it)->height());
|
||||
// so toolbar know that we changed size
|
||||
// done inside this loop, because otherwise we can get into nasty looping
|
||||
resizeSig().notify();
|
||||
resizeSig().emit();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
#include "FbTk/BoolMenuItem.hh"
|
||||
#include "FbTk/IntMenuItem.hh"
|
||||
#include "FbTk/Shape.hh"
|
||||
#include "FbTk/SimpleObserver.hh"
|
||||
#include "FbTk/MemFun.hh"
|
||||
#include "FbTk/STLUtil.hh"
|
||||
#include "FbTk/Util.hh"
|
||||
|
@ -227,8 +226,6 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::Layer &layer, size_t width):
|
|||
m_shape(new FbTk::Shape(frame.window, 0)),
|
||||
m_resize_lock(false) {
|
||||
_FB_USES_NLS;
|
||||
// NOTE: first subject is always the rearrangeItem !
|
||||
m_observers.push_back(makeObserver(*this, &Toolbar::rearrangeItems));
|
||||
|
||||
// get this on antialias change
|
||||
m_signal_tracker.join(screen().reconfigureSig(),
|
||||
|
@ -425,9 +422,8 @@ void Toolbar::reconfigure() {
|
|||
if (item == 0)
|
||||
continue;
|
||||
m_item_list.push_back(item);
|
||||
// attach to first observer ( which must be rearrangeItems )
|
||||
item->resizeSig().attach(m_observers[0]);
|
||||
|
||||
m_signal_tracker.join(item->resizeSig(),
|
||||
FbTk::MemFun(*this, &Toolbar::rearrangeItems));
|
||||
}
|
||||
// show all items
|
||||
frame.window.showSubwindows();
|
||||
|
|
|
@ -197,8 +197,6 @@ private:
|
|||
StringList m_tools;
|
||||
|
||||
bool m_resize_lock; ///< to lock rearrangeItems or not
|
||||
/// observers for various signals
|
||||
std::vector<FbTk::Observer*> m_observers;
|
||||
FbTk::SignalTracker m_signal_tracker;
|
||||
};
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#ifndef TOOLBARITEM_HH
|
||||
#define TOOLBARITEM_HH
|
||||
|
||||
#include "FbTk/Subject.hh"
|
||||
#include "FbTk/Signal.hh"
|
||||
#include "FbTk/Orientation.hh"
|
||||
|
||||
/// An item in the toolbar that has either fixed or relative size to the toolbar
|
||||
|
@ -62,7 +62,7 @@ public:
|
|||
// just update theme items that affect the size
|
||||
virtual void updateSizing() = 0;
|
||||
|
||||
FbTk::Subject &resizeSig() { return m_resize_sig; }
|
||||
FbTk::Signal<> &resizeSig() { return m_resize_sig; }
|
||||
|
||||
void setType(Type type) { m_type = type; }
|
||||
Type type() const { return m_type; }
|
||||
|
@ -70,14 +70,12 @@ public:
|
|||
FbTk::Orientation orientation() const { return m_orientation; }
|
||||
virtual void setOrientation(FbTk::Orientation orient) { m_orientation = orient; }
|
||||
|
||||
class ToolbarItemSubject : public FbTk::Subject {};
|
||||
|
||||
private:
|
||||
Type m_type;
|
||||
|
||||
FbTk::Orientation m_orientation;
|
||||
|
||||
ToolbarItemSubject m_resize_sig;
|
||||
FbTk::Signal<> m_resize_sig;
|
||||
};
|
||||
|
||||
#endif // TOOLBARITEM_HH
|
||||
|
|
|
@ -74,7 +74,7 @@ void WorkspaceNameTool::update() {
|
|||
m_button.setText(m_screen.currentWorkspace()->name());
|
||||
if (m_button.width() != width()) {
|
||||
resize(width(), height());
|
||||
resizeSig().notify();
|
||||
resizeSig().emit();
|
||||
}
|
||||
reRender();
|
||||
m_button.clear();
|
||||
|
|
Loading…
Reference in a new issue