1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /* vim:expandtab:shiftwidth=4:tabstop=4:
3 : */
4 : /* ***** BEGIN LICENSE BLOCK *****
5 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 : *
7 : * The contents of this file are subject to the Mozilla Public License Version
8 : * 1.1 (the "License"); you may not use this file except in compliance with
9 : * the License. You may obtain a copy of the License at
10 : * http://www.mozilla.org/MPL/
11 : *
12 : * Software distributed under the License is distributed on an "AS IS" basis,
13 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 : * for the specific language governing rights and limitations under the
15 : * License.
16 : *
17 : * The Original Code is mozilla.org code.
18 : *
19 : * The Initial Developer of the Original Code is Martin Stransky
20 : * <stransky@redhat.com>. Portions created by the Initial Developer
21 : * are Copyright (C) 2001 the Initial Developer. All Rights Reserved.
22 : *
23 : * Contributor(s):
24 : *
25 : * Alternatively, the contents of this file may be used under the terms of
26 : * either the GNU General Public License Version 2 or later (the "GPL"), or
27 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 : * in which case the provisions of the GPL or the LGPL are applicable instead
29 : * of those above. If you wish to allow use of your version of this file only
30 : * under the terms of either the GPL or the LGPL, and not to allow others to
31 : * use your version of this file under the terms of the MPL, indicate your
32 : * decision by deleting the provisions above and replace them with the notice
33 : * and other provisions required by the GPL or the LGPL. If you do not delete
34 : * the provisions above, a recipient may use your version of this file under
35 : * the terms of any one of the MPL, the GPL or the LGPL.
36 : *
37 : * ***** END LICENSE BLOCK ***** */
38 :
39 : /**
40 : * gtk2compat.h: GTK2 compatibility routines
41 : *
42 : * gtk2compat provides an API which is not defined in GTK2.
43 : */
44 :
45 : #ifndef _GTK2_COMPAT_H_
46 : #define _GTK2_COMPAT_H_
47 :
48 : #ifdef __cplusplus
49 : extern "C" {
50 : #endif /* __cplusplus */
51 :
52 : #if !GTK_CHECK_VERSION(2, 14, 0)
53 : static inline GdkWindow*
54 0 : gtk_widget_get_window(GtkWidget *widget)
55 : {
56 0 : return widget->window;
57 : }
58 :
59 : static inline const guchar *
60 : gtk_selection_data_get_data(GtkSelectionData *selection_data)
61 : {
62 : return selection_data->data;
63 : }
64 :
65 : static inline gint
66 : gtk_selection_data_get_length(GtkSelectionData *selection_data)
67 : {
68 : return selection_data->length;
69 : }
70 :
71 : static inline GdkAtom
72 : gtk_selection_data_get_target(GtkSelectionData *selection_data)
73 : {
74 : return selection_data->target;
75 : }
76 :
77 : static inline GtkWidget *
78 : gtk_dialog_get_content_area(GtkDialog *dialog)
79 : {
80 : return dialog->vbox;
81 : }
82 : #endif
83 :
84 :
85 : #if !GTK_CHECK_VERSION(2, 16, 0)
86 : static inline GdkAtom
87 : gtk_selection_data_get_selection(GtkSelectionData *selection_data)
88 : {
89 : return selection_data->selection;
90 : }
91 : #endif
92 :
93 : #if !GTK_CHECK_VERSION(2, 18, 0)
94 : static inline gboolean
95 0 : gtk_widget_get_visible(GtkWidget *widget)
96 : {
97 0 : return GTK_WIDGET_VISIBLE(widget);
98 : }
99 :
100 : static inline gboolean
101 0 : gtk_widget_has_focus(GtkWidget *widget)
102 : {
103 0 : return GTK_WIDGET_HAS_FOCUS(widget);
104 : }
105 :
106 : static inline void
107 0 : gtk_widget_get_allocation(GtkWidget *widget, GtkAllocation *allocation)
108 : {
109 0 : *allocation = widget->allocation;
110 0 : }
111 :
112 : static inline void
113 0 : gtk_widget_set_allocation(GtkWidget *widget, const GtkAllocation *allocation)
114 : {
115 0 : widget->allocation = *allocation;
116 0 : }
117 :
118 : static inline gboolean
119 0 : gdk_window_is_destroyed(GdkWindow *window)
120 : {
121 0 : return GDK_WINDOW_OBJECT(window)->destroyed;
122 : }
123 :
124 : static inline void
125 0 : gtk_widget_set_can_focus(GtkWidget *widget, gboolean can_focus)
126 : {
127 0 : if (can_focus)
128 0 : GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
129 : else
130 0 : GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS);
131 0 : }
132 :
133 : static inline void
134 0 : gtk_widget_set_window(GtkWidget *widget, GdkWindow *window)
135 : {
136 0 : widget->window = window;
137 0 : }
138 : #endif
139 :
140 : #if !GTK_CHECK_VERSION(2, 20, 0)
141 : static inline void
142 0 : gtk_widget_set_mapped(GtkWidget *widget, gboolean mapped)
143 : {
144 0 : if (mapped)
145 0 : GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
146 : else
147 0 : GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
148 0 : }
149 :
150 : static inline gboolean
151 0 : gtk_widget_get_mapped(GtkWidget *widget)
152 : {
153 0 : return GTK_WIDGET_MAPPED (widget);
154 : }
155 :
156 : static inline void
157 0 : gtk_widget_set_realized(GtkWidget *widget, gboolean realized)
158 : {
159 0 : if (realized)
160 0 : GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
161 : else
162 0 : GTK_WIDGET_UNSET_FLAGS(widget, GTK_REALIZED);
163 0 : }
164 :
165 : static inline gboolean
166 0 : gtk_widget_get_realized(GtkWidget *widget)
167 : {
168 0 : return GTK_WIDGET_REALIZED (widget);
169 : }
170 : #endif
171 :
172 : #if !GTK_CHECK_VERSION(2, 22, 0)
173 : static inline gint
174 0 : gdk_visual_get_depth(GdkVisual *visual)
175 : {
176 0 : return visual->depth;
177 : }
178 :
179 : static inline GdkDragAction
180 0 : gdk_drag_context_get_actions(GdkDragContext *context)
181 : {
182 0 : return context->actions;
183 : }
184 : #endif
185 :
186 : #if !GTK_CHECK_VERSION(2, 24, 0)
187 : #ifdef GDK_WINDOW_XDISPLAY
188 : static inline GdkWindow *
189 0 : gdk_x11_window_lookup_for_display(GdkDisplay *display, Window window)
190 : {
191 0 : return gdk_window_lookup_for_display(display, window);
192 : }
193 : #endif
194 : static inline GdkDisplay *
195 0 : gdk_window_get_display(GdkWindow *window)
196 : {
197 0 : return gdk_drawable_get_display(GDK_DRAWABLE(window));
198 : }
199 :
200 : static inline GdkScreen*
201 : gdk_window_get_screen (GdkWindow *window)
202 : {
203 : return gdk_drawable_get_screen (window);
204 : }
205 : #endif
206 :
207 : #ifdef GDK_WINDOW_XWINDOW
208 : static inline Window
209 0 : gdk_x11_window_get_xid(GdkWindow *window)
210 : {
211 0 : return(GDK_WINDOW_XWINDOW(window));
212 : }
213 : #endif
214 :
215 : #ifdef __cplusplus
216 : }
217 : #endif /* __cplusplus */
218 :
219 : #endif /* _GTK2_COMPAT_H_ */
|