src/WinButton.{cc,hh}: cosmetic

This commit is contained in:
Vladimir A. Pavlov 2012-12-07 23:41:34 +03:00 committed by Mathias Gumz
parent c8d0945a8f
commit edcb6d57ce
2 changed files with 17 additions and 44 deletions

View file

@ -114,60 +114,32 @@ void WinButton::setPressedColor(const FbTk::Color &color) {
}
}
Pixmap WinButton::getBackgroundPixmap() const {
Pixmap WinButton::getPixmap(const FbTk::ThemeProxy<WinButtonTheme> &theme) const {
switch(m_type) {
case MAXIMIZE:
return m_theme->maximizePixmap().pixmap().drawable();
break;
return theme->maximizePixmap().pixmap().drawable();
case MINIMIZE:
return m_theme->iconifyPixmap().pixmap().drawable();
break;
return theme->iconifyPixmap().pixmap().drawable();
case STICK:
if (m_listen_to.isStuck())
return m_theme->stuckPixmap().pixmap().drawable();
return m_theme->stickPixmap().pixmap().drawable();
break;
return theme->stuckPixmap().pixmap().drawable();
else
return theme->stickPixmap().pixmap().drawable();
case CLOSE:
return m_theme->closePixmap().pixmap().drawable();
break;
return theme->closePixmap().pixmap().drawable();
case SHADE:
if (m_listen_to.isShaded())
return m_theme->unshadePixmap().pixmap().drawable();
return m_theme->shadePixmap().pixmap().drawable();
break;
return theme->unshadePixmap().pixmap().drawable();
else
return theme->shadePixmap().pixmap().drawable();
case MENUICON:
if (m_icon_pixmap.drawable())
return m_theme->titlePixmap().pixmap().drawable();
return m_theme->menuiconPixmap().pixmap().drawable();
break;
}
return None;
}
Pixmap WinButton::getPressedPixmap() const {
switch(m_type) {
case MAXIMIZE:
return m_pressed_theme->maximizePixmap().pixmap().drawable();
case MINIMIZE:
return m_pressed_theme->iconifyPixmap().pixmap().drawable();
case STICK:
if (m_listen_to.isStuck())
return m_pressed_theme->stuckPixmap().pixmap().drawable();
return m_pressed_theme->stickPixmap().pixmap().drawable();
case CLOSE:
return m_pressed_theme->closePixmap().pixmap().drawable();
case SHADE:
if (m_listen_to.isShaded())
return m_pressed_theme->unshadePixmap().pixmap().drawable();
return theme->titlePixmap().pixmap().drawable();
else
return m_pressed_theme->shadePixmap().pixmap().drawable();
case MENUICON:
if (m_icon_pixmap.drawable())
return m_theme->titlePixmap().pixmap().drawable();
else
return m_pressed_theme->menuiconPixmap().pixmap().drawable();
}
return theme->menuiconPixmap().pixmap().drawable();
default:
return None;
}
}
// clear is used to force this to clear the window (e.g. called from clear())

View file

@ -52,13 +52,14 @@ public:
void setBackgroundColor(const FbTk::Color &color);
void setPressedColor(const FbTk::Color &color);
Pixmap getBackgroundPixmap() const;
Pixmap getPressedPixmap() const;
Pixmap getBackgroundPixmap() const { return getPixmap(m_theme); }
Pixmap getPressedPixmap() const { return getPixmap(m_pressed_theme); }
/// override for redrawing
void clear();
void updateAll();
private:
void drawType();
Pixmap getPixmap(const FbTk::ThemeProxy<WinButtonTheme> &) const;
Type m_type; ///< the button type
FluxboxWindow &m_listen_to;
FbTk::ThemeProxy<WinButtonTheme> &m_theme, &m_pressed_theme;