28 |
28 |
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 <string.h> |
33 |
34 |
34 #ifdef __cplusplus |
35 #ifdef __cplusplus |
35 extern "C" { |
36 extern "C" { |
36 #endif |
37 #endif |
37 |
38 |
38 typedef void (*ui_container_add_f)(UiContainer*, GtkWidget*); |
39 #define ui_reset_layout(layout) memset(&(layout), 0, sizeof(UiLayout)) |
|
40 |
|
41 typedef void (*ui_container_add_f)(UiContainer*, GtkWidget*, UiBool); |
39 |
42 |
40 typedef struct UiDocumentView UiDocumentView; |
43 typedef struct UiDocumentView UiDocumentView; |
41 |
44 |
|
45 typedef struct UiLayout UiLayout; |
|
46 typedef enum UiLayoutBool UiLayoutBool; |
|
47 |
|
48 enum UiLayoutBool { |
|
49 UI_LAYOUT_UNDEFINED = 0, |
|
50 UI_LAYOUT_TRUE, |
|
51 UI_LAYOUT_FALSE, |
|
52 }; |
|
53 |
|
54 struct UiLayout { |
|
55 UiLayoutBool fill; |
|
56 }; |
|
57 |
42 struct UiContainer { |
58 struct UiContainer { |
43 GtkWidget *widget; |
59 GtkWidget *widget; |
44 void (*add)(UiContainer*, GtkWidget*); |
60 void (*add)(UiContainer*, GtkWidget*, UiBool); |
|
61 UiLayout layout; |
45 }; |
62 }; |
46 |
63 |
|
64 typedef struct UiBoxContainer { |
|
65 UiContainer container; |
|
66 UiBool has_fill; |
|
67 } UiBoxContainer; |
|
68 |
|
69 GtkWidget* ui_gtk_vbox_new(); |
|
70 GtkWidget* ui_gtk_hbox_new(); |
|
71 |
47 UiContainer* ui_frame_container(UiObject *obj, GtkWidget *frame); |
72 UiContainer* ui_frame_container(UiObject *obj, GtkWidget *frame); |
48 void ui_frame_container_add(UiContainer *ct, GtkWidget *widget); |
73 void ui_frame_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill); |
49 |
74 |
50 void ui_split_container_add1(UiContainer *ct, GtkWidget *widget); |
75 UiContainer* ui_box_container(UiObject *obj, GtkWidget *box); |
51 void ui_split_container_add2(UiContainer *ct, GtkWidget *widget); |
76 void ui_box_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill); |
52 |
77 |
53 void ui_box_add(UiContainer *ct, GtkWidget *widget); |
78 void ui_split_container_add1(UiContainer *ct, GtkWidget *widget, UiBool fill); |
|
79 void ui_split_container_add2(UiContainer *ct, GtkWidget *widget, UiBool fill); |
54 |
80 |
55 |
81 |
56 UiObject* ui_add_document_tab(UiDocumentView *view); |
82 UiObject* ui_add_document_tab(UiDocumentView *view); |
57 void ui_tab_set_document(UiContext *ctx, void *document); |
83 void ui_tab_set_document(UiContext *ctx, void *document); |
58 void ui_tab_detach_document(UiContext *ctx, void *document); |
84 void ui_tab_detach_document(UiContext *ctx, void *document); |