34 #include "../common/context.h" |
34 #include "../common/context.h" |
35 #include "../../ucx/mempool.h" |
35 #include "../../ucx/mempool.h" |
36 |
36 |
37 |
37 |
38 UIWIDGET ui_button(UiObject *obj, char *label, ui_callback f, void *data) { |
38 UIWIDGET ui_button(UiObject *obj, char *label, ui_callback f, void *data) { |
|
39 UiContainer *ct = uic_get_current_container(obj); |
39 XmString str = XmStringCreateLocalized(label); |
40 XmString str = XmStringCreateLocalized(label); |
40 |
41 |
41 int n = 0; |
42 int n = 0; |
42 Arg args[16]; |
43 Arg args[16]; |
43 XtSetArg(args[n], XmNlabelString, str); |
44 XtSetArg(args[n], XmNlabelString, str); |
44 n++; |
45 n++; |
45 |
46 |
46 Widget parent = obj->container->add(obj->container, args, &n); |
47 Widget parent = ct->add(ct, args, &n); |
47 Widget button = XmCreatePushButton(parent, "button", args, n); |
48 Widget button = XmCreatePushButton(parent, "button", args, n); |
48 |
49 |
49 if(f) { |
50 if(f) { |
50 UiEventData *event = ucx_mempool_malloc( |
51 UiEventData *event = ucx_mempool_malloc( |
51 obj->ctx->mempool, |
52 obj->ctx->mempool, |