ui_controls.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #pragma once
  2. #include <inttypes.h>
  3. #include <gui/gui.h>
  4. #define UI_CONTROL_VSCROLL_WIDTH (3)
  5. /**
  6. * @brief Renders TextBox control
  7. * @param canvas canvas to render control at
  8. * @param y vertical position of a control to be rendered at
  9. * @param text text to be rendered inside control
  10. * @param is_selected whether control should be rendered as focused or not
  11. */
  12. void ui_control_text_box_render(
  13. Canvas* const canvas,
  14. int16_t y,
  15. const char* text,
  16. bool is_selected);
  17. /**
  18. * @brief Renders Button control
  19. * @param canvas canvas to render control at
  20. * @param x horizontal position of a control to be rendered at
  21. * @param y vertical position of a control to be rendered at
  22. * @param width control width
  23. * @param height control height
  24. * @param text text to be rendered inside control
  25. * @param is_selected whether control should be rendered as focused or not
  26. */
  27. void ui_control_button_render(
  28. Canvas* const canvas,
  29. int16_t x,
  30. int16_t y,
  31. uint8_t width,
  32. uint8_t height,
  33. const char* text,
  34. bool is_selected);
  35. /**
  36. * @brief Renders Select control
  37. * @param canvas canvas to render control at
  38. * @param x horizontal position of a control to be rendered at
  39. * @param y vertical position of a control to be rendered at
  40. * @param width control width
  41. * @param text text to be rendered inside control
  42. * @param is_selected whether control should be rendered as focused or not
  43. */
  44. void ui_control_select_render(
  45. Canvas* const canvas,
  46. int16_t x,
  47. int16_t y,
  48. uint8_t width,
  49. const char* text,
  50. bool is_selected);
  51. /**
  52. * @brief Renders vertical scroll bar
  53. * @param canvas canvas to render control at
  54. * @param x horizontal position of a control to be rendered at
  55. * @param y vertical position of a control to be rendered at
  56. * @param height control height
  57. * @param position current position
  58. * @param max_position maximal position
  59. */
  60. void ui_control_vscroll_render(
  61. Canvas* const canvas,
  62. uint8_t x,
  63. uint8_t y,
  64. uint8_t height,
  65. uint8_t position,
  66. uint8_t max_position);