ui/motif/container.c

changeset 34
0ec8a5f17782
parent 4
39b9b86ec452
child 36
e4198fc2ead4
equal deleted inserted replaced
33:458831c574f4 34:0ec8a5f17782
29 #include <stdio.h> 29 #include <stdio.h>
30 #include <stdlib.h> 30 #include <stdlib.h>
31 31
32 #include "container.h" 32 #include "container.h"
33 #include "../common/context.h" 33 #include "../common/context.h"
34 #include "../common/object.h"
34 35
35 UiContainer* ui_frame_container(UiObject *obj, Widget frame) { 36 UiContainer* ui_frame_container(UiObject *obj, Widget frame) {
36 UiContainer *ct = ucx_mempool_malloc( 37 UiContainer *ct = ucx_mempool_malloc(
37 obj->ctx->mempool, 38 obj->ctx->mempool,
38 sizeof(UiContainer)); 39 sizeof(UiContainer));
42 } 43 }
43 44
44 Widget ui_frame_container_add(UiContainer *ct, Arg *args, int *n) { 45 Widget ui_frame_container_add(UiContainer *ct, Arg *args, int *n) {
45 return ct->widget; 46 return ct->widget;
46 } 47 }
48
49
50 UIWIDGET ui_sidebar(UiObject *obj) {
51 UiContainer *ct = uic_get_current_container(obj);
52
53 Arg args[8];
54 int n = 0;
55 XtSetArg(args[n], XmNorientation, XmHORIZONTAL);
56 n++;
57
58 Widget parent = ct->add(ct, args, &n);
59 Widget pane = XmCreatePanedWindow(parent, "pane", args, n);
60 XtManageChild(pane);
61
62 // add sidebar widget
63 XtSetArg(args[0], XmNshadowType, XmSHADOW_ETCHED_OUT);
64 XtSetArg(args[1], XmNshadowThickness, 0);
65 Widget sidebar = XmCreateFrame(pane, "sidebar", args, 2);
66 //XtManageChild(sidebar);
67
68 UiObject *left = uic_object_new(obj, sidebar);
69 left->container = ui_frame_container(left, sidebar);
70
71 // add content widget
72 XtSetArg (args[2], XmNpaneMaximum, 8000);
73 Widget content = XmCreateFrame(pane, "content_area", args, 3);
74 XtManageChild(content);
75
76 UiObject *right = uic_object_new(obj, content);
77 right->container = ui_frame_container(right, content);
78
79 uic_obj_add(obj, right);
80 uic_obj_add(obj, left);
81
82 return sidebar;
83 }

mercurial