[gtk+] Bug 69872 - GTK_WIDGET_SET_FLAGS should be deprecated



commit 0e52286d53b48005bfd2dc78a0f6f53875f88ee6
Author: Michael Natterer <mitch gimp org>
Date:   Fri Aug 28 16:27:26 2009 +0200

    Bug 69872 -  GTK_WIDGET_SET_FLAGS should be deprecated
    
    Add gtk_widget_is_toplevel() for GTK_WIDGET_TOPLEVEL()
    and gtk_widget_is_drawable() for GTK_WIDGET_DRAWABLE()

 gtk/gtk.symbols |    2 ++
 gtk/gtkwidget.c |   40 ++++++++++++++++++++++++++++++++++++++++
 gtk/gtkwidget.h |    6 ++++++
 3 files changed, 48 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index 89e3240..bd13c92 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -5018,6 +5018,8 @@ gtk_widget_intersect
 gtk_widget_is_ancestor
 gtk_widget_is_focus
 gtk_widget_is_sensitive
+gtk_widget_is_toplevel
+gtk_widget_is_drawable
 gtk_widget_keynav_failed
 gtk_widget_list_accel_closures
 gtk_widget_list_mnemonic_labels
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 00bb748..0f29020 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5702,6 +5702,46 @@ gtk_widget_get_has_window (GtkWidget *widget)
 }
 
 /**
+ * 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 (wid) & GTK_VISIBLE) != 0 &&
+          (GTK_WIDGET_FLAGS (wid) & GTK_MAPPED) != 0);
+}
+
+/**
  * gtk_widget_set_app_paintable:
  * @widget: a #GtkWidget
  * @app_paintable: %TRUE if the application will paint on the widget
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 0838083..eb972c9 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -584,6 +584,9 @@ void                  gtk_widget_set_has_window         (GtkWidget    *widget,
                                                          gboolean      has_window);
 gboolean              gtk_widget_get_has_window         (GtkWidget    *widget);
 
+gboolean              gtk_widget_is_toplevel            (GtkWidget    *widget);
+gboolean              gtk_widget_is_drawable            (GtkWidget    *widget);
+
 void                  gtk_widget_set_app_paintable      (GtkWidget    *widget,
 							 gboolean      app_paintable);
 gboolean              gtk_widget_get_app_paintable      (GtkWidget    *widget);
@@ -594,12 +597,15 @@ gboolean              gtk_widget_get_double_buffered    (GtkWidget    *widget);
 
 void                  gtk_widget_set_redraw_on_allocate (GtkWidget    *widget,
 							 gboolean      redraw_on_allocate);
+
 void                  gtk_widget_set_parent             (GtkWidget    *widget,
 							 GtkWidget    *parent);
 GtkWidget           * gtk_widget_get_parent             (GtkWidget    *widget);
+
 void                  gtk_widget_set_parent_window      (GtkWidget    *widget,
 							 GdkWindow    *parent_window);
 GdkWindow           * gtk_widget_get_parent_window      (GtkWidget    *widget);
+
 void                  gtk_widget_set_child_visible      (GtkWidget    *widget,
 							 gboolean      is_visible);
 gboolean              gtk_widget_get_child_visible      (GtkWidget    *widget);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]