1 // 2 // TestRadioButton.cs 3 // 4 // Author: Duncan Mak (duncan@ximian.com) 5 // 6 // Copyright (C) 2002, Duncan Mak, Ximian Inc. 7 // 8 9 using System; 10 11 using Gtk; 12 13 namespace WidgetViewer { 14 public class TestRadioButton 15 { 16 static Window window = null; 17 static RadioButton radio_button = null; 18 Create()19 public static Gtk.Window Create () 20 { 21 window = new Window ("GtkRadioButton"); 22 window.SetDefaultSize (200, 100); 23 24 VBox box1 = new VBox (false, 0); 25 window.Add (box1); 26 27 VBox box2 = new VBox (false, 10); 28 box2.BorderWidth = 10; 29 box1.PackStart (box2, true, true, 0); 30 31 radio_button = new RadioButton ("Button 1"); 32 box2.PackStart (radio_button, true, true, 0); 33 34 radio_button = new RadioButton (radio_button, "Button 2"); 35 radio_button.Active = true; 36 box2.PackStart (radio_button, true, true, 0); 37 38 radio_button = new RadioButton (radio_button, "Button 3"); 39 box2.PackStart (radio_button, true, true, 0); 40 41 radio_button = new RadioButton (radio_button, "Inconsistent"); 42 radio_button.Inconsistent = true; 43 box2.PackStart (radio_button, true, true, 0); 44 45 box1.PackStart (new HSeparator (), false, true, 0); 46 47 box2 = new VBox (false, 10); 48 box2.BorderWidth = 10; 49 box1.PackStart (box2, true, true, 0); 50 51 radio_button = new RadioButton ("Button 4"); 52 radio_button.Mode = false; 53 box2.PackStart (radio_button, true, true, 0); 54 55 radio_button = new RadioButton (radio_button, "Button 5"); 56 radio_button.Active = true; 57 radio_button.Mode = false; 58 box2.PackStart (radio_button, true, true, 0); 59 60 radio_button = new RadioButton (radio_button, "Button 6"); 61 radio_button.Mode = false; 62 box2.PackStart (radio_button, true, true, 0); 63 64 box1.PackStart (new HSeparator (), false, true, 0); 65 66 box2 = new VBox (false, 10); 67 box2.BorderWidth = 10; 68 box1.PackStart (box2, false, true, 0); 69 70 Button button = new Button (Stock.Close); 71 button.Clicked += new EventHandler (Close_Button); 72 box2.PackStart (button, true, true, 0); 73 button.CanDefault = true; 74 button.GrabDefault (); 75 76 return window; 77 } 78 Close_Button(object o, EventArgs args)79 static void Close_Button (object o, EventArgs args) 80 { 81 window.Destroy (); 82 } 83 } 84 } 85