elements.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #pragma once
  2. #include <stdint.h>
  3. #include "canvas.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*
  8. * Draw scrollbar on canvas at specific position.
  9. * @param x - scrollbar position on X axis
  10. * @param y - scrollbar position on Y axis
  11. * @param height - scrollbar height
  12. * @param pos - current element
  13. * @param total - total elements
  14. */
  15. void elements_scrollbar_pos(
  16. Canvas* canvas,
  17. uint8_t x,
  18. uint8_t y,
  19. uint8_t height,
  20. uint16_t pos,
  21. uint16_t total);
  22. /*
  23. * Draw scrollbar on canvas.
  24. * width 3px, height equal to canvas height
  25. * @param pos - current element of total elements
  26. * @param total - total elements
  27. */
  28. void elements_scrollbar(Canvas* canvas, uint8_t pos, uint8_t total);
  29. /*
  30. * Draw rounded frame
  31. * @param x, y - top left corner coordinates
  32. * @param width, height - frame width and height
  33. */
  34. void elements_frame(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height);
  35. /*
  36. * Draw button in left corner
  37. * @param str - button text
  38. */
  39. void elements_button_left(Canvas* canvas, const char* str);
  40. /*
  41. * Draw button in right corner
  42. * @param str - button text
  43. */
  44. void elements_button_right(Canvas* canvas, const char* str);
  45. /*
  46. * Draw button in center
  47. * @param str - button text
  48. */
  49. void elements_button_center(Canvas* canvas, const char* str);
  50. /*
  51. * Draw aligned multiline text
  52. * @param x, y - coordinates based on align param
  53. * @param horizontal, vertical - aligment of multiline text
  54. * @param text - string (possible multiline)
  55. */
  56. void elements_multiline_text_aligned(
  57. Canvas* canvas,
  58. uint8_t x,
  59. uint8_t y,
  60. Align horizontal,
  61. Align vertical,
  62. const char* text);
  63. /*
  64. * Draw multiline text
  65. * @param x, y - top left corner coordinates
  66. * @param text - string (possible multiline)
  67. */
  68. void elements_multiline_text(Canvas* canvas, uint8_t x, uint8_t y, const char* text);
  69. /*
  70. * Draw framed multiline text
  71. * @param x, y - top left corner coordinates
  72. * @param text - string (possible multiline)
  73. */
  74. void elements_multiline_text_framed(Canvas* canvas, uint8_t x, uint8_t y, const char* text);
  75. /*
  76. * Draw framed multiline text
  77. * @param x, y - top left corner coordinates
  78. * @param text - string (possible multiline)
  79. */
  80. void elements_multiline_text_framed(Canvas* canvas, uint8_t x, uint8_t y, const char* text);
  81. /*
  82. * Draw slightly rounded frame
  83. * @param x, y - top left corner coordinates
  84. * @param width, height - size of frame
  85. */
  86. void elements_slightly_rounded_frame(
  87. Canvas* canvas,
  88. uint8_t x,
  89. uint8_t y,
  90. uint8_t width,
  91. uint8_t height);
  92. #ifdef __cplusplus
  93. }
  94. #endif