fixed indentation and added theme listener object

This commit is contained in:
fluxgen 2003-02-15 02:00:29 +00:00
parent f25cf733d6
commit 0a01f73b51
2 changed files with 90 additions and 70 deletions

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Toolbar.cc,v 1.55 2003/01/12 18:53:16 fluxgen Exp $
// $Id: Toolbar.cc,v 1.56 2003/02/15 02:00:29 fluxgen Exp $
#include "Toolbar.hh"
@ -181,7 +181,11 @@ Toolbar::Toolbar(BScreen *scrn, size_t width):
hide_timer(&hide_handler),
m_toolbarmenu(*scrn->menuTheme(), scrn->getScreenNumber(), *scrn->getImageControl()),
m_theme(scrn->getScreenNumber()),
m_place(BOTTOMCENTER) {
m_place(BOTTOMCENTER),
m_themelistener(*this) {
// we need to get notified when the theme is reloaded
m_theme.addListener(m_themelistener);
setupMenus(*this);
@ -412,7 +416,8 @@ void Toolbar::reconfigure() {
frame.base = None;
frame.window.setBackgroundColor(texture->color());
} else {
frame.base = image_ctrl.renderImage(frame.window.width(), frame.window.height(), *texture);
frame.base = image_ctrl.renderImage(frame.window.width(),
frame.window.height(), *texture);
frame.window.setBackgroundPixmap(frame.base);
}
if (tmp) image_ctrl.removeImage(tmp);
@ -424,7 +429,8 @@ void Toolbar::reconfigure() {
frame.window_label.setBackgroundColor(texture->color());
} else {
frame.label =
image_ctrl.renderImage(frame.window_label.width(), frame.window_label.height(), *texture);
image_ctrl.renderImage(frame.window_label.width(),
frame.window_label.height(), *texture);
frame.window_label.setBackgroundPixmap(frame.label);
}
if (tmp) image_ctrl.removeImage(tmp);
@ -562,7 +568,9 @@ void Toolbar::checkClock(bool redraw, bool date) {
cerr<<__FILE__<<"("<<__LINE__<<"): time(null)<0"<<endl;
if (redraw) {
if (!redraw)
return;
frame.clock.clear();
#ifdef HAVE_STRFTIME
char t[1024];
@ -630,7 +638,7 @@ void Toolbar::checkClock(bool redraw, bool date) {
m_theme.clockTextGC(),
t, newlen,
dx, dy);
}
}

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Toolbar.hh,v 1.21 2003/01/12 18:52:35 fluxgen Exp $
// $Id: Toolbar.hh,v 1.22 2003/02/15 02:00:29 fluxgen Exp $
#ifndef TOOLBAR_HH
#define TOOLBAR_HH
@ -33,6 +33,7 @@
#include "EventHandler.hh"
#include "FbWindow.hh"
#include "ArrowButton.hh"
#include "Observer.hh"
#include <memory>
@ -144,6 +145,7 @@ private:
virtual void timeout();
} hide_handler;
friend class HideHandler;
BScreen *m_screen;
FbTk::ImageControl &image_ctrl;
@ -156,8 +158,18 @@ private:
ToolbarTheme m_theme;
Placement m_place;
//!! TODO this is just temporary
class ThemeListener: public FbTk::Observer {
public:
ThemeListener(Toolbar &tb):m_tb(tb) { }
void update(FbTk::Subject *subj) {
m_tb.reconfigure();
}
private:
Toolbar &m_tb;
};
friend class HideHandler;
ThemeListener m_themelistener;
};