]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/private/compat.h
9e1db828f3ae01dceef59307ceae18d7848cb1b6
[wxWidgets.git] / include / wx / gtk / private / compat.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/private/compat.h
3 // Purpose: Compatibility code for older GTK+ versions
4 // Author: Vaclav Slavik
5 // Created: 2011-03-25
6 // RCS-ID: $Id$
7 // Copyright: (c) 2011 Vaclav Slavik <vslavik@fastmail.fm>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_GTK_PRIVATE_COMPAT_H_
12 #define _WX_GTK_PRIVATE_COMPAT_H_
13
14 // ----------------------------------------------------------------------------
15 // Implementations of new accessors for older GTK+ versions
16 // ----------------------------------------------------------------------------
17
18 // GTK+ deprecated direct access to struct members and some other stuff,
19 // replacing them with simple accessor functions. These aren't available in
20 // older versions, though, so we have to provide them for compatibility.
21 //
22 // Note: wx_ prefix is used to avoid symbol conflicts at runtime
23
24
25 #if !GTK_CHECK_VERSION(2,18,0)
26 inline gboolean wx_gtk_widget_get_has_window(GtkWidget *widget)
27 {
28 return !GTK_WIDGET_NO_WINDOW(widget);
29 }
30 #define gtk_widget_get_has_window wx_gtk_widget_get_has_window
31 #endif
32
33
34 #if !GTK_CHECK_VERSION(2,18,0)
35 inline gboolean wx_gtk_widget_get_has_grab(GtkWidget *widget)
36 {
37 return GTK_WIDGET_HAS_GRAB(widget);
38 }
39 #define gtk_widget_get_has_grab wx_gtk_widget_get_has_grab
40 #endif
41
42
43 #if !GTK_CHECK_VERSION(2,18,0)
44 inline gboolean wx_gtk_widget_get_visible(GtkWidget *widget)
45 {
46 return GTK_WIDGET_VISIBLE(widget);
47 }
48 #define gtk_widget_get_visible wx_gtk_widget_get_visible
49 #endif
50
51
52 #if !GTK_CHECK_VERSION(2,18,0)
53 inline gboolean wx_gtk_widget_get_sensitive(GtkWidget *widget)
54 {
55 return GTK_WIDGET_VISIBLE(widget);
56 }
57 #define gtk_widget_get_sensitive wx_gtk_widget_get_sensitive
58 #endif
59
60
61 #if !GTK_CHECK_VERSION(2,18,0)
62 inline gboolean wx_gtk_widget_is_drawable(GtkWidget *widget)
63 {
64 return GTK_WIDGET_DRAWABLE(widget);
65 }
66 #define gtk_widget_is_drawable wx_gtk_widget_is_drawable
67 #endif
68
69
70 #if !GTK_CHECK_VERSION(2,18,0)
71 inline gboolean wx_gtk_widget_get_can_focus(GtkWidget *widget)
72 {
73 return GTK_WIDGET_CAN_FOCUS(widget);
74 }
75 #define gtk_widget_get_can_focus wx_gtk_widget_get_can_focus
76
77 inline void wx_gtk_widset_set_can_focus(GtkWidget *widget, gboolean can)
78 {
79 if ( can )
80 GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS);
81 else
82 GTK_WIDGET_UNSET_FLAGS(widget, GTK_CAN_FOCUS);
83 }
84 #define gtk_widset_set_can_focus wx_gtk_widset_set_can_focus
85 #endif
86
87
88 #if !GTK_CHECK_VERSION(2,18,0)
89 inline gboolean wx_gtk_widget_get_can_default(GtkWidget *widget)
90 {
91 return GTK_WIDGET_CAN_DEFAULT(widget);
92 }
93 #define gtk_widget_get_can_default wx_gtk_widget_get_can_default
94
95 inline void wx_gtk_widget_set_can_default(GtkWidget *widget, gboolean can)
96 {
97 if ( can )
98 GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_DEFAULT);
99 else
100 GTK_WIDGET_UNSET_FLAGS(widget, GTK_CAN_DEFAULT);
101 }
102 #define gtk_widget_set_can_default wx_gtk_widget_set_can_default
103 #endif
104
105
106 #if !GTK_CHECK_VERSION(2,18,0)
107 inline gboolean wx_gtk_widget_has_default(GtkWidget *widget)
108 {
109 return GTK_WIDGET_HAS_DEFAULT(widget);
110 }
111 #define gtk_widget_has_default wx_gtk_widget_has_default
112 #endif
113
114
115 #if !GTK_CHECK_VERSION(2,18,0)
116 inline GtkStateType wx_gtk_widget_get_state(GtkWidget *widget)
117 {
118 return (GtkStateType)GTK_WIDGET_STATE(widget);
119 }
120 #define gtk_widget_get_state wx_gtk_widget_get_state
121 #endif
122
123
124 #if !GTK_CHECK_VERSION(2,18,0)
125 inline gboolean wx_gtk_widget_get_double_buffered(GtkWidget *widget)
126 {
127 return GTK_WIDGET_DOUBLE_BUFFERED(widget);
128 }
129 #define gtk_widget_get_double_buffered wx_gtk_widget_get_double_buffered
130 #endif
131
132
133 #if !GTK_CHECK_VERSION(2,20,0)
134 inline gboolean wx_gtk_widget_get_realized(GtkWidget *widget)
135 {
136 return GTK_WIDGET_REALIZED(widget);
137 }
138 #define gtk_widget_get_realized wx_gtk_widget_get_realized
139 #endif
140
141
142 #if !GTK_CHECK_VERSION(2,20,0)
143 inline gboolean wx_gtk_widget_get_mapped(GtkWidget *widget)
144 {
145 return GTK_WIDGET_MAPPED(widget);
146 }
147 #define gtk_widget_get_mapped wx_gtk_widget_get_mapped
148 #endif
149
150
151 #endif // _WX_GTK_PRIVATE_COMPAT_H_
152