From edcb6d57ce4823616963071cfe4f151eb3880dc1 Mon Sep 17 00:00:00 2001 From: "Vladimir A. Pavlov" Date: Fri, 7 Dec 2012 23:41:34 +0300 Subject: src/WinButton.{cc,hh}: cosmetic --- src/WinButton.cc | 54 +++++++++++++----------------------------------------- src/WinButton.hh | 5 +++-- 2 files changed, 16 insertions(+), 43 deletions(-) diff --git a/src/WinButton.cc b/src/WinButton.cc index ff0ff76..e1b79a2 100644 --- a/src/WinButton.cc +++ b/src/WinButton.cc @@ -114,60 +114,32 @@ void WinButton::setPressedColor(const FbTk::Color &color) { } } -Pixmap WinButton::getBackgroundPixmap() const { +Pixmap WinButton::getPixmap(const FbTk::ThemeProxy &theme) 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 { - 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()) diff --git a/src/WinButton.hh b/src/WinButton.hh index 80fc4b1..3912a1a 100644 --- a/src/WinButton.hh +++ b/src/WinButton.hh @@ -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 &) const; Type m_type; ///< the button type FluxboxWindow &m_listen_to; FbTk::ThemeProxy &m_theme, &m_pressed_theme; -- cgit v0.11.2