#ifndef __lib_gui_einput_h
#define __lib_gui_einput_h
-#include <lib/gui/elabel.h>
+#include <lib/gui/ewidget.h>
#include <lib/python/connections.h>
class eInputContent;
-class eInput: public eLabel
+class eInput: public eWidget
{
public:
eInput(eWidget *parent);
PSignal0<void> changed;
int m_cursor;
-
+
+ enum {
+ INPUT_ACTIONS,
+ ASCII_ACTIONS
+ };
+
enum InputActions {
moveLeft,
moveRight,
moveHome,
moveEnd,
- deleteChar
+ deleteForward,
+ deleteBackward,
+ toggleOverwrite,
+ accept
};
-
+
+ enum AsciiActions {
+ gotAsciiCode
+ };
+
void setContent(eInputContent *cnt);
- int getNumber();
+ void setOverwriteMode(int o);
+
+ void setFont(gFont *font);
protected:
+ ePtr<gFont> m_font;
+ int m_mode, m_have_focus;
ePtr<eInputContent> m_content;
int event(int event, void *data=0, void *data2=0);
};
dirUser
};
virtual void moveCursor(int dir)=0;
+
+ enum {
+ deleteForward, deleteBackward
+ };
+ virtual void deleteChar(int dir)=0;
+
/* no movement keys except stuff like '.' or so*/
- virtual int haveKey(int code)=0;
+ virtual int haveKey(int code, int overwrite)=0;
virtual int isValid()=0;
+ virtual void validate()=0;
protected:
eInput *m_input;
};
-class eInputContentNumber: public eInputContent
-{
- DECLARE_REF(eInputContentNumber);
-public:
- eInputContentNumber(int cur, int min, int max);
-
- void getDisplay(std::string &res, int &cursor);
- void moveCursor(int dir);
- int haveKey(int code);
- int isValid();
-
-private:
- void recalcLen();
-
- void insertDigit(int pos, int dig);
-
- int m_value;
- int m_cursor, m_len;
-
- int m_min, m_max;
-};
-
#endif