Sun, 23 May 2021 09:44:43 +0200
refactor widget groups/document tree (Motif)
ui/common/context.c | file | annotate | diff | comparison | revisions | |
ui/motif/container.c | file | annotate | diff | comparison | revisions | |
ui/motif/image.c | file | annotate | diff | comparison | revisions | |
ui/motif/menu.c | file | annotate | diff | comparison | revisions | |
ui/motif/toolbar.c | file | annotate | diff | comparison | revisions |
--- a/ui/common/context.c Fri Dec 11 11:47:30 2020 +0100 +++ b/ui/common/context.c Sun May 23 09:44:43 2021 +0200 @@ -30,6 +30,7 @@ #include <stdlib.h> #include <string.h> #include <inttypes.h> +#include <stdarg.h> #include "context.h" #include "../ui/window.h"
--- a/ui/motif/container.c Fri Dec 11 11:47:30 2020 +0100 +++ b/ui/motif/container.c Sun May 23 09:44:43 2021 +0200 @@ -168,7 +168,7 @@ if(bc->prev_widget) { int v = 0; - XtVaGetValues(bc->prev_widget, d2, &v, 0); + XtVaGetValues(bc->prev_widget, d2, &v, NULL); if(v == XmATTACH_FORM) { XtVaSetValues( bc->prev_widget, @@ -176,14 +176,14 @@ XmATTACH_WIDGET, w2, widget, - 0); + NULL); XtVaSetValues( widget, d1, XmATTACH_NONE, d2, XmATTACH_FORM, - 0); + NULL); } } bc->prev_widget = widget; @@ -259,7 +259,7 @@ &widget_width, XmNheight, &widget_height, - 0); + NULL); // get the maximum height in this row if(widget_height > rheight) { @@ -667,8 +667,8 @@ content->widget = NULL; // initialization for uic_context() content->ctx = uic_context(content, view->ctx->mempool); content->ctx->parent = view->ctx; - content->ctx->set_document = ui_tab_set_document; - content->ctx->detach_document = ui_tab_detach_document; + content->ctx->attach_document = uic_context_attach_document; + content->ctx->detach_document2 = uic_context_detach_document2; content->widget = frame; content->window = view->ctx->obj->window; content->container = ui_frame_container(content, frame); @@ -726,7 +726,8 @@ void ui_change_tab(MotifTabbedPane *pane, UiTab *tab) { UiContext *ctx = tab->content->ctx; - ctx->parent->set_document(ctx->parent, ctx->document); + ctx->parent->detach_document2(ctx->parent, pane->current->content->ctx->document); + ctx->parent->attach_document(ctx->parent, ctx->document); if(pane->current) { XtVaSetValues(pane->current->tab_button, XmNshadowThickness, 0, XmNbackground, pane->bg1, NULL); @@ -750,7 +751,7 @@ if(ctx->parent->document) { //ctx->parent->detach_document(ctx->parent, ctx->parent->document); } - uic_context_set_document(ctx, document); + uic_context_attach_document(ctx, document); //uic_context_set_document(ctx->parent, document); //ctx->parent->document = document; @@ -762,16 +763,13 @@ NULL); if(tab) { if(tab->tabbedpane->current == tab) { - ctx->parent->set_document(ctx->parent, ctx->document); + ctx->parent->attach_document(ctx->parent, ctx->document); } } else { fprintf(stderr, "UiError: ui_bar_set_document: Cannot set document"); } } -void ui_tab_detach_document(UiContext *ctx) { - uic_context_detach_document(ctx->parent); -} /*
--- a/ui/motif/image.c Fri Dec 11 11:47:30 2020 +0100 +++ b/ui/motif/image.c Sun May 23 09:44:43 2021 +0200 @@ -7,11 +7,11 @@ #include "image.h" UiIcon* ui_icon(const char *name, int size) { - + return NULL; } UiIcon* ui_icon_unscaled(const char *name, int size) { - + return NULL; } void ui_free_icon(UiIcon *icon) { @@ -19,19 +19,19 @@ } UiImage* ui_icon_image(UiIcon *icon) { - + return NULL; } UiImage* ui_image(const char *filename) { - + return NULL; } UiImage* ui_named_image(const char *filename, const char *name) { - + return NULL; } UiImage* ui_load_image_from_path(const char *path, const char *name) { - + return NULL; } void ui_free_image(UiImage *img) {
--- a/ui/motif/menu.c Fri Dec 11 11:47:30 2020 +0100 +++ b/ui/motif/menu.c Sun May 23 09:44:43 2021 +0200 @@ -275,7 +275,7 @@ } if(mi->groups) { - uic_add_group_widget(obj->ctx, mitem, mi->groups); + uic_add_group_widget(obj->ctx, mitem, (ui_enablefunc)XtSetSensitive, mi->groups); } return 1; @@ -334,7 +334,7 @@ } if(mi->groups) { - uic_add_group_widget(obj->ctx, mitem, mi->groups); + uic_add_group_widget(obj->ctx, mitem, (ui_enablefunc)XtSetSensitive, mi->groups); } return 1;
--- a/ui/motif/toolbar.c Fri Dec 11 11:47:30 2020 +0100 +++ b/ui/motif/toolbar.c Sun May 23 09:44:43 2021 +0200 @@ -258,7 +258,7 @@ XtManageChild(button); if(item->groups) { - uic_add_group_widget(obj->ctx, button, item->groups); + uic_add_group_widget(obj->ctx, button, (ui_enablefunc)XtSetSensitive, item->groups); } } @@ -292,7 +292,7 @@ XtManageChild(button); if(item->groups) { - uic_add_group_widget(obj->ctx, button, item->groups); + uic_add_group_widget(obj->ctx, button, (ui_enablefunc)XtSetSensitive, item->groups); } } @@ -325,7 +325,7 @@ XtManageChild(button); if(item->groups) { - uic_add_group_widget(obj->ctx, button, item->groups); + uic_add_group_widget(obj->ctx, button, (ui_enablefunc)XtSetSensitive, item->groups); } }