diff options
-rw-r--r-- | src/ButtonTool.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ButtonTool.cc b/src/ButtonTool.cc index ad54534..746549f 100644 --- a/src/ButtonTool.cc +++ b/src/ButtonTool.cc | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "ButtonTheme.hh" | 23 | #include "ButtonTheme.hh" |
24 | #include "FbTk/Button.hh" | 24 | #include "FbTk/Button.hh" |
25 | #include "FbTk/ImageControl.hh" | 25 | #include "FbTk/ImageControl.hh" |
26 | #include "FbTk/TextButton.hh" | ||
26 | 27 | ||
27 | ButtonTool::ButtonTool(FbTk::Button *button, | 28 | ButtonTool::ButtonTool(FbTk::Button *button, |
28 | ToolbarItem::Type type, | 29 | ToolbarItem::Type type, |
@@ -46,7 +47,13 @@ ButtonTool::~ButtonTool() { | |||
46 | 47 | ||
47 | void ButtonTool::updateSizing() { | 48 | void ButtonTool::updateSizing() { |
48 | FbTk::Button &btn = static_cast<FbTk::Button &>(window()); | 49 | FbTk::Button &btn = static_cast<FbTk::Button &>(window()); |
49 | btn.setBorderWidth(theme()->border().width()); | 50 | int bw = theme()->border().width(); |
51 | btn.setBorderWidth(bw); | ||
52 | if (FbTk::TextButton *txtBtn = dynamic_cast<FbTk::TextButton*>(&btn)) { | ||
53 | bw += 2; // extra padding, seems somehow required... | ||
54 | resize(theme()->font().textWidth(txtBtn->text()) + 2*bw, | ||
55 | theme()->font().height() + 2*bw); | ||
56 | } | ||
50 | } | 57 | } |
51 | 58 | ||
52 | void ButtonTool::renderTheme(int alpha) { | 59 | void ButtonTool::renderTheme(int alpha) { |