Seal GtkWidget

svn path=/trunk/; revision=20620
This commit is contained in:
Tim Janik
2008-06-20 11:09:42 +00:00
parent 161f29ca55
commit 10896d4874
3 changed files with 71 additions and 10 deletions

View File

@ -4778,6 +4778,9 @@ gtk_widget_trigger_tooltip_query
gtk_widget_unmap gtk_widget_unmap
gtk_widget_unparent gtk_widget_unparent
gtk_widget_unrealize gtk_widget_unrealize
gtk_widget_unref
gtk_widget_get_allocation
gtk_widget_get_window
#endif #endif
#endif #endif

View File

@ -153,7 +153,8 @@ enum {
PROP_NO_SHOW_ALL, PROP_NO_SHOW_ALL,
PROP_HAS_TOOLTIP, PROP_HAS_TOOLTIP,
PROP_TOOLTIP_MARKUP, PROP_TOOLTIP_MARKUP,
PROP_TOOLTIP_TEXT PROP_TOOLTIP_TEXT,
PROP_WINDOW
}; };
typedef struct _GtkStateData GtkStateData; typedef struct _GtkStateData GtkStateData;
@ -673,6 +674,22 @@ gtk_widget_class_init (GtkWidgetClass *klass)
NULL, NULL,
GTK_PARAM_READWRITE)); 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] = widget_signals[SHOW] =
g_signal_new (I_("show"), g_signal_new (I_("show"),
G_TYPE_FROM_CLASS (gobject_class), G_TYPE_FROM_CLASS (gobject_class),
@ -2585,6 +2602,9 @@ gtk_widget_get_property (GObject *object,
case PROP_TOOLTIP_MARKUP: case PROP_TOOLTIP_MARKUP:
g_value_set_string (value, g_object_get_qdata (object, quark_tooltip_markup)); g_value_set_string (value, g_object_get_qdata (object, quark_tooltip_markup));
break; break;
case PROP_WINDOW:
g_value_set_object (value, gtk_widget_get_window (widget));
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -9867,5 +9887,41 @@ gtk_widget_get_has_tooltip (GtkWidget *widget)
return has_tooltip; 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__ #define __GTK_WIDGET_C__
#include "gtkaliasdef.c" #include "gtkaliasdef.c"

View File

@ -178,12 +178,12 @@ struct _GtkWidget
* state and saved_state go. we therefore don't waste any new * state and saved_state go. we therefore don't waste any new
* space on this. * space on this.
*/ */
guint16 private_flags; guint16 GSEAL (private_flags);
/* The state of the widget. There are actually only /* The state of the widget. There are actually only
* 5 widget states (defined in "gtkenums.h"). * 5 widget states (defined in "gtkenums.h").
*/ */
guint8 state; guint8 GSEAL (state);
/* The saved state of the widget. When a widget's state /* The saved state of the widget. When a widget's state
* is changed to GTK_STATE_INSENSITIVE via * is changed to GTK_STATE_INSENSITIVE via
@ -191,7 +191,7 @@ struct _GtkWidget
* the old state is kept around in this field. The state * the old state is kept around in this field. The state
* will be restored once the widget gets sensitive again. * 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 widget's name. If the widget does not have a name
* (the name is NULL), then its name (as returned by * (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 * Among other things, the widget name is used to determine
* the style to use for a widget. * the style to use for a widget.
*/ */
gchar *name; gchar *GSEAL (name);
/*< public >*/ /*< public >*/
@ -208,25 +208,25 @@ struct _GtkWidget
* along with graphics contexts used to draw with and * along with graphics contexts used to draw with and
* the font to use for text. * the font to use for text.
*/ */
GtkStyle *style; GtkStyle *GSEAL (style);
/* The widget's desired size. /* The widget's desired size.
*/ */
GtkRequisition requisition; GtkRequisition GSEAL (requisition);
/* The widget's allocated size. /* The widget's allocated size.
*/ */
GtkAllocation allocation; GtkAllocation GSEAL (allocation);
/* The widget's window or its parent window if it does /* The widget's window or its parent window if it does
* not have a window. (Which will be indicated by the * not have a window. (Which will be indicated by the
* GTK_NO_WINDOW flag being set). * GTK_NO_WINDOW flag being set).
*/ */
GdkWindow *window; GdkWindow *GSEAL (window);
/* The widget's parent. /* The widget's parent.
*/ */
GtkWidget *parent; GtkWidget *GSEAL (parent);
}; };
struct _GtkWidgetClass struct _GtkWidgetClass
@ -572,6 +572,8 @@ void gtk_widget_set_parent_window (GtkWidget *widget,
void gtk_widget_set_child_visible (GtkWidget *widget, void gtk_widget_set_child_visible (GtkWidget *widget,
gboolean is_visible); gboolean is_visible);
gboolean gtk_widget_get_child_visible (GtkWidget *widget); 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); GtkWidget *gtk_widget_get_parent (GtkWidget *widget);
GdkWindow *gtk_widget_get_parent_window (GtkWidget *widget); GdkWindow *gtk_widget_get_parent_window (GtkWidget *widget);