ui/gtk/container.h

changeset 669
5b930e8c3a87
parent 604
0afad58e3078
child 765
ee08f7859b78
equal deleted inserted replaced
668:e6a1bcfc0dd9 669:5b930e8c3a87
42 #ifdef __cplusplus 42 #ifdef __cplusplus
43 extern "C" { 43 extern "C" {
44 #endif 44 #endif
45 45
46 #define ui_reset_layout(layout) memset(&(layout), 0, sizeof(UiLayout)) 46 #define ui_reset_layout(layout) memset(&(layout), 0, sizeof(UiLayout))
47 #define ui_lb2bool(b) ((b) == UI_LAYOUT_TRUE ? TRUE : FALSE)
48 #define ui_bool2lb(b) ((b) ? UI_LAYOUT_TRUE : UI_LAYOUT_FALSE)
49 47
50 typedef void (*ui_container_add_f)(UiContainer*, GtkWidget*, UiBool); 48 typedef void (*ui_container_add_f)(UiContainer*, GtkWidget*);
51 49
52 typedef struct UiDocumentView UiDocumentView; 50 typedef struct UiDocumentView UiDocumentView;
53 51
54
55 typedef enum UiLayoutBool {
56 UI_LAYOUT_UNDEFINED = 0,
57 UI_LAYOUT_TRUE,
58 UI_LAYOUT_FALSE,
59 } UiLayoutBool;
60 52
61 typedef struct UiLayout UiLayout; 53 typedef struct UiLayout UiLayout;
62 struct UiLayout { 54 struct UiLayout {
63 UiLayoutBool fill; 55 UiBool fill;
64 UiBool newline; 56 UiBool newline;
65 char *label; 57 char *label;
66 UiBool hexpand; 58 UiBool hexpand;
67 UiBool vexpand; 59 UiBool vexpand;
68 UiBool hfill; 60 UiBool hfill;
76 struct UiContainer { 68 struct UiContainer {
77 GtkWidget *widget; 69 GtkWidget *widget;
78 UIMENU menu; 70 UIMENU menu;
79 GtkWidget *current; 71 GtkWidget *current;
80 72
81 void (*add)(UiContainer*, GtkWidget*, UiBool); 73 void (*add)(UiContainer*, GtkWidget*);
82 UiLayout layout; 74 UiLayout layout;
83 75
84 int close; 76 int close;
85 }; 77 };
86 78
170 int columnspacing, 162 int columnspacing,
171 int rowspacing, 163 int rowspacing,
172 int margin); 164 int margin);
173 165
174 UiContainer* ui_frame_container(UiObject *obj, GtkWidget *frame); 166 UiContainer* ui_frame_container(UiObject *obj, GtkWidget *frame);
175 void ui_frame_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill); 167 void ui_frame_container_add(UiContainer *ct, GtkWidget *widget);
176 168
177 GtkWidget* ui_box_set_margin(GtkWidget *box, int margin); 169 GtkWidget* ui_box_set_margin(GtkWidget *box, int margin);
178 UIWIDGET ui_box_create(UiObject *obj, UiContainerArgs *args, UiSubContainerType type); 170 UIWIDGET ui_box_create(UiObject *obj, UiContainerArgs *args, UiSubContainerType type);
179 171
180 UiContainer* ui_box_container(UiObject *obj, GtkWidget *box, UiSubContainerType type); 172 UiContainer* ui_box_container(UiObject *obj, GtkWidget *box, UiSubContainerType type);
181 void ui_box_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill); 173 void ui_box_container_add(UiContainer *ct, GtkWidget *widget);
182 174
183 GtkWidget* ui_create_grid_widget(int colspacing, int rowspacing); 175 GtkWidget* ui_create_grid_widget(int colspacing, int rowspacing);
184 UiContainer* ui_grid_container( 176 UiContainer* ui_grid_container(
185 UiObject *obj, 177 UiObject *obj,
186 GtkWidget *grid, 178 GtkWidget *grid,
187 UiBool def_hexpand, 179 UiBool def_hexpand,
188 UiBool def_vexpand, 180 UiBool def_vexpand,
189 UiBool def_hfill, 181 UiBool def_hfill,
190 UiBool def_vfill); 182 UiBool def_vfill);
191 void ui_grid_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill); 183 void ui_grid_container_add(UiContainer *ct, GtkWidget *widget);
192 184
193 UiContainer* ui_frame_container(UiObject *obj, GtkWidget *frame); 185 UiContainer* ui_frame_container(UiObject *obj, GtkWidget *frame);
194 void ui_frame_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill); 186 void ui_frame_container_add(UiContainer *ct, GtkWidget *widget);
195 187
196 UiContainer* ui_expander_container(UiObject *obj, GtkWidget *expander); 188 UiContainer* ui_expander_container(UiObject *obj, GtkWidget *expander);
197 void ui_expander_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill); 189 void ui_expander_container_add(UiContainer *ct, GtkWidget *widget);
198 190
199 UiContainer* ui_scrolledwindow_container(UiObject *obj, GtkWidget *scrolledwindow); 191 UiContainer* ui_scrolledwindow_container(UiObject *obj, GtkWidget *scrolledwindow);
200 void ui_scrolledwindow_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill); 192 void ui_scrolledwindow_container_add(UiContainer *ct, GtkWidget *widget);
201 193
202 UiContainer* ui_tabview_container(UiObject *obj, GtkWidget *tabview); 194 UiContainer* ui_tabview_container(UiObject *obj, GtkWidget *tabview);
203 void ui_tabview_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill); 195 void ui_tabview_container_add(UiContainer *ct, GtkWidget *widget);
204 196
205 UiContainer* ui_splitpane_container(UiObject *obj, GtkWidget *pane, UiOrientation orientation, int max, int init); 197 UiContainer* ui_splitpane_container(UiObject *obj, GtkWidget *pane, UiOrientation orientation, int max, int init);
206 void ui_splitpane_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill); 198 void ui_splitpane_container_add(UiContainer *ct, GtkWidget *widget);
207 199
208 200
209 UiGtkTabView* ui_widget_get_tabview_data(UIWIDGET tabview); 201 UiGtkTabView* ui_widget_get_tabview_data(UIWIDGET tabview);
210 202
211 void ui_gtk_notebook_select_tab(GtkWidget *widget, int tab); 203 void ui_gtk_notebook_select_tab(GtkWidget *widget, int tab);
212 204
213 #if GTK_CHECK_VERSION(3, 10, 0) 205 #if GTK_CHECK_VERSION(3, 10, 0)
214 UiContainer* ui_headerbar_container(UiObject *obj, GtkWidget *headerbar); 206 UiContainer* ui_headerbar_container(UiObject *obj, GtkWidget *headerbar);
215 void ui_headerbar_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill); 207 void ui_headerbar_container_add(UiContainer *ct, GtkWidget *widget);
216 #endif 208 #endif
217 209
218 UiContainer* ui_headerbar_fallback_container(UiObject *obj, GtkWidget *headerbar); 210 UiContainer* ui_headerbar_fallback_container(UiObject *obj, GtkWidget *headerbar);
219 void ui_headerbar_fallback_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill); 211 void ui_headerbar_fallback_container_add(UiContainer *ct, GtkWidget *widget);
220 212
221 #ifdef __cplusplus 213 #ifdef __cplusplus
222 } 214 }
223 #endif 215 #endif
224 216

mercurial