summaryrefslogtreecommitdiff
path: root/plugingui/lineedit.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2015-10-26 19:48:30 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2015-10-26 19:48:30 +0100
commit88ad7366a3eb6bc73bc99078ae13302099b76f09 (patch)
tree64a5f5b3a4b5c187d25e21e21bf2808f12367820 /plugingui/lineedit.h
parentb84e5f74e5513e4cd14fe62b03777be8ee9c2537 (diff)
Refactored LineEdit and FileBrowser. Renamed all KEY_XYZ event types to KeyXyz.
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..21e448b 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);
+ virtual void repaintEvent(RepaintEvent *repaintEvent);
+ virtual void buttonEvent(ButtonEvent *buttonEvent);
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;
+ bool readonly;
};
-#endif/*__DRUMGIZMO_LINEEDIT_H__*/
+} // GUI::