2002-07-31 Duncan Mak <duncan@ximian.com>

* *.cs: Flush. Made it use Stock buttons instead of just a plain
	text label.

	* TestColorSelection.cs: Made the result dialog work a bit better.

	* ChangeLog: Added Rachel's ChangeLog entry to here.

svn path=/trunk/gtk-sharp/; revision=6273
This commit is contained in:
Duncan Mak 2002-07-31 07:07:29 +00:00
parent 967e3e9c5a
commit c73ccc6b50
11 changed files with 40 additions and 22 deletions

View file

@ -1,3 +1,17 @@
2002-07-31 Duncan Mak <duncan@ximian.com>
* *.cs: Flush. Made it use Stock buttons instead of just a plain
text label.
* TestColorSelection.cs: Made the result dialog work a bit better.
* ChangeLog: Added Rachel's ChangeLog entry to here.
2002-07-30 Rachel Hestilow <hestilow@ximian.com>
* sample/test/TestColorSelection.cs: Display color string in hex format,
update to use IsNull instead of == null, and size dialog to look pretty.
2002-07-25 Duncan Mak <duncan@ximian.com> 2002-07-25 Duncan Mak <duncan@ximian.com>
* TestRange.cs: Fix the EventHandlers here. * TestRange.cs: Fix the EventHandlers here.

View file

@ -50,7 +50,7 @@ namespace WidgetViewer {
box2.BorderWidth = 10; box2.BorderWidth = 10;
box1.PackStart (box2, false, false, 0); box1.PackStart (box2, false, false, 0);
Button button = new Button ("close"); Button button = Button.NewFromStock (Stock.Close);
button.Clicked += new EventHandler (Close_Button); button.Clicked += new EventHandler (Close_Button);
button.CanDefault = true; button.CanDefault = true;

View file

@ -88,39 +88,44 @@ namespace WidgetViewer {
static void Color_Selection_OK (object o, EventArgs args) static void Color_Selection_OK (object o, EventArgs args)
{ {
Gdk.Color selected = window.ColorSelection.CurrentColor; Gdk.Color selected = window.ColorSelection.CurrentColor;
if (selected.IsNull) { if (selected.IsNull)
Console.WriteLine ("Color selection failed."); Console.WriteLine ("Color selection failed.");
return; else {
} window.Hide ();
Display_Result (selected); Display_Result (selected);
} }
}
static void Color_Selection_Cancel (object o, EventArgs args) static void Color_Selection_Cancel (object o, EventArgs args)
{ {
if (dialog != null)
dialog.Destroy ();
window.Destroy (); window.Destroy ();
} }
static void Dialog_Ok (object o, EventArgs args)
{
dialog.Destroy ();
window.ShowAll ();
}
static void Display_Result (Gdk.Color color) static void Display_Result (Gdk.Color color)
{ {
if (color.IsNull) if (color.IsNull)
Console.WriteLine ("Null color"); Console.WriteLine ("Null color");
dialog = new Dialog ();
dialog.Title = "Selected Color";
dialog.VBox.PackStart (new Gtk.Label (HexFormat (color)), dialog = new Dialog ();
false, false, 0); dialog.Title = "Selected Color: " + HexFormat (color);
dialog.HasSeparator = true;
DrawingArea da = new DrawingArea (); DrawingArea da = new DrawingArea ();
da.ModifyBg (StateType.Normal, color); da.ModifyBg (StateType.Normal, color);
dialog.VBox.PackStart (da, true, true, 0); dialog.VBox.BorderWidth = 10;
dialog.VBox.PackStart (da, true, true, 10);
dialog.SetDefaultSize (200, 200); dialog.SetDefaultSize (200, 200);
Button button = new Button ("OK"); Button button = Button.NewFromStock (Stock.Ok);
button.Clicked += new EventHandler (Close_Button); button.Clicked += new EventHandler (Dialog_Ok);
button.CanDefault = true; button.CanDefault = true;
dialog.ActionArea.PackStart (button, true, true, 0); dialog.ActionArea.PackStart (button, true, true, 0);
button.GrabDefault (); button.GrabDefault ();

View file

@ -25,7 +25,7 @@ namespace WidgetViewer {
window.SetDefaultSize (200, 100); window.SetDefaultSize (200, 100);
window.Title = "GtkDialog"; window.Title = "GtkDialog";
Button button = new Button ("OK"); Button button = Button.NewFromStock (Stock.Ok);
button.Clicked += new EventHandler (Close_Button); button.Clicked += new EventHandler (Close_Button);
button.CanDefault = true; button.CanDefault = true;
window.ActionArea.PackStart (button, true, true, 0); window.ActionArea.PackStart (button, true, true, 0);

View file

@ -39,7 +39,7 @@ namespace WidgetViewer {
check_button.Toggled += new EventHandler (Toggle_Flip); check_button.Toggled += new EventHandler (Toggle_Flip);
check_button.BorderWidth = 10; check_button.BorderWidth = 10;
button = new Button ("close"); button = Button.NewFromStock (Stock.Close);
button.Clicked += new EventHandler (Close_Button); button.Clicked += new EventHandler (Close_Button);
button.CanDefault = true; button.CanDefault = true;

View file

@ -88,7 +88,7 @@ namespace WidgetViewer {
box2.BorderWidth = 10; box2.BorderWidth = 10;
box1.PackStart (box2, false, true, 0); box1.PackStart (box2, false, true, 0);
Button close_button = new Button ("Close"); Button close_button = Button.NewFromStock (Stock.Close);
close_button.Clicked += new EventHandler (Close_Button); close_button.Clicked += new EventHandler (Close_Button);
box2.PackStart (close_button, true, true, 0); box2.PackStart (close_button, true, true, 0);

View file

@ -30,7 +30,6 @@ namespace WidgetViewer {
box1.PackStart (box2, true, true, 0); box1.PackStart (box2, true, true, 0);
radio_button = RadioButton.NewWithLabel (new GLib.SList (IntPtr.Zero), "Button 1"); radio_button = RadioButton.NewWithLabel (new GLib.SList (IntPtr.Zero), "Button 1");
Console.WriteLine (radio_button);
box2.PackStart (radio_button, true, true, 0); box2.PackStart (radio_button, true, true, 0);
radio_button = RadioButton.NewWithLabelFromWidget (radio_button, "Button 2"); radio_button = RadioButton.NewWithLabelFromWidget (radio_button, "Button 2");
@ -69,7 +68,7 @@ namespace WidgetViewer {
box2.BorderWidth = 10; box2.BorderWidth = 10;
box1.PackStart (box2, false, true, 0); box1.PackStart (box2, false, true, 0);
Button button = new Button ("_Close"); Button button = Button.NewFromStock (Stock.Close);
button.Clicked += new EventHandler (Close_Button); button.Clicked += new EventHandler (Close_Button);
box2.PackStart (button, true, true, 0); box2.PackStart (button, true, true, 0);
button.CanDefault = true; button.CanDefault = true;

View file

@ -76,7 +76,7 @@ namespace WidgetViewer {
box2.BorderWidth = 10; box2.BorderWidth = 10;
box1.PackStart (box2, false, true, 0); box1.PackStart (box2, false, true, 0);
Button button = new Button ("_Close"); Button button = Button.NewFromStock (Stock.Close);
button.Clicked += new EventHandler (Close_Button); button.Clicked += new EventHandler (Close_Button);
box2.PackStart (button, true, true, 0); box2.PackStart (button, true, true, 0);
button.CanDefault = true; button.CanDefault = true;

View file

@ -62,7 +62,7 @@ namespace WidgetViewer {
check_button.Active = true; check_button.Active = true;
check_button.Toggled += new EventHandler (Button_Toggle_Cb); check_button.Toggled += new EventHandler (Button_Toggle_Cb);
Button close_button = new Button ("_Close"); Button close_button = Button.NewFromStock (Stock.Close);
close_button.Clicked += new EventHandler (Close_Button); close_button.Clicked += new EventHandler (Close_Button);
window.ActionArea.PackStart (close_button, false, false, 0); window.ActionArea.PackStart (close_button, false, false, 0);

View file

@ -50,7 +50,7 @@ namespace WidgetViewer {
box2.BorderWidth = 10; box2.BorderWidth = 10;
box1.PackStart (box2, false, true, 0); box1.PackStart (box2, false, true, 0);
Button close_button = new Button ("Close"); Button close_button = Button.NewFromStock (Stock.Close);
close_button.Clicked += new EventHandler (Close_Button); close_button.Clicked += new EventHandler (Close_Button);
box2.PackStart (close_button, true, true, 0); box2.PackStart (close_button, true, true, 0);
button.CanDefault = true; button.CanDefault = true;

View file

@ -56,7 +56,7 @@ namespace WidgetViewer {
box2.BorderWidth = 10; box2.BorderWidth = 10;
box1.PackStart (box2, false, false, 0); box1.PackStart (box2, false, false, 0);
Button close_button = new Button ("_Close"); Button close_button = Button.NewFromStock (Stock.Close);
close_button.Clicked += new EventHandler (Close_Button); close_button.Clicked += new EventHandler (Close_Button);
box2.PackStart (close_button, true, true, 0); box2.PackStart (close_button, true, true, 0);