From 152423c0274887415b50c0d31828036a8fe54708 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 3 Feb 2019 19:24:47 +0100 Subject: Increase tab-button width. --- plugingui/mainwindow.cc | 1 + plugingui/tabwidget.cc | 12 +++++++++++- plugingui/tabwidget.h | 5 +++++ 3 files changed, 17 insertions(+), 1 deletion(-) (limited to 'plugingui') diff --git a/plugingui/mainwindow.cc b/plugingui/mainwindow.cc index 049d7aa..a0364fa 100644 --- a/plugingui/mainwindow.cc +++ b/plugingui/mainwindow.cc @@ -48,6 +48,7 @@ MainWindow::MainWindow(Settings& settings, void* native_window) setCaption("DrumGizmo v" VERSION); + tabs.setTabWidth(100); tabs.move(16, 0); // x-offset to make room for the left side bar. tabs.addTab("Main", &main_tab); tabs.addTab("Drumkit", &drumkit_tab); diff --git a/plugingui/tabwidget.cc b/plugingui/tabwidget.cc index b18f62f..7ba39c9 100644 --- a/plugingui/tabwidget.cc +++ b/plugingui/tabwidget.cc @@ -50,6 +50,16 @@ void TabWidget::addTab(const std::string& title, Widget* widget) sizeChanged(width(), height()); } +void TabWidget::setTabWidth(std::size_t width) +{ + tab_width = width; +} + +std::size_t TabWidget::getTabWidth() const +{ + return tab_width; +} + std::size_t TabWidget::getBarHeight() const { return topbar.height(); @@ -94,7 +104,7 @@ void TabWidget::sizeChanged(int width, int height) { std::size_t pos = 0; - int button_width = 1; + int button_width = tab_width; int bar_height = 25; int button_border_width = 10; diff --git a/plugingui/tabwidget.h b/plugingui/tabwidget.h index 3f0e041..ff239a8 100644 --- a/plugingui/tabwidget.h +++ b/plugingui/tabwidget.h @@ -47,6 +47,9 @@ public: std::size_t getBarHeight() const; + void setTabWidth(std::size_t width); + std::size_t getTabWidth() const; + private: //! Callback for Widget::sizeChangeNotifier void sizeChanged(int width, int height); @@ -68,6 +71,8 @@ private: Texture toplogo{getImageCache(), ":resources/toplogo.png", 0, 0, // atlas offset (x, y) 95, 17}; // width, height + + std::size_t tab_width{64}; }; } // GUI:: -- cgit v1.2.3