#pragma once #include #include #include #include #include namespace XCEngine::UI::Editor { class UIEditorShortcutManager; enum class UIEditorMenuItemKind : std::uint8_t { Command = 0, Separator, Submenu }; enum class UIEditorMenuCheckedStateSource : std::uint8_t { None = 0, PanelOpen, PanelVisible, PanelActive }; struct UIEditorMenuCheckedStateBinding { UIEditorMenuCheckedStateSource source = UIEditorMenuCheckedStateSource::None; std::string panelId = {}; }; struct UIEditorMenuItemDescriptor { UIEditorMenuItemKind kind = UIEditorMenuItemKind::Command; std::string itemId = {}; std::string label = {}; std::string commandId = {}; UIEditorMenuCheckedStateBinding checkedState = {}; std::vector children = {}; }; struct UIEditorMenuDescriptor { std::string menuId = {}; std::string label = {}; std::vector items = {}; }; struct UIEditorMenuModel { std::vector menus = {}; }; enum class UIEditorMenuModelValidationCode : std::uint8_t { None = 0, InvalidCommandRegistry, EmptyMenuId, EmptyMenuLabel, DuplicateMenuId, EmptyCommandId, UnknownCommandId, MissingItemLabel, CommandItemHasChildren, SubmenuMissingLabel, SubmenuEmptyChildren, SubmenuHasCommandId, SeparatorHasCommandId, SeparatorHasChildren, UnexpectedCheckedState, MissingCheckedStatePanelId }; struct UIEditorMenuModelValidationResult { UIEditorMenuModelValidationCode code = UIEditorMenuModelValidationCode::None; std::string message = {}; [[nodiscard]] bool IsValid() const { return code == UIEditorMenuModelValidationCode::None; } }; struct UIEditorResolvedMenuItem { UIEditorMenuItemKind kind = UIEditorMenuItemKind::Command; std::string itemId = {}; std::string label = {}; std::string commandId = {}; std::string commandDisplayName = {}; std::string shortcutText = {}; bool enabled = true; bool checked = false; UIEditorWorkspaceCommandStatus previewStatus = UIEditorWorkspaceCommandStatus::Rejected; std::string message = {}; std::vector children = {}; }; struct UIEditorResolvedMenuDescriptor { std::string menuId = {}; std::string label = {}; std::vector items = {}; }; struct UIEditorResolvedMenuModel { std::vector menus = {}; }; std::string_view GetUIEditorMenuItemKindName(UIEditorMenuItemKind kind); UIEditorMenuModelValidationResult ValidateUIEditorMenuModel( const UIEditorMenuModel& model, const UIEditorCommandRegistry& commandRegistry); UIEditorResolvedMenuModel BuildUIEditorResolvedMenuModel( const UIEditorMenuModel& model, const UIEditorCommandDispatcher& commandDispatcher, const UIEditorWorkspaceController& controller, const UIEditorShortcutManager* shortcutManager = nullptr); } // namespace XCEngine::UI::Editor