Files
XCEngine/new_editor/app/Composition/EditorShellRuntimeRendering.cpp

82 lines
2.8 KiB
C++

#include "Composition/EditorShellRuntimeSupport.h"
#include <XCEditor/Foundation/UIEditorTheme.h>
#include <algorithm>
namespace XCEngine::UI::Editor::App::RuntimeSupport {
using ::XCEngine::UI::UIDrawList;
UIEditorShellComposeModel BuildShellComposeModelFromFrame(
const UIEditorShellInteractionFrame& frame) {
UIEditorShellComposeModel model = {};
model.menuBarItems = frame.request.menuBarItems;
model.toolbarButtons = frame.model.toolbarButtons;
model.statusSegments = frame.model.statusSegments;
model.workspacePresentations = frame.model.workspacePresentations;
return model;
}
void AppendShellPopups(
UIDrawList& drawList,
const UIEditorShellInteractionFrame& frame,
const UIEditorShellInteractionPalette& palette,
const UIEditorShellInteractionMetrics& metrics) {
const std::size_t popupCount =
(std::min)(frame.request.popupRequests.size(), frame.popupFrames.size());
for (std::size_t index = 0; index < popupCount; ++index) {
const UIEditorShellInteractionPopupRequest& popupRequest =
frame.request.popupRequests[index];
const UIEditorShellInteractionPopupFrame& popupFrame =
frame.popupFrames[index];
Widgets::AppendUIEditorMenuPopupBackground(
drawList,
popupRequest.layout,
popupRequest.widgetItems,
popupFrame.popupState,
palette.popupPalette,
metrics.popupMetrics);
Widgets::AppendUIEditorMenuPopupForeground(
drawList,
popupRequest.layout,
popupRequest.widgetItems,
popupFrame.popupState,
palette.popupPalette,
metrics.popupMetrics);
}
}
} // namespace XCEngine::UI::Editor::App::RuntimeSupport
namespace XCEngine::UI::Editor::App {
using ::XCEngine::UI::UIDrawList;
using namespace RuntimeSupport;
void EditorShellRuntime::RenderRequestedViewports(
const ::XCEngine::Rendering::RenderContext& renderContext) {
m_viewportHostService.RenderRequestedViewports(renderContext);
}
void EditorShellRuntime::Append(UIDrawList& drawList) const {
const auto& metrics = ResolveUIEditorShellInteractionMetrics();
const auto& palette = ResolveUIEditorShellInteractionPalette();
const UIEditorShellComposeModel shellComposeModel =
BuildShellComposeModelFromFrame(m_shellFrame);
AppendUIEditorShellCompose(
drawList,
m_shellFrame.shellFrame,
shellComposeModel,
m_shellInteractionState.composeState,
palette.shellPalette,
metrics.shellMetrics);
m_consolePanel.Append(drawList);
m_hierarchyPanel.Append(drawList);
m_inspectorPanel.Append(drawList);
m_projectPanel.Append(drawList);
AppendShellPopups(drawList, m_shellFrame, palette, metrics);
}
} // namespace XCEngine::UI::Editor::App