ui/winui/appmenu.cpp

branch
newapi
changeset 236
ee794586f51b
parent 229
a952760955b4
child 237
8649c6a29e6d
equal deleted inserted replaced
235:9c79f00fbf36 236:ee794586f51b
168 winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::UI::Xaml::Controls::MenuFlyoutItemBase> parent = { nullptr }; 168 winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::UI::Xaml::Controls::MenuFlyoutItemBase> parent = { nullptr };
169 UiMenuItemType type; 169 UiMenuItemType type;
170 int prevSize = 0; 170 int prevSize = 0;
171 int insertPos = 0; 171 int insertPos = 0;
172 UiVar* var = nullptr; 172 UiVar* var = nullptr;
173 ui_getvaluefunc getvalue = nullptr;
173 ui_callback callback = nullptr; 174 ui_callback callback = nullptr;
174 void* userdata = nullptr; 175 void* userdata = nullptr;
175 176
176 UiMenuList() { 177 UiMenuList() {
177 178
187 188
188 // insert new items 189 // insert new items
189 int count = 0; 190 int count = 0;
190 void* elm = list->first(list); 191 void* elm = list->first(list);
191 while (elm) { 192 while (elm) {
193 char *menuItemLabel = (char*) (getvalue ? getvalue(elm, 0) : elm);
192 194
193 MenuFlyoutItem mi = MenuFlyoutItem(); 195 MenuFlyoutItem mi = MenuFlyoutItem();
194 wchar_t* wlabel = str2wstr((char*)elm, NULL); 196 wchar_t* wlabel = str2wstr((char*)elm, NULL);
195 mi.Text(wlabel); 197 mi.Text(wlabel);
196 free(wlabel); 198 free(wlabel);
234 236
235 UiVar* var = uic_create_var(ui_global_context(), it->varname, UI_VAR_LIST); 237 UiVar* var = uic_create_var(ui_global_context(), it->varname, UI_VAR_LIST);
236 238
237 UiMenuList* mlist = new UiMenuList(); 239 UiMenuList* mlist = new UiMenuList();
238 mlist->parent = parent; 240 mlist->parent = parent;
241 mlist->getvalue = it->getvalue;
239 mlist->callback = it->callback; 242 mlist->callback = it->callback;
240 mlist->userdata = it->userdata; 243 mlist->userdata = it->userdata;
241 mlist->prevSize = 0; 244 mlist->prevSize = 0;
242 mlist->insertPos = size; 245 mlist->insertPos = size;
243 mlist->type = item->type; 246 mlist->type = item->type;

mercurial