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/button.h | 37 ++++--------------------------------- 1 file changed, 4 insertions(+), 33 deletions(-) (limited to 'plugingui/button.h') diff --git a/plugingui/button.h b/plugingui/button.h index 04656ba..fde0459 100644 --- a/plugingui/button.h +++ b/plugingui/button.h @@ -26,42 +26,23 @@ */ #pragma once -#include - -#include - -#include "widget.h" -#include "painter.h" +#include "button_base.h" #include "font.h" #include "texturedbox.h" namespace GUI { -class Button : public Widget { +class Button + : public ButtonBase { public: - Button(Widget *parent); + Button(Widget* parent); virtual ~Button(); - // From Widget: - bool isFocusable() override { return true; } - bool catchMouse() override { return true; } - - void setText(const std::string& text); - - Notifier<> clickNotifier; - protected: - virtual void clicked() {} - // From Widget: virtual void repaintEvent(RepaintEvent* e) override; - virtual void buttonEvent(ButtonEvent* e) override; - virtual void mouseLeaveEvent() override; - virtual void mouseEnterEvent() override; private: - bool in_button{false}; - TexturedBox box_up{getImageCache(), ":pushbutton.png", 0, 0, // atlas offset (x, y) 11, 1, 11, // dx1, dx2, dx3 @@ -72,17 +53,7 @@ private: 11, 1, 11, // dx1, dx2, dx3 10, 72, 12}; // dy1, dy2, dy3 - typedef enum { - up, - down - } state_t; - - std::string text; - Font font{":fontemboss.png"}; - - state_t draw_state{up}; - state_t button_state{up}; }; } // GUI:: -- cgit v1.2.3