diff options
author | Thomas Lübking <thomas.luebking@gmail.com> | 2016-04-05 12:13:05 (GMT) |
---|---|---|
committer | Mathias Gumz <akira@fluxbox.org> | 2016-08-26 06:17:42 (GMT) |
commit | 5c1bb0a21f178ddc240aabdd2ead2da8e3d56858 (patch) | |
tree | 13d4b02b7367816525493ab15631cce7fa9cbb08 /src | |
parent | 1473bcf655271f6e229526c37e237ee0d49d366d (diff) | |
download | fluxbox-5c1bb0a21f178ddc240aabdd2ead2da8e3d56858.zip fluxbox-5c1bb0a21f178ddc240aabdd2ead2da8e3d56858.tar.bz2 |
support FbTk::TextButton's in ButtonTool
required to allow labeled general action
buttons in the toolbar
Diffstat (limited to 'src')
-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) { |