summaryrefslogtreecommitdiff
path: root/gtk/gtkcheckbutton.c
diff options
context:
space:
mode:
authorAlexander Larsson <alla@lysator.liu.se>2001-08-27 01:05:07 +0000
committerAlexander Larsson <alexl@src.gnome.org>2001-08-27 01:05:07 +0000
commitf9e666244fb25940b113cd35dbed18d0f75c4f44 (patch)
treea7647e917586f524dba60b1bed78054c1e21fef4 /gtk/gtkcheckbutton.c
parent8d00215d9ed8a40f17fa6658bc30520b2fc8d03d (diff)
downloadgdk-pixbuf-f9e666244fb25940b113cd35dbed18d0f75c4f44.tar.gz
Add properties for labels, mnemonics and stock items. Added C accessor
2001-08-26 Alexander Larsson <alla@lysator.liu.se> * gtk/gtkbutton.[ch]: Add properties for labels, mnemonics and stock items. Added C accessor functions for the properties. Removed deprecated button->child. * gtk/gtkradiobutton.c: * gtk/gtktogglebutton.c: Update to use the functions in GtkButton. * gtk/gtkcheckbutton.c: Update to use the functions in GtkButton. Changed size allocation of child. Now only gets as much space as it requests. * gtk/gtkclist.c: Don't use GtkButton->child * gtk/gtklabel.c: Fixed typo in docs
Diffstat (limited to 'gtk/gtkcheckbutton.c')
-rw-r--r--gtk/gtkcheckbutton.c33
1 files changed, 7 insertions, 26 deletions
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index 67f3e4a15..b9671e0d6 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -126,17 +126,7 @@ gtk_check_button_new (void)
GtkWidget*
gtk_check_button_new_with_label (const gchar *label)
{
- GtkWidget *check_button;
- GtkWidget *label_widget;
-
- check_button = gtk_check_button_new ();
- label_widget = gtk_label_new (label);
- gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5);
-
- gtk_container_add (GTK_CONTAINER (check_button), label_widget);
- gtk_widget_show (label_widget);
-
- return check_button;
+ return g_object_new (GTK_TYPE_CHECK_BUTTON, "label", label, NULL);
}
/**
@@ -152,17 +142,7 @@ gtk_check_button_new_with_label (const gchar *label)
GtkWidget*
gtk_check_button_new_with_mnemonic (const gchar *label)
{
- GtkWidget *check_button;
- GtkWidget *label_widget;
-
- check_button = gtk_check_button_new ();
- label_widget = gtk_label_new_with_mnemonic (label);
- gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5);
-
- gtk_container_add (GTK_CONTAINER (check_button), label_widget);
- gtk_widget_show (label_widget);
-
- return check_button;
+ return g_object_new (GTK_TYPE_CHECK_BUTTON, "label", label, "use_underline", TRUE, NULL);
}
@@ -306,10 +286,11 @@ gtk_check_button_size_allocate (GtkWidget *widget,
child_allocation.x = (border_width + indicator_size + indicator_spacing * 3 + 1 +
widget->allocation.x);
child_allocation.y = border_width + 1 + widget->allocation.y;
- child_allocation.width = MAX (1, allocation->width -
- (border_width + indicator_size + indicator_spacing * 3 + 1) -
- border_width - 1);
- child_allocation.height = MAX (1, allocation->height - (border_width + 1) * 2);
+ child_allocation.width = MIN (GTK_BIN (button)->child->requisition.width,
+ allocation->width -
+ ((border_width + 1) * 2 + indicator_size + indicator_spacing * 3));
+ child_allocation.height = MIN (GTK_BIN (button)->child->requisition.height,
+ allocation->height - (border_width + 1) * 2);
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
child_allocation.x = allocation->x + allocation->width