diff --git a/Import/GacUI.cpp b/Import/GacUI.cpp index 8eacbb41..d3326e03 100644 --- a/Import/GacUI.cpp +++ b/Import/GacUI.cpp @@ -31163,13 +31163,14 @@ GuiMenuButton return subMenu; } - void GuiMenuButton::CreateSubMenu(GuiMenu::IStyleController* subMenuStyleController) + GuiMenu* GuiMenuButton::CreateSubMenu(GuiMenu::IStyleController* subMenuStyleController) { if(!subMenu) { GuiMenu* newSubMenu=new GuiMenu(subMenuStyleController?subMenuStyleController:styleController->CreateSubMenuStyleController(), this); SetSubMenu(newSubMenu, true); } + return subMenu; } void GuiMenuButton::SetSubMenu(GuiMenu* value, bool owned) diff --git a/Import/GacUI.h b/Import/GacUI.h index b1e378f8..f7885feb 100644 --- a/Import/GacUI.h +++ b/Import/GacUI.h @@ -11330,8 +11330,9 @@ MenuButton /// The sub menu. GuiMenu* GetSubMenu(); /// Create the sub menu if necessary. The created sub menu is owned by this menu button. + /// The created sub menu. /// The style controller for the sub menu. If this argument is null, it will call for a style controller. - void CreateSubMenu(GuiMenu::IStyleController* subMenuStyleController=0); + GuiMenu* CreateSubMenu(GuiMenu::IStyleController* subMenuStyleController=0); /// Associate a sub menu if there is no sub menu binded in this menu button. The associated sub menu is not owned by this menu button if the "owned" argument is set to false. /// The sub menu to associate. /// Set to true if the menu is expected to be owned. diff --git a/Import/GacUIReflection.cpp b/Import/GacUIReflection.cpp index d5f3500c..8c5d44b7 100644 --- a/Import/GacUIReflection.cpp +++ b/Import/GacUIReflection.cpp @@ -704,18 +704,14 @@ GuiInstanceLoaderManager struct VirtualTypeInfo { GlobalStringKey typeName; - ITypeDescriptor* typeDescriptor; + ITypeDescriptor* typeDescriptor = nullptr; GlobalStringKey parentTypeName; // for virtual type only Ptr loader; List parentTypes; // all direct or indirect base types that does not has a type info List parentTypeInfos; // type infos for all registered direct or indirect base types - - VirtualTypeInfo() - :typeDescriptor(0) - { - } }; + typedef Dictionary> VirtualTypeInfoMap; typedef Dictionary> ResourceMap; typedef Pair, Ptr> ResourceItemPair; @@ -759,6 +755,10 @@ GuiInstanceLoaderManager void FillParentTypeInfos(Ptr typeInfo) { + if (typeInfo->parentTypeName != GlobalStringKey::Empty) + { + typeInfo->typeDescriptor = nullptr; + } typeInfo->parentTypes.Clear(); typeInfo->parentTypeInfos.Clear(); @@ -5241,22 +5241,19 @@ GuiToolstripButtonInstanceLoader Ptr GetParameter(const PropertyInfo& propertyInfo, GlobalStringKey variableName, collections::List& errors) { - if (propertyInfo.typeInfo.typeName == GetTypeName()) + if (propertyInfo.propertyName == _SubMenu) { - if (propertyInfo.propertyName == _SubMenu) - { - auto refControl = MakePtr(); - refControl->name.value = variableName.ToString(); + auto refControl = MakePtr(); + refControl->name.value = variableName.ToString(); - auto refEnsureToolstripSubMenu = MakePtr(); - refEnsureToolstripSubMenu->parent = refControl; - refEnsureToolstripSubMenu->name.value = L"EnsureToolstripSubMenu"; + auto refEnsureToolstripSubMenu = MakePtr(); + refEnsureToolstripSubMenu->parent = refControl; + refEnsureToolstripSubMenu->name.value = L"EnsureToolstripSubMenu"; - auto call = MakePtr(); - call->function = refEnsureToolstripSubMenu; + auto call = MakePtr(); + call->function = refEnsureToolstripSubMenu; - return call; - } + return call; } return nullptr; } @@ -10576,7 +10573,32 @@ WorkflowReferenceNamesVisitor if (auto propInfo = resolvedTypeInfo.typeDescriptor->GetPropertyByName(prop.ToString(), true)) { - resolvingResult.typeOverrides.Add(setTarget->instanceName, CopyTypeInfo(propInfo->GetReturn())); + auto propType = propInfo->GetReturn(); + if (propType->GetTypeDescriptor() == td) + { + resolvingResult.typeOverrides.Add(setTarget->instanceName, CopyTypeInfo(propInfo->GetReturn())); + } + else + { + switch (propType->GetDecorator()) + { + case ITypeInfo::Nullable: + case ITypeInfo::RawPtr: + case ITypeInfo::SharedPtr: + { + auto elementType = MakePtr(ITypeInfo::TypeDescriptor); + elementType->SetTypeDescriptor(td); + + auto decoratedType = MakePtr(propType->GetDecorator()); + decoratedType->SetElementType(elementType); + + resolvingResult.typeOverrides.Add(setTarget->instanceName, decoratedType); + } + break; + default: + resolvingResult.typeOverrides.Add(setTarget->instanceName, CopyTypeInfo(propInfo->GetReturn())); + } + } } } else diff --git a/Tools/GacGen.exe b/Tools/GacGen.exe index 6b7f87d0..7b220984 100644 Binary files a/Tools/GacGen.exe and b/Tools/GacGen.exe differ diff --git a/Tutorial/GacUI_HelloWorlds/UIRes/MVVM.bin b/Tutorial/GacUI_HelloWorlds/UIRes/MVVM.bin index 6ad268b8..660e1d49 100644 Binary files a/Tutorial/GacUI_HelloWorlds/UIRes/MVVM.bin and b/Tutorial/GacUI_HelloWorlds/UIRes/MVVM.bin differ diff --git a/Tutorial/GacUI_Layout/UIRes/RichTextEmbedding.bin b/Tutorial/GacUI_Layout/UIRes/RichTextEmbedding.bin index 6911aac8..0bb93fbe 100644 Binary files a/Tutorial/GacUI_Layout/UIRes/RichTextEmbedding.bin and b/Tutorial/GacUI_Layout/UIRes/RichTextEmbedding.bin differ