aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/MenuIcon.cc
diff options
context:
space:
mode:
authorsimonb <simonb>2005-04-26 01:41:55 (GMT)
committersimonb <simonb>2005-04-26 01:41:55 (GMT)
commit1c2f92a3d2288b1cae9500110a72173506a18072 (patch)
treecdb695da16dcee74872790c772bb535def9f2895 /src/FbTk/MenuIcon.cc
parentb49432be05c6cf748e662e196778463e2190b4c3 (diff)
downloadfluxbox_pavel-1c2f92a3d2288b1cae9500110a72173506a18072.zip
fluxbox_pavel-1c2f92a3d2288b1cae9500110a72173506a18072.tar.bz2
extension of previous big patch. Move a bunch of menu things onto
background pixmap. Same for textbuttons.
Diffstat (limited to 'src/FbTk/MenuIcon.cc')
-rw-r--r--src/FbTk/MenuIcon.cc54
1 files changed, 29 insertions, 25 deletions
diff --git a/src/FbTk/MenuIcon.cc b/src/FbTk/MenuIcon.cc
index acdc333..f1ae389 100644
--- a/src/FbTk/MenuIcon.cc
+++ b/src/FbTk/MenuIcon.cc
@@ -53,35 +53,39 @@ void MenuIcon::updateTheme(const MenuTheme &theme) {
53 53
54void MenuIcon::draw(FbDrawable &drawable, 54void MenuIcon::draw(FbDrawable &drawable,
55 const MenuTheme &theme, 55 const MenuTheme &theme,
56 bool highlight, 56 bool highlight, bool draw_foreground, bool draw_background,
57 int x, int y, 57 int x, int y,
58 unsigned int width, unsigned int height) const { 58 unsigned int width, unsigned int height) const {
59 59
60 Display *disp = FbTk::App::instance()->display(); 60 // all background
61 if (height - 2*theme.bevelWidth() != m_pixmap.height() && 61 if (draw_background) {
62 !m_filename.empty()) { 62 Display *disp = FbTk::App::instance()->display();
63 unsigned int scale_size = height - 2*theme.bevelWidth(); 63 if (height - 2*theme.bevelWidth() != m_pixmap.height() &&
64 m_pixmap.scale(scale_size, scale_size); 64 !m_filename.empty()) {
65 m_mask.scale(scale_size, scale_size); 65 unsigned int scale_size = height - 2*theme.bevelWidth();
66 m_pixmap.scale(scale_size, scale_size);
67 m_mask.scale(scale_size, scale_size);
68 }
69
70 if (m_pixmap.drawable() != 0) {
71 GC gc = theme.frameTextGC().gc();
72
73 // enable clip mask
74 XSetClipMask(disp, gc, m_mask.drawable());
75 XSetClipOrigin(disp, gc, x + theme.bevelWidth(), y + theme.bevelWidth());
76
77 drawable.copyArea(m_pixmap.drawable(),
78 gc,
79 0, 0,
80 x + theme.bevelWidth(), y + theme.bevelWidth(),
81 m_pixmap.width(), m_pixmap.height());
82
83 // restore clip mask
84 XSetClipMask(disp, gc, None);
85 }
66 } 86 }
67 87 FbTk::MenuItem::draw(drawable, theme, highlight,
68 if (m_pixmap.drawable() != 0) { 88 draw_background, draw_foreground, x, y, width, height);
69 GC gc = theme.frameTextGC().gc();
70
71 // enable clip mask
72 XSetClipMask(disp, gc, m_mask.drawable());
73 XSetClipOrigin(disp, gc, x + theme.bevelWidth(), y + theme.bevelWidth());
74
75 drawable.copyArea(m_pixmap.drawable(),
76 gc,
77 0, 0,
78 x + theme.bevelWidth(), y + theme.bevelWidth(),
79 m_pixmap.width(), m_pixmap.height());
80
81 // restore clip mask
82 XSetClipMask(disp, gc, None);
83 }
84 FbTk::MenuItem::draw(drawable, theme, highlight, x, y, width, height);
85} 89}
86 90
87unsigned int MenuIcon::width(const MenuTheme &theme) const { 91unsigned int MenuIcon::width(const MenuTheme &theme) const {