From 81ce019fe9377bd0d5e19ed94e5e332da5294594 Mon Sep 17 00:00:00 2001 From: vczh Date: Tue, 12 Oct 2021 13:32:23 -0700 Subject: [PATCH] Fix tutorial bug --- Import/GacUI.cpp | 20 +++++++++++++++++++ Import/GacUI.h | 4 +++- TODO.md | 1 - .../FullControlTest/DocumentEditorRibbon.xml | 10 +++++----- .../Source/DemoPartialClasses.cpp | 15 ++++++++++++++ .../UI/Source/EditorRibbonPartialClasses.cpp | 15 ++++++++++++++ 6 files changed, 58 insertions(+), 7 deletions(-) diff --git a/Import/GacUI.cpp b/Import/GacUI.cpp index 968fc35e..9833b02b 100644 --- a/Import/GacUI.cpp +++ b/Import/GacUI.cpp @@ -21322,6 +21322,23 @@ GuiRibbonGroup dropdownMenu->SetControlTemplate(ct->GetSubMenuTemplate()); } + bool GuiRibbonGroup::IsAltAvailable() + { + return alt != L""; + } + + compositions::IGuiAltActionHost* GuiRibbonGroup::GetActivatingAltHost() + { + if (IsAltAvailable()) + { + return this; + } + else + { + return GuiControl::GetActivatingAltHost(); + } + } + void GuiRibbonGroup::OnBoundsChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments) { dropdownMenu->GetBoundsComposition()->SetPreferredMinSize(Size(0, containerComposition->GetBounds().Height())); @@ -21377,6 +21394,9 @@ GuiRibbonGroup :GuiControl(themeName) , items(this) { + SetAltComposition(boundsComposition); + SetAltControl(this, false); + commandExecutor = new CommandExecutor(this); { stack = new GuiStackComposition(); diff --git a/Import/GacUI.h b/Import/GacUI.h index 415614c4..b91b86c6 100644 --- a/Import/GacUI.h +++ b/Import/GacUI.h @@ -18855,7 +18855,7 @@ Ribbon Containers }; /// Ribbon group control, adding to the Groups property of a . - class GuiRibbonGroup : public GuiControl, public Description + class GuiRibbonGroup : public GuiControl, protected compositions::GuiAltActionHostBase, public Description { friend class GuiRibbonGroupItemCollection; GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(RibbonGroupTemplate, GuiControl) @@ -18885,6 +18885,8 @@ Ribbon Containers GuiToolstripButton* dropdownButton = nullptr; GuiMenu* dropdownMenu = nullptr; + bool IsAltAvailable()override; + compositions::IGuiAltActionHost* GetActivatingAltHost()override; void OnBoundsChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); void OnTextChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); void OnBeforeSwitchingView(compositions::GuiGraphicsComposition* sender, compositions::GuiItemEventArgs& arguments); diff --git a/TODO.md b/TODO.md index 65ac19f2..13e6a843 100644 --- a/TODO.md +++ b/TODO.md @@ -12,7 +12,6 @@ https://zhuanlan.zhihu.com/p/39369370 - **DocumentEditor**: When a document's height is smaller than the control, the lower part cannot click to interact with the last line. - **DocumentEditor**: In default font, the lower part of "g" in the last line is clipped, not rendered properly. - **DocumentEditorRibbon**: The dropdown menu for ribbon gallery cannot be properly resized by dragging the resize bar. - - **ALT Sequence** ribbon group needs to behave like menu item to implement `GetActivatingAltHost`. - **Github Issues** - https://github.com/vczh-libraries/GacUI/issues/66 diff --git a/Tutorial/GacUI_ControlTemplate/BlackSkin/UI/FullControlTest/DocumentEditorRibbon.xml b/Tutorial/GacUI_ControlTemplate/BlackSkin/UI/FullControlTest/DocumentEditorRibbon.xml index 143f044c..5cc61734 100644 --- a/Tutorial/GacUI_ControlTemplate/BlackSkin/UI/FullControlTest/DocumentEditorRibbon.xml +++ b/Tutorial/GacUI_ControlTemplate/BlackSkin/UI/FullControlTest/DocumentEditorRibbon.xml @@ -252,7 +252,7 @@ - + - + @@ -301,7 +301,7 @@ - + @@ -327,7 +327,7 @@ - + @@ -371,7 +371,7 @@ - + self.StyleGroups diff --git a/Tutorial/GacUI_ControlTemplate/BlackSkin/UI/FullControlTest/Source/DemoPartialClasses.cpp b/Tutorial/GacUI_ControlTemplate/BlackSkin/UI/FullControlTest/Source/DemoPartialClasses.cpp index 6a3a1d5b..cee5b0ff 100644 --- a/Tutorial/GacUI_ControlTemplate/BlackSkin/UI/FullControlTest/Source/DemoPartialClasses.cpp +++ b/Tutorial/GacUI_ControlTemplate/BlackSkin/UI/FullControlTest/Source/DemoPartialClasses.cpp @@ -15266,6 +15266,9 @@ Class (::demo::DocumentEditorRibbonConstructor) auto __vwsn_collection_ = ::vl::__vwsn::UnboxCollection<::vl::reflection::description::IValueList>(::vl::__vwsn::This(this->__vwsn_precompile_12)->GetItems()); ::vl::__vwsn::This(__vwsn_collection_.Obj())->Add(::vl::__vwsn::Box(this->__vwsn_precompile_19)); } + { + ::vl::__vwsn::This(this->__vwsn_precompile_12)->SetAlt(::vl::WString(L"A", false)); + } { ::vl::__vwsn::This(this->__vwsn_precompile_12)->SetText(::vl::WString(L"Alignment", false)); } @@ -15364,6 +15367,9 @@ Class (::demo::DocumentEditorRibbonConstructor) auto __vwsn_collection_ = ::vl::__vwsn::UnboxCollection<::vl::reflection::description::IValueList>(::vl::__vwsn::This(this->__vwsn_precompile_23)->GetItems()); ::vl::__vwsn::This(__vwsn_collection_.Obj())->Add(::vl::__vwsn::Box(this->__vwsn_precompile_33)); } + { + ::vl::__vwsn::This(this->__vwsn_precompile_23)->SetAlt(::vl::WString(L"E", false)); + } { ::vl::__vwsn::This(this->__vwsn_precompile_23)->SetText(::vl::WString(L"Edit", false)); } @@ -15490,6 +15496,9 @@ Class (::demo::DocumentEditorRibbonConstructor) auto __vwsn_collection_ = ::vl::__vwsn::UnboxCollection<::vl::reflection::description::IValueList>(::vl::__vwsn::This(this->__vwsn_precompile_34)->GetItems()); ::vl::__vwsn::This(__vwsn_collection_.Obj())->Add(::vl::__vwsn::Box(this->__vwsn_precompile_35)); } + { + ::vl::__vwsn::This(this->__vwsn_precompile_34)->SetAlt(::vl::WString(L"T", false)); + } { ::vl::__vwsn::This(this->__vwsn_precompile_34)->SetText(::vl::WString(L"Text", false)); } @@ -15677,6 +15686,9 @@ Class (::demo::DocumentEditorRibbonConstructor) auto __vwsn_collection_ = ::vl::__vwsn::UnboxCollection<::vl::reflection::description::IValueList>(::vl::__vwsn::This(this->__vwsn_precompile_49)->GetItems()); ::vl::__vwsn::This(__vwsn_collection_.Obj())->Add(::vl::__vwsn::Box(this->__vwsn_precompile_61)); } + { + ::vl::__vwsn::This(this->__vwsn_precompile_49)->SetAlt(::vl::WString(L"I", false)); + } { ::vl::__vwsn::This(this->__vwsn_precompile_49)->SetText(::vl::WString(L"Icon Labels", false)); } @@ -15785,6 +15797,9 @@ Class (::demo::DocumentEditorRibbonConstructor) auto __vwsn_collection_ = ::vl::__vwsn::UnboxCollection<::vl::reflection::description::IValueList>(::vl::__vwsn::This(this->__vwsn_precompile_71)->GetItems()); ::vl::__vwsn::This(__vwsn_collection_.Obj())->Add(::vl::__vwsn::Box(this->styleGallery)); } + { + ::vl::__vwsn::This(this->__vwsn_precompile_71)->SetAlt(::vl::WString(L"S", false)); + } { ::vl::__vwsn::This(this->__vwsn_precompile_71)->SetText(::vl::WString(L"Style", false)); } diff --git a/Tutorial/GacUI_Controls/DocumentEditorRibbon/UI/Source/EditorRibbonPartialClasses.cpp b/Tutorial/GacUI_Controls/DocumentEditorRibbon/UI/Source/EditorRibbonPartialClasses.cpp index bdef8b58..084d84c3 100644 --- a/Tutorial/GacUI_Controls/DocumentEditorRibbon/UI/Source/EditorRibbonPartialClasses.cpp +++ b/Tutorial/GacUI_Controls/DocumentEditorRibbon/UI/Source/EditorRibbonPartialClasses.cpp @@ -1291,6 +1291,9 @@ namespace demo { ::vl::__vwsn::This(this->__vwsn_precompile_21)->SetExpandable(true); } + { + ::vl::__vwsn::This(this->__vwsn_precompile_21)->SetAlt(::vl::WString(L"A", false)); + } { ::vl::__vwsn::This(this->__vwsn_precompile_21)->SetText(::vl::WString(L"Alignment", false)); } @@ -1389,6 +1392,9 @@ namespace demo auto __vwsn_collection_ = ::vl::__vwsn::UnboxCollection<::vl::reflection::description::IValueList>(::vl::__vwsn::This(this->__vwsn_precompile_32)->GetItems()); ::vl::__vwsn::This(__vwsn_collection_.Obj())->Add(::vl::__vwsn::Box(this->__vwsn_precompile_42)); } + { + ::vl::__vwsn::This(this->__vwsn_precompile_32)->SetAlt(::vl::WString(L"E", false)); + } { ::vl::__vwsn::This(this->__vwsn_precompile_32)->SetText(::vl::WString(L"Edit", false)); } @@ -1515,6 +1521,9 @@ namespace demo auto __vwsn_collection_ = ::vl::__vwsn::UnboxCollection<::vl::reflection::description::IValueList>(::vl::__vwsn::This(this->__vwsn_precompile_43)->GetItems()); ::vl::__vwsn::This(__vwsn_collection_.Obj())->Add(::vl::__vwsn::Box(this->__vwsn_precompile_44)); } + { + ::vl::__vwsn::This(this->__vwsn_precompile_43)->SetAlt(::vl::WString(L"T", false)); + } { ::vl::__vwsn::This(this->__vwsn_precompile_43)->SetText(::vl::WString(L"Text", false)); } @@ -1702,6 +1711,9 @@ namespace demo auto __vwsn_collection_ = ::vl::__vwsn::UnboxCollection<::vl::reflection::description::IValueList>(::vl::__vwsn::This(this->__vwsn_precompile_58)->GetItems()); ::vl::__vwsn::This(__vwsn_collection_.Obj())->Add(::vl::__vwsn::Box(this->__vwsn_precompile_70)); } + { + ::vl::__vwsn::This(this->__vwsn_precompile_58)->SetAlt(::vl::WString(L"I", false)); + } { ::vl::__vwsn::This(this->__vwsn_precompile_58)->SetText(::vl::WString(L"Icon Labels", false)); } @@ -1810,6 +1822,9 @@ namespace demo auto __vwsn_collection_ = ::vl::__vwsn::UnboxCollection<::vl::reflection::description::IValueList>(::vl::__vwsn::This(this->__vwsn_precompile_80)->GetItems()); ::vl::__vwsn::This(__vwsn_collection_.Obj())->Add(::vl::__vwsn::Box(this->styleGallery)); } + { + ::vl::__vwsn::This(this->__vwsn_precompile_80)->SetAlt(::vl::WString(L"S", false)); + } { ::vl::__vwsn::This(this->__vwsn_precompile_80)->SetText(::vl::WString(L"Style", false)); }