146 |
146 |
147 void ui_progressbar_set(UiDouble *d, double value) { |
147 void ui_progressbar_set(UiDouble *d, double value) { |
148 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(d->obj), value); |
148 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(d->obj), value); |
149 d->value = value; |
149 d->value = value; |
150 } |
150 } |
|
151 |
|
152 |
|
153 /* ------------------------- progress spinner ------------------------- */ |
|
154 |
|
155 UIWIDGET ui_progressspinner_create(UiObject* obj, UiProgressbarSpinnerArgs args) { |
|
156 UiObject* current = uic_current_obj(obj); |
|
157 |
|
158 GtkWidget *spinner = gtk_spinner_new(); |
|
159 |
|
160 UiVar* var = uic_widget_var(obj->ctx, current->ctx, args.value, args.varname, UI_VAR_INTEGER); |
|
161 if(var && var->value) { |
|
162 UiInteger *value = var->value; |
|
163 value->get = ui_spinner_get; |
|
164 value->set = ui_spinner_set; |
|
165 value->obj = spinner; |
|
166 ui_spinner_set(value, value->value); |
|
167 } |
|
168 |
|
169 UI_APPLY_LAYOUT1(current, args); |
|
170 current->container->add(current->container, spinner, FALSE); |
|
171 |
|
172 return spinner; |
|
173 } |
|
174 |
|
175 int64_t ui_spinner_get(UiInteger *i) { |
|
176 return i->value; |
|
177 } |
|
178 |
|
179 void ui_spinner_set(UiInteger *i, int64_t value) { |
|
180 i->value = value; |
|
181 if(i->obj) { |
|
182 GtkSpinner *spinner = GTK_SPINNER(i->obj); |
|
183 if(value != 0) { |
|
184 gtk_spinner_start(spinner); |
|
185 } else { |
|
186 gtk_spinner_stop(spinner); |
|
187 } |
|
188 } |
|
189 } |