#pragma once #include #include #include namespace XCEngine { namespace Editor { class IUndoManager; class IComponentEditor { public: virtual ~IComponentEditor() = default; virtual const char* GetComponentTypeName() const = 0; virtual const char* GetDisplayName() const = 0; virtual bool CanEdit(::XCEngine::Components::Component* component) const { return component && component->GetName() == GetComponentTypeName(); } virtual bool Render(::XCEngine::Components::Component* component, IUndoManager* undoManager) = 0; virtual bool ShowInAddComponentMenu() const { return true; } virtual bool CanAddTo(::XCEngine::Components::GameObject* gameObject) const { return false; } virtual const char* GetAddDisabledReason(::XCEngine::Components::GameObject* gameObject) const { (void)gameObject; return nullptr; } virtual ::XCEngine::Components::Component* AddTo(::XCEngine::Components::GameObject* gameObject) const { return gameObject ? ::XCEngine::Components::ComponentFactoryRegistry::Get().CreateComponent(gameObject, GetComponentTypeName()) : nullptr; } virtual bool CanRemove(::XCEngine::Components::Component* component) const { (void)component; return false; } }; } // namespace Editor } // namespace XCEngine