• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 Collabora Ltd.
3  * Copyright (C) 2010 Igalia, S.L.
4  *
5  *  This library is free software; you can redistribute it and/or
6  *  modify it under the terms of the GNU Library General Public
7  *  License as published by the Free Software Foundation; either
8  *  version 2 of the License, or (at your option) any later version.
9  *
10  *  This library is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  *  Library General Public License for more details.
14  *
15  *  You should have received a copy of the GNU Library General Public License
16  *  along with this library; see the file COPYING.LIB.  If not, write to
17  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  *  Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef GtkVersioning_h
22 #define GtkVersioning_h
23 
24 #include <gtk/gtk.h>
25 
26 #ifndef GTK_API_VERSION_2
27 #include <gdk/gdkkeysyms-compat.h>
28 #endif
29 
30 G_BEGIN_DECLS
31 
32 // Macros to avoid deprecation checking churn
33 #ifndef GTK_API_VERSION_2
34 #define GDK_WINDOW_XWINDOW(window) (gdk_x11_window_get_xid(window))
35 #else
36 GdkPixbuf* gdk_pixbuf_get_from_surface(cairo_surface_t* surface, int srcX, int srcY,
37                                        int width, int height);
38 #endif
39 
40 #if !GTK_CHECK_VERSION(2, 23, 4)
41 #define gdk_pixmap_get_size gdk_drawable_get_size
42 #endif // GTK_CHECK_VERSION(2, 23, 4)
43 
44 #if !GTK_CHECK_VERSION(2, 23, 0)
45 #define gdk_window_get_display(window) gdk_drawable_get_display(window)
46 #define gdk_window_get_visual gdk_drawable_get_visual
47 #endif // GTK_CHECK_VERSION(2, 23, 0)
48 
49 #if !GTK_CHECK_VERSION(2, 22, 0)
50 cairo_surface_t* gdk_window_create_similar_surface(GdkWindow* window, cairo_content_t content, int width, int height);
51 #endif // GTK_CHECK_VERSION(2, 22, 0)
52 
53 #if !GTK_CHECK_VERSION(2, 21, 2)
54 #define gdk_visual_get_depth(visual) (visual)->depth
55 #define gdk_visual_get_bits_per_rgb(visual) (visual)->bits_per_rgb
56 #define gdk_drag_context_get_selected_action(context) (context)->action
57 #define gdk_drag_context_get_actions(context) (context)->actions
58 #endif // GTK_CHECK_VERSION(2, 21, 2)
59 
60 #if !GTK_CHECK_VERSION(2, 20, 0)
61 #define gtk_widget_get_realized(widget) GTK_WIDGET_REALIZED(widget)
62 #define gtk_widget_set_realized(widget, TRUE) GTK_WIDGET_SET_FLAGS((widget), GTK_REALIZED)
63 #define gtk_range_get_min_slider_size(range) (range)->min_slider_size
64 #endif // GTK_CHECK_VERSION(2, 20, 0)
65 
66 #if !GTK_CHECK_VERSION(2, 19, 0)
67 #define gtk_widget_is_toplevel(widget) GTK_WIDGET_TOPLEVEL(widget)
68 #define gtk_widget_get_realized(widget) GTK_WIDGET_REALIZED(widget)
69 #define gtk_widget_get_has_window(widget) !GTK_WIDGET_NO_WINDOW(widget)
70 #define gtk_widget_get_can_focus(widget) GTK_WIDGET_CAN_FOCUS(widget)
71 #define gtk_widget_is_sensitive(widget) GTK_WIDGET_IS_SENSITIVE(widget)
72 #endif // GTK_CHECK_VERSION(2, 19, 0)
73 
74 #if !GTK_CHECK_VERSION(2, 18, 0)
75 #define gtk_widget_set_visible(widget, FALSE) GTK_WIDGET_UNSET_FLAGS((widget), GTK_VISIBLE)
76 #define gtk_widget_get_visible(widget) (GTK_WIDGET_FLAGS(widget) & GTK_VISIBLE)
77 
78 #define gtk_widget_set_window(widget, new_window) (widget)->window = (new_window)
79 #define gtk_widget_set_can_focus(widget, TRUE) GTK_WIDGET_SET_FLAGS((widget), GTK_CAN_FOCUS)
80 #define gtk_widget_get_allocation(widget, alloc) (*(alloc) = (widget)->allocation)
81 #define gtk_widget_set_allocation(widget, alloc) ((widget)->allocation = *(alloc))
82 #endif // GTK_CHECK_VERSION(2, 18, 0)
83 
84 #if !GTK_CHECK_VERSION(2, 17, 3)
85 void gdk_window_get_root_coords(GdkWindow* window, gint x, gint y, gint* rootX, gint* rootY);
86 #endif // GTK_CHECK_VERSION(2, 17, 3)
87 
88 #if !GTK_CHECK_VERSION(2, 16, 0)
89 const gchar* gtk_menu_item_get_label(GtkMenuItem*);
90 #endif // GTK_CHECK_VERSION(2, 16, 0)
91 
92 
93 #if !GTK_CHECK_VERSION(2, 14, 0)
94 #define gtk_widget_get_window(widget) (widget)->window
95 #define gtk_adjustment_get_value(adj) (adj)->value
96 #define gtk_dialog_get_content_area(dialog) (dialog)->vbox
97 #define gtk_dialog_get_action_area(dialog) (dialog)->action_area
98 #define gtk_selection_data_get_length(data) (data)->length
99 #define gtk_selection_data_get_data(data) (data)->data
100 #define gtk_selection_data_get_target(data) (data)->target
101 #define gtk_adjustment_set_page_size(adj, newValue) ((adj)->page_size = newValue)
102 #define gtk_adjustment_set_value(adj, newValue) ((adj)->value = newValue)
103 #define gtk_adjustment_set_lower(adj, newValue) ((adj)->lower = newValue)
104 #define gtk_adjustment_set_upper(adj, newValue) ((adj)->upper = newValue)
105 
106 void gtk_adjustment_configure(GtkAdjustment* adjustment, gdouble value, gdouble lower, gdouble upper,
107                               gdouble stepIncrement, gdouble pageIncrement, gdouble pageSize);
108 
109 void gtk_adjustment_set_value(GtkAdjustment* adjusment, gdouble value);
110 #endif // GTK_CHECK_VERSION(2, 14, 0)
111 
112 GdkDevice* getDefaultGDKPointerDevice(GdkWindow* window);
113 GdkCursor* blankCursor();
114 
115 #if !GLIB_CHECK_VERSION(2, 27, 1)
116 gboolean g_signal_accumulator_first_wins(GSignalInvocationHint* invocationHint, GValue* returnAccumulator, const GValue* handlerReturn, gpointer data);
117 #endif
118 
119 G_END_DECLS
120 
121 #endif // GtkVersioning_h
122