diff --git a/src/ButtonTool.cc b/src/ButtonTool.cc index 746549f3..5f9aec18 100644 --- a/src/ButtonTool.cc +++ b/src/ButtonTool.cc @@ -51,8 +51,15 @@ void ButtonTool::updateSizing() { 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); + + unsigned int new_width = theme()->font().textWidth(txtBtn->text()) + 2*bw; + unsigned int new_height = theme()->font().height() + 2*bw; + + if (orientation() == FbTk::ROT0 || orientation() == FbTk::ROT180) { + resize(new_width, new_height); + } else { + resize(new_height, new_width); + } } } @@ -93,3 +100,9 @@ void ButtonTool::renderTheme(int alpha) { btn.clear(); } +void ButtonTool::setOrientation(FbTk::Orientation orient) { + FbTk::Button &btn = static_cast(window()); + btn.setOrientation(orient); + ToolbarItem::setOrientation(orient); +} + diff --git a/src/ButtonTool.hh b/src/ButtonTool.hh index ec746189..e5e50268 100644 --- a/src/ButtonTool.hh +++ b/src/ButtonTool.hh @@ -39,6 +39,7 @@ public: FbTk::ThemeProxy &theme, FbTk::ImageControl &img_ctrl); virtual ~ButtonTool(); + void setOrientation(FbTk::Orientation orient); protected: void renderTheme(int alpha);