Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
vczh committed Apr 26, 2023
1 parent 0fccac2 commit 878bab1
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
25 changes: 14 additions & 11 deletions Import/GacUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26187,17 +26187,22 @@ GuiToolstripCommand
return nullptr;
}

void GuiToolstripCommand::RemoveShortcut()
{
if (shortcutKeyItem)
{
shortcutKeyItem->Executed.Detach(shortcutKeyItemExecutedHandler);
shortcutKeyItem->GetManager()->DestroyShortcut(shortcutKeyItem);
}
shortcutKeyItem = nullptr;
shortcutKeyItemExecutedHandler = nullptr;
}

void GuiToolstripCommand::ReplaceShortcut(compositions::IGuiShortcutKeyItem* value)
{
if (shortcutKeyItem != value)
{
if (shortcutKeyItem)
{
shortcutKeyItem->Executed.Detach(shortcutKeyItemExecutedHandler);
shortcutKeyItem->GetManager()->DestroyShortcut(shortcutKeyItem);
}
shortcutKeyItem = nullptr;
shortcutKeyItemExecutedHandler = nullptr;
RemoveShortcut();
if (value)
{
shortcutKeyItem = value;
Expand Down Expand Up @@ -26258,10 +26263,8 @@ GuiToolstripCommand

GuiToolstripCommand::~GuiToolstripCommand()
{
if (shortcutBuilder && shortcutKeyItem)
{
ReplaceShortcut(nullptr);
}
RemoveShortcut();
shortcutBuilder = nullptr;
}

void GuiToolstripCommand::Attach(GuiInstanceRootObject* rootObject)
Expand Down
1 change: 1 addition & 0 deletions Import/GacUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -10427,6 +10427,7 @@ namespace vl
void InvokeDescriptionChanged();

compositions::IGuiShortcutKeyManager* GetShortcutManagerFromBuilder(Ptr<ShortcutBuilder> builder);
void RemoveShortcut();
void ReplaceShortcut(compositions::IGuiShortcutKeyItem* value);
void BuildShortcut(const WString& builderText);
void UpdateShortcutOwner();
Expand Down
8 changes: 4 additions & 4 deletions Tutorial/GacUI_Controls/GlobalHotKey/UI/Resource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{
GuiApplication::GetApplication().InvokeInMainThread(self, func():void
{
dialog.ShowDialog();-eval
dialog.ShowDialog();
});
}
]]></ev.Executed-eval>
Expand All @@ -31,7 +31,7 @@
</ToolstripGroupContainer>
</ToolstripMenu>

<Table CellPadding="5" BorderVisible="true" AlignmentToParent="left:0 top:0 right:0 bottom:0" MinSizeLimitation="LimitToElementAndChildren">
<Table CellPadding="5" BorderVisible="false" AlignmentToParent="left:0 top:0 right:0 bottom:0" MinSizeLimitation="LimitToElementAndChildren">
<att.Rows>
<_>composeType:MinSize</_>
<_>composeType:Percentage percentage:1.0</_>
Expand All @@ -53,9 +53,9 @@
</ToolstripMenuBar>
</Cell>

<Cell Site="row:1 column:1">
<Cell Site="row:1 column:0">
<Label Font="fontFamily:'Segoe UI' size:24" Text="Right click to show the menu">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
<att.BoundsComposition-set AlignmentToParent="left:5 top:0 right:5 bottom:0"/>
</Label>
</Cell>
</Table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ namespace demo
::vl::__vwsn::This(this->__vwsn_precompile_3)->SetAlignmentToParent([&](){ ::vl::presentation::Margin __vwsn_temp__; __vwsn_temp__.left = static_cast<::vl::vint>(0); __vwsn_temp__.top = static_cast<::vl::vint>(0); __vwsn_temp__.right = static_cast<::vl::vint>(0); __vwsn_temp__.bottom = static_cast<::vl::vint>(0); return __vwsn_temp__; }());
}
{
::vl::__vwsn::This(this->__vwsn_precompile_3)->SetBorderVisible(true);
::vl::__vwsn::This(this->__vwsn_precompile_3)->SetBorderVisible(false);
}
{
::vl::__vwsn::This(this->__vwsn_precompile_3)->SetCellPadding(static_cast<::vl::vint>(5));
Expand Down Expand Up @@ -219,7 +219,7 @@ namespace demo
}
(this->__vwsn_precompile_11 = new ::vl::presentation::compositions::GuiCellComposition());
{
::vl::__vwsn::This(this->__vwsn_precompile_11)->SetSite(static_cast<::vl::vint>(1), static_cast<::vl::vint>(1), static_cast<::vl::vint>(1), static_cast<::vl::vint>(1));
::vl::__vwsn::This(this->__vwsn_precompile_11)->SetSite(static_cast<::vl::vint>(1), static_cast<::vl::vint>(0), static_cast<::vl::vint>(1), static_cast<::vl::vint>(1));
}
{
(this->__vwsn_precompile_12 = new ::vl::presentation::controls::GuiLabel(::vl::presentation::theme::ThemeName::Label));
Expand All @@ -229,7 +229,7 @@ namespace demo
}
(this->__vwsn_precompile_13 = ::vl::__vwsn::This(this->__vwsn_precompile_12)->GetBoundsComposition());
{
::vl::__vwsn::This(this->__vwsn_precompile_13)->SetAlignmentToParent([&](){ ::vl::presentation::Margin __vwsn_temp__; __vwsn_temp__.left = static_cast<::vl::vint>(0); __vwsn_temp__.top = static_cast<::vl::vint>(0); __vwsn_temp__.right = static_cast<::vl::vint>(0); __vwsn_temp__.bottom = static_cast<::vl::vint>(0); return __vwsn_temp__; }());
::vl::__vwsn::This(this->__vwsn_precompile_13)->SetAlignmentToParent([&](){ ::vl::presentation::Margin __vwsn_temp__; __vwsn_temp__.left = static_cast<::vl::vint>(5); __vwsn_temp__.top = static_cast<::vl::vint>(0); __vwsn_temp__.right = static_cast<::vl::vint>(5); __vwsn_temp__.bottom = static_cast<::vl::vint>(0); return __vwsn_temp__; }());
}
{
::vl::__vwsn::This(this->__vwsn_precompile_12)->SetText(::vl::WString::Unmanaged(L"Right click to show the menu"));
Expand Down

0 comments on commit 878bab1

Please sign in to comment.