diff -r e377456302df -r a82d9beaa94a ui/winui/label.cpp --- a/ui/winui/label.cpp Tue Oct 17 21:50:48 2023 +0200 +++ b/ui/winui/label.cpp Thu Oct 19 18:30:19 2023 +0200 @@ -153,3 +153,47 @@ d->value = newvalue; progressbar.Value(newvalue); } + +UIWIDGET ui_progressspinner_create(UiObject* obj, UiProgressbarSpinnerArgs args) { + UiObject* current = uic_current_obj(obj); + + // create textbox and toolkit wrapper + ProgressRing spinner = ProgressRing(); + spinner.IsActive(false); + + UIElement elm = spinner; + UiWidget* widget = new UiWidget(elm); + ui_context_add_widget_destructor(current->ctx, widget); + + UiVar* var = uic_widget_var(obj->ctx, current->ctx, args.value, args.varname, UI_VAR_DOUBLE); + if (var) { + UiInteger* value = (UiInteger*)var->value; + value->obj = widget; + value->get = ui_progressspinner_get; + value->set = ui_progressspinner_set; + + // listener for notifying observers + // TODO: + } + + // add button to current container + UI_APPLY_LAYOUT1(current, args); + + current->container->Add(spinner, false); + + return widget; +} + +int64_t ui_progressspinner_get(UiInteger * i) { + UiWidget* widget = (UiWidget*)i->obj; + ProgressRing spinner = widget->uielement.as(); + i->value = spinner.IsActive(); + return i->value; +} + +void ui_progressspinner_set(UiInteger * i, int64_t newvalue) { + UiWidget* widget = (UiWidget*)i->obj; + ProgressRing spinner = widget->uielement.as(); + i->value = newvalue != 0 ? 1 : 0; + spinner.IsActive(i->value); +}