From 19b9cddf7d5ef3daac5cda481db492f28574d28d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Nusser?= Date: Sun, 16 Apr 2017 12:54:16 +0200 Subject: Move button functionality to BaseButton. Create TabButton. --- plugingui/tabbutton.h | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'plugingui/tabbutton.h') diff --git a/plugingui/tabbutton.h b/plugingui/tabbutton.h index 2f5e287..2f0dc10 100644 --- a/plugingui/tabbutton.h +++ b/plugingui/tabbutton.h @@ -28,26 +28,48 @@ #include -#include "widget.h" -#include "button.h" +#include "button_base.h" +#include "font.h" +#include "texturedbox.h" namespace GUI { class TabButton - : public Button + : public ButtonBase { public: - TabButton(Widget* parent, Widget* tabWidget); + TabButton(Widget* parent, Widget* tab_widget); + virtual ~TabButton(); - Widget *getTabWidget(); + Widget* getTabWidget(); + std::size_t getMinimalWidth() const; + std::size_t getMinimalHeight() const; + void setActive(bool active); Notifier switchTabNotifier; +protected: + // From Widget: + virtual void repaintEvent(RepaintEvent* e) override; + private: void clickHandler(); - Widget* tabWidget; + Widget* tab_widget; + bool active; + + TexturedBox tab_active{getImageCache(), ":tab.png", + 0, 0, // atlas offset (x, y) + 5, 1, 5, // dx1, dx2, dx3 + 5, 13, 1}; // dy1, dy2, dy3 + + TexturedBox tab_passive{getImageCache(), ":tab.png", + 11, 0, // atlas offset (x, y) + 5, 1, 5, // dx1, dx2, dx3 + 5, 13, 1}; // dy1, dy2, dy3 + + Font font{":fontemboss.png"}; }; } // GUI:: -- cgit v1.2.3