1 /* Wrapper for <gtk/gtk.h>.
2 Copyright (C) 2011 Free Software Foundation, Inc.
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.
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.
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/>. */
17 #ifndef PSPP_GTK_GTK_H
18 #define PSPP_GTK_GTK_H
21 @PRAGMA_SYSTEM_HEADER@
25 #@INCLUDE_NEXT@ @NEXT_GTK_GTK_H@
27 #if !GTK_CHECK_VERSION(2,20,0)
29 * gtk_widget_get_realized:
30 * @widget: a #GtkWidget
32 * Determines whether @widget is realized.
34 * Return value: %TRUE if @widget is realized, %FALSE otherwise
38 static inline gboolean
39 gtk_widget_get_realized (GtkWidget *widget)
41 g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
43 return (GTK_WIDGET_FLAGS (widget) & GTK_REALIZED) != 0;
45 #endif /* gtk < 2.20 */
47 #if !GTK_CHECK_VERSION(2,20,0)
49 * gtk_widget_get_mapped:
50 * @widget: a #GtkWidget
52 * Whether the widget is mapped.
54 * Return value: %TRUE if the widget is mapped, %FALSE otherwise.
58 static inline gboolean
59 gtk_widget_get_mapped (GtkWidget *widget)
61 g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
63 return (GTK_WIDGET_FLAGS (widget) & GTK_MAPPED) != 0;
65 #endif /* gtk < 2.20 */
67 #if !GTK_CHECK_VERSION(2,18,0)
69 * gtk_widget_get_visible:
70 * @widget: a #GtkWidget
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.
76 * See gtk_widget_set_visible().
78 * Return value: %TRUE if the widget is visible
82 static inline gboolean
83 gtk_widget_get_visible (GtkWidget *widget)
85 g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
87 return (GTK_WIDGET_FLAGS (widget) & GTK_VISIBLE) != 0;
89 #endif /* gtk < 2.18 */
91 #if !GTK_CHECK_VERSION(2,18,0)
93 * gtk_widget_is_drawable:
94 * @widget: a #GtkWidget
96 * Determines whether @widget can be drawn to. A widget can be drawn
97 * to if it is mapped and visible.
99 * Return value: %TRUE if @widget is drawable, %FALSE otherwise
103 static inline gboolean
104 gtk_widget_is_drawable (GtkWidget *widget)
106 g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
108 return ((GTK_WIDGET_FLAGS (wid) & GTK_VISIBLE) != 0 &&
109 (GTK_WIDGET_FLAGS (wid) & GTK_MAPPED) != 0);
111 #endif /* gtk < 2.18 */
113 #if !GTK_CHECK_VERSION(2,18,0)
115 * gtk_widget_has_focus:
116 * @widget: a #GtkWidget
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.
122 * Return value: %TRUE if the widget has the global input focus.
126 static inline gboolean
127 gtk_widget_has_focus (GtkWidget *widget)
129 g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
131 return GTK_WIDGET_HAS_FOCUS (widget);
133 #endif /* gtk < 2.18 */
135 #if !GTK_CHECK_VERSION(2,18,0)
137 * gtk_widget_set_can_focus:
138 * @widget: a #GtkWidget
139 * @can_focus: whether or not @widget can own the input focus.
141 * Specifies whether @widget can own the input focus. See
142 * gtk_widget_grab_focus() for actually setting the input focus on a
148 gtk_widget_set_can_focus (GtkWidget *widget,
151 g_return_if_fail (GTK_IS_WIDGET (widget));
153 if (can_focus != GTK_WIDGET_CAN_FOCUS (widget))
156 GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
158 GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS);
160 gtk_widget_queue_resize (widget);
161 g_object_notify (G_OBJECT (widget), "can-focus");
164 #endif /* gtk < 2.18 */
166 #endif /* PSPP_GTK_GTK_H */