gui.h 1.1 KB

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