fixed new image loading
fluxgen fluxgen
3 files changed,
74 insertions(+),
132 deletions(-)
M
src/WinButton.cc
→
src/WinButton.cc
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -/// $Id: WinButton.cc,v 1.9 2003/08/22 15:04:18 fluxgen Exp $ +/// $Id: WinButton.cc,v 1.10 2003/08/22 21:33:13 fluxgen Exp $ #include "WinButton.hh" #include "App.hh"@@ -52,23 +52,23 @@ void WinButton::drawType() {
switch (m_type) { case MAXIMIZE: - if (m_theme.maximizePixmap().pixmap.drawable() != 0) { + if (m_theme.maximizePixmap().pixmap().drawable() != 0) { if (pressed()) { FbTk::FbWindow::setBackgroundPixmap(m_theme. maximizePressedPixmap(). - pixmap.drawable()); - } else if (m_theme.maximizePixmap().pixmap.drawable()) { + pixmap().drawable()); + } else if (m_theme.maximizePixmap().pixmap().drawable()) { // check focus if (!m_listen_to.isFocused() && - m_theme.maximizeUnfocusPixmap().pixmap.drawable() != 0) { + m_theme.maximizeUnfocusPixmap().pixmap().drawable() != 0) { // not focused FbTk::FbWindow::setBackgroundPixmap(m_theme. maximizeUnfocusPixmap(). - pixmap.drawable()); + pixmap().drawable()); } else { // focused FbTk::FbWindow::setBackgroundPixmap(m_theme. maximizePixmap(). - pixmap.drawable()); + pixmap().drawable()); } }@@ -84,23 +84,23 @@ 2, 3, width() - 3, 3);
} break; case MINIMIZE: - if (m_theme.iconifyPixmap().pixmap.drawable() != 0) { + if (m_theme.iconifyPixmap().pixmap().drawable() != 0) { if (pressed()) { FbTk::FbWindow::setBackgroundPixmap(m_theme. iconifyPressedPixmap(). - pixmap.drawable()); - } else if (m_theme.iconifyPixmap().pixmap.drawable()){ + pixmap().drawable()); + } else if (m_theme.iconifyPixmap().pixmap().drawable()){ // check focus if (!m_listen_to.isFocused() && - m_theme.iconifyUnfocusPixmap().pixmap.drawable() != 0) { + m_theme.iconifyUnfocusPixmap().pixmap().drawable() != 0) { // not focused FbTk::FbWindow::setBackgroundPixmap(m_theme. iconifyUnfocusPixmap(). - pixmap.drawable()); + pixmap().drawable()); } else { // focused FbTk::FbWindow::setBackgroundPixmap(m_theme. iconifyPixmap(). - pixmap.drawable()); + pixmap().drawable()); } }@@ -114,41 +114,41 @@ 2, height() - 5, width() - 5, 2);
} break; case STICK: - if (m_theme.stickPixmap().pixmap.drawable() != 0) { + if (m_theme.stickPixmap().pixmap().drawable() != 0) { if (m_listen_to.isStuck() && - m_theme.stuckPixmap().pixmap.drawable() && + m_theme.stuckPixmap().pixmap().drawable() && ! pressed()) { // we're using the same pixmap for pressed as in not stuck // check focus if (!m_listen_to.isFocused() && - m_theme.stuckUnfocusPixmap().pixmap.drawable() != 0) { + m_theme.stuckUnfocusPixmap().pixmap().drawable() != 0) { // not focused FbTk::FbWindow::setBackgroundPixmap(m_theme. stuckUnfocusPixmap(). - pixmap.drawable()); + pixmap().drawable()); } else { // focused FbTk::FbWindow::setBackgroundPixmap(m_theme. stuckPixmap(). - pixmap.drawable()); + pixmap().drawable()); } } else { // not stuck if (pressed()) { FbTk::FbWindow::setBackgroundPixmap(m_theme. stickPressedPixmap(). - pixmap.drawable()); + pixmap().drawable()); - } else if (m_theme.stickPixmap().pixmap.drawable()) { + } else if (m_theme.stickPixmap().pixmap().drawable()) { // check focus if (!m_listen_to.isFocused() && - m_theme.stickUnfocusPixmap().pixmap.drawable() != 0) { + m_theme.stickUnfocusPixmap().pixmap().drawable() != 0) { // not focused FbTk::FbWindow::setBackgroundPixmap(m_theme. stickUnfocusPixmap(). - pixmap.drawable()); + pixmap().drawable()); } else { // focused FbTk::FbWindow::setBackgroundPixmap(m_theme. stickPixmap(). - pixmap.drawable()); + pixmap().drawable()); } }@@ -172,24 +172,24 @@ }
break; case CLOSE: - if (m_theme.closePixmap().pixmap.drawable() != 0) { + if (m_theme.closePixmap().pixmap().drawable() != 0) { if (pressed()) { FbTk::FbWindow::setBackgroundPixmap(m_theme. closePressedPixmap(). - pixmap.drawable()); + pixmap().drawable()); - } else if (m_theme.closePixmap().pixmap.drawable()) { + } else if (m_theme.closePixmap().pixmap().drawable()) { // check focus if (!m_listen_to.isFocused() && - m_theme.closeUnfocusPixmap().pixmap.drawable() != 0) { + m_theme.closeUnfocusPixmap().pixmap().drawable() != 0) { // not focused FbTk::FbWindow::setBackgroundPixmap(m_theme. closeUnfocusPixmap(). - pixmap.drawable()); + pixmap().drawable()); } else { // focused FbTk::FbWindow::setBackgroundPixmap(m_theme. closePixmap(). - pixmap.drawable()); + pixmap().drawable()); } }@@ -207,23 +207,23 @@ height() - 3, 2);
} break; case SHADE: - if (m_theme.shadePixmap().pixmap.drawable() != 0) { + if (m_theme.shadePixmap().pixmap().drawable() != 0) { if (pressed()) { FbTk::FbWindow::setBackgroundPixmap(m_theme. shadePressedPixmap(). - pixmap.drawable()); - } else if (m_theme.shadePixmap().pixmap.drawable()) { + pixmap().drawable()); + } else if (m_theme.shadePixmap().pixmap().drawable()) { // check focus if (!m_listen_to.isFocused() && - m_theme.shadeUnfocusPixmap().pixmap.drawable() != 0) { + m_theme.shadeUnfocusPixmap().pixmap().drawable() != 0) { // not focused FbTk::FbWindow::setBackgroundPixmap(m_theme. shadeUnfocusPixmap(). - pixmap.drawable()); + pixmap().drawable()); } else { // focused FbTk::FbWindow::setBackgroundPixmap(m_theme. shadePixmap(). - pixmap.drawable()); + pixmap().drawable()); } }
M
src/WinButtonTheme.cc
→
src/WinButtonTheme.cc
@@ -19,62 +19,15 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: WinButtonTheme.cc,v 1.5 2003/08/22 15:19:39 fluxgen Exp $ +// $Id: WinButtonTheme.cc,v 1.6 2003/08/22 21:35:40 fluxgen Exp $ #include "WinButtonTheme.hh" #include "FbTk/App.hh" -#include "FbWinFrameTheme.hh" - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif // HAVE_CONFIG_H - -#ifdef HAVE_XPM -#include <X11/xpm.h> -#endif // HAVE_XPM - -// not used -template <> -void FbTk::ThemeItem<WinButtonTheme::PixmapWithMask>:: -load() { } - -template <> -void FbTk::ThemeItem<WinButtonTheme::PixmapWithMask>:: -setDefaultValue() { - // create empty pixmap - (*this)->pixmap = FbTk::FbPixmap(); // pixmap - (*this)->mask = FbTk::FbPixmap(); // mask -} +#include "FbTk/Image.hh" +#include "FbTk/PixmapWithMask.hh" -template <> -void FbTk::ThemeItem<WinButtonTheme::PixmapWithMask>:: -setFromString(const char *str) { - if (str == 0) - setDefaultValue(); - else { -#ifdef HAVE_XPM - XpmAttributes xpm_attr; - xpm_attr.valuemask = 0; - Display *dpy = FbTk::App::instance()->display(); - Pixmap pm = 0, mask = 0; - int retvalue = XpmReadFileToPixmap(dpy, - RootWindow(dpy, m_tm.screenNum()), - const_cast<char *>(str), - &pm, - &mask, &xpm_attr); - if (retvalue == 0) { // success - (*this)->pixmap = pm; - (*this)->mask = mask; - } else { // failure - setDefaultValue(); - } -#else - setDefaultValue(); -#endif // HAVE_XPM - - } -} +#include "FbWinFrameTheme.hh" WinButtonTheme::WinButtonTheme(int screen_num, const FbWinFrameTheme &frame_theme): FbTk::Theme(screen_num),
M
src/WinButtonTheme.hh
→
src/WinButtonTheme.hh
@@ -19,75 +19,64 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: WinButtonTheme.hh,v 1.3 2003/08/22 14:48:10 fluxgen Exp $ +// $Id: WinButtonTheme.hh,v 1.4 2003/08/22 21:35:40 fluxgen Exp $ #ifndef WINBUTTONTHEME_HH #define WINBUTTONTHEME_HH #include "Theme.hh" -#include "FbPixmap.hh" +#include "FbTk/PixmapWithMask.hh" class FbWinFrameTheme; class WinButtonTheme: public FbTk::Theme { public: - /// holds pixmap and a mask - struct PixmapWithMask { - /// scale both pixmap and mask to specified size - void scale(unsigned int width, unsigned int height) { - pixmap.scale(width, height); - mask.scale(width, height); - } - FbTk::FbPixmap pixmap; - FbTk::FbPixmap mask; - }; - WinButtonTheme(int screen_num, const FbWinFrameTheme &frame_theme); ~WinButtonTheme(); void reconfigTheme(); - inline const PixmapWithMask &closePixmap() const { 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 PixmapWithMask &closePressedPixmap() { return *m_close_pressed_pm; } + inline const FbTk::PixmapWithMask &closePixmap() const { return *m_close_pm; } + inline FbTk::PixmapWithMask &closePixmap() { return *m_close_pm; } + inline FbTk::PixmapWithMask &closeUnfocusPixmap() { return *m_close_unfocus_pm; } + inline const FbTk::PixmapWithMask &closePressedPixmap() const { return *m_close_pressed_pm; } + inline FbTk::PixmapWithMask &closePressedPixmap() { return *m_close_pressed_pm; } - inline const PixmapWithMask &maximizePixmap() const { 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 PixmapWithMask &maximizePressedPixmap() { return *m_maximize_pressed_pm; } + inline const FbTk::PixmapWithMask &maximizePixmap() const { return *m_maximize_pm; } + inline FbTk::PixmapWithMask &maximizePixmap() { return *m_maximize_pm; } + inline FbTk::PixmapWithMask &maximizeUnfocusPixmap() { return *m_maximize_unfocus_pm; } + inline const FbTk::PixmapWithMask &maximizePressedPixmap() const { return *m_maximize_pressed_pm; } + inline FbTk::PixmapWithMask &maximizePressedPixmap() { return *m_maximize_pressed_pm; } - inline const PixmapWithMask &iconifyPixmap() const { 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 PixmapWithMask &iconifyPressedPixmap() { return *m_iconify_pressed_pm; } + inline const FbTk::PixmapWithMask &iconifyPixmap() const { return *m_iconify_pm; } + inline FbTk::PixmapWithMask &iconifyPixmap() { return *m_iconify_pm; } + inline FbTk::PixmapWithMask &iconifyUnfocusPixmap() { return *m_iconify_unfocus_pm; } + inline const FbTk::PixmapWithMask &iconifyPressedPixmap() const { return *m_iconify_pressed_pm; } + inline FbTk::PixmapWithMask &iconifyPressedPixmap() { return *m_iconify_pressed_pm; } - inline const PixmapWithMask &stickPixmap() const { 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 PixmapWithMask &stickPressedPixmap() { return *m_stick_pressed_pm; } + inline const FbTk::PixmapWithMask &stickPixmap() const { return *m_stick_pm; } + inline FbTk::PixmapWithMask &stickPixmap() { return *m_stick_pm; } + inline FbTk::PixmapWithMask &stickUnfocusPixmap() { return *m_stick_unfocus_pm; } + inline const FbTk::PixmapWithMask &stickPressedPixmap() const { return *m_stick_pressed_pm; } + inline FbTk::PixmapWithMask &stickPressedPixmap() { return *m_stick_pressed_pm; } - inline PixmapWithMask &stuckPixmap() { return *m_stuck_pm; } - inline PixmapWithMask &stuckUnfocusPixmap() { return *m_stuck_unfocus_pm; } + inline FbTk::PixmapWithMask &stuckPixmap() { return *m_stuck_pm; } + inline FbTk::PixmapWithMask &stuckUnfocusPixmap() { return *m_stuck_unfocus_pm; } - inline const PixmapWithMask &shadePixmap() const { 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 PixmapWithMask &shadePressedPixmap() { return *m_shade_pressed_pm; } + inline const FbTk::PixmapWithMask &shadePixmap() const { return *m_shade_pm; } + inline FbTk::PixmapWithMask &shadePixmap() { return *m_shade_pm; } + inline FbTk::PixmapWithMask &shadeUnfocusPixmap() { return *m_shade_unfocus_pm; } + inline const FbTk::PixmapWithMask &shadePressedPixmap() const { return *m_shade_pressed_pm; } + inline FbTk::PixmapWithMask &shadePressedPixmap() { return *m_shade_pressed_pm; } private: - FbTk::ThemeItem<PixmapWithMask> m_close_pm, m_close_unfocus_pm, m_close_pressed_pm; - FbTk::ThemeItem<PixmapWithMask> m_maximize_pm, m_maximize_unfocus_pm, m_maximize_pressed_pm; - FbTk::ThemeItem<PixmapWithMask> m_iconify_pm, m_iconify_unfocus_pm, m_iconify_pressed_pm; - FbTk::ThemeItem<PixmapWithMask> m_shade_pm, m_shade_unfocus_pm, m_shade_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; + FbTk::ThemeItem<FbTk::PixmapWithMask> m_close_pm, m_close_unfocus_pm, m_close_pressed_pm; + FbTk::ThemeItem<FbTk::PixmapWithMask> m_maximize_pm, m_maximize_unfocus_pm, m_maximize_pressed_pm; + FbTk::ThemeItem<FbTk::PixmapWithMask> m_iconify_pm, m_iconify_unfocus_pm, m_iconify_pressed_pm; + FbTk::ThemeItem<FbTk::PixmapWithMask> m_shade_pm, m_shade_unfocus_pm, m_shade_pressed_pm; + FbTk::ThemeItem<FbTk::PixmapWithMask> m_stick_pm, m_stick_unfocus_pm, m_stick_pressed_pm; + FbTk::ThemeItem<FbTk::PixmapWithMask> m_stuck_pm, m_stuck_unfocus_pm; const FbWinFrameTheme &m_frame_theme; };