]> Pileus Git - ~andy/gtk/commitdiff
Seal GtkWidget
authorTim Janik <timj@src.gnome.org>
Fri, 20 Jun 2008 11:09:42 +0000 (11:09 +0000)
committerTim Janik <timj@src.gnome.org>
Fri, 20 Jun 2008 11:09:42 +0000 (11:09 +0000)
svn path=/trunk/; revision=20620

gtk/gtk.symbols
gtk/gtkwidget.c
gtk/gtkwidget.h

index 2ac45f436384a7a0ace7bc684d890805bcbc1765..f0e604149bdd3d4e5f5b59f2ca9d787ffb790fd9 100644 (file)
@@ -4778,6 +4778,9 @@ gtk_widget_trigger_tooltip_query
 gtk_widget_unmap
 gtk_widget_unparent
 gtk_widget_unrealize
+gtk_widget_unref
+gtk_widget_get_allocation
+gtk_widget_get_window
 #endif
 #endif
 
index 79cda47a9643726c0004144c648777db8f1c1e30..30560ba8f1f21b673c0a9dc10284d1ddd83675aa 100644 (file)
@@ -153,7 +153,8 @@ enum {
   PROP_NO_SHOW_ALL,
   PROP_HAS_TOOLTIP,
   PROP_TOOLTIP_MARKUP,
-  PROP_TOOLTIP_TEXT
+  PROP_TOOLTIP_TEXT,
+  PROP_WINDOW
 };
 
 typedef        struct  _GtkStateData    GtkStateData;
@@ -673,6 +674,22 @@ gtk_widget_class_init (GtkWidgetClass *klass)
                                                        NULL,
                                                        GTK_PARAM_READWRITE));
 
+  /**
+   * GtkWidget:window:
+   *
+   * The widget's window or its parent window if it does not have a
+   * window (as indicated by the GTK_NO_WINDOW flag).
+   *
+   * Since: GSEAL-branch
+   */
+  g_object_class_install_property (gobject_class,
+                                  PROP_WINDOW,
+                                  g_param_spec_object ("window",
+                                                       P_("Window"),
+                                                       P_("The widget's window or its parent window"),
+                                                       GDK_TYPE_WINDOW,
+                                                       GTK_PARAM_READABLE));
+
   widget_signals[SHOW] =
     g_signal_new (I_("show"),
                  G_TYPE_FROM_CLASS (gobject_class),
@@ -2585,6 +2602,9 @@ gtk_widget_get_property (GObject         *object,
     case PROP_TOOLTIP_MARKUP:
       g_value_set_string (value, g_object_get_qdata (object, quark_tooltip_markup));
       break;
+    case PROP_WINDOW:
+      g_value_set_object (value, gtk_widget_get_window (widget));
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -9867,5 +9887,41 @@ gtk_widget_get_has_tooltip (GtkWidget *widget)
   return has_tooltip;
 }
 
+/**
+ * gtk_widget_get_allocation:
+ * @widget: a #GtkWidget
+ *
+ * Returns the widget's allocation as provided by its parent.
+ *
+ * Return value: current allocation of @widget.
+ *
+ * Since: GSEAL-branch
+ */
+GtkAllocation
+gtk_widget_get_allocation (GtkWidget *widget)
+{
+  g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
+
+  return widget->allocation;
+}
+
+/**
+ * gtk_widget_get_window:
+ * @widget: a #GtkWidget
+ *
+ * Returns the widget's window or the parent window.
+ *
+ * Return value: @widget's window.
+ *
+ * Since: GSEAL-branch
+ */
+GdkWindow*
+gtk_widget_get_window (GtkWidget *widget)
+{
+  g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
+
+  return widget->window;
+}
+
 #define __GTK_WIDGET_C__
 #include "gtkaliasdef.c"
index f81b5dbf47095e4de8aa396e36083860f9128d37..596b8eeac4d007d5696f5f260040dbd9801b9abd 100644 (file)
@@ -178,12 +178,12 @@ struct _GtkWidget
    * state and saved_state go. we therefore don't waste any new
    * space on this.
    */
-  guint16 private_flags;
+  guint16 GSEAL (private_flags);
   
   /* The state of the widget. There are actually only
    *  5 widget states (defined in "gtkenums.h").
    */
-  guint8 state;
+  guint8 GSEAL (state);
   
   /* The saved state of the widget. When a widget's state
    *  is changed to GTK_STATE_INSENSITIVE via
@@ -191,7 +191,7 @@ struct _GtkWidget
    *  the old state is kept around in this field. The state
    *  will be restored once the widget gets sensitive again.
    */
-  guint8 saved_state;
+  guint8 GSEAL (saved_state);
   
   /* The widget's name. If the widget does not have a name
    *  (the name is NULL), then its name (as returned by
@@ -199,7 +199,7 @@ struct _GtkWidget
    * Among other things, the widget name is used to determine
    *  the style to use for a widget.
    */
-  gchar *name;
+  gchar *GSEAL (name);
   
   /*< public >*/
 
@@ -208,25 +208,25 @@ struct _GtkWidget
    *  along with graphics contexts used to draw with and
    *  the font to use for text.
    */
-  GtkStyle *style;
+  GtkStyle *GSEAL (style);
   
   /* The widget's desired size.
    */
-  GtkRequisition requisition;
+  GtkRequisition GSEAL (requisition);
   
   /* The widget's allocated size.
    */
-  GtkAllocation allocation;
+  GtkAllocation GSEAL (allocation);
   
   /* The widget's window or its parent window if it does
    *  not have a window. (Which will be indicated by the
    *  GTK_NO_WINDOW flag being set).
    */
-  GdkWindow *window;
+  GdkWindow *GSEAL (window);
   
   /* The widget's parent.
    */
-  GtkWidget *parent;
+  GtkWidget *GSEAL (parent);
 };
 
 struct _GtkWidgetClass
@@ -572,6 +572,8 @@ void                  gtk_widget_set_parent_window      (GtkWidget    *widget,
 void                  gtk_widget_set_child_visible      (GtkWidget    *widget,
                                                         gboolean      is_visible);
 gboolean              gtk_widget_get_child_visible      (GtkWidget    *widget);
+GtkAllocation         gtk_widget_get_allocation         (GtkWidget    *widget);
+GdkWindow*            gtk_widget_get_window             (GtkWidget    *widget);
 
 GtkWidget *gtk_widget_get_parent          (GtkWidget           *widget);
 GdkWindow *gtk_widget_get_parent_window          (GtkWidget           *widget);