Convert FbTk::Theme::reconfigSig and friends to the new Signal system
I removed the const versions of reconfigSig() in the process since FbTk::Signal has no const methods anyway.
This commit is contained in:
parent
54230c9a44
commit
f7d7dfd2a8
34 changed files with 92 additions and 115 deletions
|
@ -43,8 +43,7 @@ public:
|
|||
int scale() const { return *m_scale; } // scale factor for inside objects
|
||||
const std::string &name() { return m_name; }
|
||||
|
||||
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
||||
virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||
|
||||
virtual ButtonTheme &operator *() { return *this; }
|
||||
virtual const ButtonTheme &operator *() const { return *this; }
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "FbMenu.hh"
|
||||
|
||||
#include "FbTk/Signal.hh"
|
||||
#include "FbTk/Subject.hh"
|
||||
|
||||
class BScreen;
|
||||
class FluxboxWindow;
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "CommandDialog.hh"
|
||||
#include "fluxbox.hh"
|
||||
|
||||
#include "FbTk/MemFun.hh"
|
||||
#include "FbTk/SimpleCommand.hh"
|
||||
#include "FbTk/ImageControl.hh"
|
||||
#include "FbTk/TextUtils.hh"
|
||||
|
@ -168,7 +169,7 @@ ClockTool::ClockTool(const FbTk::FbWindow &parent,
|
|||
screen.name() + ".strftimeFormat", screen.altName() + ".StrftimeFormat"),
|
||||
m_stringconvertor(FbTk::StringConvertor::ToFbString) {
|
||||
// attach signals
|
||||
theme.reconfigSig().attach(this);
|
||||
m_tracker.join(theme.reconfigSig(), FbTk::MemFun(*this, &ClockTool::themeReconfigured));
|
||||
|
||||
std::string time_locale = setlocale(LC_TIME, NULL);
|
||||
size_t pos = time_locale.find('.');
|
||||
|
@ -197,7 +198,7 @@ ClockTool::ClockTool(const FbTk::FbWindow &parent,
|
|||
menu.insert(_FB_XTEXT(Toolbar, ClockEditFormat, "Edit Clock Format", "edit Clock Format") , editformat_cmd);
|
||||
|
||||
|
||||
update(0);
|
||||
themeReconfigured();
|
||||
}
|
||||
|
||||
ClockTool::~ClockTool() {
|
||||
|
@ -233,10 +234,10 @@ void ClockTool::hide() {
|
|||
|
||||
void ClockTool::setTimeFormat(const std::string &format) {
|
||||
*m_timeformat = format;
|
||||
update(0);
|
||||
themeReconfigured();
|
||||
}
|
||||
|
||||
void ClockTool::update(FbTk::Subject *subj) {
|
||||
void ClockTool::themeReconfigured() {
|
||||
updateTime();
|
||||
|
||||
// + 2 to make the entire text fit inside
|
||||
|
@ -316,7 +317,7 @@ void ClockTool::updateTime() {
|
|||
void ClockTool::updateSizing() {
|
||||
m_button.setBorderWidth(m_theme->border().width());
|
||||
// resizes if new timeformat
|
||||
update(0);
|
||||
themeReconfigured();
|
||||
}
|
||||
|
||||
void ClockTool::reRender() {
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
|
||||
#include "ToolbarItem.hh"
|
||||
|
||||
#include "FbTk/Signal.hh"
|
||||
#include "FbTk/TextButton.hh"
|
||||
#include "FbTk/Observer.hh"
|
||||
#include "FbTk/Resource.hh"
|
||||
#include "FbTk/Timer.hh"
|
||||
#include "FbTk/FbString.hh"
|
||||
|
@ -37,12 +37,11 @@ class BScreen;
|
|||
|
||||
namespace FbTk {
|
||||
class ImageControl;
|
||||
class Subject;
|
||||
class Menu;
|
||||
template <class T> class ThemeProxy;
|
||||
}
|
||||
|
||||
class ClockTool:public ToolbarItem, public FbTk::Observer {
|
||||
class ClockTool:public ToolbarItem {
|
||||
public:
|
||||
ClockTool(const FbTk::FbWindow &parent, FbTk::ThemeProxy<ToolTheme> &theme,
|
||||
BScreen &screen, FbTk::Menu &menu);
|
||||
|
@ -68,7 +67,7 @@ public:
|
|||
|
||||
private:
|
||||
void updateTime();
|
||||
void update(FbTk::Subject *subj);
|
||||
void themeReconfigured();
|
||||
void renderTheme(int alpha);
|
||||
void reRender();
|
||||
void updateSizing();
|
||||
|
@ -83,6 +82,8 @@ private:
|
|||
FbTk::Resource<std::string> m_timeformat;
|
||||
|
||||
FbTk::StringConvertor m_stringconvertor;
|
||||
|
||||
FbTk::SignalTracker m_tracker;
|
||||
};
|
||||
|
||||
#endif // CLOCKTOOL_HH
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "MenuItem.hh"
|
||||
#include "MenuSeparator.hh"
|
||||
#include "ImageControl.hh"
|
||||
#include "MemFun.hh"
|
||||
#include "MenuTheme.hh"
|
||||
#include "App.hh"
|
||||
#include "EventManager.hh"
|
||||
|
@ -121,7 +122,7 @@ Menu::Menu(FbTk::ThemeProxy<MenuTheme> &tm, ImageControl &imgctrl):
|
|||
m_hide_timer.fireOnce(true);
|
||||
|
||||
// make sure we get updated when the theme is reloaded
|
||||
tm.reconfigSig().attach(this);
|
||||
m_tracker.join(tm.reconfigSig(), MemFun(*this, &Menu::themeReconfigured));
|
||||
|
||||
m_title_vis = true;
|
||||
|
||||
|
@ -1244,7 +1245,6 @@ void Menu::update(FbTk::Subject *subj) {
|
|||
reconfigure();
|
||||
}
|
||||
|
||||
|
||||
void Menu::setScreen(int x, int y, int w, int h) {
|
||||
m_screen_x = x;
|
||||
m_screen_y = y;
|
||||
|
|
|
@ -195,6 +195,7 @@ private:
|
|||
void closeMenu();
|
||||
void startHide();
|
||||
void stopHide();
|
||||
void themeReconfigured() { update(NULL); }
|
||||
|
||||
FbTk::ThemeProxy<MenuTheme> &m_theme;
|
||||
Menu *m_parent;
|
||||
|
@ -261,6 +262,8 @@ private:
|
|||
bool m_need_update;
|
||||
Timer m_submenu_timer;
|
||||
Timer m_hide_timer;
|
||||
|
||||
SignalTracker m_tracker;
|
||||
};
|
||||
|
||||
} // end namespace FbTk
|
||||
|
|
|
@ -130,8 +130,7 @@ public:
|
|||
m_hl_selected_pixmap->pixmap().dontFree();
|
||||
}
|
||||
|
||||
virtual Subject &reconfigSig() { return Theme::reconfigSig(); }
|
||||
virtual const Subject &reconfigSig() const { return Theme::reconfigSig(); }
|
||||
virtual Signal<void> &reconfigSig() { return Theme::reconfigSig(); }
|
||||
|
||||
virtual MenuTheme &operator *() { return *this; }
|
||||
virtual const MenuTheme &operator *() const { return *this; }
|
||||
|
|
|
@ -56,7 +56,7 @@ struct LoadThemeHelper {
|
|||
ThemeManager::ThemeList::iterator it = tmlist.begin();
|
||||
ThemeManager::ThemeList::iterator it_end = tmlist.end();
|
||||
for (; it != it_end; ++it) {
|
||||
(*it)->reconfigSig().notify();
|
||||
(*it)->reconfigSig().emit();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
#ifndef FBTK_THEME_HH
|
||||
#define FBTK_THEME_HH
|
||||
|
||||
#include "Signal.hh"
|
||||
#include "XrmDatabaseHelper.hh"
|
||||
#include "Subject.hh"
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
@ -107,15 +107,13 @@ public:
|
|||
template <typename T>
|
||||
void remove(ThemeItem<T> &item);
|
||||
virtual bool fallback(ThemeItem_base &) { return false; }
|
||||
FbTk::Subject &reconfigSig() { return m_reconfig_sig; }
|
||||
const FbTk::Subject &reconfigSig() const { return m_reconfig_sig; }
|
||||
|
||||
Signal<void> &reconfigSig() { return m_reconfig_sig; }
|
||||
|
||||
private:
|
||||
const int m_screen_num;
|
||||
|
||||
ItemList m_themeitems;
|
||||
FbTk::Subject m_reconfig_sig;
|
||||
Signal<void> m_reconfig_sig;
|
||||
};
|
||||
|
||||
/// Proxy interface for themes, so they can be substituted dynamically
|
||||
|
@ -124,8 +122,7 @@ class ThemeProxy {
|
|||
public:
|
||||
virtual ~ThemeProxy() { }
|
||||
|
||||
virtual Subject &reconfigSig() = 0;
|
||||
virtual const Subject &reconfigSig() const = 0;
|
||||
virtual Signal<void> &reconfigSig() = 0;
|
||||
|
||||
virtual BaseTheme &operator *() = 0;
|
||||
virtual const BaseTheme &operator *() const = 0;
|
||||
|
|
|
@ -79,8 +79,7 @@ public:
|
|||
|
||||
IconbarTheme &iconbarTheme() { return m_iconbar_theme; }
|
||||
|
||||
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
||||
virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||
|
||||
virtual FbWinFrameTheme &operator *() { return *this; }
|
||||
virtual const FbWinFrameTheme &operator *() const { return *this; }
|
||||
|
|
|
@ -34,12 +34,15 @@ public:
|
|||
FocusableTheme(Focusable &win, FbTk::ThemeProxy<BaseTheme> &focused,
|
||||
FbTk::ThemeProxy<BaseTheme> &unfocused):
|
||||
m_win(win), m_focused_theme(focused), m_unfocused_theme(unfocused) {
|
||||
// relay focus signal to reconfig signal
|
||||
FbTk::relaySignal(m_signals, m_win.focusSig(), m_reconfig_sig);
|
||||
|
||||
m_signals.join(m_win.focusSig(),
|
||||
FbTk::MemFunIgnoreArgs(m_reconfig_sig, &FbTk::Signal<void>::emit));
|
||||
|
||||
m_win.attentionSig().attach(this);
|
||||
m_focused_theme.reconfigSig().attach(this);
|
||||
m_unfocused_theme.reconfigSig().attach(this);
|
||||
m_signals.join(m_focused_theme.reconfigSig(),
|
||||
FbTk::MemFun(m_reconfig_sig, &FbTk::Signal<void>::emit));
|
||||
m_signals.join(m_unfocused_theme.reconfigSig(),
|
||||
FbTk::MemFun(m_reconfig_sig, &FbTk::Signal<void>::emit));
|
||||
}
|
||||
|
||||
Focusable &win() { return m_win; }
|
||||
|
@ -51,8 +54,7 @@ public:
|
|||
FbTk::ThemeProxy<BaseTheme> &unfocusedTheme() { return m_unfocused_theme; }
|
||||
const FbTk::ThemeProxy<BaseTheme> &unfocusedTheme() const { return m_unfocused_theme; }
|
||||
|
||||
FbTk::Subject &reconfigSig() { return m_reconfig_sig; }
|
||||
const FbTk::Subject &reconfigSig() const { return m_reconfig_sig; }
|
||||
FbTk::Signal<void> &reconfigSig() { return m_reconfig_sig; }
|
||||
|
||||
virtual BaseTheme &operator *() {
|
||||
return (m_win.isFocused() || m_win.getAttentionState()) ?
|
||||
|
@ -64,11 +66,11 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
void update(FbTk::Subject *subj) { m_reconfig_sig.notify(); }
|
||||
void update(FbTk::Subject *subj) { m_reconfig_sig.emit(); }
|
||||
|
||||
Focusable &m_win;
|
||||
FbTk::ThemeProxy<BaseTheme> &m_focused_theme, &m_unfocused_theme;
|
||||
FbTk::Subject m_reconfig_sig;
|
||||
FbTk::Signal<void> m_reconfig_sig;
|
||||
FbTk::SignalTracker m_signals;
|
||||
};
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "GenericTool.hh"
|
||||
#include "FbTk/FbWindow.hh"
|
||||
#include "FbTk/MemFun.hh"
|
||||
#include "ToolTheme.hh"
|
||||
|
||||
#include <string>
|
||||
|
@ -31,7 +32,7 @@ GenericTool::GenericTool(FbTk::FbWindow *new_window, ToolbarItem::Type type,
|
|||
m_window(new_window),
|
||||
m_theme(theme) {
|
||||
|
||||
theme.reconfigSig().attach(this);
|
||||
m_tracker.join(theme.reconfigSig(), FbTk::MemFun(*this, &GenericTool::themeReconfigured));
|
||||
|
||||
if (new_window == 0)
|
||||
throw std::string("GenericTool: Error! Tried to create a tool with window = 0");
|
||||
|
@ -80,7 +81,7 @@ void GenericTool::renderTheme(int alpha) {
|
|||
m_window->clear();
|
||||
}
|
||||
|
||||
void GenericTool::update(FbTk::Subject *subj) {
|
||||
void GenericTool::themeReconfigured() {
|
||||
m_window->clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "ToolbarItem.hh"
|
||||
|
||||
#include "FbTk/NotCopyable.hh"
|
||||
#include "FbTk/Observer.hh"
|
||||
#include "FbTk/Signal.hh"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
@ -37,7 +37,7 @@ template <class T> class ThemeProxy;
|
|||
}
|
||||
|
||||
/// helper class for simple tools, i.e buttons etc
|
||||
class GenericTool: public ToolbarItem, public FbTk::Observer, private FbTk::NotCopyable {
|
||||
class GenericTool: public ToolbarItem, private FbTk::NotCopyable {
|
||||
public:
|
||||
GenericTool(FbTk::FbWindow *new_window, ToolbarItem::Type type,
|
||||
FbTk::ThemeProxy<ToolTheme> &theme);
|
||||
|
@ -63,10 +63,11 @@ protected:
|
|||
virtual void renderTheme(int alpha);
|
||||
|
||||
private:
|
||||
void update(FbTk::Subject *subj);
|
||||
void themeReconfigured();
|
||||
|
||||
std::auto_ptr<FbTk::FbWindow> m_window;
|
||||
FbTk::ThemeProxy<ToolTheme> &m_theme;
|
||||
FbTk::SignalTracker m_tracker;
|
||||
};
|
||||
|
||||
#endif // GENERICTOOL_HH
|
||||
|
|
|
@ -41,8 +41,7 @@ public:
|
|||
const FbTk::Texture &texture() const { return *m_texture; }
|
||||
const FbTk::Texture &emptyTexture() const { return *m_empty_texture; }
|
||||
|
||||
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
||||
virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||
|
||||
virtual IconbarTheme &operator *() { return *this; }
|
||||
virtual const IconbarTheme &operator *() const { return *this; }
|
||||
|
|
|
@ -291,10 +291,12 @@ IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme,
|
|||
menu.insert(m_menu.label().logical(), &m_menu);
|
||||
|
||||
// setup signals
|
||||
theme.reconfigSig().attach(this);
|
||||
focused_theme.reconfigSig().attach(this);
|
||||
unfocused_theme.reconfigSig().attach(this);
|
||||
setMode(*m_rc_mode);
|
||||
m_tracker.join(theme.reconfigSig(), FbTk::MemFun(*this, &IconbarTool::themeReconfigured));
|
||||
m_tracker.join(focused_theme.reconfigSig(),
|
||||
FbTk::MemFun(*this, &IconbarTool::themeReconfigured));
|
||||
m_tracker.join(unfocused_theme.reconfigSig(),
|
||||
FbTk::MemFun(*this, &IconbarTool::themeReconfigured));
|
||||
themeReconfigured();
|
||||
}
|
||||
|
||||
IconbarTool::~IconbarTool() {
|
||||
|
@ -383,6 +385,10 @@ unsigned int IconbarTool::borderWidth() const {
|
|||
return m_icon_container.borderWidth();
|
||||
}
|
||||
|
||||
void IconbarTool::themeReconfigured() {
|
||||
setMode(*m_rc_mode);
|
||||
}
|
||||
|
||||
void IconbarTool::update(FbTk::Subject *subj) {
|
||||
// ignore updates if we're shutting down
|
||||
if (m_screen.isShuttingdown()) {
|
||||
|
@ -396,13 +402,6 @@ void IconbarTool::update(FbTk::Subject *subj) {
|
|||
*m_rc_client_width = FbTk::Util::clamp(*m_rc_client_width, 10, 400);
|
||||
m_icon_container.setMaxSizePerClient(*m_rc_client_width);
|
||||
|
||||
if (subj == &m_focused_theme.reconfigSig() ||
|
||||
subj == &m_unfocused_theme.reconfigSig() ||
|
||||
subj == &m_theme.reconfigSig()) {
|
||||
setMode(*m_rc_mode);
|
||||
return;
|
||||
}
|
||||
|
||||
// lock graphic update
|
||||
m_icon_container.setUpdateLock(true);
|
||||
|
||||
|
|
|
@ -95,12 +95,15 @@ private:
|
|||
/// add icons to the list
|
||||
void updateList();
|
||||
|
||||
void themeReconfigured();
|
||||
|
||||
BScreen &m_screen;
|
||||
FbTk::Container m_icon_container;
|
||||
IconbarTheme &m_theme;
|
||||
FbTk::ThemeProxy<IconbarTheme> &m_focused_theme, &m_unfocused_theme;
|
||||
FbTk::CachedPixmap m_empty_pm; ///< pixmap for empty container
|
||||
|
||||
FbTk::SignalTracker m_tracker;
|
||||
|
||||
std::auto_ptr<FocusableList> m_winlist;
|
||||
IconMap m_icons;
|
||||
|
|
|
@ -48,8 +48,7 @@ public:
|
|||
|
||||
GC opGC() const { return m_opgc.gc(); }
|
||||
|
||||
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
||||
virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||
|
||||
virtual RootTheme &operator *() { return *this; }
|
||||
virtual const RootTheme &operator *() const { return *this; }
|
||||
|
|
|
@ -435,7 +435,8 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
|
|||
|
||||
m_menutheme->setDelay(*resource.menu_delay);
|
||||
|
||||
focusedWinFrameTheme()->reconfigSig().attach(this);// for geom window
|
||||
m_tracker.join(focusedWinFrameTheme()->reconfigSig(),
|
||||
FbTk::MemFun(*this, &BScreen::focusedWinFrameThemeReconfigured));
|
||||
|
||||
|
||||
renderGeomWindow();
|
||||
|
@ -749,10 +750,7 @@ unsigned int BScreen::maxBottom(int head) const {
|
|||
return doFullMax() ? height() : height() - availableWorkspaceArea(head)->bottom();
|
||||
}
|
||||
|
||||
void BScreen::update(FbTk::Subject *subj) {
|
||||
// for now we're only listening to the theme sig, so no object check
|
||||
// if another signal is added later, will need to differentiate here
|
||||
|
||||
void BScreen::focusedWinFrameThemeReconfigured() {
|
||||
renderGeomWindow();
|
||||
renderPosWindow();
|
||||
|
||||
|
|
|
@ -75,7 +75,6 @@ class Menu;
|
|||
class ImageControl;
|
||||
class LayerItem;
|
||||
class FbWindow;
|
||||
class Subject;
|
||||
}
|
||||
|
||||
|
||||
|
@ -83,8 +82,7 @@ class Subject;
|
|||
/**
|
||||
Create workspaces, handles switching between workspaces and windows
|
||||
*/
|
||||
class BScreen: public FbTk::EventHandler, public FbTk::Observer,
|
||||
private FbTk::NotCopyable {
|
||||
class BScreen: public FbTk::EventHandler, private FbTk::NotCopyable {
|
||||
public:
|
||||
typedef std::list<FluxboxWindow *> Icons;
|
||||
|
||||
|
@ -220,9 +218,6 @@ public:
|
|||
ScreenSignal &bgChangeSig() { return m_bg_change_sig; }
|
||||
//@}
|
||||
|
||||
/// called when the screen receives a signal from a subject
|
||||
void update(FbTk::Subject *subj);
|
||||
|
||||
void propertyNotify(Atom atom);
|
||||
void keyPressEvent(XKeyEvent &ke);
|
||||
void keyReleaseEvent(XKeyEvent &ke);
|
||||
|
@ -476,9 +471,11 @@ private:
|
|||
void setupConfigmenu(FbTk::Menu &menu);
|
||||
void renderGeomWindow();
|
||||
void renderPosWindow();
|
||||
void focusedWinFrameThemeReconfigured();
|
||||
|
||||
const Strut* availableWorkspaceArea(int head) const;
|
||||
|
||||
FbTk::SignalTracker m_tracker;
|
||||
ScreenSubject m_reconfigure_sig; ///< reconfigure signal
|
||||
|
||||
|
||||
|
|
10
src/Slit.cc
10
src/Slit.cc
|
@ -263,13 +263,13 @@ Slit::Slit(BScreen &scr, FbTk::Layer &layer, const char *filename)
|
|||
_FB_USES_NLS;
|
||||
|
||||
// attach to theme and root window change signal
|
||||
theme().reconfigSig().attach(this);
|
||||
join(theme().reconfigSig(), FbTk::MemFun(*this, &Slit::reconfigure));
|
||||
|
||||
join(scr.resizeSig(),
|
||||
FbTk::MemFun(*this, &Slit::screenSizeChanged));
|
||||
|
||||
join(scr.bgChangeSig(),
|
||||
FbTk::MemFun(*this, &Slit::updateForScreen));
|
||||
FbTk::MemFunIgnoreArgs(*this, &Slit::reconfigure));
|
||||
|
||||
scr.reconfigureSig().attach(this); // if alpha changed (we disablethis signal when we get theme change sig)
|
||||
|
||||
|
@ -1042,12 +1042,8 @@ void Slit::screenSizeChanged(BScreen &screen) {
|
|||
#endif // XINERAMA
|
||||
}
|
||||
|
||||
void Slit::updateForScreen(BScreen &screen) {
|
||||
reconfigure();
|
||||
}
|
||||
|
||||
void Slit::update(FbTk::Subject*) {
|
||||
updateForScreen(screen());
|
||||
reconfigure();
|
||||
}
|
||||
|
||||
void Slit::clearWindow() {
|
||||
|
|
|
@ -134,7 +134,6 @@ public:
|
|||
private:
|
||||
/// Called when screen has changed
|
||||
void screenSizeChanged(BScreen &screen);
|
||||
void updateForScreen(BScreen &screen);
|
||||
|
||||
void updateAlpha();
|
||||
void clearWindow();
|
||||
|
|
|
@ -38,8 +38,7 @@ public:
|
|||
int borderWidth() const { return *m_border_width; }
|
||||
int bevelWidth() const { return *m_bevel_width; }
|
||||
|
||||
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
||||
virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||
|
||||
virtual SlitTheme &operator *() { return *this; }
|
||||
virtual const SlitTheme &operator *() const { return *this; }
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "FbTk/ImageControl.hh"
|
||||
#include "FbTk/TextUtils.hh"
|
||||
#include "FbTk/MemFun.hh"
|
||||
#include "FbTk/SimpleObserver.hh"
|
||||
|
||||
#include "AtomHandler.hh"
|
||||
#include "fluxbox.hh"
|
||||
|
@ -167,11 +166,10 @@ SystemTray::SystemTray(const FbTk::FbWindow& parent,
|
|||
FbTk::EventManager::instance()->add(*this, m_window);
|
||||
FbTk::EventManager::instance()->add(*this, m_selection_owner);
|
||||
// setup signals
|
||||
m_observer.reset(makeObserver(*this, &SystemTray::update));
|
||||
m_theme->reconfigSig().attach(m_observer.get());
|
||||
join(m_theme->reconfigSig(), FbTk::MemFun(*this, &SystemTray::update));
|
||||
|
||||
join(screen.bgChangeSig(),
|
||||
FbTk::MemFun(*this, &SystemTray::updateForScreen));
|
||||
FbTk::MemFunIgnoreArgs(*this, &SystemTray::update));
|
||||
|
||||
|
||||
Fluxbox* fluxbox = Fluxbox::instance();
|
||||
|
|
|
@ -40,7 +40,6 @@ class AtomHandler;
|
|||
|
||||
namespace FbTk {
|
||||
template <class T> class ThemeProxy;
|
||||
class Observer;
|
||||
}
|
||||
|
||||
class SystemTray: public ToolbarItem, public FbTk::EventHandler,
|
||||
|
@ -89,10 +88,6 @@ public:
|
|||
static Atom getXEmbedInfoAtom();
|
||||
|
||||
private:
|
||||
/// Called when an update for a screen is needed.
|
||||
void updateForScreen(BScreen &screen) {
|
||||
update();
|
||||
}
|
||||
void update();
|
||||
|
||||
typedef std::list<TrayWindow *> ClientList;
|
||||
|
@ -116,7 +111,6 @@ private:
|
|||
// gaim/pidgin seems to barf if the selection is not an independent window.
|
||||
// I suspect it's an interacton with parent relationship and gdk window caching.
|
||||
FbTk::FbWindow m_selection_owner;
|
||||
std::auto_ptr<FbTk::Observer> m_observer;
|
||||
};
|
||||
|
||||
#endif // SYSTEMTRAY_HH
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#ifndef TOOLTHEME_HH
|
||||
#define TOOLTHEME_HH
|
||||
|
||||
|
||||
#include "FbTk/TextTheme.hh"
|
||||
#include "FbTk/BorderTheme.hh"
|
||||
#include "FbTk/Texture.hh"
|
||||
|
@ -44,8 +43,7 @@ public:
|
|||
int alpha() const { return m_alpha; }
|
||||
void setAlpha(int alpha) { m_alpha = alpha; }
|
||||
|
||||
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
||||
virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||
|
||||
virtual ToolTheme &operator *() { return *this; }
|
||||
virtual const ToolTheme &operator *() const { return *this; }
|
||||
|
|
|
@ -231,8 +231,8 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::Layer &layer, size_t width):
|
|||
m_observers.push_back(makeObserver(*this, &Toolbar::rearrangeItems));
|
||||
// we need to get notified when the theme is reloaded
|
||||
m_observers.push_back(makeObserver(*this, &Toolbar::reconfigure));
|
||||
m_theme.reconfigSig().attach(m_observers.back());
|
||||
screen().reconfigureSig().attach(m_observers.back()); // get this on antialias change
|
||||
m_signal_tracker.join(m_theme.reconfigSig(), FbTk::MemFun(*this, &Toolbar::reconfigure));
|
||||
|
||||
// listen to screen size changes
|
||||
m_signal_tracker.join(screen().resizeSig(),
|
||||
|
|
|
@ -44,8 +44,7 @@ public:
|
|||
int height() const { return *m_height; }
|
||||
int buttonSize() const { return *m_button_size; }
|
||||
|
||||
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
||||
virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||
|
||||
virtual ToolbarTheme &operator *() { return *this; }
|
||||
virtual const ToolbarTheme &operator *() const { return *this; }
|
||||
|
|
|
@ -44,7 +44,8 @@ WinButton::WinButton(FluxboxWindow &listen_to,
|
|||
m_theme(theme), m_pressed_theme(pressed),
|
||||
m_icon_pixmap(0), m_icon_mask(0),
|
||||
overrode_bg(false), overrode_pressed(false) {
|
||||
theme.reconfigSig().attach(this);
|
||||
|
||||
join(theme.reconfigSig(), FbTk::MemFun(*this, &WinButton::updateAll));
|
||||
|
||||
if (buttontype == MENUICON)
|
||||
update(0);
|
||||
|
|
|
@ -65,8 +65,7 @@ public:
|
|||
FbTk::PixmapWithMask &titlePixmap() { return *m_title_pm; }
|
||||
const FbTk::PixmapWithMask &titlePixmap() const { return *m_title_pm; }
|
||||
|
||||
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
||||
virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||
|
||||
virtual WinButtonTheme &operator *() { return *this; }
|
||||
virtual const WinButtonTheme &operator *() const { return *this; }
|
||||
|
|
|
@ -291,7 +291,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client):
|
|||
m_parent(client.screen().rootWindow()),
|
||||
m_resize_corner(RIGHTBOTTOM) {
|
||||
|
||||
m_theme.reconfigSig().attach(this);
|
||||
join(m_theme.reconfigSig(), FbTk::MemFun(*this, &FluxboxWindow::themeReconfigured));
|
||||
m_frame.frameExtentSig().attach(this);
|
||||
|
||||
init();
|
||||
|
@ -2682,15 +2682,17 @@ void FluxboxWindow::setTitle(const std::string& title, Focusable &client) {
|
|||
}
|
||||
|
||||
void FluxboxWindow::update(FbTk::Subject *subj) {
|
||||
if (subj == &m_theme.reconfigSig()) {
|
||||
frame().applyDecorations();
|
||||
sendConfigureNotify();
|
||||
} else if (m_initialized && subj == &m_frame.frameExtentSig()) {
|
||||
if (m_initialized && subj == &m_frame.frameExtentSig()) {
|
||||
Fluxbox::instance()->updateFrameExtents(*this);
|
||||
sendConfigureNotify();
|
||||
}
|
||||
}
|
||||
|
||||
void FluxboxWindow::themeReconfigured() {
|
||||
frame().applyDecorations();
|
||||
sendConfigureNotify();
|
||||
}
|
||||
|
||||
void FluxboxWindow::workspaceAreaChanged(BScreen &screen) {
|
||||
frame().applyState();
|
||||
}
|
||||
|
|
|
@ -492,6 +492,8 @@ private:
|
|||
void updateClientLeftWindow();
|
||||
void grabButtons();
|
||||
|
||||
void themeReconfigured();
|
||||
|
||||
/**
|
||||
* Calculates insertition position in the list by
|
||||
* using pixel position x and y.
|
||||
|
|
|
@ -49,8 +49,7 @@ public:
|
|||
return ToolTheme::fallback(item);
|
||||
}
|
||||
|
||||
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
||||
virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||
|
||||
virtual WorkspaceNameTheme &operator *() { return *this; }
|
||||
virtual const WorkspaceNameTheme &operator *() const { return *this; }
|
||||
|
|
|
@ -44,11 +44,11 @@ WorkspaceNameTool::WorkspaceNameTool(const FbTk::FbWindow &parent,
|
|||
|
||||
// setup signals
|
||||
join(screen.currentWorkspaceSig(),
|
||||
FbTk::MemFun(*this, &WorkspaceNameTool::updateForScreen));
|
||||
FbTk::MemFunIgnoreArgs(*this, &WorkspaceNameTool::update));
|
||||
join(screen.workspaceNamesSig(),
|
||||
FbTk::MemFun(*this, &WorkspaceNameTool::updateForScreen));
|
||||
FbTk::MemFunIgnoreArgs(*this, &WorkspaceNameTool::update));
|
||||
|
||||
theme.reconfigSig().attach(this);
|
||||
join(theme.reconfigSig(), FbTk::MemFun(*this, &WorkspaceNameTool::update));
|
||||
}
|
||||
|
||||
WorkspaceNameTool::~WorkspaceNameTool() {
|
||||
|
@ -70,12 +70,8 @@ void WorkspaceNameTool::moveResize(int x, int y,
|
|||
m_button.moveResize(x, y, width, height);
|
||||
}
|
||||
|
||||
void WorkspaceNameTool::update(FbTk::Subject *subj) {
|
||||
updateForScreen(m_screen);
|
||||
}
|
||||
|
||||
void WorkspaceNameTool::updateForScreen(BScreen &screen) {
|
||||
m_button.setText(screen.currentWorkspace()->name());
|
||||
void WorkspaceNameTool::update() {
|
||||
m_button.setText(m_screen.currentWorkspace()->name());
|
||||
if (m_button.width() != width()) {
|
||||
resize(width(), height());
|
||||
resizeSig().notify();
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "ToolbarItem.hh"
|
||||
|
||||
#include "FbTk/TextButton.hh"
|
||||
#include "FbTk/Observer.hh"
|
||||
#include "FbTk/Signal.hh"
|
||||
|
||||
class BScreen;
|
||||
|
@ -36,8 +35,7 @@ namespace FbTk {
|
|||
template <class T> class ThemeProxy;
|
||||
}
|
||||
|
||||
class WorkspaceNameTool: public ToolbarItem, public FbTk::Observer,
|
||||
private FbTk::SignalTracker {
|
||||
class WorkspaceNameTool: public ToolbarItem, private FbTk::SignalTracker {
|
||||
public:
|
||||
WorkspaceNameTool(const FbTk::FbWindow &parent, FbTk::ThemeProxy<ToolTheme> &theme, BScreen &screen);
|
||||
virtual ~WorkspaceNameTool();
|
||||
|
@ -53,7 +51,6 @@ public:
|
|||
unsigned int height() const;
|
||||
unsigned int borderWidth() const;
|
||||
|
||||
void update(FbTk::Subject *subj);
|
||||
FbTk::Button &button() { return m_button; }
|
||||
const FbTk::Button &button() const { return m_button; }
|
||||
void setOrientation(FbTk::Orientation orient);
|
||||
|
@ -61,8 +58,7 @@ public:
|
|||
void parentMoved() { m_button.parentMoved(); }
|
||||
|
||||
private:
|
||||
/// Called when workspace changed on \c screen
|
||||
void updateForScreen(BScreen &screen);
|
||||
void update();
|
||||
|
||||
void renderTheme(int alpha);
|
||||
void reRender();
|
||||
|
|
Loading…
Reference in a new issue