aboutsummaryrefslogtreecommitdiff
path: root/src/ButtonTool.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/ButtonTool.cc')
-rw-r--r--src/ButtonTool.cc26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/ButtonTool.cc b/src/ButtonTool.cc
index a88e47b..0e11733 100644
--- a/src/ButtonTool.cc
+++ b/src/ButtonTool.cc
@@ -26,9 +26,9 @@
26 26
27ButtonTool::ButtonTool(FbTk::Button *button, 27ButtonTool::ButtonTool(FbTk::Button *button,
28 ToolbarItem::Type type, 28 ToolbarItem::Type type,
29 ButtonTheme &theme, 29 FbTk::ThemeProxy<ButtonTheme> &theme,
30 FbTk::ImageControl &img_ctrl): 30 FbTk::ImageControl &img_ctrl):
31 GenericTool(button, type, theme), 31 GenericTool(button, type, dynamic_cast<FbTk::ThemeProxy<ToolTheme> &>(theme)),
32 m_cache_pm(0), 32 m_cache_pm(0),
33 m_cache_pressed_pm(0), 33 m_cache_pressed_pm(0),
34 m_image_ctrl(img_ctrl) { 34 m_image_ctrl(img_ctrl) {
@@ -46,37 +46,37 @@ ButtonTool::~ButtonTool() {
46 46
47void ButtonTool::updateSizing() { 47void ButtonTool::updateSizing() {
48 FbTk::Button &btn = static_cast<FbTk::Button &>(window()); 48 FbTk::Button &btn = static_cast<FbTk::Button &>(window());
49 btn.setBorderWidth(theme().border().width()); 49 btn.setBorderWidth(theme()->border().width());
50} 50}
51 51
52void ButtonTool::renderTheme(unsigned char alpha) { 52void ButtonTool::renderTheme(unsigned char alpha) {
53 FbTk::Button &btn = static_cast<FbTk::Button &>(window()); 53 FbTk::Button &btn = static_cast<FbTk::Button &>(window());
54 54
55 btn.setGC(static_cast<const ButtonTheme &>(theme()).gc()); 55 btn.setGC(static_cast<const ButtonTheme &>(*theme()).gc());
56 btn.setBorderColor(theme().border().color()); 56 btn.setBorderColor(theme()->border().color());
57 btn.setBorderWidth(theme().border().width()); 57 btn.setBorderWidth(theme()->border().width());
58 btn.setAlpha(alpha); 58 btn.setAlpha(alpha);
59 btn.updateTheme(static_cast<const FbTk::Theme &>(theme())); 59 btn.updateTheme(*theme());
60 60
61 Pixmap old_pm = m_cache_pm; 61 Pixmap old_pm = m_cache_pm;
62 if (!theme().texture().usePixmap()) { 62 if (!theme()->texture().usePixmap()) {
63 m_cache_pm = 0; 63 m_cache_pm = 0;
64 btn.setBackgroundColor(theme().texture().color()); 64 btn.setBackgroundColor(theme()->texture().color());
65 } else { 65 } else {
66 m_cache_pm = m_image_ctrl.renderImage(width(), height(), 66 m_cache_pm = m_image_ctrl.renderImage(width(), height(),
67 theme().texture(), orientation()); 67 theme()->texture(), orientation());
68 btn.setBackgroundPixmap(m_cache_pm); 68 btn.setBackgroundPixmap(m_cache_pm);
69 } 69 }
70 if (old_pm) 70 if (old_pm)
71 m_image_ctrl.removeImage(old_pm); 71 m_image_ctrl.removeImage(old_pm);
72 72
73 old_pm = m_cache_pressed_pm; 73 old_pm = m_cache_pressed_pm;
74 if (! static_cast<const ButtonTheme &>(theme()).pressed().usePixmap()) { 74 if (! static_cast<const ButtonTheme &>(*theme()).pressed().usePixmap()) {
75 m_cache_pressed_pm = 0; 75 m_cache_pressed_pm = 0;
76 btn.setPressedColor(static_cast<const ButtonTheme &>(theme()).pressed().color()); 76 btn.setPressedColor(static_cast<const ButtonTheme &>(*theme()).pressed().color());
77 } else { 77 } else {
78 m_cache_pressed_pm = m_image_ctrl.renderImage(width(), height(), 78 m_cache_pressed_pm = m_image_ctrl.renderImage(width(), height(),
79 static_cast<const ButtonTheme &>(theme()).pressed(), orientation()); 79 static_cast<const ButtonTheme &>(*theme()).pressed(), orientation());
80 btn.setPressedPixmap(m_cache_pressed_pm); 80 btn.setPressedPixmap(m_cache_pressed_pm);
81 } 81 }
82 82