2
0

ui_textbox.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef ui_textbox_h
  2. #define ui_textbox_h
  3. #include "ui/ui_rectangle.h"
  4. #include "ui/ui_text.h"
  5. typedef struct {
  6. ui_rectangle* outer;
  7. ui_rectangle* inner;
  8. ui_text* contents;
  9. ui_text* label;
  10. bool password;
  11. int max_chars;
  12. bool selected;
  13. bool active;
  14. bool enabled;
  15. } ui_textbox;
  16. ui_textbox* ui_textbox_new();
  17. void ui_textbox_delete(ui_textbox* tb);
  18. void ui_textbox_set_password(ui_textbox* tb, bool password);
  19. void ui_textbox_set_max_chars(ui_textbox* tb, int l);
  20. void ui_textbox_addchar(ui_textbox* tb, char c);
  21. void ui_textbox_rmchar(ui_textbox* tb);
  22. void ui_textbox_move(ui_textbox* tb, vec2 pos);
  23. void ui_textbox_resize(ui_textbox* tb, vec2 size);
  24. void ui_textbox_set_font(ui_textbox* tb, asset_hndl f);
  25. void ui_textbox_set_label(ui_textbox* tb, char* label);
  26. void ui_textbox_set_contents(ui_textbox* tb, char* label);
  27. void ui_textbox_set_alignment(ui_textbox* tb, int halign, int valign);
  28. void ui_textbox_disable(ui_textbox* tb);
  29. void ui_textbox_enable(ui_textbox* tb);
  30. void ui_textbox_event(ui_textbox* tb, SDL_Event e);
  31. void ui_textbox_update(ui_textbox* tb);
  32. void ui_textbox_render(ui_textbox* tb);
  33. bool ui_textbox_contains_point(ui_textbox* tb, vec2 p);
  34. #endif