51 lines
1.5 KiB
C++
51 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include "UtilityWindows/EditorUtilityWindowPanel.h"
|
|
|
|
#include <cstddef>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace XCEngine::Components {
|
|
class GameObject;
|
|
}
|
|
|
|
namespace XCEngine::UI::Editor::App {
|
|
|
|
class AddComponentPanel final : public EditorUtilityWindowPanel {
|
|
public:
|
|
std::string_view GetDrawListId() const override {
|
|
return "XCEditorUtility.AddComponent";
|
|
}
|
|
void ResetInteractionState() override;
|
|
void Update(
|
|
EditorContext& context,
|
|
const EditorUtilityWindowHostContext& hostContext,
|
|
const std::vector<::XCEngine::UI::UIInputEvent>& inputEvents) override;
|
|
void Append(::XCEngine::UI::UIDrawList& drawList) const override;
|
|
|
|
private:
|
|
struct EntryPresentation {
|
|
std::string componentTypeName = {};
|
|
std::string displayName = {};
|
|
std::string disabledReason = {};
|
|
::XCEngine::UI::UIRect rect = {};
|
|
bool enabled = false;
|
|
};
|
|
|
|
void ResetPanelState();
|
|
void RebuildEntries(const ::XCEngine::Components::GameObject* gameObject);
|
|
bool TryActivateEntry(EditorContext& context, std::size_t entryIndex);
|
|
std::size_t HitTestEntry(const ::XCEngine::UI::UIPoint& point) const;
|
|
|
|
bool m_visible = false;
|
|
bool m_hasTarget = false;
|
|
::XCEngine::UI::UIRect m_bounds = {};
|
|
std::string m_targetDisplayName = {};
|
|
std::vector<EntryPresentation> m_entries = {};
|
|
std::size_t m_hoveredEntryIndex = static_cast<std::size_t>(-1);
|
|
std::size_t m_pressedEntryIndex = static_cast<std::size_t>(-1);
|
|
};
|
|
|
|
} // namespace XCEngine::UI::Editor::App
|