Sun, 07 Dec 2025 15:28:46 +0100
rename ui_set_group/ui_unset_group
| application/main.c | file | annotate | diff | comparison | revisions | |
| ui/common/context.c | file | annotate | diff | comparison | revisions | |
| ui/gtk/button.c | file | annotate | diff | comparison | revisions | |
| ui/gtk/text.c | file | annotate | diff | comparison | revisions | |
| ui/motif/button.c | file | annotate | diff | comparison | revisions | |
| ui/motif/text.c | file | annotate | diff | comparison | revisions | |
| ui/ui/toolkit.h | file | annotate | diff | comparison | revisions |
--- a/application/main.c Sun Dec 07 15:23:03 2025 +0100 +++ b/application/main.c Sun Dec 07 15:28:46 2025 +0100 @@ -409,18 +409,18 @@ void action_group1(UiEvent *event, void *userdata) { UiContext *ctx = event->obj->ctx; if(userdata) { - ui_unset_group(ctx, 1); + ui_unset_state(ctx, 1); } else { - ui_set_group(ctx, 1); + ui_set_state(ctx, 1); } } void action_group2(UiEvent *event, void *userdata) { UiContext *ctx = event->obj->ctx; if(userdata) { - ui_unset_group(ctx, 2); + ui_unset_state(ctx, 2); } else { - ui_set_group(ctx, 2); + ui_set_state(ctx, 2); } } @@ -1002,9 +1002,9 @@ static void action_show_button1(UiEvent *event, void *data) { WData *wdata = event->window; if(event->intval) { - ui_set_group(event->obj->ctx, 10); + ui_set_state(event->obj->ctx, 10); } else { - ui_unset_group(event->obj->ctx, 10); + ui_unset_state(event->obj->ctx, 10); } } @@ -1064,7 +1064,7 @@ } ui_set(wdata->checkbox1, 1); - ui_set_group(obj->ctx, 10); + ui_set_state(obj->ctx, 10); ui_show(obj);
--- a/ui/common/context.c Sun Dec 07 15:23:03 2025 +0100 +++ b/ui/common/context.c Sun Dec 07 15:28:46 2025 +0100 @@ -525,17 +525,17 @@ } -void ui_set_group(UiContext *ctx, int group) { - if(!cxListIndexValid(ctx->states, cxListFind(ctx->states, &group))) { - cxListAdd(ctx->states, &group); +void ui_set_state(UiContext *ctx, int state) { + if(!cxListIndexValid(ctx->states, cxListFind(ctx->states, &state))) { + cxListAdd(ctx->states, &state); } // enable/disable group widgets uic_check_state_widgets(ctx); } -void ui_unset_group(UiContext *ctx, int group) { - int i = cxListFind(ctx->states, &group); +void ui_unset_state(UiContext *ctx, int state) { + int i = cxListFind(ctx->states, &state); if(i != -1) { cxListRemove(ctx->states, i); } @@ -544,14 +544,14 @@ uic_check_state_widgets(ctx); } -int* ui_active_groups(UiContext *ctx, int *ngroups) { - *ngroups = cxListSize(ctx->states); +int* ui_active_states(UiContext *ctx, int *nstates) { + *nstates = cxListSize(ctx->states); return cxListAt(ctx->states, 0); } void uic_check_state_widgets(UiContext *ctx) { int ngroups = 0; - int *groups = ui_active_groups(ctx, &ngroups); + int *groups = ui_active_states(ctx, &ngroups); CxIterator i = cxListIterator(ctx->state_widgets); cx_foreach(UiStateWidget *, gw, i) {
--- a/ui/gtk/button.c Sun Dec 07 15:23:03 2025 +0100 +++ b/ui/gtk/button.c Sun Dec 07 15:28:46 2025 +0100 @@ -174,9 +174,9 @@ static void ui_togglebutton_enable_state_callback(GtkToggleButton *widget, UiEventData *event) { if(gtk_toggle_button_get_active(widget)) { - ui_set_group(event->obj->ctx, event->value); + ui_set_state(event->obj->ctx, event->value); } else { - ui_unset_group(event->obj->ctx, event->value); + ui_unset_state(event->obj->ctx, event->value); } } @@ -351,9 +351,9 @@ static void ui_checkbox_enable_state(GtkCheckButton *widget, UiEventData *event) { if(gtk_check_button_get_active(widget)) { - ui_set_group(event->obj->ctx, event->value); + ui_set_state(event->obj->ctx, event->value); } else { - ui_unset_group(event->obj->ctx, event->value); + ui_unset_state(event->obj->ctx, event->value); } }
--- a/ui/gtk/text.c Sun Dec 07 15:23:03 2025 +0100 +++ b/ui/gtk/text.c Sun Dec 07 15:28:46 2025 +0100 @@ -54,9 +54,9 @@ int sel = gtk_text_buffer_get_selection_bounds (buf, &begin, &end); if(sel != textview->last_selection_state) { if(sel) { - ui_set_group(textview->ctx, UI_GROUP_SELECTION); + ui_set_state(textview->ctx, UI_GROUP_SELECTION); } else { - ui_unset_group(textview->ctx, UI_GROUP_SELECTION); + ui_unset_state(textview->ctx, UI_GROUP_SELECTION); } } textview->last_selection_state = sel;
--- a/ui/motif/button.c Sun Dec 07 15:23:03 2025 +0100 +++ b/ui/motif/button.c Sun Dec 07 15:28:46 2025 +0100 @@ -162,9 +162,9 @@ if(event->value > 0) { // button in configured to enable/disable states if(tb->set) { - ui_set_group(event->obj->ctx, event->value); + ui_set_state(event->obj->ctx, event->value); } else { - ui_unset_group(event->obj->ctx, event->value); + ui_unset_state(event->obj->ctx, event->value); } } @@ -249,9 +249,9 @@ if(event->value > 0) { // button in configured to enable/disable states if(tb->set) { - ui_set_group(event->obj->ctx, event->value); + ui_set_state(event->obj->ctx, event->value); } else { - ui_unset_group(event->obj->ctx, event->value); + ui_unset_state(event->obj->ctx, event->value); } }
--- a/ui/motif/text.c Sun Dec 07 15:23:03 2025 +0100 +++ b/ui/motif/text.c Sun Dec 07 15:28:46 2025 +0100 @@ -213,9 +213,9 @@ int sel = left < right ? 1 : 0; if(sel != textarea->last_selection_state) { if(sel) { - ui_set_group(textarea->obj->ctx, UI_GROUP_SELECTION); + ui_set_state(textarea->obj->ctx, UI_GROUP_SELECTION); } else { - ui_unset_group(textarea->obj->ctx, UI_GROUP_SELECTION); + ui_unset_state(textarea->obj->ctx, UI_GROUP_SELECTION); } } textarea->last_selection_state = sel;
--- a/ui/ui/toolkit.h Sun Dec 07 15:23:03 2025 +0100 +++ b/ui/ui/toolkit.h Sun Dec 07 15:28:46 2025 +0100 @@ -574,9 +574,9 @@ UIEXPORT void ui_widget_set_states2(UiContext *ctx, UIWIDGET widget, ui_enablefunc enable, const int *states, int nstates); UIEXPORT void ui_widget_set_visibility_states(UiContext *ctx, UIWIDGET widget, const int *states, int nstates); -UIEXPORT void ui_set_group(UiContext *ctx, int group); -UIEXPORT void ui_unset_group(UiContext *ctx, int group); -UIEXPORT int* ui_active_groups(UiContext *ctx, int *ngroups); +UIEXPORT void ui_set_state(UiContext *ctx, int state); +UIEXPORT void ui_unset_state(UiContext *ctx, int state); +UIEXPORT int* ui_active_states(UiContext *ctx, int *nstates); UIEXPORT void* ui_allocator(UiContext *ctx); UIEXPORT void* ui_cx_mempool(UiContext *ctx);