elements.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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.
  9. * width 3px, height equal to canvas height
  10. * @param pos - current element of total elements
  11. * @param total - total elements
  12. */
  13. void elements_scrollbar(Canvas* canvas, uint8_t pos, uint8_t total);
  14. /*
  15. * Draw rounded frame
  16. * @param x, y - top left corner coordinates
  17. * @param width, height - frame width and height
  18. */
  19. void elements_frame(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height);
  20. /*
  21. * Draw button in left corner
  22. * @param str - button text
  23. */
  24. void elements_button_left(Canvas* canvas, const char* str);
  25. /*
  26. * Draw button in right corner
  27. * @param str - button text
  28. */
  29. void elements_button_right(Canvas* canvas, const char* str);
  30. /*
  31. * Draw button in center
  32. * @param str - button text
  33. */
  34. void elements_button_center(Canvas* canvas, const char* str);
  35. /*
  36. * Draw aligned multiline text
  37. * @param x, y - coordinates based on align param
  38. * @param horizontal, vertical - aligment of multiline text
  39. * @param text - string (possible multiline)
  40. */
  41. void elements_multiline_text_aligned(
  42. Canvas* canvas,
  43. uint8_t x,
  44. uint8_t y,
  45. Align horizontal,
  46. Align vertical,
  47. const char* text);
  48. /*
  49. * Draw multiline text
  50. * @param x, y - top left corner coordinates
  51. * @param text - string (possible multiline)
  52. */
  53. void elements_multiline_text(Canvas* canvas, uint8_t x, uint8_t y, const char* text);
  54. /*
  55. * Draw framed multiline text
  56. * @param x, y - top left corner coordinates
  57. * @param text - string (possible multiline)
  58. */
  59. void elements_multiline_text_framed(Canvas* canvas, uint8_t x, uint8_t y, const char* text);
  60. /*
  61. * Draw framed multiline text
  62. * @param x, y - top left corner coordinates
  63. * @param text - string (possible multiline)
  64. */
  65. void elements_multiline_text_framed(Canvas* canvas, uint8_t x, uint8_t y, const char* text);
  66. /*
  67. * Draw slightly rounded frame
  68. * @param x, y - top left corner coordinates
  69. * @param width, height - size of frame
  70. */
  71. void elements_slightly_rounded_frame(
  72. Canvas* canvas,
  73. uint8_t x,
  74. uint8_t y,
  75. uint8_t width,
  76. uint8_t height);
  77. #ifdef __cplusplus
  78. }
  79. #endif