text_box.h 1.6 KB

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