added stuck pixmap, and unfocus pixmaps

This commit is contained in:
fluxgen 2003-05-06 23:58:08 +00:00
parent 1cbf54adeb
commit 7298f23b0d
3 changed files with 123 additions and 39 deletions

View file

@ -19,16 +19,13 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
/// $Id: WinButton.cc,v 1.4 2003/04/28 22:41:28 fluxgen Exp $ /// $Id: WinButton.cc,v 1.5 2003/05/06 23:58:08 fluxgen Exp $
#include "WinButton.hh" #include "WinButton.hh"
#include "App.hh" #include "App.hh"
#include "Window.hh" #include "Window.hh"
#include "WinButtonTheme.hh" #include "WinButtonTheme.hh"
#include <iostream>
using namespace std;
namespace { namespace {
inline void scale(const FbTk::Button &btn, WinButtonTheme::PixmapWithMask &pm) { inline void scale(const FbTk::Button &btn, WinButtonTheme::PixmapWithMask &pm) {
@ -46,15 +43,27 @@ void updateScale(const FbTk::Button &btn, WinButtonTheme &theme) {
// we need to scale our pixmaps to right size // we need to scale our pixmaps to right size
scale(btn, theme.closePixmap()); scale(btn, theme.closePixmap());
scale(btn, theme.closeUnfocusPixmap());
scale(btn, theme.closePressedPixmap()); scale(btn, theme.closePressedPixmap());
scale(btn, theme.maximizePixmap()); scale(btn, theme.maximizePixmap());
scale(btn, theme.maximizeUnfocusPixmap());
scale(btn, theme.maximizePressedPixmap()); scale(btn, theme.maximizePressedPixmap());
scale(btn, theme.iconifyPixmap()); scale(btn, theme.iconifyPixmap());
scale(btn, theme.iconifyUnfocusPixmap());
scale(btn, theme.iconifyPressedPixmap()); scale(btn, theme.iconifyPressedPixmap());
scale(btn, theme.shadePixmap()); scale(btn, theme.shadePixmap());
scale(btn, theme.shadeUnfocusPixmap());
scale(btn, theme.shadePressedPixmap()); scale(btn, theme.shadePressedPixmap());
scale(btn, theme.stickPixmap()); scale(btn, theme.stickPixmap());
scale(btn, theme.stickUnfocusPixmap());
scale(btn, theme.stickPressedPixmap()); scale(btn, theme.stickPressedPixmap());
scale(btn, theme.stuckPixmap());
scale(btn, theme.stuckUnfocusPixmap());
} }
}; };
@ -91,9 +100,18 @@ void WinButton::drawType() {
maximizePressedPixmap(). maximizePressedPixmap().
pixmap_scaled.drawable()); pixmap_scaled.drawable());
} else if (m_theme.maximizePixmap().pixmap_scaled.drawable()) { } else if (m_theme.maximizePixmap().pixmap_scaled.drawable()) {
window().setBackgroundPixmap(m_theme. // check focus
maximizePixmap(). if (!m_listen_to.isFocused() &&
pixmap_scaled.drawable()); m_theme.maximizeUnfocusPixmap().pixmap_scaled.drawable() != 0) {
// not focused
window().setBackgroundPixmap(m_theme.
maximizeUnfocusPixmap().
pixmap_scaled.drawable());
} else { // focused
window().setBackgroundPixmap(m_theme.
maximizePixmap().
pixmap_scaled.drawable());
}
} }
window().clear(); window().clear();
@ -114,9 +132,18 @@ void WinButton::drawType() {
iconifyPressedPixmap(). iconifyPressedPixmap().
pixmap_scaled.drawable()); pixmap_scaled.drawable());
} else if (m_theme.iconifyPixmap().pixmap_scaled.drawable()){ } else if (m_theme.iconifyPixmap().pixmap_scaled.drawable()){
window().setBackgroundPixmap(m_theme. // check focus
iconifyPixmap(). if (!m_listen_to.isFocused() &&
pixmap_scaled.drawable()); m_theme.iconifyUnfocusPixmap().pixmap_scaled.drawable() != 0) {
// not focused
window().setBackgroundPixmap(m_theme.
iconifyUnfocusPixmap().
pixmap_scaled.drawable());
} else { // focused
window().setBackgroundPixmap(m_theme.
iconifyPixmap().
pixmap_scaled.drawable());
}
} }
window().clear(); window().clear();
@ -130,17 +157,45 @@ void WinButton::drawType() {
break; break;
case STICK: case STICK:
if (m_theme.stickPixmap().pixmap_scaled.drawable() != 0) { if (m_theme.stickPixmap().pixmap_scaled.drawable() != 0) {
if (pressed()) { if (m_listen_to.isStuck() &&
window().setBackgroundPixmap(m_theme. m_theme.stuckPixmap().pixmap_scaled.drawable() &&
stickPressedPixmap(). ! pressed()) { // we're using the same pixmap for pressed as in not stuck
pixmap_scaled.drawable()); // check focus
if (!m_listen_to.isFocused() &&
m_theme.stuckUnfocusPixmap().pixmap_scaled.drawable() != 0) {
// not focused
window().setBackgroundPixmap(m_theme.
stuckUnfocusPixmap().
pixmap_scaled.drawable());
} else { // focused
window().setBackgroundPixmap(m_theme.
stuckPixmap().
pixmap_scaled.drawable());
}
} else { // not stuck
if (pressed()) {
window().setBackgroundPixmap(m_theme.
stickPressedPixmap().
pixmap_scaled.drawable());
} else if (m_theme.stickPixmap().pixmap_scaled.drawable()) {
// check focus
if (!m_listen_to.isFocused() &&
m_theme.stickUnfocusPixmap().pixmap_scaled.drawable() != 0) {
// not focused
window().setBackgroundPixmap(m_theme.
stickUnfocusPixmap().
pixmap_scaled.drawable());
} else { // focused
window().setBackgroundPixmap(m_theme.
stickPixmap().
pixmap_scaled.drawable());
}
}
} // end if stuck
} else if (m_theme.closePixmap().pixmap_scaled.drawable()) {
window().setBackgroundPixmap(m_theme.
stickPixmap().
pixmap_scaled.drawable());
}
window().clear(); window().clear();
} else { } else {
@ -166,9 +221,18 @@ void WinButton::drawType() {
pixmap_scaled.drawable()); pixmap_scaled.drawable());
} else if (m_theme.closePixmap().pixmap_scaled.drawable()) { } else if (m_theme.closePixmap().pixmap_scaled.drawable()) {
window().setBackgroundPixmap(m_theme. // check focus
closePixmap(). if (!m_listen_to.isFocused() &&
pixmap_scaled.drawable()); m_theme.closeUnfocusPixmap().pixmap_scaled.drawable() != 0) {
// not focused
window().setBackgroundPixmap(m_theme.
closeUnfocusPixmap().
pixmap_scaled.drawable());
} else { // focused
window().setBackgroundPixmap(m_theme.
closePixmap().
pixmap_scaled.drawable());
}
} }
window().clear(); window().clear();
@ -191,9 +255,18 @@ void WinButton::drawType() {
shadePressedPixmap(). shadePressedPixmap().
pixmap_scaled.drawable()); pixmap_scaled.drawable());
} else if (m_theme.shadePixmap().pixmap_scaled.drawable()) { } else if (m_theme.shadePixmap().pixmap_scaled.drawable()) {
window().setBackgroundPixmap(m_theme. // check focus
shadePixmap(). if (!m_listen_to.isFocused() &&
pixmap_scaled.drawable()); m_theme.shadeUnfocusPixmap().pixmap_scaled.drawable() != 0) {
// not focused
window().setBackgroundPixmap(m_theme.
shadeUnfocusPixmap().
pixmap_scaled.drawable());
} else { // focused
window().setBackgroundPixmap(m_theme.
shadePixmap().
pixmap_scaled.drawable());
}
} }
window().clear(); window().clear();

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: WinButtonTheme.cc,v 1.2 2003/04/28 22:33:19 fluxgen Exp $ // $Id: WinButtonTheme.cc,v 1.3 2003/05/06 23:56:46 fluxgen Exp $
#include "WinButtonTheme.hh" #include "WinButtonTheme.hh"
@ -80,15 +80,22 @@ setFromString(const char *str) {
WinButtonTheme::WinButtonTheme(int screen_num): WinButtonTheme::WinButtonTheme(int screen_num):
FbTk::Theme(screen_num), FbTk::Theme(screen_num),
m_close_pm(*this, "window.close.pixmap", "Window.Close.Pixmap"), m_close_pm(*this, "window.close.pixmap", "Window.Close.Pixmap"),
m_close_unfocus_pm(*this, "window.close.unfocus.pixmap", "Window.Close.Unfocus.Pixmap"),
m_close_pressed_pm(*this, "window.close.pressed.pixmap", "Window.Close.Pressed.Pixmap"), m_close_pressed_pm(*this, "window.close.pressed.pixmap", "Window.Close.Pressed.Pixmap"),
m_maximize_pm(*this, "window.maximize.pixmap", "Window.Maximize.Pixmap"), m_maximize_pm(*this, "window.maximize.pixmap", "Window.Maximize.Pixmap"),
m_maximize_unfocus_pm(*this, "window.maximize.unfocus.pixmap", "Window.Maximize.Unfocus.pixmap"),
m_maximize_pressed_pm(*this, "window.maximize.pressed.pixmap", "Window.Maximize.Pressed.Pixmap"), m_maximize_pressed_pm(*this, "window.maximize.pressed.pixmap", "Window.Maximize.Pressed.Pixmap"),
m_iconify_pm(*this, "window.iconify.pixmap", "Window.Iconify.Pixmap"), m_iconify_pm(*this, "window.iconify.pixmap", "Window.Iconify.Pixmap"),
m_iconify_unfocus_pm(*this, "window.iconify.unfocus.pixmap", "Window.Iconify.Unfocus.Pixmap"),
m_iconify_pressed_pm(*this, "window.iconify.pressed.pixmap", "Window.Iconify.Pressed.Pixmap"), m_iconify_pressed_pm(*this, "window.iconify.pressed.pixmap", "Window.Iconify.Pressed.Pixmap"),
m_shade_pm(*this, "window.shade.pixmap", "Window.Shade.Pixmap"), m_shade_pm(*this, "window.shade.pixmap", "Window.Shade.Pixmap"),
m_shade_unfocus_pm(*this, "window.shade.unfocus.pixmap", "Window.Shade.Unfocus.Pixmap"),
m_shade_pressed_pm(*this, "window.shade.pressed.pixmap", "Window.Shade.Pressed.Pixmap"), m_shade_pressed_pm(*this, "window.shade.pressed.pixmap", "Window.Shade.Pressed.Pixmap"),
m_stick_pm(*this, "window.stick.pixmap", "Window.Stick.Pixmap"), m_stick_pm(*this, "window.stick.pixmap", "Window.Stick.Pixmap"),
m_stick_pressed_pm(*this, "window.stick.pressed.pixmap", "Window.Stick.Pressed.Pixmap") { m_stick_unfocus_pm(*this, "window.stick.unfocus.pixmap", "Window.Stick.Unfocus.Pixmap"),
m_stick_pressed_pm(*this, "window.stick.pressed.pixmap", "Window.Stick.Pressed.Pixmap"),
m_stuck_pm(*this, "window.stuck.pixmap", "Window.Stuck.Pixmap"),
m_stuck_unfocus_pm(*this, "window.stuck.unfocus.pixmap", "Window.Stuck.Unfocus.Pixmap") {
} }

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: WinButtonTheme.hh,v 1.1 2003/04/28 22:30:34 fluxgen Exp $ // $Id: WinButtonTheme.hh,v 1.2 2003/05/06 23:52:55 fluxgen Exp $
#ifndef WINBUTTONTHEME_HH #ifndef WINBUTTONTHEME_HH
#define WINBUTTONTHEME_HH #define WINBUTTONTHEME_HH
@ -44,42 +44,46 @@ public:
inline const PixmapWithMask &closePixmap() const { return *m_close_pm; } inline const PixmapWithMask &closePixmap() const { return *m_close_pm; }
inline PixmapWithMask &closePixmap() { return *m_close_pm; } inline PixmapWithMask &closePixmap() { return *m_close_pm; }
inline PixmapWithMask &closeUnfocusPixmap() { return *m_close_unfocus_pm; }
inline const PixmapWithMask &closePressedPixmap() const { return *m_close_pressed_pm; } inline const PixmapWithMask &closePressedPixmap() const { return *m_close_pressed_pm; }
inline PixmapWithMask &closePressedPixmap() { return *m_close_pressed_pm; } inline PixmapWithMask &closePressedPixmap() { return *m_close_pressed_pm; }
inline const PixmapWithMask &maximizePixmap() const { return *m_maximize_pm; } inline const PixmapWithMask &maximizePixmap() const { return *m_maximize_pm; }
inline PixmapWithMask &maximizePixmap() { return *m_maximize_pm; } inline PixmapWithMask &maximizePixmap() { return *m_maximize_pm; }
inline PixmapWithMask &maximizeUnfocusPixmap() { return *m_maximize_unfocus_pm; }
inline const PixmapWithMask &maximizePressedPixmap() const { return *m_maximize_pressed_pm; } inline const PixmapWithMask &maximizePressedPixmap() const { return *m_maximize_pressed_pm; }
inline PixmapWithMask &maximizePressedPixmap() { return *m_maximize_pressed_pm; } inline PixmapWithMask &maximizePressedPixmap() { return *m_maximize_pressed_pm; }
inline const PixmapWithMask &iconifyPixmap() const { return *m_iconify_pm; } inline const PixmapWithMask &iconifyPixmap() const { return *m_iconify_pm; }
inline PixmapWithMask &iconifyPixmap() { return *m_iconify_pm; } inline PixmapWithMask &iconifyPixmap() { return *m_iconify_pm; }
inline PixmapWithMask &iconifyUnfocusPixmap() { return *m_iconify_unfocus_pm; }
inline const PixmapWithMask &iconifyPressedPixmap() const { return *m_iconify_pressed_pm; } inline const PixmapWithMask &iconifyPressedPixmap() const { return *m_iconify_pressed_pm; }
inline PixmapWithMask &iconifyPressedPixmap() { return *m_iconify_pressed_pm; } inline PixmapWithMask &iconifyPressedPixmap() { return *m_iconify_pressed_pm; }
inline const PixmapWithMask &stickPixmap() const { return *m_stick_pm; } inline const PixmapWithMask &stickPixmap() const { return *m_stick_pm; }
inline PixmapWithMask &stickPixmap() { return *m_stick_pm; } inline PixmapWithMask &stickPixmap() { return *m_stick_pm; }
inline PixmapWithMask &stickUnfocusPixmap() { return *m_stick_unfocus_pm; }
inline const PixmapWithMask &stickPressedPixmap() const { return *m_stick_pressed_pm; } inline const PixmapWithMask &stickPressedPixmap() const { return *m_stick_pressed_pm; }
inline PixmapWithMask &stickPressedPixmap() { return *m_stick_pressed_pm; } inline PixmapWithMask &stickPressedPixmap() { return *m_stick_pressed_pm; }
inline PixmapWithMask &stuckPixmap() { return *m_stuck_pm; }
inline PixmapWithMask &stuckUnfocusPixmap() { return *m_stuck_unfocus_pm; }
inline const PixmapWithMask &shadePixmap() const { return *m_shade_pm; } inline const PixmapWithMask &shadePixmap() const { return *m_shade_pm; }
inline PixmapWithMask &shadePixmap() { return *m_shade_pm; } inline PixmapWithMask &shadePixmap() { return *m_shade_pm; }
inline PixmapWithMask &shadeUnfocusPixmap() { return *m_shade_unfocus_pm; }
inline const PixmapWithMask &shadePressedPixmap() const { return *m_shade_pressed_pm; } inline const PixmapWithMask &shadePressedPixmap() const { return *m_shade_pressed_pm; }
inline PixmapWithMask &shadePressedPixmap() { return *m_shade_pressed_pm; } inline PixmapWithMask &shadePressedPixmap() { return *m_shade_pressed_pm; }
FbTk::Subject &reconfigSig() { return m_reconf_sig; } FbTk::Subject &reconfigSig() { return m_reconf_sig; }
private: private:
FbTk::Subject m_reconf_sig; FbTk::Subject m_reconf_sig;
FbTk::ThemeItem<PixmapWithMask> m_close_pm, m_close_pressed_pm; FbTk::ThemeItem<PixmapWithMask> m_close_pm, m_close_unfocus_pm, m_close_pressed_pm;
FbTk::ThemeItem<PixmapWithMask> m_maximize_pm, m_maximize_pressed_pm; FbTk::ThemeItem<PixmapWithMask> m_maximize_pm, m_maximize_unfocus_pm, m_maximize_pressed_pm;
FbTk::ThemeItem<PixmapWithMask> m_iconify_pm, m_iconify_pressed_pm; FbTk::ThemeItem<PixmapWithMask> m_iconify_pm, m_iconify_unfocus_pm, m_iconify_pressed_pm;
FbTk::ThemeItem<PixmapWithMask> m_shade_pm, m_shade_pressed_pm; FbTk::ThemeItem<PixmapWithMask> m_shade_pm, m_shade_unfocus_pm, m_shade_pressed_pm;
FbTk::ThemeItem<PixmapWithMask> m_stick_pm, m_stick_pressed_pm; FbTk::ThemeItem<PixmapWithMask> m_stick_pm, m_stick_unfocus_pm, m_stick_pressed_pm;
FbTk::ThemeItem<PixmapWithMask> m_stuck_pm, m_stuck_unfocus_pm;
}; };
#endif // WINBUTTONTHEME_HH #endif // WINBUTTONTHEME_HH