Files
XCEngine/new_editor/include/XCEditor/Shell/UIEditorShellInteraction.h

190 lines
7.1 KiB
C
Raw Normal View History

2026-04-07 10:16:55 +08:00
#pragma once
2026-04-10 00:41:28 +08:00
#include <XCEditor/Shell/UIEditorMenuModel.h>
#include <XCEditor/Shell/UIEditorMenuSession.h>
#include <XCEditor/Shell/UIEditorShellCompose.h>
#include <XCEditor/Shell/UIEditorWorkspaceController.h>
#include <XCEditor/Shell/UIEditorWorkspaceInteraction.h>
#include <XCEditor/Shell/UIEditorMenuPopup.h>
2026-04-07 10:16:55 +08:00
#include <XCEngine/UI/DrawData.h>
#include <string>
#include <vector>
namespace XCEngine::UI::Editor {
2026-04-07 12:09:26 +08:00
struct UIEditorShellInteractionDefinition {
UIEditorMenuModel menuModel = {};
std::vector<Widgets::UIEditorStatusBarSegment> statusSegments = {};
std::vector<UIEditorWorkspacePanelPresentationModel> workspacePresentations = {};
};
2026-04-07 10:16:55 +08:00
struct UIEditorShellInteractionModel {
UIEditorResolvedMenuModel resolvedMenuModel = {};
std::vector<Widgets::UIEditorStatusBarSegment> statusSegments = {};
std::vector<UIEditorWorkspacePanelPresentationModel> workspacePresentations = {};
};
struct UIEditorShellInteractionState {
UIEditorShellComposeState composeState = {};
UIEditorMenuSession menuSession = {};
UIEditorWorkspaceInteractionState workspaceInteractionState = {};
2026-04-07 10:16:55 +08:00
::XCEngine::UI::UIPoint pointerPosition = {};
bool focused = false;
bool hasPointerPosition = false;
};
struct UIEditorShellInteractionMetrics {
UIEditorShellComposeMetrics shellMetrics = {};
Widgets::UIEditorMenuPopupMetrics popupMetrics = {};
};
struct UIEditorShellInteractionPalette {
UIEditorShellComposePalette shellPalette = {};
Widgets::UIEditorMenuPopupPalette popupPalette = {};
};
struct UIEditorShellInteractionServices {
const UIEditorCommandDispatcher* commandDispatcher = nullptr;
2026-04-07 12:09:26 +08:00
const UIEditorShortcutManager* shortcutManager = nullptr;
};
2026-04-07 10:16:55 +08:00
struct UIEditorShellInteractionMenuButtonRequest {
std::string menuId = {};
std::string label = {};
std::string popupId = {};
::XCEngine::UI::UIRect rect = {};
::XCEngine::UI::UIInputPath path = {};
bool enabled = true;
};
struct UIEditorShellInteractionPopupItemRequest {
std::string popupId = {};
std::string menuId = {};
std::string itemId = {};
std::string label = {};
std::string commandId = {};
std::string childPopupId = {};
::XCEngine::UI::UIRect rect = {};
::XCEngine::UI::UIInputPath path = {};
UIEditorMenuItemKind kind = UIEditorMenuItemKind::Command;
bool enabled = false;
bool checked = false;
bool hasSubmenu = false;
};
struct UIEditorShellInteractionPopupRequest {
std::string popupId = {};
std::string menuId = {};
std::string sourceItemId = {};
::XCEngine::UI::Widgets::UIPopupOverlayEntry overlayEntry = {};
::XCEngine::UI::Widgets::UIPopupPlacementResult placement = {};
Widgets::UIEditorMenuPopupLayout layout = {};
std::vector<UIEditorResolvedMenuItem> resolvedItems = {};
std::vector<Widgets::UIEditorMenuPopupItem> widgetItems = {};
std::vector<UIEditorShellInteractionPopupItemRequest> itemRequests = {};
};
struct UIEditorShellInteractionRequest {
UIEditorShellComposeRequest shellRequest = {};
std::vector<Widgets::UIEditorMenuBarItem> menuBarItems = {};
std::vector<UIEditorShellInteractionMenuButtonRequest> menuButtons = {};
std::vector<UIEditorShellInteractionPopupRequest> popupRequests = {};
};
struct UIEditorShellInteractionResult {
bool consumed = false;
bool menuModal = false;
bool workspaceInputSuppressed = false;
bool requestPointerCapture = false;
bool releasePointerCapture = false;
bool viewportInteractionChanged = false;
2026-04-07 10:16:55 +08:00
bool commandTriggered = false;
bool commandDispatched = false;
2026-04-07 10:16:55 +08:00
std::string menuId = {};
std::string popupId = {};
std::string itemId = {};
std::string commandId = {};
std::string viewportPanelId = {};
UIEditorViewportInputBridgeFrame viewportInputFrame = {};
2026-04-07 10:16:55 +08:00
UIEditorMenuSessionMutationResult menuMutation = {};
UIEditorCommandDispatchResult commandDispatchResult = {};
UIEditorWorkspaceInteractionResult workspaceResult = {};
2026-04-07 10:16:55 +08:00
};
struct UIEditorShellInteractionPopupFrame {
std::string popupId = {};
Widgets::UIEditorMenuPopupState popupState = {};
};
struct UIEditorShellInteractionFrame {
2026-04-07 12:09:26 +08:00
UIEditorShellInteractionModel model = {};
2026-04-07 10:16:55 +08:00
UIEditorShellInteractionRequest request = {};
UIEditorShellComposeFrame shellFrame = {};
UIEditorWorkspaceInteractionFrame workspaceInteractionFrame = {};
2026-04-07 10:16:55 +08:00
std::vector<UIEditorShellInteractionPopupFrame> popupFrames = {};
UIEditorShellInteractionResult result = {};
std::string openRootMenuId = {};
std::string hoveredMenuId = {};
std::string hoveredPopupId = {};
std::string hoveredItemId = {};
bool focused = false;
};
2026-04-07 12:09:26 +08:00
UIEditorShellInteractionModel ResolveUIEditorShellInteractionModel(
const UIEditorWorkspaceController& controller,
const UIEditorShellInteractionDefinition& definition,
const UIEditorShellInteractionServices& services = {});
2026-04-07 10:16:55 +08:00
UIEditorShellInteractionRequest ResolveUIEditorShellInteractionRequest(
const ::XCEngine::UI::UIRect& bounds,
const UIEditorWorkspaceController& controller,
2026-04-07 10:16:55 +08:00
const UIEditorShellInteractionModel& model,
const UIEditorShellInteractionState& state = {},
const UIEditorShellInteractionMetrics& metrics = {},
const UIEditorShellInteractionServices& services = {});
2026-04-07 10:16:55 +08:00
UIEditorShellInteractionFrame UpdateUIEditorShellInteraction(
UIEditorShellInteractionState& state,
UIEditorWorkspaceController& controller,
2026-04-07 10:16:55 +08:00
const ::XCEngine::UI::UIRect& bounds,
const UIEditorShellInteractionModel& model,
const std::vector<::XCEngine::UI::UIInputEvent>& inputEvents,
const UIEditorShellInteractionServices& services = {},
2026-04-07 10:16:55 +08:00
const UIEditorShellInteractionMetrics& metrics = {});
2026-04-07 12:09:26 +08:00
UIEditorShellInteractionRequest ResolveUIEditorShellInteractionRequest(
const ::XCEngine::UI::UIRect& bounds,
const UIEditorWorkspaceController& controller,
const UIEditorShellInteractionDefinition& definition,
const UIEditorShellInteractionState& state = {},
const UIEditorShellInteractionMetrics& metrics = {},
const UIEditorShellInteractionServices& services = {});
UIEditorShellInteractionFrame UpdateUIEditorShellInteraction(
UIEditorShellInteractionState& state,
UIEditorWorkspaceController& controller,
const ::XCEngine::UI::UIRect& bounds,
const UIEditorShellInteractionDefinition& definition,
const std::vector<::XCEngine::UI::UIInputEvent>& inputEvents,
const UIEditorShellInteractionServices& services = {},
const UIEditorShellInteractionMetrics& metrics = {});
2026-04-07 10:16:55 +08:00
void AppendUIEditorShellInteraction(
::XCEngine::UI::UIDrawList& drawList,
const UIEditorShellInteractionFrame& frame,
const UIEditorShellInteractionModel& model,
const UIEditorShellInteractionState& state,
const UIEditorShellInteractionPalette& palette = {},
const UIEditorShellInteractionMetrics& metrics = {});
2026-04-07 12:09:26 +08:00
void AppendUIEditorShellInteraction(
::XCEngine::UI::UIDrawList& drawList,
const UIEditorShellInteractionFrame& frame,
const UIEditorShellInteractionState& state,
const UIEditorShellInteractionPalette& palette = {},
const UIEditorShellInteractionMetrics& metrics = {});
2026-04-07 10:16:55 +08:00
} // namespace XCEngine::UI::Editor