From 5c1bb0a21f178ddc240aabdd2ead2da8e3d56858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Tue, 5 Apr 2016 14:13:05 +0200 Subject: support FbTk::TextButton's in ButtonTool required to allow labeled general action buttons in the toolbar --- src/ButtonTool.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 @@ #include "ButtonTheme.hh" #include "FbTk/Button.hh" #include "FbTk/ImageControl.hh" +#include "FbTk/TextButton.hh" ButtonTool::ButtonTool(FbTk::Button *button, ToolbarItem::Type type, @@ -46,7 +47,13 @@ ButtonTool::~ButtonTool() { void ButtonTool::updateSizing() { FbTk::Button &btn = static_cast(window()); - btn.setBorderWidth(theme()->border().width()); + int bw = theme()->border().width(); + btn.setBorderWidth(bw); + if (FbTk::TextButton *txtBtn = dynamic_cast(&btn)) { + bw += 2; // extra padding, seems somehow required... + resize(theme()->font().textWidth(txtBtn->text()) + 2*bw, + theme()->font().height() + 2*bw); + } } void ButtonTool::renderTheme(int alpha) { -- cgit v0.11.2