Add required header
[pinentry.git] / gtk+-2 / gseal-gtk-compat.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
2 /*
3  *  Copyright © 2009 Thomas H.P. Andersen <phomes@gmail.com>,
4  *              2009 Javier Jardón <jjardon@gnome.org>
5  *              2010 Guido Günther <agx@sigxcpu.org>
6  *
7  *  This runtime is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU Lesser General Public License as published by
9  *  the Free Software Foundation; either version 2.1, or (at your option)
10  *  any later version.
11  *
12  *  This runtime is distributed in the hope runtime it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU Lesser General Public License
18  *  along with this runtime; if not, write to the Free Software
19  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20  */
21
22 #ifndef GSEAL_GTK_COMPAT_H
23 #define GSEAL_GTK_COMPAT_H
24
25 G_BEGIN_DECLS
26
27 #if !GTK_CHECK_VERSION (2, 20, 0)
28 #define gtk_widget_get_realized(widget)                         GTK_WIDGET_REALIZED(widget)
29 #define gtk_widget_get_mapped(widget)                           GTK_WIDGET_MAPPED(widget)
30 #endif /* GTK < 2.20.0 */
31
32 #if !GTK_CHECK_VERSION (2, 18, 0)
33 #define gtk_cell_renderer_get_alignment(cell, xalign, yalign)   g_object_get (cell, "xalign", xalign, "yalign", yalign, NULL)
34 #define gtk_cell_renderer_get_padding(cell, xpad, ypad)         g_object_get (cell, "xpad", xpad, "ypad", ypad, NULL)
35 #define gtk_cell_renderer_set_padding(cell, xpad, ypad)         g_object_set (cell, "xpad", xpad, "ypad", ypad, NULL)
36 #define gtk_widget_get_allocation(widget, alloc)                (*(alloc)=(widget)->allocation)
37 #define gtk_widget_set_allocation(widget, alloc)                ((widget)->allocation=*(alloc))
38 #define gtk_widget_get_app_paintable(widget)                    (GTK_WIDGET_APP_PAINTABLE (widget))
39 #define gtk_widget_set_can_default(widget, can_default)         ((can_default) ? (GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_DEFAULT)) : (GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_DEFAULT)))
40 #define gtk_widget_set_can_focus(widget, can_focus)             ((can_focus) ? (GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS)) : (GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS)))
41 #define gtk_widget_set_double_buffered(widget, double_buffered) ((double_buffered) ? (GTK_WIDGET_SET_FLAGS (widget, GTK_DOUBLE_BUFFERED)) : (GTK_WIDGET_UNSET_FLAGS (widget, GTK_DOUBLE_BUFFERED)))
42 #define gtk_widget_is_drawable(widget)                          (GTK_WIDGET_DRAWABLE (widget))
43 #define gtk_widget_is_sensitive(widget)                         (GTK_WIDGET_IS_SENSITIVE(widget))
44 #define gtk_widget_has_focus(widget)                            (GTK_WIDGET_HAS_FOCUS (widget))
45 #define gtk_widget_get_has_window(widget)                       (!GTK_WIDGET_NO_WINDOW (widget))
46 #define gtk_widget_get_sensitive(widget)                        (GTK_WIDGET_SENSITIVE(widget))
47 #define gtk_widget_get_state(widget)                            ((widget)->state)
48 #define gtk_widget_get_visible(widget)                          (GTK_WIDGET_VISIBLE (widget))
49 #define gtk_widget_set_window(widget, _window)                  ((widget)->window=_window)
50 #define gtk_widget_set_realized(widget, realized)               ((realized) ? (GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED)) : (GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED)))
51 #endif /* GTK+ < 2.18.0 */
52
53 #if !GTK_CHECK_VERSION (2, 14, 0)
54 #define gtk_window_get_default_widget(window)                   ((window)->default_widget)
55 #define gtk_widget_get_window(widget)                           ((widget)->window)
56 #endif /* GTK+ < 2.14.0 */
57
58 G_END_DECLS
59
60 #endif /* GSEAL_GTK_COMPAT_H */
61 /* ex:ts=8:noet: */