00001 #ifndef _VGUI_TEXTBOX_H
00002 #define _VGUI_TEXTBOX_H
00003
00004
00005 #include "gui/gui.h"
00006
00007 namespace VGUI
00008 {
00009 class TextBox : public Widget
00010 {
00011 private:
00012 TEXTURE_HANDLE textbox_tex, cursor_tex, highlight_tex;
00013 bool l_down, r_down, bkspc_down, del_down, mbtn_down, cursor_on;
00014 string value, setting, accepts;
00015 float spacing, tex_width, tex_height;
00016 string::size_type cursor_pos, highlight_start, highlight_end;
00017 Uint32 last_blink;
00018
00019 public:
00020 TextBox();
00021 TextBox( Widget *w );
00022 ~TextBox();
00023
00024 void Draw();
00025 void Draw( float opacity );
00026 void Save();
00027 bool MouseOver( float x, float y );
00028 string MousePress( float x, float y );
00029 string MouseRelease( float x, float y );
00030 void ResetValue();
00031 void IncValuePress();
00032 void DecValuePress();
00033 void BackspacePress();
00034 void DeletePress();
00035 void IncValueRelease();
00036 void DecValueRelease();
00037 void BackspaceRelease();
00038 void DeleteRelease();
00039 void Release();
00040 void EnterText( SDLKey key );
00041
00042 string GetValue() { return value; }
00043 string GetSetting() { return setting; }
00044 float GetSpacing() { return spacing; }
00045 string GetAccepts() { return accepts; }
00046 void SetValue( string new_value ) { value = new_value; }
00047 void SetSetting( string new_setting ) { setting = new_setting; }
00048 void SetSpacing( float new_spacing );
00049 void SetAccepts( string new_accepts ) { accepts = new_accepts; }
00050 };
00051 }
00052
00053 #endif // _VGUI_TEXTBOX_H