]> Pileus Git - ~andy/gtk/blob - gtk/gtkradiobutton.c
Add a "group" property like the one found in radio buttons.
[~andy/gtk] / gtk / gtkradiobutton.c
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /*
21  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
22  * file for a list of people on the GTK+ Team.  See the ChangeLog
23  * files for a list of changes.  These files are distributed with
24  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
25  */
26
27 #include <config.h>
28 #include "gtklabel.h"
29 #include "gtkmarshalers.h"
30 #include "gtkradiobutton.h"
31 #include "gtkprivate.h"
32 #include "gtkintl.h"
33 #include "gtkalias.h"
34
35
36 enum {
37   PROP_0,
38   PROP_GROUP
39 };
40
41
42 static void     gtk_radio_button_class_init     (GtkRadioButtonClass *klass);
43 static void     gtk_radio_button_init           (GtkRadioButton      *radio_button);
44 static void     gtk_radio_button_destroy        (GtkObject           *object);
45 static gboolean gtk_radio_button_focus          (GtkWidget           *widget,
46                                                  GtkDirectionType     direction);
47 static void     gtk_radio_button_clicked        (GtkButton           *button);
48 static void     gtk_radio_button_draw_indicator (GtkCheckButton      *check_button,
49                                                  GdkRectangle        *area);
50 static void     gtk_radio_button_set_property   (GObject             *object,
51                                                  guint                prop_id,
52                                                  const GValue        *value,
53                                                  GParamSpec          *pspec);
54 static void     gtk_radio_button_get_property   (GObject             *object,
55                                                  guint                prop_id,
56                                                  GValue              *value,
57                                                  GParamSpec          *pspec);
58
59 static GtkCheckButtonClass *parent_class = NULL;
60
61 static guint group_changed_signal = 0;
62
63 GType
64 gtk_radio_button_get_type (void)
65 {
66   static GType radio_button_type = 0;
67
68   if (!radio_button_type)
69     {
70       static const GTypeInfo radio_button_info =
71       {
72         sizeof (GtkRadioButtonClass),
73         NULL,           /* base_init */
74         NULL,           /* base_finalize */
75         (GClassInitFunc) gtk_radio_button_class_init,
76         NULL,           /* class_finalize */
77         NULL,           /* class_data */
78         sizeof (GtkRadioButton),
79         0,              /* n_preallocs */
80         (GInstanceInitFunc) gtk_radio_button_init,
81       };
82
83       radio_button_type =
84         g_type_register_static (GTK_TYPE_CHECK_BUTTON, "GtkRadioButton",
85                                 &radio_button_info, 0);
86     }
87
88   return radio_button_type;
89 }
90
91 static void
92 gtk_radio_button_class_init (GtkRadioButtonClass *class)
93 {
94   GObjectClass *gobject_class;
95   GtkObjectClass *object_class;
96   GtkButtonClass *button_class;
97   GtkCheckButtonClass *check_button_class;
98   GtkWidgetClass *widget_class;
99
100   gobject_class = G_OBJECT_CLASS (class);
101   object_class = (GtkObjectClass*) class;
102   widget_class = (GtkWidgetClass*) class;
103   button_class = (GtkButtonClass*) class;
104   check_button_class = (GtkCheckButtonClass*) class;
105
106   parent_class = g_type_class_peek_parent (class);
107
108   gobject_class->set_property = gtk_radio_button_set_property;
109   gobject_class->get_property = gtk_radio_button_get_property;
110
111   g_object_class_install_property (gobject_class,
112                                    PROP_GROUP,
113                                    g_param_spec_object ("group",
114                                                         P_("Group"),
115                                                         P_("The radio button whose group this widget belongs to."),
116                                                         GTK_TYPE_RADIO_BUTTON,
117                                                         GTK_PARAM_WRITABLE));
118   object_class->destroy = gtk_radio_button_destroy;
119
120   widget_class->focus = gtk_radio_button_focus;
121
122   button_class->clicked = gtk_radio_button_clicked;
123
124   check_button_class->draw_indicator = gtk_radio_button_draw_indicator;
125
126   class->group_changed = NULL;
127
128   /**
129    * GtkRadioButton::group-changed:
130    * @style: the object which received the signal
131    *
132    * Emitted when the group of radio buttons that a radio button belongs
133    * to changes. This is emitted when a radio button switches from
134    * being alone to being part of a group of 2 or more buttons, or
135    * vice-versa, and when a buttton is moved from one group of 2 or
136    * more buttons to a different one, but not when the composition
137    * of the group that a button belongs to changes.
138    *
139    * Since: 2.4
140    */
141   group_changed_signal = g_signal_new ("group-changed",
142                                        G_OBJECT_CLASS_TYPE (object_class),
143                                        G_SIGNAL_RUN_FIRST,
144                                        G_STRUCT_OFFSET (GtkRadioButtonClass, group_changed),
145                                        NULL, NULL,
146                                        _gtk_marshal_VOID__VOID,
147                                        G_TYPE_NONE, 0);
148 }
149
150 static void
151 gtk_radio_button_init (GtkRadioButton *radio_button)
152 {
153   GTK_WIDGET_SET_FLAGS (radio_button, GTK_NO_WINDOW);
154   GTK_WIDGET_UNSET_FLAGS (radio_button, GTK_RECEIVES_DEFAULT);
155
156   GTK_TOGGLE_BUTTON (radio_button)->active = TRUE;
157
158   GTK_BUTTON (radio_button)->depress_on_activate = FALSE;
159
160   radio_button->group = g_slist_prepend (NULL, radio_button);
161
162   _gtk_button_set_depressed (GTK_BUTTON (radio_button), TRUE);
163   gtk_widget_set_state (GTK_WIDGET (radio_button), GTK_STATE_ACTIVE);
164 }
165
166 static void
167 gtk_radio_button_set_property (GObject      *object,
168                                guint         prop_id,
169                                const GValue *value,
170                                GParamSpec   *pspec)
171 {
172   GtkRadioButton *radio_button;
173
174   radio_button = GTK_RADIO_BUTTON (object);
175
176   switch (prop_id)
177     {
178       GSList *slist;
179
180     case PROP_GROUP:
181       if (G_VALUE_HOLDS_OBJECT (value))
182         slist = gtk_radio_button_get_group ((GtkRadioButton*) g_value_get_object (value));
183       else
184         slist = NULL;
185       gtk_radio_button_set_group (radio_button, slist);
186       break;
187     default:
188       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
189       break;
190     }
191 }
192
193 static void
194 gtk_radio_button_get_property (GObject    *object,
195                                guint       prop_id,
196                                GValue     *value,
197                                GParamSpec *pspec)
198 {
199   GtkRadioButton *radio_button;
200
201   radio_button = GTK_RADIO_BUTTON (object);
202
203   switch (prop_id)
204     {
205     default:
206       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
207       break;
208     }
209 }
210
211 void
212 gtk_radio_button_set_group (GtkRadioButton *radio_button,
213                             GSList         *group)
214 {
215   GtkWidget *old_group_singleton = NULL;
216   GtkWidget *new_group_singleton = NULL;
217   
218   g_return_if_fail (GTK_IS_RADIO_BUTTON (radio_button));
219   g_return_if_fail (!g_slist_find (group, radio_button));
220
221   if (radio_button->group)
222     {
223       GSList *slist;
224
225       radio_button->group = g_slist_remove (radio_button->group, radio_button);
226       
227       if (radio_button->group && !radio_button->group->next)
228         old_group_singleton = g_object_ref (radio_button->group->data);
229           
230       for (slist = radio_button->group; slist; slist = slist->next)
231         {
232           GtkRadioButton *tmp_button;
233           
234           tmp_button = slist->data;
235           
236           tmp_button->group = radio_button->group;
237         }
238     }
239   
240   if (group && !group->next)
241     new_group_singleton = g_object_ref (group->data);
242   
243   radio_button->group = g_slist_prepend (group, radio_button);
244   
245   if (group)
246     {
247       GSList *slist;
248       
249       for (slist = group; slist; slist = slist->next)
250         {
251           GtkRadioButton *tmp_button;
252           
253           tmp_button = slist->data;
254           
255           tmp_button->group = radio_button->group;
256         }
257     }
258
259   g_object_ref (radio_button);
260   
261   g_object_notify (G_OBJECT (radio_button), "group");
262   g_signal_emit (radio_button, group_changed_signal, 0);
263   if (old_group_singleton)
264     {
265       g_signal_emit (old_group_singleton, group_changed_signal, 0);
266       g_object_unref (old_group_singleton);
267     }
268   if (new_group_singleton)
269     {
270       g_signal_emit (new_group_singleton, group_changed_signal, 0);
271       g_object_unref (new_group_singleton);
272     }
273
274   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_button), group == NULL);
275
276   g_object_unref (radio_button);
277 }
278
279 GtkWidget*
280 gtk_radio_button_new (GSList *group)
281 {
282   GtkRadioButton *radio_button;
283
284   radio_button = g_object_new (GTK_TYPE_RADIO_BUTTON, NULL);
285
286   if (group)
287     gtk_radio_button_set_group (radio_button, group);
288
289   return GTK_WIDGET (radio_button);
290 }
291
292 GtkWidget*
293 gtk_radio_button_new_with_label (GSList      *group,
294                                  const gchar *label)
295 {
296   GtkWidget *radio_button;
297
298   radio_button = g_object_new (GTK_TYPE_RADIO_BUTTON, "label", label, NULL) ;
299
300   if (group)
301     gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_button), group);
302
303   return radio_button;
304 }
305
306
307 /**
308  * gtk_radio_button_new_with_mnemonic:
309  * @group: the radio button group
310  * @label: the text of the button, with an underscore in front of the
311  *         mnemonic character
312  * @returns: a new #GtkRadioButton
313  *
314  * Creates a new #GtkRadioButton containing a label, adding it to the same 
315  * group as @group. The label will be created using 
316  * gtk_label_new_with_mnemonic(), so underscores in @label indicate the 
317  * mnemonic for the button.
318  **/
319 GtkWidget*
320 gtk_radio_button_new_with_mnemonic (GSList      *group,
321                                     const gchar *label)
322 {
323   GtkWidget *radio_button;
324
325   radio_button = g_object_new (GTK_TYPE_RADIO_BUTTON, 
326                                "label", label, 
327                                "use-underline", TRUE, 
328                                NULL);
329
330   if (group)
331     gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_button), group);
332
333   return radio_button;
334 }
335
336 GtkWidget*
337 gtk_radio_button_new_from_widget (GtkRadioButton *group)
338 {
339   GSList *l = NULL;
340   if (group)
341     l = gtk_radio_button_get_group (group);
342   return gtk_radio_button_new (l);
343 }
344
345
346 GtkWidget*
347 gtk_radio_button_new_with_label_from_widget (GtkRadioButton *group,
348                                              const gchar    *label)
349 {
350   GSList *l = NULL;
351   if (group)
352     l = gtk_radio_button_get_group (group);
353   return gtk_radio_button_new_with_label (l, label);
354 }
355
356 /**
357  * gtk_radio_button_new_with_mnemonic_from_widget:
358  * @group: widget to get radio group from
359  * @label: the text of the button, with an underscore in front of the
360  *         mnemonic character
361  * @returns: a new #GtkRadioButton
362  *
363  * Creates a new #GtkRadioButton containing a label. The label
364  * will be created using gtk_label_new_with_mnemonic(), so underscores
365  * in @label indicate the mnemonic for the button.
366  **/
367 GtkWidget*
368 gtk_radio_button_new_with_mnemonic_from_widget (GtkRadioButton *group,
369                                                 const gchar    *label)
370 {
371   GSList *l = NULL;
372   if (group)
373     l = gtk_radio_button_get_group (group);
374   return gtk_radio_button_new_with_mnemonic (l, label);
375 }
376
377 GSList*
378 gtk_radio_button_get_group (GtkRadioButton *radio_button)
379 {
380   g_return_val_if_fail (GTK_IS_RADIO_BUTTON (radio_button), NULL);
381
382   return radio_button->group;
383 }
384
385
386 static void
387 gtk_radio_button_destroy (GtkObject *object)
388 {
389   GtkWidget *old_group_singleton = NULL;
390   GtkRadioButton *radio_button;
391   GtkRadioButton *tmp_button;
392   GSList *tmp_list;
393   gboolean was_in_group;
394   
395   radio_button = GTK_RADIO_BUTTON (object);
396
397   was_in_group = radio_button->group && radio_button->group->next;
398   
399   radio_button->group = g_slist_remove (radio_button->group, radio_button);
400   if (radio_button->group && !radio_button->group->next)
401     old_group_singleton = radio_button->group->data;
402
403   tmp_list = radio_button->group;
404
405   while (tmp_list)
406     {
407       tmp_button = tmp_list->data;
408       tmp_list = tmp_list->next;
409
410       tmp_button->group = radio_button->group;
411     }
412
413   /* this button is no longer in the group */
414   radio_button->group = NULL;
415
416   if (old_group_singleton)
417     g_signal_emit (old_group_singleton, group_changed_signal, 0);
418   if (was_in_group)
419     g_signal_emit (radio_button, group_changed_signal, 0);
420   
421   if (GTK_OBJECT_CLASS (parent_class)->destroy)
422     (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
423 }
424
425 static void
426 get_coordinates (GtkWidget    *widget,
427                  GtkWidget    *reference,
428                  gint         *x,
429                  gint         *y)
430 {
431   *x = widget->allocation.x + widget->allocation.width / 2;
432   *y = widget->allocation.y + widget->allocation.height / 2;
433   
434   gtk_widget_translate_coordinates (widget, reference, *x, *y, x, y);
435 }
436
437 static gint
438 left_right_compare (gconstpointer a,
439                     gconstpointer b,
440                     gpointer      data)
441 {
442   gint x1, y1, x2, y2;
443
444   get_coordinates ((GtkWidget *)a, data, &x1, &y1);
445   get_coordinates ((GtkWidget *)b, data, &x2, &y2);
446
447   if (y1 == y2)
448     return (x1 < x2) ? -1 : ((x1 == x2) ? 0 : 1);
449   else
450     return (y1 < y2) ? -1 : 1;
451 }
452
453 static gint
454 up_down_compare (gconstpointer a,
455                  gconstpointer b,
456                  gpointer      data)
457 {
458   gint x1, y1, x2, y2;
459   
460   get_coordinates ((GtkWidget *)a, data, &x1, &y1);
461   get_coordinates ((GtkWidget *)b, data, &x2, &y2);
462   
463   if (x1 == x2)
464     return (y1 < y2) ? -1 : ((y1 == y2) ? 0 : 1);
465   else
466     return (x1 < x2) ? -1 : 1;
467 }
468
469 static gboolean
470 gtk_radio_button_focus (GtkWidget         *widget,
471                         GtkDirectionType   direction)
472 {
473   GtkRadioButton *radio_button = GTK_RADIO_BUTTON (widget);
474   GSList *tmp_slist;
475
476   /* Radio buttons with draw_indicator unset focus "normally", since
477    * they look like buttons to the user.
478    */
479   if (!GTK_TOGGLE_BUTTON (widget)->draw_indicator)
480     return GTK_WIDGET_CLASS (parent_class)->focus (widget, direction);
481   
482   if (gtk_widget_is_focus (widget))
483     {
484       GSList *focus_list, *tmp_list;
485       GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
486       GtkWidget *new_focus = NULL;
487
488       focus_list = g_slist_copy (radio_button->group);
489       
490       switch (direction)
491         {
492         case GTK_DIR_TAB_FORWARD:
493         case GTK_DIR_TAB_BACKWARD:
494           return FALSE;
495         case GTK_DIR_LEFT:
496         case GTK_DIR_RIGHT:
497           focus_list = g_slist_sort_with_data (focus_list, left_right_compare, toplevel);
498           break;
499         case GTK_DIR_UP:
500         case GTK_DIR_DOWN:
501           focus_list = g_slist_sort_with_data (focus_list, up_down_compare, toplevel);
502           break;
503         }
504
505       if (direction == GTK_DIR_LEFT || direction == GTK_DIR_UP)
506         focus_list = g_slist_reverse (focus_list);
507
508       tmp_list = g_slist_find (focus_list, widget);
509
510       if (tmp_list)
511         {
512           tmp_list = tmp_list->next;
513           
514           while (tmp_list)
515             {
516               GtkWidget *child = tmp_list->data;
517               
518               if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_IS_SENSITIVE (child))
519                 {
520                   new_focus = child;
521                   break;
522                 }
523
524               tmp_list = tmp_list->next;
525             }
526         }
527
528       if (!new_focus)
529         {
530           tmp_list = focus_list;
531
532           while (tmp_list)
533             {
534               GtkWidget *child = tmp_list->data;
535               
536               if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_IS_SENSITIVE (child))
537                 {
538                   new_focus = child;
539                   break;
540                 }
541               
542               tmp_list = tmp_list->next;
543             }
544         }
545       
546       g_slist_free (focus_list);
547
548       if (new_focus)
549         {
550           gtk_widget_grab_focus (new_focus);
551           gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (new_focus), TRUE);
552         }
553
554       return TRUE;
555     }
556   else
557     {
558       GtkRadioButton *selected_button = NULL;
559       
560       /* We accept the focus if, we don't have the focus and
561        *  - we are the currently active button in the group
562        *  - there is no currently active radio button.
563        */
564       
565       tmp_slist = radio_button->group;
566       while (tmp_slist)
567         {
568           if (GTK_TOGGLE_BUTTON (tmp_slist->data)->active)
569             selected_button = tmp_slist->data;
570           tmp_slist = tmp_slist->next;
571         }
572       
573       if (selected_button && selected_button != radio_button)
574         return FALSE;
575
576       gtk_widget_grab_focus (widget);
577       return TRUE;
578     }
579 }
580
581 static void
582 gtk_radio_button_clicked (GtkButton *button)
583 {
584   GtkToggleButton *toggle_button;
585   GtkRadioButton *radio_button;
586   GtkToggleButton *tmp_button;
587   GtkStateType new_state;
588   GSList *tmp_list;
589   gint toggled;
590   gboolean depressed;
591
592   radio_button = GTK_RADIO_BUTTON (button);
593   toggle_button = GTK_TOGGLE_BUTTON (button);
594   toggled = FALSE;
595
596   g_object_ref (GTK_WIDGET (button));
597
598   if (toggle_button->active)
599     {
600       tmp_button = NULL;
601       tmp_list = radio_button->group;
602
603       while (tmp_list)
604         {
605           tmp_button = tmp_list->data;
606           tmp_list = tmp_list->next;
607
608           if (tmp_button->active && tmp_button != toggle_button)
609             break;
610
611           tmp_button = NULL;
612         }
613
614       if (!tmp_button)
615         {
616           new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_ACTIVE);
617         }
618       else
619         {
620           toggled = TRUE;
621           toggle_button->active = !toggle_button->active;
622           new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL);
623         }
624     }
625   else
626     {
627       toggled = TRUE;
628       toggle_button->active = !toggle_button->active;
629
630       tmp_list = radio_button->group;
631       while (tmp_list)
632         {
633           tmp_button = tmp_list->data;
634           tmp_list = tmp_list->next;
635
636           if (tmp_button->active && (tmp_button != toggle_button))
637             {
638               gtk_button_clicked (GTK_BUTTON (tmp_button));
639               break;
640             }
641         }
642
643       new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_ACTIVE);
644     }
645
646   if (toggle_button->inconsistent)
647     depressed = FALSE;
648   else if (button->in_button && button->button_down)
649     depressed = !toggle_button->active;
650   else
651     depressed = toggle_button->active;
652
653   if (GTK_WIDGET_STATE (button) != new_state)
654     gtk_widget_set_state (GTK_WIDGET (button), new_state);
655
656   if (toggled)
657     gtk_toggle_button_toggled (toggle_button);
658
659   _gtk_button_set_depressed (button, depressed);
660
661   gtk_widget_queue_draw (GTK_WIDGET (button));
662
663   g_object_unref (button);
664 }
665
666 static void
667 gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
668                                  GdkRectangle   *area)
669 {
670   GtkWidget *widget;
671   GtkWidget *child;
672   GtkButton *button;
673   GtkToggleButton *toggle_button;
674   GtkStateType state_type;
675   GtkShadowType shadow_type;
676   gint x, y;
677   gint indicator_size, indicator_spacing;
678   gint focus_width;
679   gint focus_pad;
680   gboolean interior_focus;
681
682   if (GTK_WIDGET_DRAWABLE (check_button))
683     {
684       widget = GTK_WIDGET (check_button);
685       button = GTK_BUTTON (check_button);
686       toggle_button = GTK_TOGGLE_BUTTON (check_button);
687
688       gtk_widget_style_get (widget,
689                             "interior-focus", &interior_focus,
690                             "focus-line-width", &focus_width,
691                             "focus-padding", &focus_pad,
692                             NULL);
693
694       _gtk_check_button_get_props (check_button, &indicator_size, &indicator_spacing);
695
696       x = widget->allocation.x + indicator_spacing + GTK_CONTAINER (widget)->border_width;
697       y = widget->allocation.y + (widget->allocation.height - indicator_size) / 2;
698
699       child = GTK_BIN (check_button)->child;
700       if (!interior_focus || !(child && GTK_WIDGET_VISIBLE (child)))
701         x += focus_width + focus_pad;      
702
703       if (toggle_button->inconsistent)
704         shadow_type = GTK_SHADOW_ETCHED_IN;
705       else if (toggle_button->active)
706         shadow_type = GTK_SHADOW_IN;
707       else
708         shadow_type = GTK_SHADOW_OUT;
709
710       if (button->activate_timeout || (button->button_down && button->in_button))
711         state_type = GTK_STATE_ACTIVE;
712       else if (button->in_button)
713         state_type = GTK_STATE_PRELIGHT;
714       else if (!GTK_WIDGET_IS_SENSITIVE (widget))
715         state_type = GTK_STATE_INSENSITIVE;
716       else
717         state_type = GTK_STATE_NORMAL;
718
719       if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
720         x = widget->allocation.x + widget->allocation.width - (indicator_size + x - widget->allocation.x);
721
722       if (GTK_WIDGET_STATE (toggle_button) == GTK_STATE_PRELIGHT)
723         {
724           GdkRectangle restrict_area;
725           GdkRectangle new_area;
726               
727           restrict_area.x = widget->allocation.x + GTK_CONTAINER (widget)->border_width;
728           restrict_area.y = widget->allocation.y + GTK_CONTAINER (widget)->border_width;
729           restrict_area.width = widget->allocation.width - (2 * GTK_CONTAINER (widget)->border_width);
730           restrict_area.height = widget->allocation.height - (2 * GTK_CONTAINER (widget)->border_width);
731           
732           if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
733             {
734               gtk_paint_flat_box (widget->style, widget->window, GTK_STATE_PRELIGHT,
735                                   GTK_SHADOW_ETCHED_OUT, 
736                                   area, widget, "checkbutton",
737                                   new_area.x, new_area.y,
738                                   new_area.width, new_area.height);
739             }
740         }
741
742       gtk_paint_option (widget->style, widget->window,
743                         state_type, shadow_type,
744                         area, widget, "radiobutton",
745                         x, y, indicator_size, indicator_size);
746     }
747 }
748
749 #define __GTK_RADIO_BUTTON_C__
750 #include "gtkaliasdef.c"