gui.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. GuiLayerDesktop, /**< Desktop layer for internal use. Like fullscreen but with status bar */
  14. GuiLayerWindow, /**< Window layer, status bar is shown */
  15. GuiLayerStatusBarLeft, /**< Status bar left-side layer, auto-layout */
  16. GuiLayerStatusBarRight, /**< Status bar right-side layer, auto-layout */
  17. GuiLayerFullscreen, /**< Fullscreen layer, no status bar */
  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. * @param context GuiCanvasCommitCallback context
  64. */
  65. void gui_set_framebuffer_callback(Gui* gui, GuiCanvasCommitCallback callback, void* context);
  66. #ifdef __cplusplus
  67. }
  68. #endif