00001 /* 00002 File: TextField.h 00003 00004 Copyright(C) C. Kotterink, Computed Graphics 00005 */ 00006 #ifndef TEXTFIELD_H 00007 #define TEXTFIELD_H 00008 00009 #include<Widget.h> 00010 00011 #include<string> 00012 00025 class TextField : public Widget 00026 { 00027 DYNAMIC_OBJECT; 00028 public: 00030 TextField(const string t = ""); 00031 00033 const string &getText() { 00034 return text; 00035 } 00036 00038 void setText(const string &t); 00039 00041 virtual void checkInput(); 00042 00043 // Inherited from Region 00044 void refresh(); 00045 bool handleEvent(Event &evnt); 00046 00047 // Inherited from DynamicObject 00048 void parseSymbol(Token &t, ObjectFile &file); 00049 void writeParams(ostream &stream); 00050 00051 protected: 00053 void cursorLeft(); 00054 00056 void cursorRight(); 00057 00059 int widgetSize(); 00060 00061 // Inherited from DynamicObject 00062 void createSymbols(); 00063 00065 string text; 00066 00068 int start; 00069 00071 int cursor; 00072 00073 private: 00074 typedef Widget super; 00075 }; 00076 #endif