diff -r 4a8b1a748f09 -r 5db4979bf482 ui/winui/button.cpp --- a/ui/winui/button.cpp Sun Sep 24 12:03:57 2023 +0200 +++ b/ui/winui/button.cpp Sun Oct 01 09:23:47 2023 +0200 @@ -41,13 +41,13 @@ using namespace Windows::UI::Xaml::Interop; using namespace winrt::Windows::Foundation; -UIWIDGET ui_button(UiObject* obj, char* label, ui_callback f, void* data) { +UIWIDGET ui_button_create(UiObject* obj, UiButtonArgs args) { UiObject* current = uic_current_obj(obj); // create button with label Button button = Button(); - if (label) { - wchar_t *wlabel = str2wstr(label, nullptr); + if (args.label) { + wchar_t* wlabel = str2wstr(args.label, nullptr); button.Content(box_value(wlabel)); free(wlabel); } @@ -58,10 +58,10 @@ ui_context_add_widget_destructor(current->ctx, widget); // register callback - if (f) { + if (args.onclick) { widget->obj = obj; - widget->event_func = (ui_eventfunc)f; - widget->event_data = data; + widget->event_func = (ui_eventfunc)args.onclick; + widget->event_data = args.onclickdata; button.Click([widget](IInspectable const& sender, RoutedEventArgs) { ui_callback cb = (ui_callback)widget->event_func; @@ -72,11 +72,20 @@ evt.eventdata = nullptr; evt.intval = 0; cb(&evt, widget->event_data); - } ); + }); } - + // add button to current container + UI_APPLY_LAYOUT1(current, args); current->container->Add(button, false); return widget; } + +UIWIDGET ui_checkbox_create(UiObject* obj, UiToggleArgs args) { + return nullptr; +} + +UIWIDGET ui_radiobutton_create(UiObject* obj, UiToggleArgs) { + return nullptr; +}