Refine editor action shell and add regression tests
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
#include "Actions/MainMenuActionRouter.h"
|
||||
#include "MenuBar.h"
|
||||
#include "Core/IEditorContext.h"
|
||||
#include "UI/UI.h"
|
||||
#include <imgui.h>
|
||||
|
||||
namespace XCEngine {
|
||||
@@ -12,61 +11,13 @@ namespace Editor {
|
||||
MenuBar::MenuBar() : Panel("MenuBar") {}
|
||||
|
||||
void MenuBar::Render() {
|
||||
HandleShortcuts();
|
||||
|
||||
if (ImGui::BeginMainMenuBar()) {
|
||||
ShowFileMenu();
|
||||
ShowEditMenu();
|
||||
ShowViewMenu();
|
||||
ShowHelpMenu();
|
||||
RenderSceneStatus();
|
||||
ImGui::EndMainMenuBar();
|
||||
}
|
||||
|
||||
RenderAboutPopup();
|
||||
}
|
||||
|
||||
void MenuBar::HandleShortcuts() {
|
||||
if (!m_context) {
|
||||
return;
|
||||
}
|
||||
|
||||
Actions::HandleMainMenuShortcuts(*m_context, Actions::GlobalShortcutContext());
|
||||
}
|
||||
|
||||
void MenuBar::ShowFileMenu() {
|
||||
UI::DrawMenuScope("File", [&]() {
|
||||
Actions::DrawFileMenuActions(*m_context);
|
||||
});
|
||||
}
|
||||
|
||||
void MenuBar::ShowEditMenu() {
|
||||
UI::DrawMenuScope("Edit", [&]() {
|
||||
Actions::DrawEditActions(*m_context);
|
||||
});
|
||||
}
|
||||
|
||||
void MenuBar::ShowViewMenu() {
|
||||
UI::DrawMenuScope("View", [&]() {
|
||||
Actions::DrawViewMenuActions(*m_context);
|
||||
});
|
||||
}
|
||||
|
||||
void MenuBar::ShowHelpMenu() {
|
||||
UI::DrawMenuScope("Help", [&]() {
|
||||
Actions::DrawHelpMenuActions(m_aboutPopup);
|
||||
});
|
||||
}
|
||||
|
||||
void MenuBar::RenderAboutPopup() {
|
||||
UI::DrawEditorAboutDialog(m_context, m_aboutPopup);
|
||||
}
|
||||
|
||||
void MenuBar::RenderSceneStatus() {
|
||||
if (!m_context) {
|
||||
return;
|
||||
}
|
||||
UI::DrawSceneStatusWidget(*m_context);
|
||||
Actions::HandleMenuBarShortcuts(*m_context);
|
||||
Actions::DrawMainMenuBar(*m_context, m_aboutPopup);
|
||||
Actions::DrawMainMenuOverlays(m_context, m_aboutPopup);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user