29 #ifndef CONTAINER_H |
29 #ifndef CONTAINER_H |
30 #define CONTAINER_H |
30 #define CONTAINER_H |
31 |
31 |
32 #include "../ui/toolkit.h" |
32 #include "../ui/toolkit.h" |
33 #include <ucx/list.h> |
33 #include <ucx/list.h> |
|
34 #include <string.h> |
34 |
35 |
35 #ifdef __cplusplus |
36 #ifdef __cplusplus |
36 extern "C" { |
37 extern "C" { |
37 #endif |
38 #endif |
38 |
39 |
|
40 #define ui_reset_layout(layout) memset(&(layout), 0, sizeof(UiLayout)) |
|
41 |
39 typedef struct MotifTabbedPane MotifTabbedPane; |
42 typedef struct MotifTabbedPane MotifTabbedPane; |
40 typedef struct UiTab UiTab; |
43 typedef struct UiTab UiTab; |
|
44 typedef struct UiBoxContainer UiBoxContainer; |
41 |
45 |
42 typedef Widget (*ui_container_add_f)(UiContainer*, Arg*, int*); |
46 typedef Widget (*ui_container_add_f)(UiContainer*, Arg*, int*, UiBool); |
|
47 |
|
48 typedef struct UiLayout UiLayout; |
|
49 typedef enum UiLayoutBool UiLayoutBool; |
|
50 |
|
51 |
|
52 enum UiLayoutBool { |
|
53 UI_LAYOUT_UNDEFINED = 0, |
|
54 UI_LAYOUT_TRUE, |
|
55 UI_LAYOUT_FALSE, |
|
56 }; |
|
57 |
|
58 struct UiLayout { |
|
59 UiLayoutBool fill; |
|
60 }; |
43 |
61 |
44 struct UiContainer { |
62 struct UiContainer { |
45 Widget widget; |
63 Widget widget; |
46 Widget (*add)(UiContainer*, Arg *, int*); |
64 Widget (*prepare)(UiContainer*, Arg *, int*, UiBool); |
|
65 void (*add)(UiContainer*, Widget); |
|
66 UiLayout layout; |
|
67 }; |
|
68 |
|
69 struct UiBoxContainer { |
|
70 UiContainer container; |
|
71 Widget prev_widget; |
|
72 Widget filled_widget; |
|
73 UiBool cur_fill; |
|
74 UiBool has_fill; |
47 }; |
75 }; |
48 |
76 |
49 struct MotifTabbedPane { |
77 struct MotifTabbedPane { |
50 UiTabbedPane view; |
78 UiTabbedPane view; |
51 Widget tabbar; |
79 Widget tabbar; |
59 Widget tab_button; |
87 Widget tab_button; |
60 }; |
88 }; |
61 |
89 |
62 |
90 |
63 UiContainer* ui_frame_container(UiObject *obj, Widget frame); |
91 UiContainer* ui_frame_container(UiObject *obj, Widget frame); |
64 Widget ui_frame_container_add(UiContainer *ct, Arg *args, int *n); |
92 Widget ui_frame_container_prepare(UiContainer *ct, Arg *args, int *n, UiBool fill); |
|
93 void ui_frame_container_add(UiContainer *ct, Widget widget); |
|
94 |
|
95 UiContainer* ui_vbox_container(UiObject *obj, Widget box); |
|
96 Widget ui_vbox_container_prepare(UiContainer *ct, Arg *args, int *n, UiBool fill); |
|
97 void ui_vbox_container_add(UiContainer *ct, Widget widget); |
|
98 |
65 void ui_tab_button_callback(Widget widget, UiTab *tab, XtPointer d); |
99 void ui_tab_button_callback(Widget widget, UiTab *tab, XtPointer d); |
66 void ui_change_tab(MotifTabbedPane *pane, UiTab *tab); |
100 void ui_change_tab(MotifTabbedPane *pane, UiTab *tab); |
67 |
101 |
68 void ui_tab_set_document(UiContext *ctx, void *document); |
102 void ui_tab_set_document(UiContext *ctx, void *document); |
69 void ui_tab_detach_document(UiContext *ctx, void *document); |
103 void ui_tab_detach_document(UiContext *ctx, void *document); |