Files
XCEngine/editor/app/Windowing/Content/EditorWindowContentFactory.cpp

55 lines
1.9 KiB
C++

#include "Windowing/Content/EditorWindowContentFactory.h"
#include "Windowing/Content/EditorUtilityWindowContentController.h"
#include "Windowing/Content/EditorWorkspaceWindowContentController.h"
#include <XCEditor/Windowing/System/EditorWindowSystem.h>
#include <utility>
namespace XCEngine::UI::Editor::App {
namespace {
class DefaultEditorWindowContentFactory final : public EditorWindowContentFactory {
public:
DefaultEditorWindowContentFactory(
EditorWindowSystem& windowSystem,
EditorWorkspacePanelRuntimeSetFactory workspacePanelFactory)
: m_windowSystem(windowSystem)
, m_workspacePanelFactory(std::move(workspacePanelFactory)) {}
std::unique_ptr<EditorWindowContentController> CreateWorkspaceContentController(
const UIEditorWindowWorkspaceState& windowState) const override {
EditorWorkspacePanelRuntimeSet workspacePanels =
m_workspacePanelFactory
? m_workspacePanelFactory()
: EditorWorkspacePanelRuntimeSet{};
return CreateEditorWorkspaceWindowContentController(
windowState,
m_windowSystem,
std::move(workspacePanels));
}
std::unique_ptr<EditorWindowContentController> CreateUtilityContentController(
const EditorUtilityWindowDescriptor& descriptor) const override {
return CreateEditorUtilityWindowContentController(descriptor);
}
private:
EditorWindowSystem& m_windowSystem;
EditorWorkspacePanelRuntimeSetFactory m_workspacePanelFactory = {};
};
} // namespace
std::unique_ptr<EditorWindowContentFactory> CreateDefaultEditorWindowContentFactory(
EditorWindowSystem& windowSystem,
EditorWorkspacePanelRuntimeSetFactory workspacePanelFactory) {
return std::make_unique<DefaultEditorWindowContentFactory>(
windowSystem,
std::move(workspacePanelFactory));
}
} // namespace XCEngine::UI::Editor::App