start_screen.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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(
  49. StartScreen* instance,
  50. StartScreenInputCallback callback);
  51. /** Set Additional draw callback
  52. *
  53. * Use this as a secondary callback to draw on the canvas.
  54. * This callback function will happen after drawing of the established
  55. * GUI elements in the view such as the icons, text, frame, ect.
  56. *
  57. * @param instance StartScreen instance
  58. * @param callback StartScreenDrawCallback callback
  59. */
  60. void start_screen_set_secondary_draw_callback(
  61. StartScreen* instance,
  62. StartScreenDrawCallback callback);
  63. /** Set StartScreen context
  64. *
  65. * @param instance StartScreen instance
  66. * @param context context pointer, will be passed to callback
  67. */
  68. void start_screen_set_context(StartScreen* instance, void* context);
  69. // Maybe have it function similar to widget where you can attach string elements ect
  70. // Right now we will just have a Header, text, and icon similar to popup
  71. /** Set Text1 Element
  72. *
  73. * @param instance StartScreen instance
  74. * @param x x coordinate
  75. * @param y y coordinate
  76. * @param horizontal Align instance
  77. * @param vertical Align instance
  78. * @param font Font instance
  79. * @param[in] text The text
  80. */
  81. void start_screen_set_text1(
  82. StartScreen* instance,
  83. uint8_t x,
  84. uint8_t y,
  85. Align horizontal,
  86. Align vertical,
  87. Font font,
  88. const char* text);
  89. /** Set Text2 Element
  90. *
  91. * @param instance StartScreen instance
  92. * @param x x coordinate
  93. * @param y y coordinate
  94. * @param horizontal Align instance
  95. * @param vertical Align instance
  96. * @param font Font instance
  97. * @param[in] text The text
  98. */
  99. void start_screen_set_text2(
  100. StartScreen* instance,
  101. uint8_t x,
  102. uint8_t y,
  103. Align horizontal,
  104. Align vertical,
  105. Font font,
  106. const char* text);
  107. /** Set Text3 Element
  108. *
  109. * @param instance StartScreen instance
  110. * @param x x coordinate
  111. * @param y y coordinate
  112. * @param horizontal Align instance
  113. * @param vertical Align instance
  114. * @param font Font instance
  115. * @param[in] text The text
  116. */
  117. void start_screen_set_text3(
  118. StartScreen* instance,
  119. uint8_t x,
  120. uint8_t y,
  121. Align horizontal,
  122. Align vertical,
  123. Font font,
  124. const char* text);
  125. /** Set Icon Animation Element
  126. *
  127. * @param instance StartScreen instance
  128. * @param x top left x coordinate
  129. * @param y top left y coordinate
  130. * @param animation IconAnimation instance
  131. */
  132. void start_screen_set_icon_animation(StartScreen* instance, uint8_t x, uint8_t y, const Icon* animation);
  133. #ifdef __cplusplus
  134. }
  135. #endif
  136. #endif