diff options
Diffstat (limited to 'src/FbTk/MenuIcon.cc')
-rw-r--r-- | src/FbTk/MenuIcon.cc | 54 |
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 | ||
54 | void MenuIcon::draw(FbDrawable &drawable, | 54 | void 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 | ||
87 | unsigned int MenuIcon::width(const MenuTheme &theme) const { | 91 | unsigned int MenuIcon::width(const MenuTheme &theme) const { |