Files
XCEngine/new_editor/app/Features/Inspector/InspectorPanel.h

72 lines
2.7 KiB
C++

#pragma once
#include "Features/Inspector/InspectorPresentationModel.h"
#include "Features/Inspector/InspectorSubject.h"
#include "Commands/EditorEditCommandRoute.h"
#include <XCEditor/Fields/UIEditorPropertyGridInteraction.h>
#include <XCEditor/Panels/UIEditorPanelContentHost.h>
#include <XCEngine/UI/DrawData.h>
#include <XCEngine/UI/Widgets/UIExpansionModel.h>
#include <XCEngine/UI/Widgets/UIPropertyEditModel.h>
#include <XCEngine/UI/Widgets/UISelectionModel.h>
#include <string>
#include <unordered_set>
#include <vector>
namespace XCEngine::UI::Editor::App {
class EditorCommandFocusService;
class EditorSceneRuntime;
class InspectorPanel final : public EditorEditCommandRoute {
public:
void SetCommandFocusService(EditorCommandFocusService* commandFocusService);
void Update(
const EditorSession& session,
EditorSceneRuntime& sceneRuntime,
const UIEditorPanelContentHostFrame& contentHostFrame,
const std::vector<::XCEngine::UI::UIInputEvent>& inputEvents,
bool allowInteraction,
bool panelActive);
void Append(::XCEngine::UI::UIDrawList& drawList) const;
UIEditorHostCommandEvaluationResult EvaluateEditCommand(
std::string_view commandId) const override;
UIEditorHostCommandDispatchResult DispatchEditCommand(
std::string_view commandId) override;
private:
const UIEditorPanelContentHostPanelState* FindMountedInspectorPanel(
const UIEditorPanelContentHostFrame& contentHostFrame) const;
void ResetPanelState();
void ResetInteractionState();
void SyncExpansionState(bool subjectChanged);
void SyncSelectionState();
std::string BuildSubjectKey() const;
::XCEngine::UI::UIRect BuildGridBounds() const;
void ClaimCommandFocus(
const std::vector<::XCEngine::UI::UIInputEvent>& inputEvents,
bool allowInteraction);
const InspectorPresentationComponentBinding* FindSelectedComponentBinding() const;
bool ApplyChangedField(std::string_view fieldId);
EditorCommandFocusService* m_commandFocusService = nullptr;
EditorSceneRuntime* m_sceneRuntime = nullptr;
bool m_visible = false;
::XCEngine::UI::UIRect m_bounds = {};
InspectorSubject m_subject = {};
std::string m_subjectKey = {};
InspectorPresentationModel m_presentation = {};
::XCEngine::UI::Widgets::UISelectionModel m_fieldSelection = {};
::XCEngine::UI::Widgets::UIExpansionModel m_sectionExpansion = {};
::XCEngine::UI::Widgets::UIPropertyEditModel m_propertyEditModel = {};
UIEditorPropertyGridInteractionState m_interactionState = {};
UIEditorPropertyGridInteractionFrame m_gridFrame = {};
std::unordered_set<std::string> m_knownSectionIds = {};
};
} // namespace XCEngine::UI::Editor::App