00001
00015 #ifndef CUI_EDITABLETEXTBOX_H
00016 #define CUI_EDITABLETEXTBOX_H
00017
00018 #include "UI_Lib.h"
00019 #include "UI_types.h"
00020 #include "CUI_TextBox.h"
00021
00022 #ifndef UI_CURSOR_TYPES
00023 #define UI_CURSOR_TYPES
00024 #define UI_CURSOR_NONE 0
00025 #define UI_CURSOR_BAR 1
00026 #define UI_CURSOR_UNDERLINE 2
00027 #endif
00028
00030
00042 class GLGUI_ENTRY CUI_EditableTextBox : public CUI_TextBox
00043 {
00044
00045 public:
00047 CUI_EditableTextBox( CUI_UI *ui = NULL, float x = 0, float y = 0, float x2 = 1, float y2 = 1,
00048 CUI_Frame *parent = NULL, IUI_Shader *shader = NULL,
00049 IUI_Shader *cursor = NULL, CUI_CoordSys *coordsys = NULL,
00050
00051 char *text = NULL, IUI_Font *font = NULL, float textscale = 0.8,
00052 IUI_Border *border = NULL,
00053
00054 int columns = 30, int rows = 40, int startcolumn = 0, int startrow = 0,
00055 bool wordWrap = true,
00056
00057 unsigned int cursorPosition = 0, unsigned short cursorType = UI_CURSOR_NONE
00058 );
00059
00061 virtual ~CUI_EditableTextBox();
00062
00064 bool SetText( const char *text );
00065
00067 bool MoveCursor( int cursorPosition )
00068 { m_cursorPosition = cursorPosition; return false; }
00069
00071 int GetCursorPosition( )
00072 { return m_cursorPosition; }
00073
00075 bool SetCursorType( unsigned short cursorType )
00076 { m_cursorType = cursorType; return false; }
00077
00079 virtual bool ProcessKey( unsigned long key );
00080
00082 virtual bool Render( double dtime, IUI_Renderer *renderer );
00083
00085 virtual bool SetMaxRows( unsigned long maxrows )
00086 { m_maxRows = maxrows; return false; }
00087
00089 virtual bool IsClickable( void )
00090 { return true; }
00091
00093
00102 virtual bool Click( int &id, int &numparam, void **param );
00103
00105 virtual bool IsDraggable( void )
00106 { return true; }
00107
00109 virtual bool Drag( float x, float y, float dx, float dy, int &id, int &numparam, void **param );
00110
00112
00114 virtual void DeleteParam( void *param ) { };
00115
00116 protected:
00117
00119 unsigned long m_cursorPosition;
00120
00122
00126 unsigned short m_cursorType;
00127
00129 unsigned long m_maxRows;
00130
00131 };
00132
00133
00134 #endif