summaryrefslogtreecommitdiff
path: root/gtk/gtkradiobutton.c
diff options
context:
space:
mode:
authorjacob berkman <jacob@ximian.com>2001-11-16 22:56:21 +0000
committerJacob Berkman <jberkman@src.gnome.org>2001-11-16 22:56:21 +0000
commit8d99d6af28114c65f885a4b2b1a9049cb89c03f7 (patch)
treec6e1e3f73c9a12c09d8b5a0dd4c9f19f9cba7ab2 /gtk/gtkradiobutton.c
parentc344b3f905a3681c28d0ac9f9521418e25853dea (diff)
downloadgtk+-8d99d6af28114c65f885a4b2b1a9049cb89c03f7.tar.gz
add some no-indicator radio buttons
2001-11-16 jacob berkman <jacob@ximian.com> * tests/testgtk.c (create_radio_buttons): add some no-indicator radio buttons * gtk/gtkradiobutton.c (gtk_radio_button_init): since we are initially active, also initially be depressed (gtk_radio_button_clicked): also update our depressed state
Diffstat (limited to 'gtk/gtkradiobutton.c')
-rw-r--r--gtk/gtkradiobutton.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c
index 7c7148aae0..9e6e169661 100644
--- a/gtk/gtkradiobutton.c
+++ b/gtk/gtkradiobutton.c
@@ -116,6 +116,7 @@ gtk_radio_button_init (GtkRadioButton *radio_button)
radio_button->group = g_slist_prepend (NULL, radio_button);
+ _gtk_button_set_depressed (GTK_BUTTON (radio_button), TRUE);
gtk_widget_set_state (GTK_WIDGET (radio_button), GTK_STATE_ACTIVE);
}
@@ -495,6 +496,7 @@ gtk_radio_button_clicked (GtkButton *button)
GtkStateType new_state;
GSList *tmp_list;
gint toggled;
+ gboolean depressed;
g_return_if_fail (GTK_IS_RADIO_BUTTON (button));
@@ -552,12 +554,21 @@ gtk_radio_button_clicked (GtkButton *button)
new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_ACTIVE);
}
+ if (toggle_button->inconsistent)
+ depressed = FALSE;
+ else if (button->in_button && button->button_down)
+ depressed = !toggle_button->active;
+ else
+ depressed = toggle_button->active;
+
if (GTK_WIDGET_STATE (button) != new_state)
gtk_widget_set_state (GTK_WIDGET (button), new_state);
if (toggled)
gtk_toggle_button_toggled (toggle_button);
+ _gtk_button_set_depressed (button, depressed);
+
gtk_widget_queue_draw (GTK_WIDGET (button));
gtk_widget_unref (GTK_WIDGET (button));