Rename legacy shell demo toggle away from ImGui

This commit is contained in:
2026-04-05 16:34:50 +08:00
parent 74b1280aa6
commit cbd888e745
7 changed files with 50 additions and 49 deletions

View File

@@ -13,7 +13,7 @@ constexpr std::size_t ToIndex(XCUIShellPanelId panelId) {
constexpr std::string_view kViewMenuLabel = "View";
constexpr std::string_view kXCUIDemoShortcut = "Ctrl+1";
constexpr std::string_view kXCUILayoutLabShortcut = "Ctrl+2";
constexpr std::string_view kImGuiDemoShortcut = "Ctrl+3";
constexpr std::string_view kLegacyHostDemoShortcut = "Ctrl+3";
constexpr std::string_view kNativeBackdropShortcut = "Ctrl+Shift+B";
constexpr std::string_view kPulseAccentShortcut = "Ctrl+Shift+P";
constexpr std::string_view kNativeXCUIOverlayShortcut = "Ctrl+Shift+O";
@@ -164,8 +164,8 @@ bool XCUIShellChromeState::ToggleHostedPreviewMode(XCUIShellPanelId panelId) {
bool XCUIShellChromeState::GetViewToggle(XCUIShellViewToggleId toggleId) const {
switch (toggleId) {
case XCUIShellViewToggleId::ImGuiDemoWindow:
return m_viewToggles.imguiDemoWindowVisible;
case XCUIShellViewToggleId::LegacyHostDemoWindow:
return m_viewToggles.legacyHostDemoWindowVisible;
case XCUIShellViewToggleId::NativeBackdrop:
return m_viewToggles.nativeBackdropVisible;
case XCUIShellViewToggleId::PulseAccent:
@@ -183,8 +183,8 @@ bool XCUIShellChromeState::GetViewToggle(XCUIShellViewToggleId toggleId) const {
bool XCUIShellChromeState::SetViewToggle(XCUIShellViewToggleId toggleId, bool enabled) {
bool* target = nullptr;
switch (toggleId) {
case XCUIShellViewToggleId::ImGuiDemoWindow:
target = &m_viewToggles.imguiDemoWindowVisible;
case XCUIShellViewToggleId::LegacyHostDemoWindow:
target = &m_viewToggles.legacyHostDemoWindowVisible;
break;
case XCUIShellViewToggleId::NativeBackdrop:
target = &m_viewToggles.nativeBackdropVisible;
@@ -227,8 +227,8 @@ bool XCUIShellChromeState::InvokeCommand(std::string_view commandId) {
if (commandId == XCUIShellChromeCommandIds::ToggleXCUILayoutLabPanel) {
return TogglePanelVisible(XCUIShellPanelId::XCUILayoutLab);
}
if (commandId == XCUIShellChromeCommandIds::ToggleImGuiDemoWindow) {
return ToggleViewToggle(XCUIShellViewToggleId::ImGuiDemoWindow);
if (commandId == XCUIShellChromeCommandIds::ToggleLegacyHostDemoWindow) {
return ToggleViewToggle(XCUIShellViewToggleId::LegacyHostDemoWindow);
}
if (commandId == XCUIShellChromeCommandIds::ToggleNativeBackdrop) {
return ToggleViewToggle(XCUIShellViewToggleId::NativeBackdrop);
@@ -288,12 +288,12 @@ bool XCUIShellChromeState::TryGetCommandDescriptor(
return true;
}
if (commandId == GetViewToggleCommandId(XCUIShellViewToggleId::ImGuiDemoWindow)) {
outDescriptor.label = "ImGui Demo";
outDescriptor.shortcut = kImGuiDemoShortcut;
if (commandId == GetViewToggleCommandId(XCUIShellViewToggleId::LegacyHostDemoWindow)) {
outDescriptor.label = "Legacy Host Demo";
outDescriptor.shortcut = kLegacyHostDemoShortcut;
outDescriptor.commandId = commandId;
outDescriptor.checkable = true;
outDescriptor.checked = GetViewToggle(XCUIShellViewToggleId::ImGuiDemoWindow);
outDescriptor.checked = GetViewToggle(XCUIShellViewToggleId::LegacyHostDemoWindow);
outDescriptor.enabled = true;
return true;
}
@@ -374,7 +374,7 @@ XCUIShellMenuDescriptor XCUIShellChromeState::BuildViewMenuDescriptor() const {
appendCommandItem(GetPanelVisibilityCommandId(XCUIShellPanelId::XCUIDemo));
appendCommandItem(GetPanelVisibilityCommandId(XCUIShellPanelId::XCUILayoutLab));
appendCommandItem(GetViewToggleCommandId(XCUIShellViewToggleId::ImGuiDemoWindow));
appendCommandItem(GetViewToggleCommandId(XCUIShellViewToggleId::LegacyHostDemoWindow));
descriptor.items.push_back({ XCUIShellMenuItemKind::Separator, {} });
@@ -414,8 +414,8 @@ std::string_view XCUIShellChromeState::GetPanelPreviewModeCommandId(XCUIShellPan
std::string_view XCUIShellChromeState::GetViewToggleCommandId(XCUIShellViewToggleId toggleId) {
switch (toggleId) {
case XCUIShellViewToggleId::ImGuiDemoWindow:
return XCUIShellChromeCommandIds::ToggleImGuiDemoWindow;
case XCUIShellViewToggleId::LegacyHostDemoWindow:
return XCUIShellChromeCommandIds::ToggleLegacyHostDemoWindow;
case XCUIShellViewToggleId::NativeBackdrop:
return XCUIShellChromeCommandIds::ToggleNativeBackdrop;
case XCUIShellViewToggleId::PulseAccent: