+ * Returns: the state of @widget.
+ *
+ * Since: 2.18
+ */
+GtkStateType
+gtk_widget_get_state (GtkWidget *widget)
+{
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), GTK_STATE_NORMAL);
+
+ return widget->state;
+}
+
+/**
+ * gtk_widget_set_visible:
+ * @widget: a #GtkWidget
+ * @visible: whether the widget should be shown or not
+ *
+ * Sets the visibility state of @widget. Note that setting this to
+ * %TRUE doesn't mean the widget is actually viewable, see
+ * gtk_widget_get_visible().
+ *
+ * This function simply calls gtk_widget_show() or gtk_widget_hide()
+ * but is nicer to use when the visibility of the widget depends on
+ * some condition.
+ *
+ * Since: 2.18
+ **/
+void
+gtk_widget_set_visible (GtkWidget *widget,
+ gboolean visible)
+{
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+
+ if (visible != gtk_widget_get_visible (widget))
+ {
+ if (visible)
+ gtk_widget_show (widget);
+ else
+ gtk_widget_hide (widget);
+ }
+}
+
+/**
+ * gtk_widget_get_visible:
+ * @widget: a #GtkWidget
+ *
+ * Determines whether the widget is visible. Note that this doesn't
+ * take into account whether the widget's parent is also visible
+ * or the widget is obscured in any way.
+ *
+ * See gtk_widget_set_visible().
+ *
+ * Return value: %TRUE if the widget is visible
+ *
+ * Since: 2.18
+ **/
+gboolean
+gtk_widget_get_visible (GtkWidget *widget)
+{
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
+
+ return (GTK_OBJECT_FLAGS (widget) & GTK_VISIBLE) != 0;
+}
+
+/**
+ * gtk_widget_set_has_window:
+ * @widget: a #GtkWidget
+ * @has_window: whether or not @widget has a window.
+ *
+ * Specifies whether @widget has a #GdkWindow of its own. Note that
+ * all realized widgets have a non-%NULL "window" pointer
+ * (gtk_widget_get_window() never returns a %NULL window when a widget
+ * is realized), but for many of them it's actually the #GdkWindow of
+ * one of its parent widgets. Widgets that create a %window for
+ * themselves in GtkWidget::realize() however must announce this by
+ * calling this function with @has_window = %TRUE.
+ *
+ * This function should only be called by widget implementations,
+ * and they should call it in their init() function.
+ *
+ * Since: 2.18
+ **/
+void
+gtk_widget_set_has_window (GtkWidget *widget,
+ gboolean has_window)
+{
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+
+ if (has_window)
+ GTK_WIDGET_UNSET_FLAGS (widget, GTK_NO_WINDOW);
+ else
+ GTK_WIDGET_SET_FLAGS (widget, GTK_NO_WINDOW);
+}
+
+/**
+ * gtk_widget_get_has_window:
+ * @widget: a #GtkWidget
+ *
+ * Determines whether @widget has a #GdkWindow of its own. See
+ * gtk_widget_set_has_window().
+ *
+ * Return value: %TRUE if @widget has a window, %FALSE otherwise
+ *
+ * Since: 2.18
+ **/
+gboolean
+gtk_widget_get_has_window (GtkWidget *widget)
+{
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
+
+ return !((GTK_OBJECT_FLAGS (widget) & GTK_NO_WINDOW) != 0);
+}
+
+/**
+ * gtk_widget_is_toplevel:
+ * @widget: a #GtkWidget
+ *
+ * Determines whether @widget is a toplevel widget. Currently only
+ * #GtkWindow and #GtkInvisible are toplevel widgets. Toplevel
+ * widgets have no parent widget.
+ *
+ * Return value: %TRUE if @widget is a toplevel, %FALSE otherwise
+ *
+ * Since: 2.18
+ **/
+gboolean
+gtk_widget_is_toplevel (GtkWidget *widget)
+{
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
+
+ return (GTK_WIDGET_FLAGS (widget) & GTK_TOPLEVEL) != 0;
+}
+
+/**
+ * gtk_widget_is_drawable:
+ * @widget: a #GtkWidget
+ *
+ * Determines whether @widget can be drawn to. A widget can be drawn
+ * to if it is mapped and visible.
+ *
+ * Return value: %TRUE if @widget is drawable, %FALSE otherwise
+ *
+ * Since: 2.18
+ **/
+gboolean
+gtk_widget_is_drawable (GtkWidget *widget)
+{
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
+
+ return ((GTK_WIDGET_FLAGS (widget) & GTK_VISIBLE) != 0 &&
+ (GTK_WIDGET_FLAGS (widget) & GTK_MAPPED) != 0);
+}
+
+/**
+ * gtk_widget_get_realized:
+ * @widget: a #GtkWidget
+ *
+ * Determines whether @widget is realized.
+ *
+ * Return value: %TRUE if @widget is realized, %FALSE otherwise
+ *
+ * Since: 2.20
+ **/
+gboolean
+gtk_widget_get_realized (GtkWidget *widget)
+{
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
+
+ return (GTK_WIDGET_FLAGS (widget) & GTK_REALIZED) != 0;
+}
+
+/**
+ * gtk_widget_set_realized:
+ * @widget: a #GtkWidget
+ * @realized: %TRUE to mark the widget as realized
+ *
+ * Marks the widget as being realized.
+ *
+ * This function should only ever be called in a derived widget's
+ * "realize" or "unrealize" implementation.
+ *
+ * Since: 2.20
+ */
+void
+gtk_widget_set_realized (GtkWidget *widget,
+ gboolean realized)
+{
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+
+ if (realized)
+ GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+ else
+ GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED);
+}
+
+/**
+ * gtk_widget_get_mapped:
+ * @widget: a #GtkWidget
+ *
+ * Whether the widget is mapped.
+ *
+ * Return value: %TRUE if the widget is mapped, %FALSE otherwise.
+ *
+ * Since: 2.20
+ */
+gboolean
+gtk_widget_get_mapped (GtkWidget *widget)
+{
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
+
+ return (GTK_OBJECT_FLAGS (widget) & GTK_MAPPED) != 0;
+}
+
+/**
+ * gtk_widget_set_mapped:
+ * @widget: a #GtkWidget
+ * @mapped: %TRUE to mark the widget as mapped
+ *
+ * Marks the widget as being realized.
+ *
+ * This function should only ever be called in a derived widget's
+ * "map" or "unmap" implementation.
+ *
+ * Since: 2.20
+ */
+void
+gtk_widget_set_mapped (GtkWidget *widget,
+ gboolean mapped)
+{
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+
+ if (mapped)
+ GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
+ else
+ GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
+}
+
+/**
+ * gtk_widget_set_app_paintable:
+ * @widget: a #GtkWidget
+ * @app_paintable: %TRUE if the application will paint on the widget
+ *
+ * Sets whether the application intends to draw on the widget in
+ * an #GtkWidget::expose-event handler.
+ *
+ * This is a hint to the widget and does not affect the behavior of