aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ButtonTool.cc17
-rw-r--r--src/ButtonTool.hh1
2 files changed, 16 insertions, 2 deletions
diff --git a/src/ButtonTool.cc b/src/ButtonTool.cc
index 746549f..5f9aec1 100644
--- a/src/ButtonTool.cc
+++ b/src/ButtonTool.cc
@@ -51,8 +51,15 @@ void ButtonTool::updateSizing() {
51 btn.setBorderWidth(bw); 51 btn.setBorderWidth(bw);
52 if (FbTk::TextButton *txtBtn = dynamic_cast<FbTk::TextButton*>(&btn)) { 52 if (FbTk::TextButton *txtBtn = dynamic_cast<FbTk::TextButton*>(&btn)) {
53 bw += 2; // extra padding, seems somehow required... 53 bw += 2; // extra padding, seems somehow required...
54 resize(theme()->font().textWidth(txtBtn->text()) + 2*bw, 54
55 theme()->font().height() + 2*bw); 55 unsigned int new_width = theme()->font().textWidth(txtBtn->text()) + 2*bw;
56 unsigned int new_height = theme()->font().height() + 2*bw;
57
58 if (orientation() == FbTk::ROT0 || orientation() == FbTk::ROT180) {
59 resize(new_width, new_height);
60 } else {
61 resize(new_height, new_width);
62 }
56 } 63 }
57} 64}
58 65
@@ -93,3 +100,9 @@ void ButtonTool::renderTheme(int alpha) {
93 btn.clear(); 100 btn.clear();
94} 101}
95 102
103void ButtonTool::setOrientation(FbTk::Orientation orient) {
104 FbTk::Button &btn = static_cast<FbTk::Button &>(window());
105 btn.setOrientation(orient);
106 ToolbarItem::setOrientation(orient);
107}
108
diff --git a/src/ButtonTool.hh b/src/ButtonTool.hh
index ec74618..e5e5026 100644
--- a/src/ButtonTool.hh
+++ b/src/ButtonTool.hh
@@ -39,6 +39,7 @@ public:
39 FbTk::ThemeProxy<ButtonTheme> &theme, 39 FbTk::ThemeProxy<ButtonTheme> &theme,
40 FbTk::ImageControl &img_ctrl); 40 FbTk::ImageControl &img_ctrl);
41 virtual ~ButtonTool(); 41 virtual ~ButtonTool();
42 void setOrientation(FbTk::Orientation orient);
42 43
43protected: 44protected:
44 void renderTheme(int alpha); 45 void renderTheme(int alpha);