diff --git a/ChangeLog b/ChangeLog index efaff46e28..b7f5ea7f26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Wed Feb 18 04:38:24 1998 Tim Janik + + * gtk/gtkwidget.h: + * gtk/gtkwidget.c: + new signal GtkWidget::set_parent. this signal will be emitted once a + widget gets a new/no parent assigned (i.e. from gtk_widget_unparent + and gtk_widget_set_parent). + Wed Feb 18 02:58:50 1998 Tim Janik * gtk/gtktooltips.h: diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index efaff46e28..b7f5ea7f26 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,11 @@ +Wed Feb 18 04:38:24 1998 Tim Janik + + * gtk/gtkwidget.h: + * gtk/gtkwidget.c: + new signal GtkWidget::set_parent. this signal will be emitted once a + widget gets a new/no parent assigned (i.e. from gtk_widget_unparent + and gtk_widget_set_parent). + Wed Feb 18 02:58:50 1998 Tim Janik * gtk/gtktooltips.h: diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index efaff46e28..b7f5ea7f26 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +Wed Feb 18 04:38:24 1998 Tim Janik + + * gtk/gtkwidget.h: + * gtk/gtkwidget.c: + new signal GtkWidget::set_parent. this signal will be emitted once a + widget gets a new/no parent assigned (i.e. from gtk_widget_unparent + and gtk_widget_set_parent). + Wed Feb 18 02:58:50 1998 Tim Janik * gtk/gtktooltips.h: diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index efaff46e28..b7f5ea7f26 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,11 @@ +Wed Feb 18 04:38:24 1998 Tim Janik + + * gtk/gtkwidget.h: + * gtk/gtkwidget.c: + new signal GtkWidget::set_parent. this signal will be emitted once a + widget gets a new/no parent assigned (i.e. from gtk_widget_unparent + and gtk_widget_set_parent). + Wed Feb 18 02:58:50 1998 Tim Janik * gtk/gtktooltips.h: diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index efaff46e28..b7f5ea7f26 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,11 @@ +Wed Feb 18 04:38:24 1998 Tim Janik + + * gtk/gtkwidget.h: + * gtk/gtkwidget.c: + new signal GtkWidget::set_parent. this signal will be emitted once a + widget gets a new/no parent assigned (i.e. from gtk_widget_unparent + and gtk_widget_set_parent). + Wed Feb 18 02:58:50 1998 Tim Janik * gtk/gtktooltips.h: diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index efaff46e28..b7f5ea7f26 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,11 @@ +Wed Feb 18 04:38:24 1998 Tim Janik + + * gtk/gtkwidget.h: + * gtk/gtkwidget.c: + new signal GtkWidget::set_parent. this signal will be emitted once a + widget gets a new/no parent assigned (i.e. from gtk_widget_unparent + and gtk_widget_set_parent). + Wed Feb 18 02:58:50 1998 Tim Janik * gtk/gtktooltips.h: diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index efaff46e28..b7f5ea7f26 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,11 @@ +Wed Feb 18 04:38:24 1998 Tim Janik + + * gtk/gtkwidget.h: + * gtk/gtkwidget.c: + new signal GtkWidget::set_parent. this signal will be emitted once a + widget gets a new/no parent assigned (i.e. from gtk_widget_unparent + and gtk_widget_set_parent). + Wed Feb 18 02:58:50 1998 Tim Janik * gtk/gtktooltips.h: diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 024c648c01..f95142c660 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -45,6 +45,7 @@ enum { SIZE_REQUEST, SIZE_ALLOCATE, STATE_CHANGED, + SET_PARENT, INSTALL_ACCELERATOR, REMOVE_ACCELERATOR, EVENT, @@ -118,6 +119,9 @@ typedef gint (*GtkWidgetSignal4) (GtkObject *object, typedef void (*GtkWidgetSignal5) (GtkObject *object, guint arg1, gpointer data); +typedef void (*GtkWidgetSignal6) (GtkObject *object, + GtkObject *arg1, + gpointer data); typedef struct _GtkStateData GtkStateData; @@ -148,6 +152,10 @@ static void gtk_widget_marshal_signal_5 (GtkObject *object, GtkSignalFunc func, gpointer func_data, GtkArg *args); +static void gtk_widget_marshal_signal_6 (GtkObject *object, + GtkSignalFunc func, + gpointer func_data, + GtkArg *args); static void gtk_widget_class_init (GtkWidgetClass *klass); static void gtk_widget_init (GtkWidget *widget); @@ -373,6 +381,14 @@ gtk_widget_class_init (GtkWidgetClass *klass) gtk_widget_marshal_signal_5, GTK_TYPE_NONE, 1, GTK_TYPE_UINT); + widget_signals[SET_PARENT] = + gtk_signal_new ("set_parent", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (GtkWidgetClass, set_parent), + gtk_widget_marshal_signal_6, + GTK_TYPE_NONE, 1, + GTK_TYPE_OBJECT); widget_signals[INSTALL_ACCELERATOR] = gtk_signal_new ("install_accelerator", GTK_RUN_FIRST, @@ -660,6 +676,7 @@ gtk_widget_class_init (GtkWidgetClass *klass) klass->size_request = NULL; klass->size_allocate = gtk_widget_real_size_allocate; klass->state_changed = NULL; + klass->set_parent = NULL; klass->install_accelerator = NULL; klass->remove_accelerator = NULL; klass->event = NULL; @@ -1066,6 +1083,7 @@ gtk_widget_unparent (GtkWidget *widget) { GtkWidget *toplevel; GtkWidget *child; + GtkWidget *old_parent; g_return_if_fail (widget != NULL); if (widget->parent == NULL) @@ -1104,8 +1122,10 @@ gtk_widget_unparent (GtkWidget *widget) if (GTK_WIDGET_REALIZED (widget) && !GTK_WIDGET_IN_REPARENT (widget)) gtk_widget_unrealize (widget); - + + old_parent = widget->parent; widget->parent = NULL; + gtk_signal_emit (GTK_OBJECT (widget), widget_signals[SET_PARENT], old_parent); gtk_widget_unref (widget); } @@ -1925,7 +1945,7 @@ gtk_widget_reparent (GtkWidget *widget, if (GTK_WIDGET_NO_WINDOW (widget)) { if (GTK_IS_CONTAINER (widget)) - gtk_container_foreach (GTK_CONTAINER(widget), + gtk_container_foreach (GTK_CONTAINER (widget), gtk_widget_reparent_container_child, gtk_widget_get_parent_window (widget)); else @@ -2293,6 +2313,8 @@ gtk_widget_set_parent (GtkWidget *widget, gtk_widget_set_style_recurse, NULL); } + + gtk_signal_emit (GTK_OBJECT (widget), widget_signals[SET_PARENT], NULL); } /************************************************************* @@ -3087,14 +3109,33 @@ gtk_widget_marshal_signal_5 (GtkObject *object, GtkArg *args) { GtkWidgetSignal5 rfunc; - gint *return_val; rfunc = (GtkWidgetSignal5) func; - return_val = GTK_RETLOC_BOOL (args[1]); (* rfunc) (object, GTK_VALUE_UINT (args[0]), func_data); } +/***************************************** + * gtk_widget_marshal_signal_6: + * + * arguments: + * + * results: + *****************************************/ + +static void +gtk_widget_marshal_signal_6 (GtkObject *object, + GtkSignalFunc func, + gpointer func_data, + GtkArg *args) +{ + GtkWidgetSignal6 rfunc; + + rfunc = (GtkWidgetSignal6) func; + + (* rfunc) (object, GTK_VALUE_OBJECT (args[0]), func_data); +} + static void gtk_widget_real_destroy (GtkObject *object) { diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index ed8fe58a92..f1dfc8cd57 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -252,6 +252,8 @@ struct _GtkWidgetClass GtkAllocation *allocation); void (* state_changed) (GtkWidget *widget, guint previous_state); + void (* set_parent) (GtkWidget *widget, + GtkWidget *previous_parent); /* accelerators */ gint (* install_accelerator) (GtkWidget *widget,