ui/gtk/headerbar.c

branch
newapi
changeset 310
4918f9132552
parent 309
02c95df91de1
child 311
450a813dc2a5
equal deleted inserted replaced
309:02c95df91de1 310:4918f9132552
41 #else 41 #else
42 #define UI_HEADERBAR GtkHeaderBar* 42 #define UI_HEADERBAR GtkHeaderBar*
43 #define UI_HEADERBAR_CAST(h) GTK_HEADER_BAR(h) 43 #define UI_HEADERBAR_CAST(h) GTK_HEADER_BAR(h)
44 #define UI_HEADERBAR_PACK_START(h, w) gtk_header_bar_pack_start(GTK_HEADER_BAR(h), w) 44 #define UI_HEADERBAR_PACK_START(h, w) gtk_header_bar_pack_start(GTK_HEADER_BAR(h), w)
45 #define UI_HEADERBAR_PACK_END(h, w) gtk_header_bar_pack_end(GTK_HEADER_BAR(h), w) 45 #define UI_HEADERBAR_PACK_END(h, w) gtk_header_bar_pack_end(GTK_HEADER_BAR(h), w)
46 #if GTK_MAJOR_VERSION >= 4
46 #define UI_HEADERBAR_SET_TITLE_WIDGET(h, w) gtk_header_bar_set_title_widget(GTK_HEADER_BAR(h), w) 47 #define UI_HEADERBAR_SET_TITLE_WIDGET(h, w) gtk_header_bar_set_title_widget(GTK_HEADER_BAR(h), w)
48 #else
49 #define UI_HEADERBAR_SET_TITLE_WIDGET(h, w) gtk_header_bar_set_custom_title(GTK_HEADER_BAR(h), w)
50 #endif
47 #endif 51 #endif
48 52
49 void ui_fill_headerbar(UiObject *obj, GtkWidget *headerbar) { 53 void ui_fill_headerbar(UiObject *obj, GtkWidget *headerbar) {
50 CxMap *items = uic_get_toolbar_items();
51 CxList *left_defaults = uic_get_toolbar_defaults(UI_TOOLBAR_LEFT); 54 CxList *left_defaults = uic_get_toolbar_defaults(UI_TOOLBAR_LEFT);
52 CxList *center_defaults = uic_get_toolbar_defaults(UI_TOOLBAR_CENTER); 55 CxList *center_defaults = uic_get_toolbar_defaults(UI_TOOLBAR_CENTER);
53 CxList *right_defaults = uic_get_toolbar_defaults(UI_TOOLBAR_RIGHT); 56 CxList *right_defaults = uic_get_toolbar_defaults(UI_TOOLBAR_RIGHT);
54 57
55 ui_headerbar_add_items(obj, headerbar, left_defaults, UI_TOOLBAR_LEFT); 58 ui_headerbar_add_items(obj, headerbar, left_defaults, UI_TOOLBAR_LEFT);
84 case UI_TOOLBAR_CENTER: { 87 case UI_TOOLBAR_CENTER: {
85 88
86 #if GTK_MAJOR_VERSION >= 4 89 #if GTK_MAJOR_VERSION >= 4
87 gtk_box_append(GTK_BOX(box), item); 90 gtk_box_append(GTK_BOX(box), item);
88 #else 91 #else
89 gtk_box_pack_start(GTK_BOX(box), item, 0, 0, 0) 92 gtk_box_pack_start(GTK_BOX(box), item, 0, 0, 0);
90 #endif 93 #endif
91 break; 94 break;
92 } 95 }
93 case UI_TOOLBAR_RIGHT: { 96 case UI_TOOLBAR_RIGHT: {
94 UI_HEADERBAR_PACK_END(headerbar, item); 97 UI_HEADERBAR_PACK_END(headerbar, item);

mercurial