54 } |
54 } |
55 else if (type == UI_LABEL_TEXT) { |
55 else if (type == UI_LABEL_TEXT) { |
56 icon = NULL; |
56 icon = NULL; |
57 } |
57 } |
58 |
58 |
59 if (label && icon) { |
59 IconElement icon_elm = { nullptr }; |
|
60 if (icon) { |
|
61 icon_elm = ui_get_icon(icon); |
|
62 } |
|
63 |
|
64 if (label && icon_elm) { |
60 StackPanel panel = StackPanel(); |
65 StackPanel panel = StackPanel(); |
61 panel.Orientation(Orientation::Horizontal); |
66 panel.Orientation(Orientation::Horizontal); |
62 panel.Spacing(5); |
67 panel.Spacing(5); |
63 |
68 |
64 panel.Children().Append(ui_get_icon(icon)); |
69 panel.Children().Append(icon_elm); |
65 |
70 |
66 wchar_t* wlabel = str2wstr(label, nullptr); |
71 wchar_t* wlabel = str2wstr(label, nullptr); |
67 TextBlock label = TextBlock(); |
72 TextBlock label = TextBlock(); |
68 label.Text(wlabel); |
73 label.Text(wlabel); |
69 panel.Children().Append(label); |
74 panel.Children().Append(label); |
285 // store a list of radio buttons in the value |
290 // store a list of radio buttons in the value |
286 CxList* radioButtons = (CxList*) (value->obj ? value->obj : cxLinkedListCreate(current->ctx->allocator, NULL, CX_STORE_POINTERS)); |
291 CxList* radioButtons = (CxList*) (value->obj ? value->obj : cxLinkedListCreate(current->ctx->allocator, NULL, CX_STORE_POINTERS)); |
287 // get or create the group name |
292 // get or create the group name |
288 static int groupCount = 0; |
293 static int groupCount = 0; |
289 winrt::hstring groupName; |
294 winrt::hstring groupName; |
290 if (radioButtons->size == 0) { |
295 if (cxListSize(radioButtons) == 0) { |
291 groupName = winrt::to_hstring(groupCount++); |
296 groupName = winrt::to_hstring(groupCount++); |
292 } else { |
297 } else { |
293 UiWidget* firstButtonWidget = (UiWidget*)cxListAt(radioButtons, 0); |
298 UiWidget* firstButtonWidget = (UiWidget*)cxListAt(radioButtons, 0); |
294 RadioButton firstRadioButton = firstButtonWidget->uielement.as<RadioButton>(); |
299 RadioButton firstRadioButton = firstButtonWidget->uielement.as<RadioButton>(); |
295 groupName = firstRadioButton.GroupName(); |
300 groupName = firstRadioButton.GroupName(); |