From 307a5a017673d11d4638fd8cabc1d773dd4d38eb Mon Sep 17 00:00:00 2001 From: Olaf Wintermann Date: Wed, 3 Jun 2026 21:12:13 +0200 Subject: [PATCH] fix some cocoa stuff --- ui/Makefile | 5 +- ui/cocoa/ListDelegate.h | 2 + ui/cocoa/ListDelegate.m | 48 +++++++---- ui/cocoa/Toolbar.m | 18 +++- ui/cocoa/container.m | 10 +++ ui/cocoa/list.m | 6 ++ ui/cocoa/text.h | 16 ++++ ui/cocoa/text.m | 108 ++++++++++++++++++++++++ ui/gtk/Makefile | 179 +++++++++++++++++++++++++++++++++++++++- ui/motif/Makefile | 134 +++++++++++++++++++++++++++++- ui/motif/menu.c | 2 +- ui/motif/text.c | 2 +- ui/server/Makefile | 66 ++++++++++++++- 13 files changed, 561 insertions(+), 35 deletions(-) diff --git a/ui/Makefile b/ui/Makefile index ad5aad0..b03b6d3 100644 --- a/ui/Makefile +++ b/ui/Makefile @@ -41,8 +41,5 @@ OBJ = $(TOOLKITOBJS) $(COMMONOBJS) all: $(UI_LIB) $(UI_SHLIB) +include common/Makefile include $(TOOLKIT)/Makefile - -$(COMMON_OBJPRE)uic_%$(OBJ_EXT): common/%.c - $(CC) -o $@ -c -I../ucx/ $(CFLAGS) $(SHLIB_CFLAGS) $(TK_CFLAGS) $< - diff --git a/ui/cocoa/ListDelegate.h b/ui/cocoa/ListDelegate.h index 27762f7..6603b82 100644 --- a/ui/cocoa/ListDelegate.h +++ b/ui/cocoa/ListDelegate.h @@ -34,8 +34,10 @@ @property UiObject *obj; @property ui_callback onselection; @property void *onselectiondata; +@property NSString *onselection_action; @property ui_callback onactivate; @property void *onactivatedata; +@property NSString *onactivate_action; - (id)init:(NSTableView*) tableview obj:(UiObject*)obj; diff --git a/ui/cocoa/ListDelegate.m b/ui/cocoa/ListDelegate.m index db8ab84..d464231 100644 --- a/ui/cocoa/ListDelegate.m +++ b/ui/cocoa/ListDelegate.m @@ -38,31 +38,36 @@ - (void)activateEvent:(id)sender { NSTableView *table = sender; + + int row = (int)table.clickedRow; + + UiListSelection sel; + sel.count = 1; + sel.rows = &row; + + UiEvent event; + event.obj = _obj; + event.window = event.obj->window; + event.document = event.obj->ctx->document; + event.eventdata = &sel; + event.eventdatatype = UI_EVENT_DATA_LIST_SELECTION; + event.intval = row; + event.set = ui_get_setop(); + if(_onactivate) { - int row = (int)table.clickedRow; - - UiListSelection sel; - sel.count = 1; - sel.rows = &row; - - UiEvent event; - event.obj = _obj; - event.window = event.obj->window; - event.document = event.obj->ctx->document; - event.eventdata = &sel; - event.eventdatatype = UI_EVENT_DATA_LIST_SELECTION; - event.intval = row; - event.set = ui_get_setop(); - _onactivate(&event, _onactivatedata); } + + if(_onselection_action) { + uic_action_callback(&event, _onselection_action.UTF8String); + } } - (void) tableViewSelectionDidChange:(NSNotification *) notification { - if(_onselection && ui_selection_events_is_enabled()) { + if(ui_selection_events_is_enabled()) { UiListSelection sel = ui_tableview_selection(_tableview); - UiEvent event; + UiEvent event; event.obj = _obj; event.window = event.obj->window; event.document = event.obj->ctx->document; @@ -70,7 +75,14 @@ event.eventdatatype = UI_EVENT_DATA_LIST_SELECTION; event.intval = 0; event.set = ui_get_setop(); - _onselection(&event, _onselectiondata); + + if(_onselection) { + _onselection(&event, _onselectiondata); + } + + if(_onselection_action) { + uic_action_callback(&event, _onselection_action.UTF8String); + } } } diff --git a/ui/cocoa/Toolbar.m b/ui/cocoa/Toolbar.m index 8817b8e..e9a0967 100644 --- a/ui/cocoa/Toolbar.m +++ b/ui/cocoa/Toolbar.m @@ -39,7 +39,21 @@ void ui_toolbar_init(void) { } +static void toolitem_set_enabled(void *item, int enabled) { + NSToolbarItem *i = (__bridge NSToolbarItem*)item; + i.enabled = enabled; +} +static void toolitem_bind_action(UiContext *ctx, NSToolbarItem *item, const char *action) { + if(action) { + void *widget = (__bridge void*)item; + uic_bind_action(ctx, action, widget, (ui_enablefunc)toolitem_set_enabled); + UiAction *ui_action = uic_resolve_action(ctx, action); + if(!ui_action) { + toolitem_set_enabled(widget, FALSE); + } + } +} /* --------------------- UiToolbar --------------------- */ @@ -219,12 +233,14 @@ NSToolbarItem* ui_nstoolbaritem_create_item(UiObject *obj, UiToolbarItem *item, button.image = ui_cocoa_named_icon(item->args.icon); } - if(item->args.onclick) { + if(item->args.onclick || item->args.action) { EventData *event = [[EventData alloc] init:item->args.onclick userdata:item->args.onclickdata action:item->args.action]; event.obj = obj; button.target = event; button.action = @selector(handleEvent:); objc_setAssociatedObject(button, "eventdata", event, OBJC_ASSOCIATION_RETAIN); + + toolitem_bind_action(obj->ctx, button, item->args.action); } return button; } diff --git a/ui/cocoa/container.m b/ui/cocoa/container.m index b1a5a1c..2bd54a2 100644 --- a/ui/cocoa/container.m +++ b/ui/cocoa/container.m @@ -143,6 +143,16 @@ UIWIDGET ui_scrolledwindow_create(UiObject *obj, UiFrameArgs *args) { return (__bridge void*)scrollview; } +static int64_t tabview_get(UiInteger *i) { + NSView *tabview = (__bridge id)i->obj; + return 0; +} + +static void tabview_set(UiInteger *i, int64_t value) { + NSView *tabview = (__bridge id)i->obj; + +} + UIWIDGET ui_tabview_create(UiObject *obj, UiTabViewArgs *args) { NSView *tabview; switch(args->tabview) { diff --git a/ui/cocoa/list.m b/ui/cocoa/list.m index c3c4504..bf6deba 100644 --- a/ui/cocoa/list.m +++ b/ui/cocoa/list.m @@ -54,8 +54,14 @@ static void add_listdelegate(UiObject *obj, NSTableView *tableview, UiListArgs * ListDelegate *delegate = [[ListDelegate alloc] init:tableview obj:obj]; delegate.onactivate = args->onactivate; delegate.onactivatedata = args->onactivatedata; + if(args->onactivate_action) { + delegate.onactivate_action = [[NSString alloc]initWithUTF8String:args->onactivate_action]; + } delegate.onselection = args->onselection; delegate.onselectiondata = args->onselectiondata; + if(args->onselection_action) { + delegate.onselection_action = [[NSString alloc]initWithUTF8String:args->onselection_action]; + } tableview.delegate = delegate; objc_setAssociatedObject(tableview, "ui_listdelegate", delegate, OBJC_ASSOCIATION_RETAIN); tableview.doubleAction = @selector(activateEvent:); diff --git a/ui/cocoa/text.h b/ui/cocoa/text.h index aa4d410..eec2fe4 100644 --- a/ui/cocoa/text.h +++ b/ui/cocoa/text.h @@ -48,6 +48,22 @@ void ui_textarea_remove(UiText *text, int begin, int end); char* ui_textfield_get(UiString *s); void ui_textfield_set(UiString *s, const char *value); + +@interface TextAreaDelegate: NSObject + +@property UiObject *obj; +@property UiVar *var; +@property ui_callback onchange; +@property void *onchangedata; +@property NSString *onchange_action; +@property ui_callback ontextchanged; +@property void *ontextchangeddata; +@property NSString *ontextchanged_action; + +- (id)init:(UiObject*)obj var:(UiVar*)var args:(UiTextAreaArgs*)args; + +@end + @interface TextFieldDelegate : NSObject @property UiObject *obj; diff --git a/ui/cocoa/text.m b/ui/cocoa/text.m index 0d6100b..b2709d6 100644 --- a/ui/cocoa/text.m +++ b/ui/cocoa/text.m @@ -72,6 +72,10 @@ UIWIDGET ui_textarea_create(UiObject *obj, UiTextAreaArgs *args) { text->remove = ui_textarea_remove; } + if(args->onchange || args->ontextchanged || args->onchange_action || args->ontextchanged_action) { + + } + return (__bridge void*)scrollview; } @@ -269,6 +273,110 @@ void ui_textarea_remove(UiText *text, int begin, int end) { +@implementation TextAreaDelegate + +- (id)init:(UiObject*)obj var:(UiVar*)var args:(UiTextAreaArgs*)args { + self.onchange = args->onchange; + self.onchangedata = args->onchangedata; + if(args->onchange_action) { + self.onchange_action = [[NSString alloc]initWithUTF8String:args->onchange_action]; + } + self.ontextchanged = args->ontextchanged; + self.ontextchangeddata = args->ontextchangeddata; + if(args->ontextchanged_action) { + self.ontextchanged_action = [[NSString alloc]initWithUTF8String:args->ontextchanged_action]; + } + self.obj = obj; + self.var = var; + return self; +} + +- (BOOL) textView:(NSTextView *) textView + shouldChangeTextInRange:(NSRange) affectedCharRange + replacementString:(NSString *) replacementString { + + if(_onchange == nil && _onchange_action == nil) { + return YES; + } + + UiEvent event; + event.obj = _obj; + event.window = event.obj->window; + event.document = event.obj->ctx->document; + event.intval = 0; + event.set = ui_get_setop(); + // event data not set yet + + if(affectedCharRange.length > 0) { + UiTextChangeEventData eventdata; + eventdata.type = UI_TEXT_DELETE; + eventdata.begin = (int)affectedCharRange.location; + eventdata.end = (int)(affectedCharRange.location + affectedCharRange.length); + eventdata.text = NULL; + eventdata.length = 0; + + event.eventdata = &eventdata; + event.eventdatatype = UI_EVENT_DATA_TEXT_CHANGED; + + if(_onchange) { + _onchange(&event, _onchangedata); + } + + if(_onchange_action) { + uic_action_callback(&event, _onchange_action.UTF8String); + } + } + + if(replacementString.length > 0) { + UiTextChangeEventData eventdata; + eventdata.type = UI_TEXT_INSERT; + eventdata.begin = (int)affectedCharRange.location; + eventdata.end = 0; + eventdata.text = replacementString.UTF8String; + eventdata.length = (int)replacementString.length; + + event.eventdata = &eventdata; + event.eventdatatype = UI_EVENT_DATA_TEXT_CHANGED; + + if(_onchange) { + _onchange(&event, _onchangedata); + } + + if(_onchange_action) { + uic_action_callback(&event, _onchange_action.UTF8String); + } + } + + return YES; +} + +- (void) textDidChange:(NSNotification *) notification { + UiEvent event; + event.obj = _obj; + event.window = event.obj->window; + event.document = event.obj->ctx->document; + if(_var) { + event.eventdata = _var->value; + event.eventdatatype = UI_EVENT_DATA_TEXT_VALUE; + } else { + event.eventdata = NULL; + event.eventdatatype = 0; + } + event.intval = 0; + event.set = ui_get_setop(); + + if(_ontextchanged) { + _ontextchanged(&event, _ontextchangeddata); + } + + if(_ontextchanged_action) { + uic_action_callback(&event, _ontextchanged_action.UTF8String); + } +} + +@end + + /* -------------------------- TextField -------------------------- */ static void textfield_geteventdata(id sender, UiVar *var, void **eventdata, int *eventdatatype, int *value) { diff --git a/ui/gtk/Makefile b/ui/gtk/Makefile index d1979fb..8f43a1b 100644 --- a/ui/gtk/Makefile +++ b/ui/gtk/Makefile @@ -26,11 +26,184 @@ # POSSIBILITY OF SUCH DAMAGE. # -$(GTK_OBJPRE)%.o: gtk/%.c - $(CC) -o $@ -c -I../ucx $(CFLAGS) $(SHLIB_CFLAGS) $(TK_CFLAGS) $< - $(UI_LIB): $(OBJ) $(AR) $(ARFLAGS) $(UI_LIB) $(OBJ) $(UI_SHLIB): $(OBJ) $(CC) -o $(UI_SHLIB) $(LDFLAGS) $(SHLIB_LDFLAGS) $(TK_LDFLAGS) $(OBJ) -L../build/lib -lucx + +FORCE: + +$(GTK_OBJPRE)action.o: gtk/action.c gtk/action.h gtk/../ui/toolkit.h \ + gtk/../common/action.h gtk/../common/../ui/toolkit.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(GTK_OBJPRE)button.o: gtk/button.c gtk/button.h gtk/../ui/toolkit.h \ + gtk/../ui/button.h gtk/../ui/toolkit.h gtk/toolkit.h \ + gtk/../common/context.h gtk/../common/../ui/toolkit.h \ + gtk/../common/action.h gtk/../common/object.h gtk/container.h \ + gtk/../ui/container.h gtk/widget.h gtk/../ui/widget.h \ + gtk/../common/action.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(GTK_OBJPRE)container.o: gtk/container.c gtk/container.h \ + gtk/../ui/toolkit.h gtk/../ui/container.h gtk/../ui/toolkit.h \ + gtk/toolkit.h gtk/../common/context.h gtk/../common/../ui/toolkit.h \ + gtk/../common/action.h gtk/../common/object.h gtk/headerbar.h \ + gtk/../ui/toolbar.h gtk/../common/toolbar.h \ + gtk/../common/../ui/toolbar.h gtk/../common/menu.h \ + gtk/../common/../ui/menu.h gtk/../common/../ui/toolkit.h \ + gtk/../common/container.h gtk/../common/../ui/container.h \ + gtk/../ui/properties.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(GTK_OBJPRE)display.o: gtk/display.c gtk/display.h gtk/../ui/toolkit.h \ + gtk/toolkit.h gtk/../common/context.h gtk/../common/../ui/toolkit.h \ + gtk/../common/action.h gtk/../common/object.h gtk/container.h \ + gtk/../ui/container.h gtk/../ui/toolkit.h gtk/../ui/display.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(GTK_OBJPRE)dnd.o: gtk/dnd.c gtk/dnd.h gtk/../ui/dnd.h \ + gtk/../ui/toolkit.h gtk/toolkit.h gtk/../ui/toolkit.h \ + gtk/../common/context.h gtk/../common/../ui/toolkit.h \ + gtk/../common/action.h gtk/../common/object.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(GTK_OBJPRE)draw_cairo.o: gtk/draw_cairo.c gtk/container.h \ + gtk/../ui/toolkit.h gtk/../ui/container.h gtk/../ui/toolkit.h \ + gtk/toolkit.h gtk/../common/context.h gtk/../common/../ui/toolkit.h \ + gtk/../common/action.h gtk/../common/object.h gtk/draw_cairo.h \ + gtk/graphics.h gtk/../ui/graphics.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(GTK_OBJPRE)draw_gdk.o: gtk/draw_gdk.c gtk/container.h \ + gtk/../ui/toolkit.h gtk/../ui/container.h gtk/../ui/toolkit.h \ + gtk/toolkit.h gtk/../common/context.h gtk/../common/../ui/toolkit.h \ + gtk/../common/action.h gtk/../common/object.h gtk/draw_gdk.h \ + gtk/graphics.h gtk/../ui/graphics.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(GTK_OBJPRE)entry.o: gtk/entry.c gtk/../common/context.h \ + gtk/../common/../ui/toolkit.h gtk/../common/action.h \ + gtk/../common/object.h gtk/container.h gtk/../ui/toolkit.h \ + gtk/../ui/container.h gtk/../ui/toolkit.h gtk/toolkit.h gtk/entry.h \ + gtk/../ui/entry.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(GTK_OBJPRE)graphics.o: gtk/graphics.c gtk/graphics.h \ + gtk/../ui/graphics.h gtk/../ui/toolkit.h gtk/toolkit.h \ + gtk/../ui/toolkit.h gtk/../common/context.h \ + gtk/../common/../ui/toolkit.h gtk/../common/action.h \ + gtk/../common/object.h gtk/container.h gtk/../ui/container.h \ + gtk/draw_cairo.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(GTK_OBJPRE)headerbar.o: gtk/headerbar.c gtk/headerbar.h gtk/toolkit.h \ + gtk/../ui/toolkit.h gtk/../common/context.h \ + gtk/../common/../ui/toolkit.h gtk/../common/action.h \ + gtk/../common/object.h gtk/../ui/toolbar.h gtk/../ui/toolkit.h \ + gtk/../common/toolbar.h gtk/../common/../ui/toolbar.h \ + gtk/../common/menu.h gtk/../common/../ui/menu.h \ + gtk/../common/../ui/toolkit.h gtk/button.h gtk/../ui/button.h gtk/menu.h \ + gtk/../ui/menu.h gtk/../common/menu.h gtk/../ui/properties.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(GTK_OBJPRE)icon.o: gtk/icon.c gtk/toolkit.h gtk/../ui/toolkit.h \ + gtk/../common/context.h gtk/../common/../ui/toolkit.h \ + gtk/../common/action.h gtk/../common/object.h gtk/icon.h \ + gtk/../ui/icons.h gtk/../ui/toolkit.h gtk/../common/properties.h \ + gtk/../common/../ui/properties.h gtk/../common/../ui/toolkit.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(GTK_OBJPRE)image.o: gtk/image.c gtk/image.h gtk/../ui/image.h \ + gtk/../ui/toolkit.h gtk/toolkit.h gtk/../ui/toolkit.h \ + gtk/../common/context.h gtk/../common/../ui/toolkit.h \ + gtk/../common/action.h gtk/../common/object.h gtk/container.h \ + gtk/../ui/container.h gtk/menu.h gtk/../ui/menu.h gtk/../common/menu.h \ + gtk/../common/../ui/menu.h gtk/widget.h gtk/../ui/widget.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(GTK_OBJPRE)list.o: gtk/list.c gtk/../common/context.h \ + gtk/../common/../ui/toolkit.h gtk/../common/action.h \ + gtk/../common/object.h gtk/../common/action.h gtk/container.h \ + gtk/../ui/toolkit.h gtk/../ui/container.h gtk/../ui/toolkit.h \ + gtk/toolkit.h gtk/list.h gtk/../ui/list.h gtk/button.h \ + gtk/../ui/button.h gtk/icon.h gtk/../ui/icons.h gtk/menu.h \ + gtk/../ui/menu.h gtk/../common/menu.h gtk/../common/../ui/menu.h \ + gtk/dnd.h gtk/../ui/dnd.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(GTK_OBJPRE)menu.o: gtk/menu.c gtk/menu.h gtk/../ui/menu.h \ + gtk/../ui/toolkit.h gtk/../common/menu.h gtk/../common/../ui/menu.h \ + gtk/toolkit.h gtk/../ui/toolkit.h gtk/../common/context.h \ + gtk/../common/../ui/toolkit.h gtk/../common/action.h \ + gtk/../common/object.h gtk/widget.h gtk/../ui/widget.h \ + gtk/../common/types.h gtk/../common/action.h gtk/../ui/properties.h \ + gtk/../ui/window.h gtk/container.h gtk/../ui/container.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(GTK_OBJPRE)range.o: gtk/range.c gtk/range.h gtk/toolkit.h \ + gtk/../ui/toolkit.h gtk/../common/context.h \ + gtk/../common/../ui/toolkit.h gtk/../common/action.h \ + gtk/../common/object.h gtk/../ui/range.h gtk/../ui/toolkit.h \ + gtk/container.h gtk/../ui/container.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(GTK_OBJPRE)text.o: gtk/text.c gtk/text.h gtk/../ui/text.h \ + gtk/../ui/toolkit.h gtk/toolkit.h gtk/../ui/toolkit.h \ + gtk/../common/context.h gtk/../common/../ui/toolkit.h \ + gtk/../common/action.h gtk/../common/object.h gtk/container.h \ + gtk/../ui/container.h gtk/widget.h gtk/../ui/widget.h \ + gtk/../common/types.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(GTK_OBJPRE)toolbar.o: gtk/toolbar.c gtk/toolbar.h gtk/../ui/toolbar.h \ + gtk/../ui/toolkit.h gtk/../common/toolbar.h \ + gtk/../common/../ui/toolbar.h gtk/../common/menu.h \ + gtk/../common/../ui/menu.h gtk/../common/../ui/toolkit.h gtk/list.h \ + gtk/../ui/list.h gtk/toolkit.h gtk/../ui/toolkit.h \ + gtk/../common/context.h gtk/../common/../ui/toolkit.h \ + gtk/../common/action.h gtk/../common/object.h gtk/menu.h \ + gtk/../ui/menu.h gtk/../common/menu.h gtk/button.h gtk/../ui/button.h \ + gtk/icon.h gtk/../ui/icons.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(GTK_OBJPRE)toolkit.o: gtk/toolkit.c gtk/toolkit.h gtk/../ui/toolkit.h \ + gtk/../common/context.h gtk/../common/../ui/toolkit.h \ + gtk/../common/action.h gtk/../common/object.h gtk/toolbar.h \ + gtk/../ui/toolbar.h gtk/../ui/toolkit.h gtk/../common/toolbar.h \ + gtk/../common/../ui/toolbar.h gtk/../common/menu.h \ + gtk/../common/../ui/menu.h gtk/../common/../ui/toolkit.h gtk/list.h \ + gtk/../ui/list.h gtk/window.h gtk/icon.h gtk/../ui/icons.h \ + gtk/../common/document.h gtk/../common/context.h \ + gtk/../common/properties.h gtk/../common/../ui/properties.h \ + gtk/../common/menu.h gtk/../common/threadpool.h gtk/../common/app.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(GTK_OBJPRE)webview.o: gtk/webview.c gtk/toolkit.h gtk/../ui/toolkit.h \ + gtk/../common/context.h gtk/../common/../ui/toolkit.h \ + gtk/../common/action.h gtk/../common/object.h gtk/container.h \ + gtk/../ui/container.h gtk/../ui/toolkit.h gtk/webview.h \ + gtk/../ui/webview.h gtk/widget.h gtk/../ui/widget.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(GTK_OBJPRE)widget.o: gtk/widget.c gtk/widget.h gtk/../ui/widget.h \ + gtk/../ui/toolkit.h gtk/container.h gtk/../ui/toolkit.h \ + gtk/../ui/container.h gtk/toolkit.h gtk/../common/context.h \ + gtk/../common/../ui/toolkit.h gtk/../common/action.h \ + gtk/../common/object.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(GTK_OBJPRE)window.o: gtk/window.c gtk/../ui/window.h \ + gtk/../ui/toolkit.h gtk/../ui/properties.h gtk/../common/context.h \ + gtk/../common/../ui/toolkit.h gtk/../common/action.h \ + gtk/../common/menu.h gtk/../common/../ui/menu.h \ + gtk/../common/../ui/toolkit.h gtk/../common/toolbar.h \ + gtk/../common/../ui/toolbar.h gtk/../common/menu.h gtk/../common/utils.h \ + gtk/../common/../ui/text.h gtk/menu.h gtk/../ui/menu.h gtk/toolkit.h \ + gtk/../ui/toolkit.h gtk/../common/object.h gtk/toolbar.h \ + gtk/../ui/toolbar.h gtk/list.h gtk/../ui/list.h gtk/container.h \ + gtk/../ui/container.h gtk/headerbar.h gtk/button.h gtk/../ui/button.h \ + gtk/window.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + diff --git a/ui/motif/Makefile b/ui/motif/Makefile index 7f7b420..03add25 100644 --- a/ui/motif/Makefile +++ b/ui/motif/Makefile @@ -26,11 +26,139 @@ # POSSIBILITY OF SUCH DAMAGE. # -$(MOTIF_OBJPRE)%.o: motif/%.c - $(CC) -o $@ -c -I../ucx $(CFLAGS) $(SHLIB_CFLAGS) $(TK_CFLAGS) $< - $(UI_LIB): $(OBJ) $(AR) $(ARFLAGS) $(UI_LIB) $(OBJ) $(UI_SHLIB): $(OBJ) $(CC) -o $(UI_SHLIB) $(LDFLAGS) $(SHLIB_LDFLAGS) $(TK_LDFLAGS) $(OBJ) -L../build/lib -lucx + +FORCE: + +$(MOTIF_OBJPRE)button.o: motif/button.c motif/button.h \ + motif/../ui/button.h motif/../ui/toolkit.h motif/toolkit.h \ + motif/../ui/toolkit.h motif/../common/context.h \ + motif/../common/../ui/toolkit.h motif/../common/action.h \ + motif/../common/object.h motif/container.h motif/../ui/container.h \ + motif/../common/action.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(MOTIF_OBJPRE)container.o: motif/container.c motif/container.h \ + motif/../ui/toolkit.h motif/../ui/container.h motif/../ui/toolkit.h \ + motif/../common/context.h motif/../common/../ui/toolkit.h \ + motif/../common/action.h motif/../common/object.h \ + motif/../common/container.h motif/../common/../ui/container.h \ + motif/Grid.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(MOTIF_OBJPRE)dnd.o: motif/dnd.c motif/dnd.h motif/../ui/dnd.h \ + motif/../ui/toolkit.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(MOTIF_OBJPRE)entry.o: motif/entry.c motif/entry.h motif/../ui/entry.h \ + motif/../ui/toolkit.h motif/container.h motif/../ui/toolkit.h \ + motif/../ui/container.h motif/toolkit.h motif/../common/context.h \ + motif/../common/../ui/toolkit.h motif/../common/action.h \ + motif/../common/object.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(MOTIF_OBJPRE)Fsb.o: motif/Fsb.c motif/Fsb.h motif/FsbP.h \ + motif/pathbar.h motif/../ui/text.h motif/../ui/toolkit.h \ + motif/../common/utils.h motif/../common/../ui/toolkit.h \ + motif/../common/../ui/text.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(MOTIF_OBJPRE)graphics.o: motif/graphics.c motif/graphics.h \ + motif/../ui/graphics.h motif/../ui/toolkit.h motif/toolkit.h \ + motif/../ui/toolkit.h motif/../common/context.h \ + motif/../common/../ui/toolkit.h motif/../common/action.h \ + motif/../common/object.h motif/container.h motif/../ui/container.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(MOTIF_OBJPRE)Grid.o: motif/Grid.c motif/Grid.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(MOTIF_OBJPRE)image.o: motif/image.c motif/image.h motif/../ui/image.h \ + motif/../ui/toolkit.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(MOTIF_OBJPRE)label.o: motif/label.c motif/label.h motif/../ui/display.h \ + motif/../ui/toolkit.h motif/../common/context.h \ + motif/../common/../ui/toolkit.h motif/../common/action.h \ + motif/container.h motif/../ui/toolkit.h motif/../ui/container.h \ + motif/../common/object.h motif/Grid.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(MOTIF_OBJPRE)list.o: motif/list.c motif/container.h \ + motif/../ui/toolkit.h motif/../ui/container.h motif/../ui/toolkit.h \ + motif/list.h motif/toolkit.h motif/../common/context.h \ + motif/../common/../ui/toolkit.h motif/../common/action.h \ + motif/../common/object.h motif/../ui/list.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(MOTIF_OBJPRE)menu.o: motif/menu.c motif/menu.h motif/../ui/menu.h \ + motif/../ui/toolkit.h motif/../common/menu.h \ + motif/../common/../ui/menu.h motif/../common/context.h \ + motif/../common/../ui/toolkit.h motif/../common/action.h motif/button.h \ + motif/../ui/button.h motif/toolkit.h motif/../ui/toolkit.h \ + motif/../common/object.h motif/container.h motif/../ui/container.h \ + motif/../common/types.h motif/../ui/window.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(MOTIF_OBJPRE)pathbar.o: motif/pathbar.c motif/pathbar.h \ + motif/../ui/text.h motif/../ui/toolkit.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(MOTIF_OBJPRE)range.o: motif/range.c motif/range.h motif/toolkit.h \ + motif/../ui/toolkit.h motif/../common/context.h \ + motif/../common/../ui/toolkit.h motif/../common/action.h \ + motif/../common/object.h motif/../ui/range.h motif/../ui/toolkit.h \ + motif/container.h motif/../ui/container.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(MOTIF_OBJPRE)text.o: motif/text.c motif/text.h motif/../ui/text.h \ + motif/../ui/toolkit.h motif/toolkit.h motif/../ui/toolkit.h \ + motif/../common/context.h motif/../common/../ui/toolkit.h \ + motif/../common/action.h motif/../common/object.h motif/container.h \ + motif/../ui/container.h motif/pathbar.h motif/../common/utils.h \ + motif/../common/../ui/text.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(MOTIF_OBJPRE)toolbar.o: motif/toolbar.c motif/toolbar.h \ + motif/../ui/toolbar.h motif/../ui/toolkit.h motif/button.h \ + motif/../ui/button.h motif/toolkit.h motif/../ui/toolkit.h \ + motif/../common/context.h motif/../common/../ui/toolkit.h \ + motif/../common/action.h motif/../common/object.h motif/list.h \ + motif/../ui/list.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(MOTIF_OBJPRE)toolkit.o: motif/toolkit.c motif/toolkit.h \ + motif/../ui/toolkit.h motif/../common/context.h \ + motif/../common/../ui/toolkit.h motif/../common/action.h \ + motif/../common/object.h motif/toolbar.h motif/../ui/toolbar.h \ + motif/../ui/toolkit.h motif/container.h motif/../ui/container.h \ + motif/../common/menu.h motif/../common/../ui/menu.h \ + motif/../common/../ui/toolkit.h motif/../common/toolbar.h \ + motif/../common/../ui/toolbar.h motif/../common/menu.h \ + motif/../common/document.h motif/../common/context.h \ + motif/../common/properties.h motif/../common/../ui/properties.h \ + motif/../common/app.h motif/../common/threadpool.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(MOTIF_OBJPRE)widget.o: motif/widget.c motif/../ui/widget.h \ + motif/../ui/toolkit.h motif/container.h motif/../ui/toolkit.h \ + motif/../ui/container.h motif/../common/context.h \ + motif/../common/../ui/toolkit.h motif/../common/action.h \ + motif/../common/object.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(MOTIF_OBJPRE)window.o: motif/window.c motif/window.h \ + motif/../ui/window.h motif/../ui/toolkit.h motif/../ui/widget.h \ + motif/toolkit.h motif/../ui/toolkit.h motif/../common/context.h \ + motif/../common/../ui/toolkit.h motif/../common/action.h \ + motif/../common/object.h motif/menu.h motif/../ui/menu.h \ + motif/../common/menu.h motif/../common/../ui/menu.h motif/toolbar.h \ + motif/../ui/toolbar.h motif/container.h motif/../ui/container.h \ + motif/pathbar.h motif/../ui/text.h motif/../common/utils.h \ + motif/../common/../ui/text.h motif/Grid.h motif/Fsb.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + diff --git a/ui/motif/menu.c b/ui/motif/menu.c index ae2585b..d744bd6 100644 --- a/ui/motif/menu.c +++ b/ui/motif/menu.c @@ -199,7 +199,7 @@ void add_radioitem_widget(Widget p, int index, UiMenuItemI *item, UiObject *obj) Widget button = XmCreateToggleButton(p, "menuradiobutton", args, n); XtManageChild(button); - ui_bind_radiobutton(obj, button, NULL, it->varname, it->callback, it->userdata, 0); + ui_bind_radiobutton(obj, button, NULL, it->varname, it->callback, it->userdata, NULL, 0); } static void menuitem_list_remove_binding(void *obj) { diff --git a/ui/motif/text.c b/ui/motif/text.c index 43c1d65..dcb784f 100644 --- a/ui/motif/text.c +++ b/ui/motif/text.c @@ -98,7 +98,7 @@ UIWIDGET ui_textarea_create(UiObject *obj, UiTextAreaArgs *args) { var); } - if(args->onchange || args->action) { + if(args->onchange || args->onchange_action) { } diff --git a/ui/server/Makefile b/ui/server/Makefile index 7efd7f6..14a3975 100644 --- a/ui/server/Makefile +++ b/ui/server/Makefile @@ -26,11 +26,69 @@ # POSSIBILITY OF SUCH DAMAGE. # -$(SERVER_OBJPRE)%.o: server/%.c - $(CC) -o $@ -c -I../ucx $(CFLAGS) $(SHLIB_CFLAGS) $(TK_CFLAGS) $< - $(UI_LIB): $(OBJ) - $(AR) $(ARFLAGS) $(UI_LIB) $(OBJ) + $(AR) $(ARFLAGS) $(UI_LIB) $(OBJ) $(UI_SHLIB): $(OBJ) $(CC) -o $(UI_SHLIB) $(LDFLAGS) $(SHLIB_LDFLAGS) $(TK_LDFLAGS) $(OBJ) -L../build/lib -lucx + +FORCE: + +$(SERVER_OBJPRE)args.o: server/args.c server/args.h server/toolkit.h \ + server/../ui/toolkit.h server/../common/context.h \ + server/../common/../ui/toolkit.h server/../common/action.h \ + server/../common/object.h server/../common/utils.h \ + server/../common/../ui/text.h server/../common/../ui/toolkit.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(SERVER_OBJPRE)button.o: server/button.c server/button.h \ + server/toolkit.h server/../ui/toolkit.h server/../common/context.h \ + server/../common/../ui/toolkit.h server/../common/action.h \ + server/../common/object.h server/../ui/button.h server/../ui/toolkit.h \ + server/args.h server/container.h server/../common/container.h \ + server/../common/../ui/container.h server/../common/../ui/toolkit.h \ + server/widget.h server/../ui/widget.h server/var.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(SERVER_OBJPRE)container.o: server/container.c server/container.h \ + server/toolkit.h server/../ui/toolkit.h server/../common/context.h \ + server/../common/../ui/toolkit.h server/../common/action.h \ + server/../common/object.h server/../common/container.h \ + server/../common/../ui/container.h server/../common/../ui/toolkit.h \ + server/widget.h server/../ui/widget.h server/../ui/toolkit.h \ + server/args.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(SERVER_OBJPRE)image.o: server/image.c server/image.h \ + server/../ui/image.h server/../ui/toolkit.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(SERVER_OBJPRE)toolkit.o: server/toolkit.c server/toolkit.h \ + server/../ui/toolkit.h server/../common/context.h \ + server/../common/../ui/toolkit.h server/../common/action.h \ + server/../common/object.h server/../common/message.h \ + server/../common/threadpool.h server/../common/app.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(SERVER_OBJPRE)var.o: server/var.c server/toolkit.h \ + server/../ui/toolkit.h server/../common/context.h \ + server/../common/../ui/toolkit.h server/../common/action.h \ + server/../common/object.h server/var.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(SERVER_OBJPRE)widget.o: server/widget.c server/widget.h \ + server/../ui/widget.h server/../ui/toolkit.h server/toolkit.h \ + server/../ui/toolkit.h server/../common/context.h \ + server/../common/../ui/toolkit.h server/../common/action.h \ + server/../common/object.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + +$(SERVER_OBJPRE)window.o: server/window.c server/window.h \ + server/../ui/window.h server/../ui/toolkit.h server/toolkit.h \ + server/../ui/toolkit.h server/../common/context.h \ + server/../common/../ui/toolkit.h server/../common/action.h \ + server/../common/object.h server/container.h \ + server/../common/container.h server/../common/../ui/container.h \ + server/../common/../ui/toolkit.h server/widget.h server/../ui/widget.h + $(CC) -o $@ $(CFLAGS) -I../ucx $(SHLIB_CFLAGS) $(TK_CFLAGS) -c $< + -- 2.47.3