diff options
author | markt <markt> | 2007-03-27 08:43:09 (GMT) |
---|---|---|
committer | markt <markt> | 2007-03-27 08:43:09 (GMT) |
commit | 9ebfea7944a1455a74cb70781373d83f50ad196c (patch) | |
tree | 919096d5e05e9b70499433bea3db2faf19b27bae /src/FbTk/MenuItem.cc | |
parent | 58e280952a47fc3fb77b4659a21cc4ce6a73066e (diff) | |
download | fluxbox-9ebfea7944a1455a74cb70781373d83f50ad196c.zip fluxbox-9ebfea7944a1455a74cb70781373d83f50ad196c.tar.bz2 |
lots and lots of code cleanup, plus introduced new ClientMenu class
Diffstat (limited to 'src/FbTk/MenuItem.cc')
-rw-r--r-- | src/FbTk/MenuItem.cc | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/FbTk/MenuItem.cc b/src/FbTk/MenuItem.cc index 82dd155..b598c47 100644 --- a/src/FbTk/MenuItem.cc +++ b/src/FbTk/MenuItem.cc | |||
@@ -90,27 +90,32 @@ void MenuItem::draw(FbDrawable &draw, | |||
90 | // Icon | 90 | // Icon |
91 | // | 91 | // |
92 | if (draw_background) { | 92 | if (draw_background) { |
93 | if (m_icon.get() != 0 && m_icon->pixmap.get() != 0) { | 93 | if (icon() != 0) { |
94 | // copy pixmap, so we don't resize the original | ||
95 | FbPixmap tmp_pixmap, tmp_mask; | ||
96 | tmp_pixmap.copy(icon()->pixmap()); | ||
97 | tmp_mask.copy(icon()->mask()); | ||
98 | |||
94 | // scale pixmap to right size | 99 | // scale pixmap to right size |
95 | if (height - 2*theme.bevelWidth() != m_icon->pixmap->height() && | 100 | if (height - 2*theme.bevelWidth() != tmp_pixmap.height()) { |
96 | !m_icon->filename.empty()) { | ||
97 | unsigned int scale_size = height - 2*theme.bevelWidth(); | 101 | unsigned int scale_size = height - 2*theme.bevelWidth(); |
98 | m_icon->pixmap->scale(scale_size, scale_size); | 102 | tmp_pixmap.scale(scale_size, scale_size); |
103 | tmp_mask.scale(scale_size, scale_size); | ||
99 | } | 104 | } |
100 | 105 | ||
101 | if (m_icon->pixmap->pixmap().drawable() != 0) { | 106 | if (tmp_pixmap.drawable() != 0) { |
102 | GC gc = theme.frameTextGC().gc(); | 107 | GC gc = theme.frameTextGC().gc(); |
103 | int icon_x = x + theme.bevelWidth(); | 108 | int icon_x = x + theme.bevelWidth(); |
104 | int icon_y = y + theme.bevelWidth(); | 109 | int icon_y = y + theme.bevelWidth(); |
105 | // enable clip mask | 110 | // enable clip mask |
106 | XSetClipMask(disp, gc, m_icon->pixmap->mask().drawable()); | 111 | XSetClipMask(disp, gc, tmp_mask.drawable()); |
107 | XSetClipOrigin(disp, gc, icon_x, icon_y); | 112 | XSetClipOrigin(disp, gc, icon_x, icon_y); |
108 | 113 | ||
109 | draw.copyArea(m_icon->pixmap->pixmap().drawable(), | 114 | draw.copyArea(tmp_pixmap.drawable(), |
110 | gc, | 115 | gc, |
111 | 0, 0, | 116 | 0, 0, |
112 | icon_x, icon_y, | 117 | icon_x, icon_y, |
113 | m_icon->pixmap->width(), m_icon->pixmap->height()); | 118 | tmp_pixmap.width(), tmp_pixmap.height()); |
114 | 119 | ||
115 | // restore clip mask | 120 | // restore clip mask |
116 | XSetClipMask(disp, gc, None); | 121 | XSetClipMask(disp, gc, None); |