]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/private/compat.h
9e1db828f3ae01dceef59307ceae18d7848cb1b6
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/private/compat.h
3 // Purpose: Compatibility code for older GTK+ versions
4 // Author: Vaclav Slavik
7 // Copyright: (c) 2011 Vaclav Slavik <vslavik@fastmail.fm>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_GTK_PRIVATE_COMPAT_H_
12 #define _WX_GTK_PRIVATE_COMPAT_H_
14 // ----------------------------------------------------------------------------
15 // Implementations of new accessors for older GTK+ versions
16 // ----------------------------------------------------------------------------
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.
22 // Note: wx_ prefix is used to avoid symbol conflicts at runtime
25 #if !GTK_CHECK_VERSION(2,18,0)
26 inline gboolean
wx_gtk_widget_get_has_window(GtkWidget
*widget
)
28 return !GTK_WIDGET_NO_WINDOW(widget
);
30 #define gtk_widget_get_has_window wx_gtk_widget_get_has_window
34 #if !GTK_CHECK_VERSION(2,18,0)
35 inline gboolean
wx_gtk_widget_get_has_grab(GtkWidget
*widget
)
37 return GTK_WIDGET_HAS_GRAB(widget
);
39 #define gtk_widget_get_has_grab wx_gtk_widget_get_has_grab
43 #if !GTK_CHECK_VERSION(2,18,0)
44 inline gboolean
wx_gtk_widget_get_visible(GtkWidget
*widget
)
46 return GTK_WIDGET_VISIBLE(widget
);
48 #define gtk_widget_get_visible wx_gtk_widget_get_visible
52 #if !GTK_CHECK_VERSION(2,18,0)
53 inline gboolean
wx_gtk_widget_get_sensitive(GtkWidget
*widget
)
55 return GTK_WIDGET_VISIBLE(widget
);
57 #define gtk_widget_get_sensitive wx_gtk_widget_get_sensitive
61 #if !GTK_CHECK_VERSION(2,18,0)
62 inline gboolean
wx_gtk_widget_is_drawable(GtkWidget
*widget
)
64 return GTK_WIDGET_DRAWABLE(widget
);
66 #define gtk_widget_is_drawable wx_gtk_widget_is_drawable
70 #if !GTK_CHECK_VERSION(2,18,0)
71 inline gboolean
wx_gtk_widget_get_can_focus(GtkWidget
*widget
)
73 return GTK_WIDGET_CAN_FOCUS(widget
);
75 #define gtk_widget_get_can_focus wx_gtk_widget_get_can_focus
77 inline void wx_gtk_widset_set_can_focus(GtkWidget
*widget
, gboolean can
)
80 GTK_WIDGET_SET_FLAGS(widget
, GTK_CAN_FOCUS
);
82 GTK_WIDGET_UNSET_FLAGS(widget
, GTK_CAN_FOCUS
);
84 #define gtk_widset_set_can_focus wx_gtk_widset_set_can_focus
88 #if !GTK_CHECK_VERSION(2,18,0)
89 inline gboolean
wx_gtk_widget_get_can_default(GtkWidget
*widget
)
91 return GTK_WIDGET_CAN_DEFAULT(widget
);
93 #define gtk_widget_get_can_default wx_gtk_widget_get_can_default
95 inline void wx_gtk_widget_set_can_default(GtkWidget
*widget
, gboolean can
)
98 GTK_WIDGET_SET_FLAGS(widget
, GTK_CAN_DEFAULT
);
100 GTK_WIDGET_UNSET_FLAGS(widget
, GTK_CAN_DEFAULT
);
102 #define gtk_widget_set_can_default wx_gtk_widget_set_can_default
106 #if !GTK_CHECK_VERSION(2,18,0)
107 inline gboolean
wx_gtk_widget_has_default(GtkWidget
*widget
)
109 return GTK_WIDGET_HAS_DEFAULT(widget
);
111 #define gtk_widget_has_default wx_gtk_widget_has_default
115 #if !GTK_CHECK_VERSION(2,18,0)
116 inline GtkStateType
wx_gtk_widget_get_state(GtkWidget
*widget
)
118 return (GtkStateType
)GTK_WIDGET_STATE(widget
);
120 #define gtk_widget_get_state wx_gtk_widget_get_state
124 #if !GTK_CHECK_VERSION(2,18,0)
125 inline gboolean
wx_gtk_widget_get_double_buffered(GtkWidget
*widget
)
127 return GTK_WIDGET_DOUBLE_BUFFERED(widget
);
129 #define gtk_widget_get_double_buffered wx_gtk_widget_get_double_buffered
133 #if !GTK_CHECK_VERSION(2,20,0)
134 inline gboolean
wx_gtk_widget_get_realized(GtkWidget
*widget
)
136 return GTK_WIDGET_REALIZED(widget
);
138 #define gtk_widget_get_realized wx_gtk_widget_get_realized
142 #if !GTK_CHECK_VERSION(2,20,0)
143 inline gboolean
wx_gtk_widget_get_mapped(GtkWidget
*widget
)
145 return GTK_WIDGET_MAPPED(widget
);
147 #define gtk_widget_get_mapped wx_gtk_widget_get_mapped
151 #endif // _WX_GTK_PRIVATE_COMPAT_H_