ui/winui/button.cpp

changeset 79
483d7342b439
parent 76
641dcc79e0ef
equal deleted inserted replaced
78:ad7ced6cf00b 79:483d7342b439
44 using namespace winrt::Windows::Foundation; 44 using namespace winrt::Windows::Foundation;
45 using namespace winrt::Microsoft::UI::Xaml::Controls::Primitives; 45 using namespace winrt::Microsoft::UI::Xaml::Controls::Primitives;
46 46
47 47
48 48
49 static void set_button_label(ButtonBase button, const char* label, const char* stockid, const char *icon, UiLabelType type) { 49 void ui_set_button_label(ButtonBase button, const char* label, const char* stockid, const char *icon, UiLabelType type) {
50 // TODO: stockid 50 // TODO: stockid
51 51
52 if (type == UI_LABEL_ICON) { 52 if (type == UI_LABEL_ICON) {
53 label = NULL; 53 label = NULL;
54 } 54 }
90 UIWIDGET ui_button_create(UiObject* obj, UiButtonArgs args) { 90 UIWIDGET ui_button_create(UiObject* obj, UiButtonArgs args) {
91 UiObject* current = uic_current_obj(obj); 91 UiObject* current = uic_current_obj(obj);
92 92
93 // create button with label 93 // create button with label
94 Button button = Button(); 94 Button button = Button();
95 set_button_label(button, args.label, args.stockid, args.icon, args.labeltype); 95 ui_set_button_label(button, args.label, args.stockid, args.icon, args.labeltype);
96 96
97 // create toolkit wrapper object and register destructor 97 // create toolkit wrapper object and register destructor
98 UIElement elm = button; 98 UIElement elm = button;
99 UiWidget* widget = new UiWidget(elm); 99 UiWidget* widget = new UiWidget(elm);
100 ui_context_add_widget_destructor(current->ctx, widget); 100 ui_context_add_widget_destructor(current->ctx, widget);
178 178
179 static UIWIDGET create_togglebutton(UiObject *obj, ToggleButton button, UiToggleArgs args) { 179 static UIWIDGET create_togglebutton(UiObject *obj, ToggleButton button, UiToggleArgs args) {
180 UiObject* current = uic_current_obj(obj); 180 UiObject* current = uic_current_obj(obj);
181 181
182 // set label 182 // set label
183 set_button_label(button, args.label, args.stockid, args.icon, args.labeltype); 183 ui_set_button_label(button, args.label, args.stockid, args.icon, args.labeltype);
184 togglebutton_register_callback(button, obj, args); 184 togglebutton_register_callback(button, obj, args);
185 185
186 // create toolkit wrapper object and register destructor 186 // create toolkit wrapper object and register destructor
187 UIElement elm = button; 187 UIElement elm = button;
188 UiWidget* widget = new UiWidget(elm); 188 UiWidget* widget = new UiWidget(elm);
265 RadioButton button = RadioButton(); 265 RadioButton button = RadioButton();
266 266
267 UiObject* current = uic_current_obj(obj); 267 UiObject* current = uic_current_obj(obj);
268 268
269 // set label 269 // set label
270 set_button_label(button, args.label, args.stockid, args.icon, args.labeltype); 270 ui_set_button_label(button, args.label, args.stockid, args.icon, args.labeltype);
271 togglebutton_register_callback(button, obj, args); 271 togglebutton_register_callback(button, obj, args);
272 272
273 // create toolkit wrapper object and register destructor 273 // create toolkit wrapper object and register destructor
274 UIElement elm = button; 274 UIElement elm = button;
275 UiWidget* widget = new UiWidget(elm); 275 UiWidget* widget = new UiWidget(elm);

mercurial