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

190 lines
7.1 KiB
C++

#pragma once
#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>
#include <XCEngine/UI/DrawData.h>
#include <string>
#include <vector>
namespace XCEngine::UI::Editor {
struct UIEditorShellInteractionDefinition {
UIEditorMenuModel menuModel = {};
std::vector<Widgets::UIEditorStatusBarSegment> statusSegments = {};
std::vector<UIEditorWorkspacePanelPresentationModel> workspacePresentations = {};
};
struct UIEditorShellInteractionModel {
UIEditorResolvedMenuModel resolvedMenuModel = {};
std::vector<Widgets::UIEditorStatusBarSegment> statusSegments = {};
std::vector<UIEditorWorkspacePanelPresentationModel> workspacePresentations = {};
};
struct UIEditorShellInteractionState {
UIEditorShellComposeState composeState = {};
UIEditorMenuSession menuSession = {};
UIEditorWorkspaceInteractionState workspaceInteractionState = {};
::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;
const UIEditorShortcutManager* shortcutManager = nullptr;
};
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;
bool commandTriggered = false;
bool commandDispatched = false;
std::string menuId = {};
std::string popupId = {};
std::string itemId = {};
std::string commandId = {};
std::string viewportPanelId = {};
UIEditorViewportInputBridgeFrame viewportInputFrame = {};
UIEditorMenuSessionMutationResult menuMutation = {};
UIEditorCommandDispatchResult commandDispatchResult = {};
UIEditorWorkspaceInteractionResult workspaceResult = {};
};
struct UIEditorShellInteractionPopupFrame {
std::string popupId = {};
Widgets::UIEditorMenuPopupState popupState = {};
};
struct UIEditorShellInteractionFrame {
UIEditorShellInteractionModel model = {};
UIEditorShellInteractionRequest request = {};
UIEditorShellComposeFrame shellFrame = {};
UIEditorWorkspaceInteractionFrame workspaceInteractionFrame = {};
std::vector<UIEditorShellInteractionPopupFrame> popupFrames = {};
UIEditorShellInteractionResult result = {};
std::string openRootMenuId = {};
std::string hoveredMenuId = {};
std::string hoveredPopupId = {};
std::string hoveredItemId = {};
bool focused = false;
};
UIEditorShellInteractionModel ResolveUIEditorShellInteractionModel(
const UIEditorWorkspaceController& controller,
const UIEditorShellInteractionDefinition& definition,
const UIEditorShellInteractionServices& services = {});
UIEditorShellInteractionRequest ResolveUIEditorShellInteractionRequest(
const ::XCEngine::UI::UIRect& bounds,
const UIEditorWorkspaceController& controller,
const UIEditorShellInteractionModel& model,
const UIEditorShellInteractionState& state = {},
const UIEditorShellInteractionMetrics& metrics = {},
const UIEditorShellInteractionServices& services = {});
UIEditorShellInteractionFrame UpdateUIEditorShellInteraction(
UIEditorShellInteractionState& state,
UIEditorWorkspaceController& controller,
const ::XCEngine::UI::UIRect& bounds,
const UIEditorShellInteractionModel& model,
const std::vector<::XCEngine::UI::UIInputEvent>& inputEvents,
const UIEditorShellInteractionServices& services = {},
const UIEditorShellInteractionMetrics& metrics = {});
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 = {});
void AppendUIEditorShellInteraction(
::XCEngine::UI::UIDrawList& drawList,
const UIEditorShellInteractionFrame& frame,
const UIEditorShellInteractionModel& model,
const UIEditorShellInteractionState& state,
const UIEditorShellInteractionPalette& palette = {},
const UIEditorShellInteractionMetrics& metrics = {});
void AppendUIEditorShellInteraction(
::XCEngine::UI::UIDrawList& drawList,
const UIEditorShellInteractionFrame& frame,
const UIEditorShellInteractionState& state,
const UIEditorShellInteractionPalette& palette = {},
const UIEditorShellInteractionMetrics& metrics = {});
} // namespace XCEngine::UI::Editor