diff options
author | Soeren Sandmann <sandmann@daimi.au.dk> | 2002-02-22 13:34:28 +0000 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@src.gnome.org> | 2002-02-22 13:34:28 +0000 |
commit | 5d81847f201c1a25c9edf5e522c6f3d12bdb2533 (patch) | |
tree | 3452e43537b4be475937c98175bb4b679ab96d4d /gtk/gtkbutton.c | |
parent | 96387b40ead053e27d33f874ad382e3929081457 (diff) | |
download | gtk+-5d81847f201c1a25c9edf5e522c6f3d12bdb2533.tar.gz |
feedback when check and radio buttons are depressed.
Fri Feb 22 14:08:38 2002 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkradiobutton.c, gtk/gtkcheckbutton.c, gtkbutton.h,
gtktogglebutton.c: feedback when check and radio buttons are
depressed.
Diffstat (limited to 'gtk/gtkbutton.c')
-rw-r--r-- | gtk/gtkbutton.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index 86701f9fee..7a50b67ced 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -306,6 +306,7 @@ gtk_button_init (GtkButton *button) button->use_stock = FALSE; button->use_underline = FALSE; button->depressed = FALSE; + button->depress_on_activate = TRUE; } static void @@ -1069,6 +1070,7 @@ gtk_real_button_activate (GtkButton *button) button); button->button_down = TRUE; gtk_button_update_state (button); + gtk_widget_queue_draw (GTK_WIDGET (button)); } } } @@ -1088,6 +1090,7 @@ gtk_button_finish_activate (GtkButton *button, button->button_down = FALSE; gtk_button_update_state (button); + gtk_widget_queue_draw (GTK_WIDGET (button)); if (do_it) gtk_button_clicked (button); @@ -1257,12 +1260,15 @@ gtk_button_update_state (GtkButton *button) gboolean depressed; GtkStateType new_state; - depressed = button->button_down && (button->in_button || button->activate_timeout); + if (button->activate_timeout) + depressed = button->depress_on_activate; + else + depressed = button->in_button && button->button_down; - if (!button->button_down && button->in_button) + if (button->in_button && (!button->button_down || !depressed)) new_state = GTK_STATE_PRELIGHT; else - new_state = depressed ? GTK_STATE_ACTIVE: GTK_STATE_NORMAL; + new_state = depressed ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL; _gtk_button_set_depressed (button, depressed); gtk_widget_set_state (GTK_WIDGET (button), new_state); |