TextBox.h 808 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef TEXTBOX_H_
  2. #define TEXTBOX_H_
  3. #include "Base.h"
  4. #include "Label.h"
  5. #include "Theme.h"
  6. #include "Keyboard.h"
  7. namespace gameplay
  8. {
  9. class TextBox : public Label
  10. {
  11. public:
  12. static TextBox* create(Theme::Style* style, Properties* properties);
  13. static TextBox* getTextBox(const char* id);
  14. void touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex);
  15. void keyEvent(Keyboard::KeyEvent evt, int key);
  16. void update(const Vector2& position);
  17. // Draw the cursor.
  18. void drawSprites(SpriteBatch* spriteBatch, const Vector2& position);
  19. private:
  20. TextBox();
  21. TextBox(const TextBox& copy);
  22. ~TextBox();
  23. void setCursorLocation(int x, int y);
  24. Vector2 _cursorLocation;
  25. unsigned int textIndex;
  26. };
  27. }
  28. #endif