gui.h 1.8 KB

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