summaryrefslogtreecommitdiff
path: root/plugingui/lineedit.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui/lineedit.h')
-rw-r--r--plugingui/lineedit.h62
1 files changed, 28 insertions, 34 deletions
diff --git a/plugingui/lineedit.h b/plugingui/lineedit.h
index f85e9bd..ae1c7b8 100644
--- a/plugingui/lineedit.h
+++ b/plugingui/lineedit.h
@@ -24,9 +24,7 @@
* along with DrumGizmo; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#ifndef __DRUMGIZMO_LINEEDIT_H__
-#define __DRUMGIZMO_LINEEDIT_H__
-
+#pragma once
#include <string>
@@ -38,49 +36,45 @@ namespace GUI {
class LineEdit : public Widget {
public:
- LineEdit(Widget *parent);
+ LineEdit(Widget *parent);
+ ~LineEdit();
- bool isFocusable() { return true; }
+ bool isFocusable() override { return true; }
- std::string text();
- void setText(std::string text);
+ std::string text();
+ void setText(const std::string& text);
- void setReadOnly(bool readonly);
- bool readOnly();
+ void setReadOnly(bool readonly);
+ bool readOnly();
- void registerEnterPressedHandler(void (*handler)(void *), void *ptr);
+ Notifier<> enterPressedNotifier;
- //protected:
- virtual void keyEvent(KeyEvent *e);
- virtual void repaintEvent(RepaintEvent *e);
- virtual void buttonEvent(ButtonEvent *e);
+ //protected:
+ virtual void keyEvent(KeyEvent *keyEvent) override;
+ virtual void repaintEvent(RepaintEvent *repaintEvent) override;
+ virtual void buttonEvent(ButtonEvent *buttonEvent) override;
protected:
- virtual void textChanged() {}
+ virtual void textChanged() {}
private:
- Painter::Box box;
-
- Font font;
+ Painter::Box box;
- std::string _text;
- size_t pos;
- std::string _visibletext;
- size_t offsetpos;
+ Font font;
- enum state_t {
- NOOP = 0,
- WALK_LEFT = 1,
- WALK_RIGHT = 2
- };
- state_t walkstate;
+ std::string _text;
+ size_t pos{0};
+ std::string visibleText;
+ size_t offsetPos{0};
- bool readonly;
-
- void (*handler)(void *);
- void *ptr;
-};
+ enum state_t {
+ Noop,
+ WalkLeft,
+ WalkRight,
+ };
+ state_t walkstate{Noop};
+ bool readonly;
};
-#endif/*__DRUMGIZMO_LINEEDIT_H__*/
+} // GUI::