@@ -161,6 +161,83 @@ GuiVirtualTreeViewInstanceLoader
161
161
}
162
162
};
163
163
164
+ /* **********************************************************************
165
+ GuiComboBoxInstanceLoader
166
+ ***********************************************************************/
167
+
168
+ #define BASE_TYPE GuiTemplateControlInstanceLoader<GuiComboBoxListControl, GuiComboBoxTemplate_StyleProvider, GuiComboBoxTemplate>
169
+ class GuiComboBoxInstanceLoader : public BASE_TYPE
170
+ {
171
+ protected:
172
+ GlobalStringKey _ListControl;
173
+
174
+ void AddAdditionalArguments (const TypeInfo& typeInfo, GlobalStringKey variableName, ArgumentMap& arguments, collections::List<WString>& errors, Ptr <WfNewClassExpression> createControl)override
175
+ {
176
+ vint indexListControl = arguments.Keys ().IndexOf (_ListControl);
177
+ if (indexListControl != -1 )
178
+ {
179
+ createControl->arguments .Add (arguments.GetByIndex (indexListControl)[0 ].expression );
180
+ }
181
+ }
182
+ public:
183
+ GuiComboBoxInstanceLoader ()
184
+ :BASE_TYPE(L" presentation::controls::GuiComboBox" , L" CreateComboBoxStyle" )
185
+ {
186
+ _ListControl = GlobalStringKey::Get (L" ListControl" );
187
+ }
188
+
189
+ void GetConstructorParameters (const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
190
+ {
191
+ if (typeInfo.typeName == GetTypeName ())
192
+ {
193
+ propertyNames.Add (_ListControl);
194
+ propertyNames.Add (GlobalStringKey::_ItemTemplate);
195
+ }
196
+ BASE_TYPE::GetConstructorParameters (typeInfo, propertyNames);
197
+ }
198
+
199
+ Ptr <GuiInstancePropertyInfo> GetPropertyType (const PropertyInfo& propertyInfo)override
200
+ {
201
+ if (propertyInfo.propertyName == _ListControl)
202
+ {
203
+ auto info = GuiInstancePropertyInfo::Assign (description::GetTypeDescriptor<GuiSelectableListControl>());
204
+ info->scope = GuiInstancePropertyInfo::Constructor;
205
+ info->required = true ;
206
+ return info;
207
+ }
208
+ else if (propertyInfo.propertyName == GlobalStringKey::_ItemTemplate)
209
+ {
210
+ auto info = GuiInstancePropertyInfo::Assign (description::GetTypeDescriptor<WString>());
211
+ return info;
212
+ }
213
+ return BASE_TYPE::GetPropertyType (propertyInfo);
214
+ }
215
+
216
+ Ptr <workflow::WfStatement> AssignParameters (const TypeInfo& typeInfo, GlobalStringKey variableName, ArgumentMap& arguments, collections::List<WString>& errors)override
217
+ {
218
+ auto block = MakePtr<WfBlockStatement>();
219
+
220
+ FOREACH_INDEXER (GlobalStringKey, prop, index , arguments.Keys ())
221
+ {
222
+ const auto & values = arguments.GetByIndex (index );
223
+ if (prop == GlobalStringKey::_ItemTemplate)
224
+ {
225
+ if (auto stat = CreateSetControlTemplateStyle<GuiControlTemplate_ItemStyleProvider, GuiControlTemplate>(variableName, arguments.GetByIndex (index )[0 ].expression , typeInfo, L" StyleProvider" , errors))
226
+ {
227
+ block->statements .Add (stat);
228
+ }
229
+ }
230
+ }
231
+
232
+ if (block->statements .Count () > 0 )
233
+ {
234
+ return block;
235
+ }
236
+ return nullptr ;
237
+ }
238
+ };
239
+ #undef BASE_TYPE
240
+
164
241
/* **********************************************************************
165
242
GuiListViewInstanceLoader
166
243
***********************************************************************/
@@ -1040,6 +1117,11 @@ Initialization
1040
1117
1041
1118
void LoadListControls (IGuiInstanceLoaderManager* manager)
1042
1119
{
1120
+ manager->CreateVirtualType (
1121
+ GlobalStringKey::Get (description::TypeInfo<GuiComboBoxListControl>::TypeName),
1122
+ new GuiComboBoxInstanceLoader
1123
+ );
1124
+
1043
1125
manager->SetLoader (new GuiSelectableListControlInstanceLoader);
1044
1126
manager->SetLoader (new GuiVirtualTreeViewInstanceLoader);
1045
1127
0 commit comments