src/WinButton.{cc,hh}: cosmetic
Vladimir A. Pavlov pv4@bk.ru
2 files changed,
16 insertions(+),
43 deletions(-)
M
src/WinButton.cc
→
src/WinButton.cc
@@ -114,60 +114,32 @@ FbTk::Button::setPressedColor(color);
} } -Pixmap WinButton::getBackgroundPixmap() const { - switch(m_type) { - case MAXIMIZE: - return m_theme->maximizePixmap().pixmap().drawable(); - break; - case MINIMIZE: - return m_theme->iconifyPixmap().pixmap().drawable(); - break; - case STICK: - if (m_listen_to.isStuck()) - return m_theme->stuckPixmap().pixmap().drawable(); - return m_theme->stickPixmap().pixmap().drawable(); - break; - case CLOSE: - return m_theme->closePixmap().pixmap().drawable(); - break; - case SHADE: - if (m_listen_to.isShaded()) - return m_theme->unshadePixmap().pixmap().drawable(); - return m_theme->shadePixmap().pixmap().drawable(); - break; - 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 { +Pixmap WinButton::getPixmap(const FbTk::ThemeProxy<WinButtonTheme> &theme) const { switch(m_type) { case MAXIMIZE: - return m_pressed_theme->maximizePixmap().pixmap().drawable(); + return theme->maximizePixmap().pixmap().drawable(); case MINIMIZE: - return m_pressed_theme->iconifyPixmap().pixmap().drawable(); + return 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(); + return theme->stuckPixmap().pixmap().drawable(); + else + return theme->stickPixmap().pixmap().drawable(); case CLOSE: - return m_pressed_theme->closePixmap().pixmap().drawable(); + return theme->closePixmap().pixmap().drawable(); case SHADE: if (m_listen_to.isShaded()) - return m_pressed_theme->unshadePixmap().pixmap().drawable(); + return theme->unshadePixmap().pixmap().drawable(); else - return m_pressed_theme->shadePixmap().pixmap().drawable(); + return theme->shadePixmap().pixmap().drawable(); case MENUICON: if (m_icon_pixmap.drawable()) - return m_theme->titlePixmap().pixmap().drawable(); + return theme->titlePixmap().pixmap().drawable(); else - return m_pressed_theme->menuiconPixmap().pixmap().drawable(); + return theme->menuiconPixmap().pixmap().drawable(); + default: + return None; } - return None; } // clear is used to force this to clear the window (e.g. called from clear())
M
src/WinButton.hh
→
src/WinButton.hh
@@ -52,13 +52,14 @@ void setPressedPixmap(Pixmap pm);
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;