summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--ChangeLog.pre-2-011
-rw-r--r--ChangeLog.pre-2-1011
-rw-r--r--ChangeLog.pre-2-211
-rw-r--r--ChangeLog.pre-2-411
-rw-r--r--ChangeLog.pre-2-611
-rw-r--r--ChangeLog.pre-2-811
-rw-r--r--TODO3
-rw-r--r--gtk/gtkbin.c60
-rw-r--r--gtk/gtkbutton.c143
-rw-r--r--gtk/gtkbutton.h10
-rw-r--r--gtk/gtkcheckbutton.c16
-rw-r--r--gtk/gtkclist.c6
-rw-r--r--gtk/gtkoptionmenu.c18
14 files changed, 159 insertions, 174 deletions
diff --git a/ChangeLog b/ChangeLog
index 709cb43723..4d9904898a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Mon Jul 6 18:30:48 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkbutton.h:
+ * gtk/gtkbutton.c: GtkButtons are now derived from GtkBin. we mirror
+ GTK_BIN (button)->child to button->child to keep source compatibility.
+
+ * gtk/gtkoptionmenu.c:
+ * gtk/gtkclist.c:
+ * gtkcheckbutton.c: don't refer to button->child, but
+ GTK_BIN (button)->child instead.
+
Mon Jul 6 12:06:23 BST 1998 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: update anon CVS info
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 709cb43723..4d9904898a 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,14 @@
+Mon Jul 6 18:30:48 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkbutton.h:
+ * gtk/gtkbutton.c: GtkButtons are now derived from GtkBin. we mirror
+ GTK_BIN (button)->child to button->child to keep source compatibility.
+
+ * gtk/gtkoptionmenu.c:
+ * gtk/gtkclist.c:
+ * gtkcheckbutton.c: don't refer to button->child, but
+ GTK_BIN (button)->child instead.
+
Mon Jul 6 12:06:23 BST 1998 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: update anon CVS info
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 709cb43723..4d9904898a 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,14 @@
+Mon Jul 6 18:30:48 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkbutton.h:
+ * gtk/gtkbutton.c: GtkButtons are now derived from GtkBin. we mirror
+ GTK_BIN (button)->child to button->child to keep source compatibility.
+
+ * gtk/gtkoptionmenu.c:
+ * gtk/gtkclist.c:
+ * gtkcheckbutton.c: don't refer to button->child, but
+ GTK_BIN (button)->child instead.
+
Mon Jul 6 12:06:23 BST 1998 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: update anon CVS info
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 709cb43723..4d9904898a 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,14 @@
+Mon Jul 6 18:30:48 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkbutton.h:
+ * gtk/gtkbutton.c: GtkButtons are now derived from GtkBin. we mirror
+ GTK_BIN (button)->child to button->child to keep source compatibility.
+
+ * gtk/gtkoptionmenu.c:
+ * gtk/gtkclist.c:
+ * gtkcheckbutton.c: don't refer to button->child, but
+ GTK_BIN (button)->child instead.
+
Mon Jul 6 12:06:23 BST 1998 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: update anon CVS info
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 709cb43723..4d9904898a 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,14 @@
+Mon Jul 6 18:30:48 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkbutton.h:
+ * gtk/gtkbutton.c: GtkButtons are now derived from GtkBin. we mirror
+ GTK_BIN (button)->child to button->child to keep source compatibility.
+
+ * gtk/gtkoptionmenu.c:
+ * gtk/gtkclist.c:
+ * gtkcheckbutton.c: don't refer to button->child, but
+ GTK_BIN (button)->child instead.
+
Mon Jul 6 12:06:23 BST 1998 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: update anon CVS info
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 709cb43723..4d9904898a 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,14 @@
+Mon Jul 6 18:30:48 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkbutton.h:
+ * gtk/gtkbutton.c: GtkButtons are now derived from GtkBin. we mirror
+ GTK_BIN (button)->child to button->child to keep source compatibility.
+
+ * gtk/gtkoptionmenu.c:
+ * gtk/gtkclist.c:
+ * gtkcheckbutton.c: don't refer to button->child, but
+ GTK_BIN (button)->child instead.
+
Mon Jul 6 12:06:23 BST 1998 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: update anon CVS info
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 709cb43723..4d9904898a 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,14 @@
+Mon Jul 6 18:30:48 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkbutton.h:
+ * gtk/gtkbutton.c: GtkButtons are now derived from GtkBin. we mirror
+ GTK_BIN (button)->child to button->child to keep source compatibility.
+
+ * gtk/gtkoptionmenu.c:
+ * gtk/gtkclist.c:
+ * gtkcheckbutton.c: don't refer to button->child, but
+ GTK_BIN (button)->child instead.
+
Mon Jul 6 12:06:23 BST 1998 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: update anon CVS info
diff --git a/TODO b/TODO
index a8a1621996..1648429b77 100644
--- a/TODO
+++ b/TODO
@@ -206,9 +206,6 @@ Additions:
cause confusing presses to be sent to containers that actually
want to get events on themselves.
- * Buttons's should derive from Bin's. (GTK 2.0 change, breaks
- lots of stuff)
-
* New signals to handle accelerators: accel_before and accel_after (or
somesuch) to pre and post process accelerator calls. [Yosh]
diff --git a/gtk/gtkbin.c b/gtk/gtkbin.c
index 392c160de8..4c3972bdfc 100644
--- a/gtk/gtkbin.c
+++ b/gtk/gtkbin.c
@@ -203,61 +203,61 @@ gtk_bin_expose (GtkWidget *widget,
static void
gtk_bin_add (GtkContainer *container,
- GtkWidget *widget)
+ GtkWidget *child)
{
GtkBin *bin;
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_BIN (container));
- g_return_if_fail (widget != NULL);
+ g_return_if_fail (child != NULL);
+ g_return_if_fail (GTK_IS_WIDGET (child));
bin = GTK_BIN (container);
g_return_if_fail (bin->child == NULL);
- gtk_widget_set_parent (widget, GTK_WIDGET (container));
-
- if (GTK_WIDGET_VISIBLE (widget->parent))
+ gtk_widget_set_parent (child, GTK_WIDGET (bin));
+ bin->child = child;
+
+ if (GTK_WIDGET_VISIBLE (child->parent))
{
- if (GTK_WIDGET_REALIZED (widget->parent) &&
- !GTK_WIDGET_REALIZED (widget))
- gtk_widget_realize (widget);
+ if (GTK_WIDGET_REALIZED (child->parent) &&
+ !GTK_WIDGET_REALIZED (child))
+ gtk_widget_realize (child);
- if (GTK_WIDGET_MAPPED (widget->parent) &&
- !GTK_WIDGET_MAPPED (widget))
- gtk_widget_map (widget);
+ if (GTK_WIDGET_MAPPED (child->parent) &&
+ !GTK_WIDGET_MAPPED (child))
+ gtk_widget_map (child);
}
- bin->child = widget;
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
- gtk_widget_queue_resize (widget);
+ if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (container))
+ gtk_widget_queue_resize (child);
}
static void
gtk_bin_remove (GtkContainer *container,
- GtkWidget *widget)
+ GtkWidget *child)
{
GtkBin *bin;
+ gboolean widget_was_visible;
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_BIN (container));
- g_return_if_fail (widget != NULL);
+ g_return_if_fail (child != NULL);
+ g_return_if_fail (GTK_IS_WIDGET (child));
bin = GTK_BIN (container);
+ g_return_if_fail (bin->child == child);
- if (bin->child == widget)
- {
- gboolean widget_was_visible = GTK_WIDGET_VISIBLE (widget);
-
- gtk_widget_unparent (widget);
- bin->child = NULL;
-
- /* queue resize regardless of GTK_WIDGET_VISIBLE (container),
- * since that's what is needed by toplevels, which derive from GtkBin.
- */
- if (widget_was_visible)
- gtk_widget_queue_resize (GTK_WIDGET (container));
- }
+ widget_was_visible = GTK_WIDGET_VISIBLE (child);
+
+ gtk_widget_unparent (child);
+ bin->child = NULL;
+
+ /* queue resize regardless of GTK_WIDGET_VISIBLE (container),
+ * since that's what is needed by toplevels, which derive from GtkBin.
+ */
+ if (widget_was_visible)
+ gtk_widget_queue_resize (GTK_WIDGET (container));
}
static void
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 2b8cfd3c4f..101ee0d7da 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -52,8 +52,6 @@ static void gtk_button_set_arg (GtkObject *object,
static void gtk_button_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
-static void gtk_button_map (GtkWidget *widget);
-static void gtk_button_unmap (GtkWidget *widget);
static void gtk_button_realize (GtkWidget *widget);
static void gtk_button_size_request (GtkWidget *widget,
GtkRequisition *requisition);
@@ -83,9 +81,6 @@ static void gtk_button_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_button_remove (GtkContainer *container,
GtkWidget *widget);
-static void gtk_button_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data);
static void gtk_real_button_pressed (GtkButton *button);
static void gtk_real_button_released (GtkButton *button);
static void gtk_real_button_enter (GtkButton *button);
@@ -93,7 +88,7 @@ static void gtk_real_button_leave (GtkButton *button);
static GtkType gtk_button_child_type (GtkContainer *container);
-static GtkContainerClass *parent_class;
+static GtkBinClass *parent_class = NULL;
static guint button_signals[LAST_SIGNAL] = { 0 };
@@ -116,7 +111,7 @@ gtk_button_get_type (void)
(GtkClassInitFunc) NULL,
};
- button_type = gtk_type_unique (gtk_container_get_type (), &button_info);
+ button_type = gtk_type_unique (GTK_TYPE_BIN, &button_info);
gtk_type_set_chunk_alloc (button_type, 16);
}
@@ -134,7 +129,7 @@ gtk_button_class_init (GtkButtonClass *klass)
widget_class = (GtkWidgetClass*) klass;
container_class = (GtkContainerClass*) klass;
- parent_class = gtk_type_class (gtk_container_get_type ());
+ parent_class = gtk_type_class (GTK_TYPE_BIN);
gtk_object_add_arg_type ("GtkButton::label", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_LABEL);
@@ -180,8 +175,6 @@ gtk_button_class_init (GtkButtonClass *klass)
object_class->get_arg = gtk_button_get_arg;
widget_class->activate_signal = button_signals[CLICKED];
- widget_class->map = gtk_button_map;
- widget_class->unmap = gtk_button_unmap;
widget_class->realize = gtk_button_realize;
widget_class->draw = gtk_button_draw;
widget_class->draw_focus = gtk_button_draw_focus;
@@ -198,7 +191,6 @@ gtk_button_class_init (GtkButtonClass *klass)
container_class->add = gtk_button_add;
container_class->remove = gtk_button_remove;
- container_class->foreach = gtk_button_foreach;
container_class->child_type = gtk_button_child_type;
klass->pressed = gtk_real_button_pressed;
@@ -212,6 +204,7 @@ static void
gtk_button_init (GtkButton *button)
{
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_FOCUS);
+ GTK_WIDGET_UNSET_FLAGS (button, GTK_NO_WINDOW);
button->child = NULL;
button->in_button = FALSE;
@@ -222,7 +215,7 @@ gtk_button_init (GtkButton *button)
static GtkType
gtk_button_child_type (GtkContainer *container)
{
- if (!GTK_BUTTON (container)->child)
+ if (!GTK_BIN (container)->child)
return GTK_TYPE_WIDGET;
else
return GTK_TYPE_NONE;
@@ -242,11 +235,8 @@ gtk_button_set_arg (GtkObject *object,
GtkWidget *label;
case ARG_LABEL:
- if (button->child)
- {
- gtk_widget_unparent (button->child);
- button->child = NULL;
- }
+ if (GTK_BIN (button)->child)
+ gtk_container_remove (GTK_CONTAINER (button), GTK_BIN (button)->child);
label = gtk_label_new (GTK_VALUE_STRING(*arg) ? GTK_VALUE_STRING(*arg) : "");
gtk_widget_show (label);
@@ -270,8 +260,8 @@ gtk_button_get_arg (GtkObject *object,
switch (arg_id)
{
case ARG_LABEL:
- if (button->child && GTK_IS_LABEL (button->child))
- GTK_VALUE_STRING (*arg) = g_strdup (GTK_LABEL (button->child)->label);
+ if (GTK_BIN (button)->child && GTK_IS_LABEL (GTK_BIN (button)->child))
+ GTK_VALUE_STRING (*arg) = g_strdup (GTK_LABEL (GTK_BIN (button)->child)->label);
else
GTK_VALUE_STRING (*arg) = NULL;
break;
@@ -353,35 +343,6 @@ gtk_button_get_relief(GtkButton *button)
}
static void
-gtk_button_map (GtkWidget *widget)
-{
- GtkButton *button;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_BUTTON (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
- gdk_window_show (widget->window);
-
- button = GTK_BUTTON (widget);
-
- if (button->child &&
- GTK_WIDGET_VISIBLE (button->child) &&
- !GTK_WIDGET_MAPPED (button->child))
- gtk_widget_map (button->child);
-}
-
-static void
-gtk_button_unmap (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_BUTTON (widget));
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
- gdk_window_hide (widget->window);
-}
-
-static void
gtk_button_realize (GtkWidget *widget)
{
GtkButton *button;
@@ -446,12 +407,12 @@ gtk_button_size_request (GtkWidget *widget,
DEFAULT_SPACING);
}
- if (button->child && GTK_WIDGET_VISIBLE (button->child))
+ if (GTK_BIN (button)->child && GTK_WIDGET_VISIBLE (GTK_BIN (button)->child))
{
- gtk_widget_size_request (button->child, &button->child->requisition);
+ gtk_widget_size_request (GTK_BIN (button)->child, &GTK_BIN (button)->child->requisition);
- requisition->width += button->child->requisition.width;
- requisition->height += button->child->requisition.height;
+ requisition->width += GTK_BIN (button)->child->requisition.width;
+ requisition->height += GTK_BIN (button)->child->requisition.height;
}
}
@@ -479,7 +440,7 @@ gtk_button_size_allocate (GtkWidget *widget,
button = GTK_BUTTON (widget);
- if (button->child && GTK_WIDGET_VISIBLE (button->child))
+ if (GTK_BIN (button)->child && GTK_WIDGET_VISIBLE (GTK_BIN (button)->child))
{
child_allocation.x = (CHILD_SPACING + GTK_WIDGET (widget)->style->klass->xthickness);
child_allocation.y = (CHILD_SPACING + GTK_WIDGET (widget)->style->klass->ythickness);
@@ -501,7 +462,7 @@ gtk_button_size_allocate (GtkWidget *widget,
(GTK_WIDGET (widget)->style->klass->xthickness * 2 + DEFAULT_SPACING));
}
- gtk_widget_size_allocate (button->child, &child_allocation);
+ gtk_widget_size_allocate (GTK_BIN (button)->child, &child_allocation);
}
}
@@ -646,8 +607,8 @@ gtk_button_draw (GtkWidget *widget,
gtk_button_paint (widget, &tmp_area);
- if (button->child && gtk_widget_intersect (button->child, &tmp_area, &child_area))
- gtk_widget_draw (button->child, &child_area);
+ if (GTK_BIN (button)->child && gtk_widget_intersect (GTK_BIN (button)->child, &tmp_area, &child_area))
+ gtk_widget_draw (GTK_BIN (button)->child, &child_area);
gtk_widget_draw_default (widget);
gtk_widget_draw_focus (widget);
@@ -785,9 +746,9 @@ gtk_button_expose (GtkWidget *widget,
gtk_button_paint (widget, &event->area);
child_event = *event;
- if (button->child && GTK_WIDGET_NO_WINDOW (button->child) &&
- gtk_widget_intersect (button->child, &event->area, &child_event.area))
- gtk_widget_event (button->child, (GdkEvent*) &child_event);
+ if (GTK_BIN (button)->child && GTK_WIDGET_NO_WINDOW (GTK_BIN (button)->child) &&
+ gtk_widget_intersect (GTK_BIN (button)->child, &event->area, &child_event.area))
+ gtk_widget_event (GTK_BIN (button)->child, (GdkEvent*) &child_event);
gtk_widget_draw_default (widget);
gtk_widget_draw_focus (widget);
@@ -925,78 +886,26 @@ static void
gtk_button_add (GtkContainer *container,
GtkWidget *widget)
{
- GtkButton *button;
-
g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_BUTTON (container));
g_return_if_fail (widget != NULL);
- g_return_if_fail (gtk_widget_basic (widget));
-
- button = GTK_BUTTON (container);
- if (!button->child)
- {
- gtk_widget_set_parent (widget, GTK_WIDGET (container));
-
- if (GTK_WIDGET_VISIBLE (widget->parent))
- {
- if (GTK_WIDGET_REALIZED (widget->parent) &&
- !GTK_WIDGET_REALIZED (widget))
- gtk_widget_realize (widget);
-
- if (GTK_WIDGET_MAPPED (widget->parent) &&
- !GTK_WIDGET_MAPPED (widget))
- gtk_widget_map (widget);
- }
-
- button->child = widget;
+ if (GTK_CONTAINER_CLASS (parent_class)->add)
+ GTK_CONTAINER_CLASS (parent_class)->add (container, widget);
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
- gtk_widget_queue_resize (widget);
- }
+ GTK_BUTTON (container)->child = GTK_BIN (container)->child;
}
static void
gtk_button_remove (GtkContainer *container,
GtkWidget *widget)
{
- GtkButton *button;
-
g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_BUTTON (container));
g_return_if_fail (widget != NULL);
- button = GTK_BUTTON (container);
-
- if (button->child == widget)
- {
- gboolean widget_was_visible = GTK_WIDGET_VISIBLE(widget);
-
- gtk_widget_unparent (widget);
-
- button->child = NULL;
-
- if (widget_was_visible && GTK_WIDGET_VISIBLE (container))
- gtk_widget_queue_resize (GTK_WIDGET (container));
-
- }
-}
-
-static void
-gtk_button_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
-{
- GtkButton *button;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_BUTTON (container));
- g_return_if_fail (callback != NULL);
-
- button = GTK_BUTTON (container);
+ if (GTK_CONTAINER_CLASS (parent_class)->remove)
+ GTK_CONTAINER_CLASS (parent_class)->remove (container, widget);
- if (button->child)
- (* callback) (button->child, callback_data);
+ GTK_BUTTON (container)->child = GTK_BIN (container)->child;
}
static void
diff --git a/gtk/gtkbutton.h b/gtk/gtkbutton.h
index 0a74aba7fd..44f6bde65c 100644
--- a/gtk/gtkbutton.h
+++ b/gtk/gtkbutton.h
@@ -21,7 +21,7 @@
#include <gdk/gdk.h>
-#include <gtk/gtkcontainer.h>
+#include <gtk/gtkbin.h>
#include <gtk/gtkenums.h>
@@ -42,9 +42,11 @@ typedef struct _GtkButtonClass GtkButtonClass;
struct _GtkButton
{
- GtkContainer container;
+ GtkBin bin;
- GtkWidget *child;
+ GtkWidget *child /* deprecapted field,
+ * use GTK_BIN (button)->child instead
+ */;
guint in_button : 1;
guint button_down : 1;
@@ -53,7 +55,7 @@ struct _GtkButton
struct _GtkButtonClass
{
- GtkContainerClass parent_class;
+ GtkBinClass parent_class;
void (* pressed) (GtkButton *button);
void (* released) (GtkButton *button);
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index 38bc73b824..8b863a8b80 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -141,9 +141,9 @@ gtk_check_button_draw (GtkWidget *widget,
gtk_check_button_draw_indicator (check_button, area);
- if (button->child && GTK_WIDGET_NO_WINDOW (button->child) &&
- gtk_widget_intersect (button->child, area, &child_area))
- gtk_widget_draw (button->child, &child_area);
+ if (GTK_BIN (button)->child && GTK_WIDGET_NO_WINDOW (GTK_BIN (button)->child) &&
+ gtk_widget_intersect (GTK_BIN (button)->child, area, &child_area))
+ gtk_widget_draw (GTK_BIN (button)->child, &child_area);
gtk_widget_draw_focus (widget);
}
@@ -245,7 +245,7 @@ gtk_check_button_size_allocate (GtkWidget *widget,
button = GTK_BUTTON (widget);
- if (button->child && GTK_WIDGET_VISIBLE (button->child))
+ if (GTK_BIN (button)->child && GTK_WIDGET_VISIBLE (GTK_BIN (button)->child))
{
child_allocation.x = (GTK_CONTAINER (widget)->border_width +
CHECK_BUTTON_CLASS (widget)->indicator_size +
@@ -255,7 +255,7 @@ gtk_check_button_size_allocate (GtkWidget *widget,
GTK_CONTAINER (widget)->border_width - 1);
child_allocation.height = MAX (1, allocation->height - child_allocation.y * 2);
- gtk_widget_size_allocate (button->child, &child_allocation);
+ gtk_widget_size_allocate (GTK_BIN (button)->child, &child_allocation);
}
}
else
@@ -288,9 +288,9 @@ gtk_check_button_expose (GtkWidget *widget,
gtk_check_button_draw_indicator (check_button, &event->area);
child_event = *event;
- if (button->child && GTK_WIDGET_NO_WINDOW (button->child) &&
- gtk_widget_intersect (button->child, &event->area, &child_event.area))
- gtk_widget_event (button->child, (GdkEvent*) &child_event);
+ if (GTK_BIN (button)->child && GTK_WIDGET_NO_WINDOW (GTK_BIN (button)->child) &&
+ gtk_widget_intersect (GTK_BIN (button)->child, &event->area, &child_event.area))
+ gtk_widget_event (GTK_BIN (button)->child, (GdkEvent*) &child_event);
gtk_widget_draw_focus (widget);
}
diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c
index 4505ea7087..99674ee2c2 100644
--- a/gtk/gtkclist.c
+++ b/gtk/gtkclist.c
@@ -686,7 +686,7 @@ gtk_clist_set_column_title (GtkCList * clist,
column_title_new (clist, column, title);
/* remove and destroy the old widget */
- old_widget = GTK_BUTTON (clist->column[column].button)->child;
+ old_widget = GTK_BIN (clist->column[column].button)->child;
if (old_widget)
gtk_container_remove (GTK_CONTAINER (clist->column[column].button), old_widget);
@@ -746,7 +746,7 @@ gtk_clist_set_column_widget (GtkCList * clist,
column_title_new (clist, column, NULL);
/* remove and destroy the old widget */
- old_widget = GTK_BUTTON (clist->column[column].button)->child;
+ old_widget = GTK_BIN (clist->column[column].button)->child;
if (old_widget)
gtk_container_remove (GTK_CONTAINER (clist->column[column].button), old_widget);
@@ -781,7 +781,7 @@ gtk_clist_set_column_justification (GtkCList * clist,
* custom widget */
if (clist->column[column].title)
{
- alignment = GTK_BUTTON (clist->column[column].button)->child;
+ alignment = GTK_BIN (clist->column[column].button)->child;
switch (clist->column[column].justification)
{
diff --git a/gtk/gtkoptionmenu.c b/gtk/gtkoptionmenu.c
index 7a713242e6..9a29d5e176 100644
--- a/gtk/gtkoptionmenu.c
+++ b/gtk/gtkoptionmenu.c
@@ -295,7 +295,7 @@ gtk_option_menu_size_allocate (GtkWidget *widget,
allocation->x, allocation->y,
allocation->width, allocation->height);
- child = GTK_BUTTON (widget)->child;
+ child = GTK_BIN (widget)->child;
if (child && GTK_WIDGET_VISIBLE (child))
{
child_allocation.x = (GTK_CONTAINER (widget)->border_width +
@@ -369,7 +369,7 @@ gtk_option_menu_draw (GtkWidget *widget,
{
gtk_option_menu_paint (widget, area);
- child = GTK_BUTTON (widget)->child;
+ child = GTK_BIN (widget)->child;
if (child && gtk_widget_intersect (child, area, &child_area))
gtk_widget_draw (child, &child_area);
}
@@ -427,7 +427,7 @@ gtk_option_menu_expose (GtkWidget *widget,
gtk_option_menu_remove_contents (GTK_OPTION_MENU (widget));
#else
remove_child = FALSE;
- child = GTK_BUTTON (widget)->child;
+ child = GTK_BIN (widget)->child;
child_event = *event;
if (child && GTK_WIDGET_NO_WINDOW (child) &&
gtk_widget_intersect (child, &event->area, &child_event.area))
@@ -493,9 +493,9 @@ gtk_option_menu_update_contents (GtkOptionMenu *option_menu)
if (child)
{
gtk_container_block_resize (GTK_CONTAINER (option_menu));
- if (GTK_BUTTON (option_menu)->child)
+ if (GTK_BIN (option_menu)->child)
gtk_container_remove (GTK_CONTAINER (option_menu),
- GTK_BUTTON (option_menu)->child);
+ GTK_BIN (option_menu)->child);
if (GTK_WIDGET (option_menu)->state != child->state)
gtk_widget_set_state (child, GTK_WIDGET (option_menu)->state);
gtk_widget_reparent (child, GTK_WIDGET (option_menu));
@@ -518,13 +518,13 @@ gtk_option_menu_remove_contents (GtkOptionMenu *option_menu)
g_return_if_fail (option_menu != NULL);
g_return_if_fail (GTK_IS_OPTION_MENU (option_menu));
- if (GTK_BUTTON (option_menu)->child)
+ if (GTK_BIN (option_menu)->child)
{
gtk_container_block_resize (GTK_CONTAINER (option_menu));
- if (GTK_WIDGET (option_menu->menu_item)->state != GTK_BUTTON (option_menu)->child->state)
- gtk_widget_set_state (GTK_BUTTON (option_menu)->child,
+ if (GTK_WIDGET (option_menu->menu_item)->state != GTK_BIN (option_menu)->child->state)
+ gtk_widget_set_state (GTK_BIN (option_menu)->child,
GTK_WIDGET (option_menu->menu_item)->state);
- gtk_widget_reparent (GTK_BUTTON (option_menu)->child, option_menu->menu_item);
+ gtk_widget_reparent (GTK_BIN (option_menu)->child, option_menu->menu_item);
gtk_widget_unref (option_menu->menu_item);
option_menu->menu_item = NULL;
gtk_container_unblock_resize (GTK_CONTAINER (option_menu));