]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/private/gtk2-compat.h
Instead of just deleting m_popupInterface, call Destroy() of its wxWindow-based popup...
[wxWidgets.git] / include / wx / gtk / private / gtk2-compat.h
CommitLineData
fc9ab22a
VS
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
0b669520
VS
23//
24// Note 2: We support building against newer GTK+ version and using an older
25// one at runtime, so we must provide our implementations of these
26// functions even if GTK_CHECK_VERSION would indicate the function is
27// already available in GTK+.
28
29#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
30
31inline gboolean wx_gtk_widget_get_has_window(GtkWidget *widget)
32{
33 return !GTK_WIDGET_NO_WINDOW(widget);
34}
35#define gtk_widget_get_has_window wx_gtk_widget_get_has_window
36
37
38inline gboolean wx_gtk_widget_get_has_grab(GtkWidget *widget)
39{
40 return GTK_WIDGET_HAS_GRAB(widget);
41}
42#define gtk_widget_get_has_grab wx_gtk_widget_get_has_grab
43
44
45inline gboolean wx_gtk_widget_get_visible(GtkWidget *widget)
46{
47 return GTK_WIDGET_VISIBLE(widget);
48}
49#define gtk_widget_get_visible wx_gtk_widget_get_visible
50
51
52inline gboolean wx_gtk_widget_get_sensitive(GtkWidget *widget)
53{
54 return GTK_WIDGET_VISIBLE(widget);
55}
56#define gtk_widget_get_sensitive wx_gtk_widget_get_sensitive
57
58
59inline gboolean wx_gtk_widget_is_drawable(GtkWidget *widget)
60{
61 return GTK_WIDGET_DRAWABLE(widget);
62}
63#define gtk_widget_is_drawable wx_gtk_widget_is_drawable
64
65
66inline gboolean wx_gtk_widget_get_can_focus(GtkWidget *widget)
67{
68 return GTK_WIDGET_CAN_FOCUS(widget);
69}
70#define gtk_widget_get_can_focus wx_gtk_widget_get_can_focus
71
72inline void wx_gtk_widset_set_can_focus(GtkWidget *widget, gboolean can)
73{
74 if ( can )
75 GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS);
76 else
77 GTK_WIDGET_UNSET_FLAGS(widget, GTK_CAN_FOCUS);
78}
79#define gtk_widset_set_can_focus wx_gtk_widset_set_can_focus
80
81
82inline gboolean wx_gtk_widget_get_can_default(GtkWidget *widget)
83{
84 return GTK_WIDGET_CAN_DEFAULT(widget);
85}
86#define gtk_widget_get_can_default wx_gtk_widget_get_can_default
87
88inline void wx_gtk_widget_set_can_default(GtkWidget *widget, gboolean can)
89{
90 if ( can )
91 GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_DEFAULT);
92 else
93 GTK_WIDGET_UNSET_FLAGS(widget, GTK_CAN_DEFAULT);
94}
95#define gtk_widget_set_can_default wx_gtk_widget_set_can_default
96
97
98inline gboolean wx_gtk_widget_has_default(GtkWidget *widget)
99{
100 return GTK_WIDGET_HAS_DEFAULT(widget);
101}
102#define gtk_widget_has_default wx_gtk_widget_has_default
103
104
105inline GtkStateType wx_gtk_widget_get_state(GtkWidget *widget)
106{
107 return (GtkStateType)GTK_WIDGET_STATE(widget);
108}
109#define gtk_widget_get_state wx_gtk_widget_get_state
110
111
112inline gboolean wx_gtk_widget_get_double_buffered(GtkWidget *widget)
113{
114 return GTK_WIDGET_DOUBLE_BUFFERED(widget);
115}
116#define gtk_widget_get_double_buffered wx_gtk_widget_get_double_buffered
117
118
119inline gboolean wx_gtk_widget_get_realized(GtkWidget *widget)
120{
121 return GTK_WIDGET_REALIZED(widget);
122}
123#define gtk_widget_get_realized wx_gtk_widget_get_realized
124
fc9ab22a 125
0b669520
VS
126inline gboolean wx_gtk_widget_get_mapped(GtkWidget *widget)
127{
128 return GTK_WIDGET_MAPPED(widget);
129}
130#define gtk_widget_get_mapped wx_gtk_widget_get_mapped
fc9ab22a 131
0b669520 132#endif // !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
fc9ab22a
VS
133
134
135#endif // _WX_GTK_PRIVATE_COMPAT_H_
136