Add editor panel host lifecycle contract
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Core/UIEditorPanelRegistry.h>
|
||||
#include <XCEditor/Core/UIEditorWorkspaceSession.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace XCEngine::UI::Editor {
|
||||
|
||||
enum class UIEditorPanelHostLifecycleEventKind : std::uint8_t {
|
||||
Attached = 0,
|
||||
Detached,
|
||||
Shown,
|
||||
Hidden,
|
||||
Activated,
|
||||
Deactivated,
|
||||
FocusGained,
|
||||
FocusLost
|
||||
};
|
||||
|
||||
std::string_view GetUIEditorPanelHostLifecycleEventKindName(
|
||||
UIEditorPanelHostLifecycleEventKind kind);
|
||||
|
||||
struct UIEditorPanelHostState {
|
||||
std::string panelId = {};
|
||||
bool attached = false;
|
||||
bool visible = false;
|
||||
bool active = false;
|
||||
bool focused = false;
|
||||
};
|
||||
|
||||
struct UIEditorPanelHostLifecycleEvent {
|
||||
UIEditorPanelHostLifecycleEventKind kind = UIEditorPanelHostLifecycleEventKind::Attached;
|
||||
std::string panelId = {};
|
||||
};
|
||||
|
||||
struct UIEditorPanelHostLifecycleState {
|
||||
std::vector<UIEditorPanelHostState> panelStates = {};
|
||||
};
|
||||
|
||||
struct UIEditorPanelHostLifecycleRequest {
|
||||
std::string focusedPanelId = {};
|
||||
};
|
||||
|
||||
struct UIEditorPanelHostLifecycleFrame {
|
||||
std::vector<UIEditorPanelHostState> panelStates = {};
|
||||
std::vector<UIEditorPanelHostLifecycleEvent> events = {};
|
||||
};
|
||||
|
||||
const UIEditorPanelHostState* FindUIEditorPanelHostState(
|
||||
const UIEditorPanelHostLifecycleState& state,
|
||||
std::string_view panelId);
|
||||
|
||||
const UIEditorPanelHostState* FindUIEditorPanelHostState(
|
||||
const UIEditorPanelHostLifecycleFrame& frame,
|
||||
std::string_view panelId);
|
||||
|
||||
UIEditorPanelHostLifecycleFrame UpdateUIEditorPanelHostLifecycle(
|
||||
UIEditorPanelHostLifecycleState& state,
|
||||
const UIEditorPanelRegistry& panelRegistry,
|
||||
const UIEditorWorkspaceModel& workspace,
|
||||
const UIEditorWorkspaceSession& session,
|
||||
const UIEditorPanelHostLifecycleRequest& request = {});
|
||||
|
||||
} // namespace XCEngine::UI::Editor
|
||||
Reference in New Issue
Block a user