gui.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /**
  2. * @file gui.h
  3. * GUI: main API
  4. */
  5. #pragma once
  6. #include "view_port.h"
  7. #include "canvas.h"
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. /** Gui layers */
  12. typedef enum {
  13. GuiLayerNone, /**< Special layer for internal use only */
  14. GuiLayerStatusBarLeft, /**< Status bar left-side layer, auto-layout */
  15. GuiLayerStatusBarRight, /**< Status bar right-side layer, auto-layout */
  16. GuiLayerMain, /**< Main layer, status bar is shown */
  17. GuiLayerFullscreen, /**< Fullscreen layer */
  18. GuiLayerMAX /**< Don't use or move, special value */
  19. } GuiLayer;
  20. /** Gui Canvas Commit Callback */
  21. typedef void (*GuiCanvasCommitCallback)(uint8_t* data, size_t size, void* context);
  22. typedef struct Gui Gui;
  23. /** Add view_port to view_port tree
  24. *
  25. * @remark thread safe
  26. *
  27. * @param gui Gui instance
  28. * @param view_port ViewPort instance
  29. * @param[in] layer GuiLayer where to place view_port
  30. */
  31. void gui_add_view_port(Gui* gui, ViewPort* view_port, GuiLayer layer);
  32. /** Remove view_port from rendering tree
  33. *
  34. * @remark thread safe
  35. *
  36. * @param gui Gui instance
  37. * @param view_port ViewPort instance
  38. */
  39. void gui_remove_view_port(Gui* gui, ViewPort* view_port);
  40. /** Send ViewPort to the front
  41. *
  42. * Places selected ViewPort to the top of the drawing stack
  43. *
  44. * @param gui Gui instance
  45. * @param view_port ViewPort instance
  46. */
  47. void gui_view_port_send_to_front(Gui* gui, ViewPort* view_port);
  48. /** Send ViewPort to the back
  49. *
  50. * Places selected ViewPort to the bottom of the drawing stack
  51. *
  52. * @param gui Gui instance
  53. * @param view_port ViewPort instance
  54. */
  55. void gui_view_port_send_to_back(Gui* gui, ViewPort* view_port);
  56. /** Set gui canvas commit callback
  57. *
  58. * This callback will be called upon Canvas commit Callback dispatched from GUI
  59. * thread and is time critical
  60. *
  61. * @param gui Gui instance
  62. * @param callback GuiCanvasCommitCallback
  63. */
  64. void gui_set_framebuffer_callback(Gui* gui, GuiCanvasCommitCallback callback);
  65. /** Set gui canvas commit callback context
  66. *
  67. * @param gui Gui instance
  68. * @param context pointer to context
  69. */
  70. void gui_set_framebuffer_callback_context(Gui* gui, void* context);
  71. #ifdef __cplusplus
  72. }
  73. #endif