diff options
author | André Nusser <andre.nusser@googlemail.com> | 2017-03-23 12:22:00 +0100 |
---|---|---|
committer | André Nusser <andre.nusser@googlemail.com> | 2017-04-01 16:33:49 +0200 |
commit | 0e969842ccb1badc7689959c82208bd325cd01c7 (patch) | |
tree | d44cc6244e72babe78b318fd5880158266c61091 /plugingui/checkbox.h | |
parent | 6c0bcd6719d929272057a71e62d72ae7aadeb507 (diff) |
New Toggle class which includes the basic functionality of CheckBox
Diffstat (limited to 'plugingui/checkbox.h')
-rw-r--r-- | plugingui/checkbox.h | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/plugingui/checkbox.h b/plugingui/checkbox.h index f85c1d9..6627304 100644 --- a/plugingui/checkbox.h +++ b/plugingui/checkbox.h @@ -26,50 +26,24 @@ */ #pragma once -#include <notifier.h> - -#include "widget.h" +#include "toggle.h" #include "texture.h" namespace GUI { -class CheckBox : public Widget { +class CheckBox : public Toggle { public: CheckBox(Widget *parent); virtual ~CheckBox() = default; - void setText(std::string text); - - // From Widget: - bool isFocusable() override { return true; } - bool catchMouse() override { return true; } - - bool checked(); - void setChecked(bool checked); - - Notifier<bool> stateChangedNotifier; - protected: // From Widget: virtual void repaintEvent(RepaintEvent* repaintEvent) override; - virtual void buttonEvent(ButtonEvent* buttonEvent) override; - virtual void keyEvent(KeyEvent* keyEvent) override; - virtual void mouseLeaveEvent() override; - virtual void mouseEnterEvent() override; private: - void internalSetChecked(bool checked); - Texture bg_on; Texture bg_off; Texture knob; - - bool state{false}; - bool middle{false}; - bool buttonDown{false}; - bool inCheckbox{false}; - - std::string _text; }; } // GUI:: |