psppire-cell-renderer-button: New cell renderer for GtkButton.
[pspp] / src / ui / gui / include / gtk / gtk.in.h
1 /* Wrapper for <gtk/gtk.h>.
2    Copyright (C) 2011 Free Software Foundation, Inc.
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16
17 #ifndef PSPP_GTK_GTK_H
18 #define PSPP_GTK_GTK_H
19
20 #if __GNUC__ >= 3
21 @PRAGMA_SYSTEM_HEADER@
22 #endif
23 @PRAGMA_COLUMNS@
24
25 #@INCLUDE_NEXT@ @NEXT_GTK_GTK_H@
26
27 #if !GTK_CHECK_VERSION(2,20,0)
28 /**
29  * gtk_widget_get_realized:
30  * @widget: a #GtkWidget
31  *
32  * Determines whether @widget is realized.
33  *
34  * Return value: %TRUE if @widget is realized, %FALSE otherwise
35  *
36  * Since: 2.20
37  **/
38 static inline gboolean
39 gtk_widget_get_realized (GtkWidget *widget)
40 {
41   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
42
43   return (GTK_WIDGET_FLAGS (widget) & GTK_REALIZED) != 0;
44 }
45 #endif  /* gtk < 2.20 */
46
47 #if !GTK_CHECK_VERSION(2,20,0)
48 /**
49  * gtk_widget_get_mapped:
50  * @widget: a #GtkWidget
51  *
52  * Whether the widget is mapped.
53  *
54  * Return value: %TRUE if the widget is mapped, %FALSE otherwise.
55  *
56  * Since: 2.20
57  */
58 static inline gboolean
59 gtk_widget_get_mapped (GtkWidget *widget)
60 {
61   g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
62
63   return (GTK_WIDGET_FLAGS (widget) & GTK_MAPPED) != 0;
64 }
65 #endif  /* gtk < 2.20 */
66
67 #if !GTK_CHECK_VERSION(2,18,0)
68 /**
69  * gtk_widget_get_visible:
70  * @widget: a #GtkWidget
71  *
72  * Determines whether the widget is visible. Note that this doesn't
73  * take into account whether the widget's parent is also visible
74  * or the widget is obscured in any way.
75  *
76  * See gtk_widget_set_visible().
77  *
78  * Return value: %TRUE if the widget is visible
79  *
80  * Since: 2.18
81  **/
82 static inline gboolean
83 gtk_widget_get_visible (GtkWidget *widget)
84 {
85   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
86
87   return (GTK_WIDGET_FLAGS (widget) & GTK_VISIBLE) != 0;
88 }
89 #endif  /* gtk < 2.18 */
90
91 #if !GTK_CHECK_VERSION(2,18,0)
92 /**
93  * gtk_widget_is_drawable:
94  * @widget: a #GtkWidget
95  *
96  * Determines whether @widget can be drawn to. A widget can be drawn
97  * to if it is mapped and visible.
98  *
99  * Return value: %TRUE if @widget is drawable, %FALSE otherwise
100  *
101  * Since: 2.18
102  **/
103 static inline gboolean
104 gtk_widget_is_drawable (GtkWidget *widget)
105 {
106   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
107
108   return ((GTK_WIDGET_FLAGS (wid) & GTK_VISIBLE) != 0 &&
109           (GTK_WIDGET_FLAGS (wid) & GTK_MAPPED) != 0);
110 }
111 #endif  /* gtk < 2.18 */
112
113 #if !GTK_CHECK_VERSION(2,18,0)
114 /**
115  * gtk_widget_has_focus:
116  * @widget: a #GtkWidget
117  *
118  * Determines if the widget has the global input focus. See
119  * gtk_widget_is_focus() for the difference between having the global
120  * input focus, and only having the focus within a toplevel.
121  *
122  * Return value: %TRUE if the widget has the global input focus.
123  *
124  * Since: 2.18
125  **/
126 static inline gboolean
127 gtk_widget_has_focus (GtkWidget *widget)
128 {
129   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
130
131   return GTK_WIDGET_HAS_FOCUS (widget);
132 }
133 #endif  /* gtk < 2.18 */
134
135 #if !GTK_CHECK_VERSION(2,18,0)
136 /**
137  * gtk_widget_set_can_focus:
138  * @widget: a #GtkWidget
139  * @can_focus: whether or not @widget can own the input focus.
140  *
141  * Specifies whether @widget can own the input focus. See
142  * gtk_widget_grab_focus() for actually setting the input focus on a
143  * widget.
144  *
145  * Since: 2.18
146  **/
147 static inline void
148 gtk_widget_set_can_focus (GtkWidget *widget,
149                           gboolean   can_focus)
150 {
151   g_return_if_fail (GTK_IS_WIDGET (widget));
152
153   if (can_focus != GTK_WIDGET_CAN_FOCUS (widget))
154     {
155       if (can_focus)
156         GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
157       else
158         GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS);
159
160       gtk_widget_queue_resize (widget);
161       g_object_notify (G_OBJECT (widget), "can-focus");
162     }
163 }
164 #endif  /* gtk < 2.18 */
165
166 #if !GTK_CHECK_VERSION(2,22,0)
167 /**
168  * gtk_button_get_event_window:
169  * @button: a #GtkButton
170  *
171  * Returns the button's event window if it is realized, %NULL otherwise.
172  * This function should be rarely needed.
173  *
174  * Return value: (transfer none): @button's event window.
175  *
176  * Since: 2.22
177  */
178 static inline GdkWindow*
179 gtk_button_get_event_window (GtkButton *button)
180 {
181   g_return_val_if_fail (GTK_IS_BUTTON (button), NULL);
182
183   return button->event_window;
184 }
185 #endif  /* gtk < 2.22 */
186
187 #endif /* PSPP_GTK_GTK_H */