textInputComponent.h
Go to the documentation of this file.00001 #ifndef TEXT_INPUT_COMPONENT_H
00002 #define TEXT_INPUT_COMPONENT_H
00003
00013 #include "ttfDraw.h"
00014 #include "fillSurface.h"
00015 #include "labelComponent.h"
00016 #include "focusComponentInterface.h"
00017
00018
00022 class TextInputComponent : public FocusComponentInterface {
00023 enum { BufferSize = 256 };
00024 TTF_Draw& ttf;
00025 int px_size;
00026 VXV::Rect draw_rect;
00027 unsigned long fore_color;
00028 unsigned long back_color;
00029 int buffer_max;
00030 bool decided;
00031 bool ctrl_disable;
00032
00033 public:
00034 std::list<unsigned short> inputed;
00035
00036 private:
00037 std::list<unsigned short>::iterator cursor_it;
00038
00039 FillSurface* back_surface;
00040
00041 void addInputToBuffer(const UserInput& ui);
00042 bool drawChar(Uint16 ch, unsigned long fore,
00043 unsigned long back, VXV::Grid& next);
00044 TextInputComponent(void);
00045
00046 public:
00047 TextInputComponent(TTF_Draw& ttfObj, int pxSize, const VXV::Rect& size,
00048 unsigned long color = White, unsigned long back = Black);
00049 ~TextInputComponent(void);
00050 void setBufferMax(int maxSize);
00051 bool draw(unsigned long ticks, const UserInput& ui);
00052
00053 void clear(void);
00054 void setText(const char* text);
00055
00056
00057
00058 void activate(bool on);
00059 bool isDecided(void);
00060 void disable(bool on);
00061 void beginFocus(void);
00062 void endFocus(void);
00063 };
00064
00065 #endif
00066