gui.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #pragma once
  2. #include "widget.h"
  3. #include "canvas.h"
  4. #define GUI_DISPLAY_WIDTH 128
  5. #define GUI_DISPLAY_HEIGHT 64
  6. #define GUI_STATUS_BAR_X 0
  7. #define GUI_STATUS_BAR_Y 0
  8. #define GUI_STATUS_BAR_WIDTH GUI_DISPLAY_WIDTH
  9. #define GUI_STATUS_BAR_HEIGHT 8
  10. #define GUI_MAIN_X 0
  11. #define GUI_MAIN_Y 9
  12. #define GUI_MAIN_WIDTH GUI_DISPLAY_WIDTH
  13. #define GUI_MAIN_HEIGHT (GUI_DISPLAY_HEIGHT - GUI_MAIN_Y)
  14. typedef enum {
  15. GuiLayerNone, /* Special layer for internal use only */
  16. GuiLayerStatusBarLeft, /* Status bar left-side widget layer, auto-layout */
  17. GuiLayerStatusBarRight, /* Status bar right-side widget layer, auto-layout */
  18. GuiLayerMain, /* Main widget layer, status bar is shown */
  19. GuiLayerFullscreen, /* Fullscreen widget layer */
  20. GuiLayerMAX /* Don't use or move, special value */
  21. } GuiLayer;
  22. typedef struct Gui Gui;
  23. /*
  24. * Add widget to widget tree
  25. * @remarks thread safe
  26. */
  27. void gui_add_widget(Gui* gui, Widget* widget, GuiLayer layer);
  28. /*
  29. * Remove widget from rendering tree
  30. * @remarks thread safe
  31. */
  32. void gui_remove_widget(Gui* gui, Widget* widget);