added listview and sidebar (Motif)

Sat, 10 May 2014 18:52:22 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 10 May 2014 18:52:22 +0200
changeset 34
0ec8a5f17782
parent 33
458831c574f4
child 35
3e8b5c9b4033

added listview and sidebar (Motif)

ui/motif/button.h file | annotate | diff | comparison | revisions
ui/motif/container.c file | annotate | diff | comparison | revisions
ui/motif/list.c file | annotate | diff | comparison | revisions
ui/motif/list.h file | annotate | diff | comparison | revisions
ui/motif/objs.mk file | annotate | diff | comparison | revisions
ui/motif/stock.c file | annotate | diff | comparison | revisions
ui/motif/text.c file | annotate | diff | comparison | revisions
ui/motif/toolbar.c file | annotate | diff | comparison | revisions
ui/motif/toolbar.h file | annotate | diff | comparison | revisions
ui/motif/toolkit.c file | annotate | diff | comparison | revisions
ui/motif/toolkit.h file | annotate | diff | comparison | revisions
--- a/ui/motif/button.h	Sat May 10 15:43:22 2014 +0200
+++ b/ui/motif/button.h	Sat May 10 18:52:22 2014 +0200
@@ -29,7 +29,7 @@
 #ifndef BUTTON_H
 #define	BUTTON_H
 
-#include "../ui/toolkit.h"
+#include "../ui/button.h"
 #include "toolkit.h"
 
 #ifdef	__cplusplus
--- a/ui/motif/container.c	Sat May 10 15:43:22 2014 +0200
+++ b/ui/motif/container.c	Sat May 10 18:52:22 2014 +0200
@@ -31,6 +31,7 @@
 
 #include "container.h"
 #include "../common/context.h"
+#include "../common/object.h"
 
 UiContainer* ui_frame_container(UiObject *obj, Widget frame) {
     UiContainer *ct = ucx_mempool_malloc(
@@ -44,3 +45,39 @@
 Widget ui_frame_container_add(UiContainer *ct, Arg *args, int *n) {
     return ct->widget;
 }
+
+
+UIWIDGET ui_sidebar(UiObject *obj) {
+    UiContainer *ct = uic_get_current_container(obj);
+    
+    Arg args[8];
+    int n = 0;
+    XtSetArg(args[n], XmNorientation, XmHORIZONTAL);
+    n++;
+    
+    Widget parent = ct->add(ct, args, &n);
+    Widget pane = XmCreatePanedWindow(parent, "pane", args, n);
+    XtManageChild(pane);
+    
+    // add sidebar widget
+    XtSetArg(args[0], XmNshadowType, XmSHADOW_ETCHED_OUT);
+    XtSetArg(args[1], XmNshadowThickness, 0);
+    Widget sidebar = XmCreateFrame(pane, "sidebar", args, 2);
+    //XtManageChild(sidebar);
+    
+    UiObject *left = uic_object_new(obj, sidebar);
+    left->container = ui_frame_container(left, sidebar);
+    
+    // add content widget
+    XtSetArg (args[2], XmNpaneMaximum, 8000);
+    Widget content = XmCreateFrame(pane, "content_area", args, 3);
+    XtManageChild(content);
+    
+    UiObject *right = uic_object_new(obj, content);
+    right->container = ui_frame_container(right, content);
+    
+    uic_obj_add(obj, right);
+    uic_obj_add(obj, left);
+    
+    return sidebar;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ui/motif/list.c	Sat May 10 18:52:22 2014 +0200
@@ -0,0 +1,163 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2014 Olaf Wintermann. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *
+ *   2. Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "container.h"
+
+#include "list.h"
+#include "../common/object.h"
+
+
+void* ui_strmodel_getvalue(void *elm, int column) {
+    return column == 0 ? elm : NULL;
+}
+
+
+UIWIDGET ui_listview_str(UiObject *obj, UiList *list, ui_callback f, void *udata) {
+    return ui_listview(obj, list, ui_strmodel_getvalue, f, udata);
+}
+
+UIWIDGET ui_listview_var(UiObject *obj, UiListPtr *list, ui_model_getvalue_f getvalue, ui_callback f, void *udata) {
+    UiList *ls = list->list;
+    
+    //int count;
+    //XmStringTable items = ui_create_stringlist(list->list, getvalue, &count);
+    int count = list->list->count(list->list);
+    XmStringTable items = (XmStringTable)XtMalloc(count * sizeof(XmString));
+    void *data = list->list->first(list->list);
+    for(int i=0;i<count;i++) {
+        items[i] = XmStringCreateLocalized(getvalue(data, 0));
+        data = list->list->next(list->list);
+    }
+    
+    Arg args[8];
+    int n = 0;
+    XtSetArg(args[n], XmNitemCount, count);
+    n++;
+    XtSetArg(args[n], XmNitems, NULL);
+    n++;
+    
+    UiContainer *ct = uic_get_current_container(obj);
+    Widget parent = ct->add(ct, args, &n);
+    Widget widget= XmCreateScrolledList(parent, "listview", args, n);
+    XtManageChild(widget);
+    
+    UiListView *listview = ucx_mempool_malloc(obj->ctx->mempool, sizeof(UiListView));
+    listview->widget = widget;
+    listview->list = list;
+    listview->getvalue = getvalue;
+    
+    list->list->observers = ui_add_observer(
+            list->list->observers,
+            (ui_callback)ui_listview_update,
+            listview);
+    
+    for (int i=0;i<count;i++) {
+        XmStringFree(items[i]);
+    }
+    XtFree((char *)items);
+    
+    if(f) {
+        UiListViewEventData *event = ucx_mempool_malloc(
+                obj->ctx->mempool,
+                sizeof(UiEventData));
+        event->event.obj = obj;
+        event->event.user_data = udata;
+        event->event.callback = f;
+        event->event.value = 0;
+        event->list = list;
+        XtAddCallback(
+                widget,
+                XmNdefaultActionCallback,
+                (XtCallbackProc)ui_list_selection_callback,
+                event);
+    }
+    
+    return widget;
+}
+
+UIWIDGET ui_listview(UiObject *obj, UiList *list, ui_model_getvalue_f getvalue, ui_callback f, void *udata) {
+    UiListPtr *listptr = ucx_mempool_malloc(obj->ctx->mempool, sizeof(UiListPtr));
+    listptr->list = list;
+    return ui_listview_var(obj, listptr, getvalue, f, udata);
+}
+
+UIWIDGET ui_listview_nv(UiObject *obj, char *varname, ui_model_getvalue_f getvalue, ui_callback f, void *udata) {
+    UiVar *var = uic_connect_var(obj->ctx, varname, UI_VAR_LIST);
+    if(var) {
+        UiListVar *value = var->value;
+        return ui_listview_var(obj, value->listptr, getvalue, f, udata);
+    } else {
+        // TODO: error
+    }
+    return NULL;
+}
+
+
+XmStringTable ui_create_stringlist(UiList *list, ui_model_getvalue_f getvalue, int *count) { 
+    int num = list->count(list);
+    XmStringTable items = (XmStringTable)XtMalloc(num * sizeof(XmString));
+    void *data = list->first(list);
+    for(int i=0;i<num;i++) {
+        items[i] = XmStringCreateLocalized(getvalue(data, 0));
+        data = list->next(list);
+    }
+    
+    *count = num;
+    return items;
+}
+
+
+void ui_listview_update(UiEvent *event, UiListView *view) {
+    int count;
+    XmStringTable items = ui_create_stringlist(
+            view->list->list,
+            view->getvalue,
+            &count);
+    
+    XtVaSetValues(view->widget, XmNitems, items, XmNitemCount, count, NULL);
+    
+    for (int i=0;i<count;i++) {
+        XmStringFree(items[i]);
+    }
+    XtFree((char *)items);
+}
+
+void ui_list_selection_callback (Widget widget, UiListViewEventData *event, XtPointer data) {
+    XmListCallbackStruct *cbs = (XmListCallbackStruct *) data;
+    
+    UiEvent e;
+    e.obj = event->event.obj;
+    e.window = event->event.obj->window;
+    e.document = event->event.obj->document;
+    e.eventdata = event->list->list->get(event->list->list, cbs->item_position - 1);
+    e.intval = cbs->item_position - 1;
+    event->event.callback(&e, event->event.user_data);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ui/motif/list.h	Sat May 10 18:52:22 2014 +0200
@@ -0,0 +1,60 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2014 Olaf Wintermann. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *
+ *   2. Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LIST_H
+#define	LIST_H
+
+#include "toolkit.h"
+#include "../ui/tree.h"
+#include "../common/context.h"
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+typedef struct UiListView {
+    Widget              widget;
+    UiListPtr           *list;
+    ui_model_getvalue_f getvalue;
+} UiListView;
+
+typedef struct UiListViewEventData {
+    UiEventData event;
+    UiListPtr *list;
+} UiListViewEventData;
+
+XmStringTable ui_create_stringlist(UiList *list, ui_model_getvalue_f getvalue, int *count);
+void ui_listview_update(UiEvent *event, UiListView *view);
+void ui_list_selection_callback (Widget widget, UiListViewEventData *event, XtPointer data);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* LIST_H */
+
--- a/ui/motif/objs.mk	Sat May 10 15:43:22 2014 +0200
+++ b/ui/motif/objs.mk	Sat May 10 18:52:22 2014 +0200
@@ -37,6 +37,7 @@
 MOTIFOBJ += toolbar.o
 MOTIFOBJ += button.o
 MOTIFOBJ += text.o
+MOTIFOBJ += list.o
 
 TOOLKITOBJS = $(MOTIFOBJ:%=$(MOTIF_OBJPRE)%)
 TOOLKITSOURCE = $(MOTIFOBJ:%.o=motif/%.c)
--- a/ui/motif/stock.c	Sat May 10 15:43:22 2014 +0200
+++ b/ui/motif/stock.c	Sat May 10 18:52:22 2014 +0200
@@ -42,6 +42,7 @@
     ui_add_stock_item(UI_STOCK_OPEN, "Open", "Ctrl<Key>O", "Ctrl+O", NULL);
     ui_add_stock_item(UI_STOCK_SAVE, "Save", "Ctrl<Key>S", "Ctrl+S", NULL);
     ui_add_stock_item(UI_STOCK_SAVE_AS, "Save as ...", NULL, NULL, NULL);
+    ui_add_stock_item(UI_STOCK_REVERT_TO_SAVED, "Revert to saved", NULL, NULL, NULL);
     ui_add_stock_item(UI_STOCK_CLOSE, "Close", "Ctrl<Key>W", "Ctrl+W", NULL);
     ui_add_stock_item(UI_STOCK_UNDO, "Undo", "Ctrl<Key>Z", "Ctrl+Z", NULL);
     ui_add_stock_item(UI_STOCK_REDO, "Redo", NULL, NULL, NULL);
--- a/ui/motif/text.c	Sat May 10 15:43:22 2014 +0200
+++ b/ui/motif/text.c	Sat May 10 18:52:22 2014 +0200
@@ -83,6 +83,17 @@
     return text_area;
 }
 
+UIWIDGET ui_textarea_nv(UiObject *obj, char *varname) {
+    UiVar *var = uic_connect_var(obj->ctx, varname, UI_VAR_TEXT);
+    if(var) {
+        UiText *value = var->value;
+        return ui_textarea(obj, value);
+    } else {
+        // TODO: error
+    }
+    return NULL;
+}
+
 char* ui_textarea_get(UiText *text) {
     if(text->value) {
         XtFree(text->value);
--- a/ui/motif/toolbar.c	Sat May 10 15:43:22 2014 +0200
+++ b/ui/motif/toolbar.c	Sat May 10 18:52:22 2014 +0200
@@ -48,9 +48,11 @@
     UiToolItem *item = malloc(sizeof(UiToolItem));
     item->item.add_to = (ui_toolbar_add_f)add_toolitem_widget;
     item->label = label;
+    item->image = NULL;
     item->callback = f;
     item->userdata = userdata;
     item->groups = NULL;
+    item->isimportant = FALSE;
     
     ucx_map_cstr_put(toolbar_items, name, item);
 }
@@ -66,6 +68,7 @@
     item->callback = f;
     item->userdata = userdata;
     item->groups = NULL;
+    item->isimportant = FALSE;
     
     // add groups
     va_list ap;
@@ -79,6 +82,69 @@
     ucx_map_cstr_put(toolbar_items, name, item);
 }
 
+void ui_toolitem_img(char *name, char *label, char *img, ui_callback f, void *udata) {
+    // TODO
+    
+    UiToolItem *item = malloc(sizeof(UiToolItem));
+    item->item.add_to = (ui_toolbar_add_f)add_toolitem_widget;
+    item->label = label;
+    item->image = img;
+    item->callback = f;
+    item->userdata = udata;
+    item->groups = NULL;
+    item->isimportant = FALSE;
+    
+    ucx_map_cstr_put(toolbar_items, name, item);
+}
+
+
+void ui_toolitem_toggle_stgr(char *name, char *stockid, ui_callback f, void *udata, ...) {
+    // TODO
+    
+    UiStToolItem *item = malloc(sizeof(UiStToolItem));
+    item->item.add_to = (ui_toolbar_add_f)add_toolitem_st_toggle_widget;
+    item->stockid = stockid;
+    item->callback = f;
+    item->userdata = udata;
+    item->groups = NULL;
+    item->isimportant = FALSE;
+    
+    // add groups
+    va_list ap;
+    va_start(ap, udata);
+    int group;
+    while((group = va_arg(ap, int)) != -1) {
+        item->groups = ucx_list_append(item->groups, (void*)(intptr_t)group);
+    }
+    va_end(ap);
+    
+    ucx_map_cstr_put(toolbar_items, name, item);
+}
+
+void ui_toolitem_toggle_imggr(char *name, char *label, char *img, ui_callback f, void *udata, ...) {
+    // TODO
+    
+    UiToolItem *item = malloc(sizeof(UiToolItem));
+    item->item.add_to = (ui_toolbar_add_f)add_toolitem_toggle_widget;
+    item->label = label;
+    item->image = img;
+    item->callback = f;
+    item->userdata = udata;
+    item->groups = NULL;
+    item->isimportant = FALSE;
+    
+    // add groups
+    va_list ap;
+    va_start(ap, udata);
+    int group;
+    while((group = va_arg(ap, int)) != -1) {
+        item->groups = ucx_list_append(item->groups, (void*)(intptr_t)group);
+    }
+    va_end(ap);
+    
+    ucx_map_cstr_put(toolbar_items, name, item);
+}
+
 void ui_toolbar_add_default(char *name) {
     char *s = strdup(name);
     defaults = ucx_list_append(defaults, s);
@@ -158,6 +224,7 @@
     XmString label = XmStringCreateLocalized(stock_item->label);
     XtSetArg(args[0], XmNlabelString, label);
     XtSetArg(args[1], XmNshadowThickness, 1);
+    //XtSetArg(args[2], XmNhighlightThickness, 0);
     Widget button = XmCreatePushButton(parent, "toolbar_button", args, 2);
     
     XmStringFree(label);
@@ -182,3 +249,39 @@
         uic_add_group_widget(obj->ctx, button, item->groups);
     }
 }
+
+void add_toolitem_toggle_widget(Widget parent, UiToolItem *item, UiObject *obj) {
+    Arg args[8];
+    
+    XmString label = XmStringCreateLocalized(item->label);
+    XtSetArg(args[0], XmNlabelString, label);
+    XtSetArg(args[1], XmNshadowThickness, 1);
+    XtSetArg(args[2], XmNindicatorOn, XmINDICATOR_NONE);
+    Widget button = XmCreateToggleButton(parent, "toolbar_toggle_button", args, 3);
+    
+    XmStringFree(label);
+    
+    if(item->callback) {
+        UiEventData *event = ucx_mempool_malloc(
+                obj->ctx->mempool,
+                sizeof(UiEventData));
+        event->obj = obj;
+        event->user_data = item->userdata;
+        event->callback = item->callback;
+        XtAddCallback(
+                button,
+                XmNvalueChangedCallback,
+                (XtCallbackProc)ui_toggle_button_callback,
+                event);
+    }
+    
+    XtManageChild(button);
+    
+    if(item->groups) {
+        uic_add_group_widget(obj->ctx, button, item->groups);
+    }
+}
+
+void add_toolitem_st_toggle_widget(Widget parent, UiStToolItem *item, UiObject *obj) {
+    
+}
--- a/ui/motif/toolbar.h	Sat May 10 15:43:22 2014 +0200
+++ b/ui/motif/toolbar.h	Sat May 10 18:52:22 2014 +0200
@@ -50,9 +50,11 @@
 struct UiToolItem {
     UiToolItemI item;
     char           *label;
+    void           *image;
     ui_callback    callback;
     void           *userdata;
     UcxList        *groups;
+    Boolean        isimportant;
 };
 
 struct UiStToolItem {
@@ -61,6 +63,7 @@
     ui_callback    callback;
     void           *userdata;
     UcxList        *groups;
+    Boolean        isimportant;
 };
 
 void ui_toolbar_init();
@@ -69,6 +72,8 @@
 
 void add_toolitem_widget(Widget tb, UiToolItem *item, UiObject *obj);
 void add_toolitem_st_widget(Widget tb, UiStToolItem *item, UiObject *obj);
+void add_toolitem_toggle_widget(Widget tb, UiToolItem *item, UiObject *obj);
+void add_toolitem_st_toggle_widget(Widget tb, UiStToolItem *item, UiObject *obj);
 
 #ifdef	__cplusplus
 }
--- a/ui/motif/toolkit.c	Sat May 10 15:43:22 2014 +0200
+++ b/ui/motif/toolkit.c	Sat May 10 18:52:22 2014 +0200
@@ -28,6 +28,8 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
+#include <pthread.h>
 
 #include "toolkit.h"
 #include "toolbar.h"
@@ -46,11 +48,18 @@
 
 static int is_toplevel_realized = 0;
 
+int event_pipe[2];
+
 static String fallback[] = {
 	"*fontList: -dt-interface system-medium-r-normal-s*utf*:",
 	NULL
 };
 
+void input_proc(XtPointer data, int *source, XtInputId *iid) {
+    void *ptr;
+    read(event_pipe[0], &ptr, sizeof(void*));
+}
+
 void ui_init(char *appname, int argc, char **argv) { 
     application_name = appname;
     
@@ -69,6 +78,12 @@
     ui_stock_init();
     
     uic_load_app_properties();
+    
+    if(pipe(event_pipe)) {
+        fprintf(stderr, "UiError: Cannot create event pipe\n");
+        exit(-1);
+    }
+    XtAppAddInput(app, event_pipe[0], XtInputReadMask, input_proc, NULL);
 }
 
 char* ui_appname() {
@@ -109,10 +124,66 @@
     XtRealizeWidget(obj->widget);
 }
 
+void ui_close(UiObject *obj) {
+    // TODO
+}
+
 void ui_set_enabled(UIWIDGET widget, int enabled) {
     XtSetSensitive(widget, enabled);
 }
 
+void ui_set_show_all(UIWIDGET widget, int value) {
+    if(!value) {
+        XtUnmanageChild(widget);
+    }
+}
+
+void ui_set_visible(UIWIDGET widget, int visible) {
+    if(visible) {
+        XtManageChild(widget);
+    } else {
+        XtUnmanageChild(widget);
+    }
+}
+
+static Boolean ui_job_finished(void *data) {
+    printf("WorkProc\n");
+    UiJob *job = data;
+    
+    UiEvent event;
+    event.obj = job->obj;
+    event.window = job->obj->window;
+    event.document = job->obj->document;
+    event.intval = 0;
+    event.eventdata = NULL;
+
+    job->finish_callback(&event, job->finish_data);
+    free(job);
+    return TRUE;
+}
+
+static void* ui_jobthread(void *data) {
+    UiJob *job = data;
+    int result = job->job_func(job->job_data);
+    if(!result) {
+        printf("XtAppAddWorkProc\n");
+        write(event_pipe[1], &job, sizeof(void*)); // hack
+        XtAppAddWorkProc(app, ui_job_finished, job);
+        
+    }
+}
+
+void ui_job(UiObject *obj, ui_threadfunc tf, void *td, ui_callback f, void *fd) {
+    UiJob *job = malloc(sizeof(UiJob));
+    job->obj = obj;
+    job->job_func = tf;
+    job->job_data = td;
+    job->finish_callback = f;
+    job->finish_data = fd;
+    pthread_t pid;
+    pthread_create(&pid, NULL, ui_jobthread, job);
+}
+
 void ui_clipboard_set(char *str) {
     printf("copy: {%s}\n", str);
     int length = strlen(str) + 1;
--- a/ui/motif/toolkit.h	Sat May 10 15:43:22 2014 +0200
+++ b/ui/motif/toolkit.h	Sat May 10 18:52:22 2014 +0200
@@ -46,6 +46,14 @@
     int         value;
 } UiEventData;
 
+typedef struct UiJob {
+    UiObject      *obj;
+    ui_threadfunc job_func;
+    void          *job_data;
+    ui_callback   finish_callback;
+    void          *finish_data;
+} UiJob;
+
 void ui_set_active_window(Widget w);
 Widget ui_get_active_window();
 

mercurial