37 extern "C" { |
37 extern "C" { |
38 #endif |
38 #endif |
39 |
39 |
40 #pragma clang diagnostic ignored "-Wdeprecated-declarations" |
40 #pragma clang diagnostic ignored "-Wdeprecated-declarations" |
41 |
41 |
|
42 |
|
43 #if GLIB_MAJOR_VERSION * 1000 + GLIB_MINOR_VERSION > 74 |
|
44 #define UI_G_APPLICATION_FLAGS G_APPLICATION_DEFAULT_FLAGS |
|
45 #else |
|
46 #define UI_G_APPLICATION_FLAGS G_APPLICATION_FLAGS_NONE |
|
47 #endif |
|
48 |
|
49 #ifdef UI_LIBADWAITA |
|
50 #define UI_APPLICATION AdwApplication* |
|
51 #define UI_APPLICATION_NEW(id) adw_application_new(id, UI_G_APPLICATION_FLAGS) |
|
52 #elif GTK_MAJOR_VERSION >= 3 |
|
53 #define UI_APPLICATION GtkApplication* |
|
54 #define UI_APPLICATION_NEW(id) gtk_application_new(id, UI_G_APPLICATION_FLAGS) |
|
55 #endif |
|
56 |
|
57 #if GTK_MAJOR_VERSION >= 4 |
|
58 #define WINDOW_SHOW(window) gtk_window_present(GTK_WINDOW(window)) |
|
59 #define WINDOW_DESTROY(window) gtk_window_destroy(GTK_WINDOW(window)) |
|
60 #define WINDOW_SET_CONTENT(window, child) gtk_window_set_child(GTK_WINDOW(window), child) |
|
61 #define BOX_ADD(box, child) gtk_box_append(GTK_BOX(box), child) |
|
62 #define ENTRY_SET_TEXT(entry, text) gtk_editable_set_text(GTK_EDITABLE(entry), text) |
|
63 #define ENTRY_GET_TEXT(entry) gtk_editable_get_text(GTK_EDITABLE(entry)) |
|
64 #define SCROLLEDWINDOW_NEW() gtk_scrolled_window_new() |
|
65 #define SCROLLEDWINDOW_SET_CHILD(sw, child) gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), child) |
|
66 #define SCROLLEDWINDOW_GET_CHILD(sw) gtk_scrolled_window_get_child(GTK_SCROLLED_WINDOW(sw)) |
|
67 #define WIDGET_ADD_CSS_CLASS(w, cssclass) gtk_widget_add_css_class(w, cssclass) |
|
68 #else |
|
69 #define WINDOW_SHOW(window) gtk_widget_show_all(window) |
|
70 #define WINDOW_DESTROY(window) gtk_widget_destroy(window) |
|
71 #define WINDOW_SET_CONTENT(window, child) gtk_container_add(GTK_CONTAINER(window), child) |
|
72 #define BOX_ADD(box, child) gtk_box_pack_end(GTK_BOX(box), child, TRUE, TRUE, 0) |
|
73 #define ENTRY_SET_TEXT(entry, text) gtk_entry_set_text(GTK_ENTRY(entry), text) |
|
74 #define ENTRY_GET_TEXT(entry) gtk_entry_get_text(GTK_ENTRY(entry)) |
|
75 #define SCROLLEDWINDOW_NEW() gtk_scrolled_window_new(NULL, NULL) |
|
76 #define SCROLLEDWINDOW_SET_CHILD(sw, child) gtk_container_add(GTK_CONTAINER(sw), child) |
|
77 #define SCROLLEDWINDOW_GET_CHILD(sw) gtk_bin_get_child(GTK_BIN(sw)) |
|
78 #define WIDGET_ADD_CSS_CLASS(w, cssclass) gtk_style_context_add_class(gtk_widget_get_style_context(w), cssclass) |
|
79 #endif |
|
80 |
|
81 #ifdef UI_GTK2 |
|
82 #undef SCROLLEDWINDOW_SET_CHILD |
|
83 #define SCROLLEDWINDOW_SET_CHILD(sw, child) gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), child) |
|
84 #endif |
|
85 |
|
86 #if GTK_MAJOR_VERSION >= 4 |
|
87 #define UI_GTK_SINCE_V4(st) st |
|
88 #define UI_GTK_SINCE_V3(st) |
|
89 #define UI_GTK_V2(st) |
|
90 #define UI_GTK_V3(st) |
|
91 #define UI_GTK_V4(st) st |
|
92 #elif GTK_MAJOR_VERSION >= 3 |
|
93 #define UI_GTK_SINCE_V4(st) st |
|
94 #define UI_GTK_SINCE_V3(st) st |
|
95 #define UI_GTK_V2(st) |
|
96 #define UI_GTK_V3(st) st |
|
97 #define UI_GTK_V4(st) |
|
98 #else |
|
99 #define UI_GTK_SINCE_V4(st) |
|
100 #define UI_GTK_SINCE_V3(st) |
|
101 #define UI_GTK_V2(st) st |
|
102 #define UI_GTK_V3(st) |
|
103 #define UI_GTK_V4(st) |
|
104 #endif |
|
105 |
|
106 |
42 typedef struct UiEventData { |
107 typedef struct UiEventData { |
43 UiObject *obj; |
108 UiObject *obj; |
44 ui_callback callback; |
109 ui_callback callback; |
45 void *userdata; |
110 void *userdata; |
46 int value; |
111 int value; |