all repos — fluxbox @ 5c1bb0a21f178ddc240aabdd2ead2da8e3d56858

custom fork of the fluxbox windowmanager

support FbTk::TextButton's in ButtonTool

required to allow labeled general action
buttons in the toolbar
Thomas Lübking thomas.luebking@gmail.com
commit

5c1bb0a21f178ddc240aabdd2ead2da8e3d56858

parent

1473bcf655271f6e229526c37e237ee0d49d366d

1 files changed, 8 insertions(+), 1 deletions(-)

jump to
M src/ButtonTool.ccsrc/ButtonTool.cc

@@ -23,6 +23,7 @@ #include "ButtonTool.hh"

#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 @@ }

void ButtonTool::updateSizing() { FbTk::Button &btn = static_cast<FbTk::Button &>(window()); - btn.setBorderWidth(theme()->border().width()); + int bw = theme()->border().width(); + btn.setBorderWidth(bw); + if (FbTk::TextButton *txtBtn = dynamic_cast<FbTk::TextButton*>(&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) {