program.hpp 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. struct PanelList : VerticalLayout {
  2. using VerticalLayout::VerticalLayout;
  3. virtual auto show() -> void = 0;
  4. virtual auto hide() -> void = 0;
  5. virtual auto refresh() -> void {}
  6. };
  7. struct PanelItem : VerticalLayout {
  8. using VerticalLayout::VerticalLayout;
  9. virtual auto show() -> void = 0;
  10. virtual auto hide() -> void = 0;
  11. virtual auto refresh() -> void {}
  12. };
  13. using View = HorizontalLayout;
  14. #include "../panel-items/home.hpp"
  15. #include "../panel-items/system-creation.hpp"
  16. #include "../panel-items/system-overview.hpp"
  17. #include "../panel-items/port-connector.hpp"
  18. #include "../panel-items/peripheral-overview.hpp"
  19. #include "../panel-items/input-mapper.hpp"
  20. #include "../panel-items/setting-editor.hpp"
  21. #include "../panel-items/video.hpp"
  22. #include "../panel-items/audio.hpp"
  23. #include "../panel-items/input.hpp"
  24. #include "../panel-items/hotkeys.hpp"
  25. #include "../panel-lists/settings-manager.hpp"
  26. #include "../panel-lists/system-manager.hpp"
  27. #include "../panel-lists/node-manager.hpp"
  28. #include "../panel-lists/port-manager.hpp"
  29. #include "../panel-lists/event-manager.hpp"
  30. struct Program : Window {
  31. Program();
  32. auto resize() -> void;
  33. auto setOverviewMode() -> void;
  34. auto setEmulatorMode() -> void;
  35. auto setPanelList(PanelList&) -> void;
  36. auto setPanelItem(PanelItem&) -> void;
  37. auto refreshPanelList() -> void;
  38. auto showStatus() -> void;
  39. auto hideStatus() -> void;
  40. auto showPanels() -> void;
  41. auto hidePanels() -> void;
  42. MenuBar menuBar{this};
  43. ActionMenu actionMenu{&menuBar};
  44. SystemMenu systemMenu{&menuBar};
  45. SettingsMenu settingsMenu{&menuBar};
  46. ToolsMenu toolsMenu{&menuBar};
  47. HelpMenu helpMenu{&menuBar};
  48. VerticalLayout layout{this};
  49. Viewport viewport{&layout, Size{~0, ~0}, 0};
  50. HorizontalLayout statusLayout{&layout, Size{~0, 0}, 0};
  51. Label statusBefore{&statusLayout, Size{8_sx, ~0}, 0};
  52. Label statusMessage{&statusLayout, Size{~0, ~0}, 0};
  53. Label statusCaption{&statusLayout, Size{100_sx, ~0}, 0};
  54. Label statusAfter{&statusLayout, Size{8_sx, ~0}, 0};
  55. VerticalResizeGrip verticalResizeGrip{&layout, Size{~0, 7}, 0};
  56. HorizontalLayout panelLayout{&layout, Size{~0, 250_sy}, 0};
  57. VerticalLayout panelBlock{&panelLayout, Size{200_sx, ~0}};
  58. ComboButton panelGroup{&panelBlock, Size{~0, 0}};
  59. HorizontalLayout panelLists{&panelBlock, Size{~0, ~0}};
  60. SettingsManager settingsManager{&panelLists};
  61. SystemManager systemManager{&panelLists};
  62. NodeManager nodeManager{&panelLists};
  63. PortManager portManager{&panelLists};
  64. EventManager eventManager{&panelLists};
  65. HorizontalResizeGrip horizontalResizeGrip{&panelLayout, Size{7, ~0}};
  66. Home home{&panelLayout};
  67. SystemCreation systemCreation{&panelLayout};
  68. SystemOverview systemOverview{&panelLayout};
  69. PortConnector portConnector{&panelLayout};
  70. PeripheralOverview peripheralOverview{&panelLayout};
  71. InputMapper inputMapper{&panelLayout};
  72. SettingEditor settingEditor{&panelLayout};
  73. VideoSettings videoSettings{&panelLayout};
  74. AudioSettings audioSettings{&panelLayout};
  75. InputSettings inputSettings{&panelLayout};
  76. HotkeySettings hotkeySettings{&panelLayout};
  77. private:
  78. maybe<PanelList&> activePanelList;
  79. maybe<PanelItem&> activePanelItem;
  80. float verticalResizeHeight = 0;
  81. float horizontalResizeWidth = 0;
  82. float panelHeight = 0;
  83. float statusHeight = 0;
  84. };
  85. namespace Instances { extern Instance<Program> program; }
  86. extern Program& program;
  87. extern ActionMenu& actionMenu;
  88. extern SystemMenu& systemMenu;
  89. extern SettingsMenu& settingsMenu;
  90. extern ToolsMenu& toolsMenu;
  91. extern HelpMenu& helpMenu;
  92. extern SettingsManager& settingsManager;
  93. extern SystemManager& systemManager;
  94. extern NodeManager& nodeManager;
  95. extern PortManager& portManager;
  96. extern EventManager& eventManager;
  97. extern Home& home;
  98. extern SystemCreation& systemCreation;
  99. extern SystemOverview& systemOverview;
  100. extern PortConnector& portConnector;
  101. extern PeripheralOverview& peripheralOverview;
  102. extern InputMapper& inputMapper;
  103. extern SettingEditor& settingEditor;
  104. extern VideoSettings& videoSettings;
  105. extern AudioSettings& audioSettings;
  106. extern InputSettings& inputSettings;
  107. extern HotkeySettings& hotkeySettings;