aboutsummaryrefslogtreecommitdiff
path: root/src/IconbarTool.cc
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2008-01-07 10:26:32 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-01-07 10:26:32 (GMT)
commitdbfddf8e0bcf8e7abbba671eff64c9679332a774 (patch)
tree37cefce75eef2f7e0c749c3489008608e71dcd6c /src/IconbarTool.cc
parentac1bd7e0981222bf340ce7defb2bb8307d42a0a2 (diff)
downloadfluxbox-dbfddf8e0bcf8e7abbba671eff64c9679332a774.zip
fluxbox-dbfddf8e0bcf8e7abbba671eff64c9679332a774.tar.bz2
added new ThemeProxy for automatically handling focused vs. unfocused ThemeItems
Diffstat (limited to 'src/IconbarTool.cc')
-rw-r--r--src/IconbarTool.cc23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/IconbarTool.cc b/src/IconbarTool.cc
index 3984b52..d8579f2 100644
--- a/src/IconbarTool.cc
+++ b/src/IconbarTool.cc
@@ -253,12 +253,14 @@ private:
253}; // end anonymous namespace 253}; // end anonymous namespace
254 254
255IconbarTool::IconbarTool(const FbTk::FbWindow &parent, 255IconbarTool::IconbarTool(const FbTk::FbWindow &parent,
256 FbTk::ThemeProxy<IconbarTheme> &theme, 256 FbTk::ThemeProxy<IconbarTheme> &focused_theme,
257 FbTk::ThemeProxy<IconbarTheme> &unfocused_theme,
257 BScreen &screen, FbTk::Menu &menu): 258 BScreen &screen, FbTk::Menu &menu):
258 ToolbarItem(ToolbarItem::RELATIVE), 259 ToolbarItem(ToolbarItem::RELATIVE),
259 m_screen(screen), 260 m_screen(screen),
260 m_icon_container(parent), 261 m_icon_container(parent),
261 m_theme(theme), 262 m_focused_theme(focused_theme),
263 m_unfocused_theme(unfocused_theme),
262 m_empty_pm( screen.imageControl() ), 264 m_empty_pm( screen.imageControl() ),
263 m_winlist(new FocusableList(screen)), 265 m_winlist(new FocusableList(screen)),
264 m_mode("none"), 266 m_mode("none"),
@@ -297,7 +299,8 @@ IconbarTool::IconbarTool(const FbTk::FbWindow &parent,
297 menu.insert(m_menu.label(), &m_menu); 299 menu.insert(m_menu.label(), &m_menu);
298 300
299 // setup signals 301 // setup signals
300 theme.reconfigSig().attach(this); 302 focused_theme.reconfigSig().attach(this);
303 unfocused_theme.reconfigSig().attach(this);
301 setMode(*m_rc_mode); 304 setMode(*m_rc_mode);
302} 305}
303 306
@@ -402,7 +405,8 @@ void IconbarTool::update(FbTk::Subject *subj) {
402 405
403 m_icon_container.setMaxSizePerClient(*m_rc_client_width); 406 m_icon_container.setMaxSizePerClient(*m_rc_client_width);
404 407
405 if (subj == &m_theme.reconfigSig()) { 408 if (subj == &m_focused_theme.reconfigSig() ||
409 subj == &m_unfocused_theme.reconfigSig()) {
406 setMode(*m_rc_mode); 410 setMode(*m_rc_mode);
407 return; 411 return;
408 } 412 }
@@ -468,7 +472,7 @@ void IconbarTool::reset() {
468} 472}
469 473
470void IconbarTool::updateSizing() { 474void IconbarTool::updateSizing() {
471 m_icon_container.setBorderWidth(m_theme->border().width()); 475 m_icon_container.setBorderWidth(m_focused_theme->border().width());
472 476
473 IconMap::iterator icon_it = m_icons.begin(); 477 IconMap::iterator icon_it = m_icons.begin();
474 const IconMap::iterator icon_it_end = m_icons.end(); 478 const IconMap::iterator icon_it_end = m_icons.end();
@@ -489,14 +493,14 @@ void IconbarTool::renderTheme() {
489 updateSizing(); 493 updateSizing();
490 494
491 // if we dont have any icons then we should render empty texture 495 // if we dont have any icons then we should render empty texture
492 if (!m_theme->emptyTexture().usePixmap()) { 496 if (!m_focused_theme->emptyTexture().usePixmap()) {
493 m_empty_pm.reset( 0 ); 497 m_empty_pm.reset( 0 );
494 m_icon_container.setBackgroundColor(m_theme->emptyTexture().color()); 498 m_icon_container.setBackgroundColor(m_focused_theme->emptyTexture().color());
495 } else { 499 } else {
496 m_empty_pm.reset(m_screen.imageControl(). 500 m_empty_pm.reset(m_screen.imageControl().
497 renderImage(m_icon_container.width(), 501 renderImage(m_icon_container.width(),
498 m_icon_container.height(), 502 m_icon_container.height(),
499 m_theme->emptyTexture(), orientation())); 503 m_focused_theme->emptyTexture(), orientation()));
500 m_icon_container.setBackgroundPixmap(m_empty_pm); 504 m_icon_container.setBackgroundPixmap(m_empty_pm);
501 } 505 }
502 506
@@ -548,7 +552,8 @@ IconButton *IconbarTool::makeButton(Focusable &win) {
548#ifdef DEBUG 552#ifdef DEBUG
549 cerr<<"IconbarTool::addWindow(0x"<<&win<<" title = "<<win.title()<<")"<<endl; 553 cerr<<"IconbarTool::addWindow(0x"<<&win<<" title = "<<win.title()<<")"<<endl;
550#endif // DEBUG 554#endif // DEBUG
551 IconButton *button = new IconButton(m_icon_container, m_theme, win); 555 IconButton *button = new IconButton(m_icon_container, m_focused_theme,
556 m_unfocused_theme, win);
552 557
553 RefCmd focus_cmd(new ::FocusCommand(win)); 558 RefCmd focus_cmd(new ::FocusCommand(win));
554 RefCmd menu_cmd(new ::ShowMenu(*fbwin)); 559 RefCmd menu_cmd(new ::ShowMenu(*fbwin));