start_screen.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /**
  2. * @file start_screen.h
  3. * GUI: Start Screen view module API
  4. */
  5. #ifndef START_SCREEN_H
  6. #define START_SCREEN_H
  7. #include <gui/view.h>
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. /** StartScreen anonymous structure */
  12. typedef struct StartScreen StartScreen;
  13. /** StartScreen callback types
  14. * @warning comes from GUI thread
  15. */
  16. typedef void (*StartScreenTimerCallback)(void* context);
  17. typedef bool (*StartScreenInputCallback)(InputEvent* event, void* context);
  18. typedef void (*StartScreenDrawCallback)(Canvas* canvas, void* _model);
  19. /** Allocate and initalize
  20. *
  21. * This view is used as the starting screen of an application.
  22. *
  23. * @return StartScreen view instance
  24. */
  25. StartScreen* start_screen_alloc();
  26. /** Deinitialize and free Start Screen view
  27. *
  28. * @param instsance StartScreen instance
  29. */
  30. void start_screen_free(StartScreen* instance);
  31. /** Reset StartScreen
  32. *
  33. * @param instance StartScreen instance
  34. */
  35. void start_screen_reset(StartScreen* instance);
  36. /** Get StartScreen view
  37. *
  38. * @param instance StartScreen instance
  39. *
  40. * @return view instance that can be used for embedding
  41. */
  42. View* start_screen_get_view(StartScreen* instance);
  43. /** Set StartScreen input callback
  44. *
  45. * @param instance StartScreen instance
  46. * @param callback StartScreenInputCallback callback
  47. */
  48. void start_screen_set_input_callback(StartScreen* instance, StartScreenInputCallback callback);
  49. /** Set Additional draw callback
  50. *
  51. * Use this as a secondary callback to draw on the canvas.
  52. * This callback function will happen after drawing of the established
  53. * GUI elements in the view such as the icons, text, frame, ect.
  54. *
  55. * @param instance StartScreen instance
  56. * @param callback StartScreenDrawCallback callback
  57. */
  58. void start_screen_set_secondary_draw_callback(
  59. StartScreen* instance,
  60. StartScreenDrawCallback callback);
  61. /** Set StartScreen context
  62. *
  63. * @param instance StartScreen instance
  64. * @param context context pointer, will be passed to callback
  65. */
  66. void start_screen_set_context(StartScreen* instance, void* context);
  67. // Maybe have it function similar to widget where you can attach string elements ect
  68. // Right now we will just have a Header, text, and icon similar to popup
  69. /** Set Text1 Element
  70. *
  71. * @param instance StartScreen instance
  72. * @param x x coordinate
  73. * @param y y coordinate
  74. * @param horizontal Align instance
  75. * @param vertical Align instance
  76. * @param font Font instance
  77. * @param[in] text The text
  78. */
  79. void start_screen_set_text1(
  80. StartScreen* instance,
  81. uint8_t x,
  82. uint8_t y,
  83. Align horizontal,
  84. Align vertical,
  85. Font font,
  86. const char* text);
  87. /** Set Text2 Element
  88. *
  89. * @param instance StartScreen instance
  90. * @param x x coordinate
  91. * @param y y coordinate
  92. * @param horizontal Align instance
  93. * @param vertical Align instance
  94. * @param font Font instance
  95. * @param[in] text The text
  96. */
  97. void start_screen_set_text2(
  98. StartScreen* instance,
  99. uint8_t x,
  100. uint8_t y,
  101. Align horizontal,
  102. Align vertical,
  103. Font font,
  104. const char* text);
  105. /** Set Text3 Element
  106. *
  107. * @param instance StartScreen instance
  108. * @param x x coordinate
  109. * @param y y coordinate
  110. * @param horizontal Align instance
  111. * @param vertical Align instance
  112. * @param font Font instance
  113. * @param[in] text The text
  114. */
  115. void start_screen_set_text3(
  116. StartScreen* instance,
  117. uint8_t x,
  118. uint8_t y,
  119. Align horizontal,
  120. Align vertical,
  121. Font font,
  122. const char* text);
  123. /** Set Icon Animation Element
  124. *
  125. * @param instance StartScreen instance
  126. * @param x top left x coordinate
  127. * @param y top left y coordinate
  128. * @param animation IconAnimation instance
  129. */
  130. void start_screen_set_icon_animation(
  131. StartScreen* instance,
  132. uint8_t x,
  133. uint8_t y,
  134. const Icon* animation);
  135. #ifdef __cplusplus
  136. }
  137. #endif
  138. #endif