text_box.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #include <gui/view.h>
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. /* TextBox anonymous structure */
  7. typedef struct TextBox TextBox;
  8. typedef void (*TextBoxExitCallback)(void* context);
  9. typedef enum {
  10. TextBoxFontText,
  11. TextBoxFontHex,
  12. } TextBoxFont;
  13. /** Allocate and initialize text_box
  14. */
  15. TextBox* text_box_alloc();
  16. /** Deinitialize and free text_box
  17. * @param text_box text_box instance
  18. */
  19. void text_box_free(TextBox* text_box);
  20. /** Get text_box view
  21. * @param text_box TextBox instance
  22. * @return View instance that can be used for embedding
  23. */
  24. View* text_box_get_view(TextBox* text_box);
  25. /** Clean text_box
  26. * @param text_box TextBox instance
  27. */
  28. void text_box_clean(TextBox* text_box);
  29. /** Set text for text_box
  30. * @param text_box TextBox instance
  31. * @param text text to set
  32. */
  33. void text_box_set_text(TextBox* text_box, const char* text);
  34. /** Set TextBox font
  35. * @param text_box TextBox instance
  36. * @param font TextBoxFont instance
  37. */
  38. void text_box_set_font(TextBox* text_box, TextBoxFont font);
  39. /** Set text_box context
  40. * @param text_box TextBox instance
  41. * @param context context pointer
  42. */
  43. void text_box_set_context(TextBox* text_box, void* context);
  44. /** Set exit callback
  45. * @param text_box TextBox instance
  46. * @param callback TextBoxExitCallback callback pointer
  47. */
  48. void text_box_set_exit_callback(TextBox* text_box, TextBoxExitCallback callback);
  49. #ifdef __cplusplus
  50. }
  51. #endif