From ec3f7ead3e78a0ac417598da0b78f82fb78035c6 Mon Sep 17 00:00:00 2001 From: Duncan Mak Date: Wed, 17 Jul 2002 08:59:11 +0000 Subject: [PATCH] 2002-07-17 Duncan Mak * WidgetViewer.cs: Changed the EventArgs stuff to match Mike's latest commit. * TestToolbar.cs: Thanks to Dietmar for fixing #27695. Added new button for toggling showing tooltips. svn path=/trunk/gtk-sharp/; revision=5841 --- sample/test/ChangeLog | 8 +++++++ sample/test/TestColorSelection.cs | 2 +- sample/test/TestToolbar.cs | 37 +++++++++++++++++++++---------- sample/test/WidgetViewer.cs | 16 ++++++------- 4 files changed, 41 insertions(+), 22 deletions(-) diff --git a/sample/test/ChangeLog b/sample/test/ChangeLog index 1e0269aea..72e1beca0 100644 --- a/sample/test/ChangeLog +++ b/sample/test/ChangeLog @@ -1,3 +1,11 @@ +2002-07-17 Duncan Mak + + * WidgetViewer.cs: Changed the EventArgs stuff to match Mike's + latest commit. + + * TestToolbar.cs: Thanks to Dietmar for fixing #27695. Added new + button for toggling showing tooltips. + 2002-07-16 Duncan Mak * TestCheckButton.cs: diff --git a/sample/test/TestColorSelection.cs b/sample/test/TestColorSelection.cs index 245a8e337..4b0740fdf 100644 --- a/sample/test/TestColorSelection.cs +++ b/sample/test/TestColorSelection.cs @@ -42,7 +42,7 @@ namespace WidgetViewer { window.ColorSelection.ColorChanged += new EventHandler (Color_Changed); window.OkButton.Clicked += new EventHandler (Color_Selection_OK); - window.CancelButton.Clicked += new EventHandler (Color_Selection_Cancel); + window.CancelButton.Clicked += new EventHandler (Color_Selection_Cancel); options.ShowAll (); diff --git a/sample/test/TestToolbar.cs b/sample/test/TestToolbar.cs index 174aaf5b2..538b020ed 100644 --- a/sample/test/TestToolbar.cs +++ b/sample/test/TestToolbar.cs @@ -16,10 +16,12 @@ namespace WidgetViewer { static Window window = null; static Toolbar toolbar = null; + static bool showTooltips = true; public static Gtk.Window Create () { window = new Window ("Toolbar"); + window.Resizable = false; toolbar = new Toolbar (); toolbar.InsertStock (Stock.New, "Stock icon: New", "Toolbar/New", @@ -28,6 +30,14 @@ namespace WidgetViewer { toolbar.InsertStock (Stock.Open, "Stock icon: Open", "Toolbar/Open", new SignalFunc (set_large_icon), IntPtr.Zero, -1); + toolbar.AppendSpace (); + + toolbar.AppendItem ("Toggle tooltips", "toggle showing of tooltips", "Toolbar/Tooltips", + new Image (Stock.DialogInfo, IconSize.LargeToolbar), + new SignalFunc (toggle_tooltips), IntPtr.Zero); + + toolbar.AppendSpace (); + toolbar.AppendItem ("Horizontal", "Horizontal layout", "Toolbar/Horizontal", new Image (Stock.GoForward, IconSize.LargeToolbar), new SignalFunc (set_horizontal), IntPtr.Zero); @@ -66,50 +76,53 @@ namespace WidgetViewer { static void set_small_icon () { - Console.WriteLine ("set small icon"); toolbar.IconSize = IconSize.SmallToolbar; } static void set_large_icon () { - Console.WriteLine ("set large icon"); toolbar.IconSize = IconSize.LargeToolbar; } static void set_icon_only () { - Console.WriteLine ("set icon only"); - toolbar.Style = ToolbarStyle.Icons; + toolbar.ToolbarStyle = ToolbarStyle.Icons; } static void set_text_only () { - Console.WriteLine ("set text only"); - toolbar.Style = ToolbarStyle.Text; + toolbar.ToolbarStyle = ToolbarStyle.Text; } static void set_horizontal () { - Console.WriteLine ("set horizontal"); toolbar.Orientation = Orientation.Horizontal; } static void set_vertical () { - Console.WriteLine ("set vertical"); toolbar.Orientation = Orientation.Vertical; } static void set_both () { - Console.WriteLine ("set both"); - toolbar.Style = ToolbarStyle.Both; + toolbar.ToolbarStyle = ToolbarStyle.Both; } static void set_both_horiz () { - Console.WriteLine ("set both horiz."); - toolbar.Style = ToolbarStyle.BothHoriz; + toolbar.ToolbarStyle = ToolbarStyle.BothHoriz; + } + + static void toggle_tooltips () + { + if (showTooltips == true) + showTooltips = false; + else + showTooltips = true; + + toolbar.Tooltips = showTooltips; + Console.WriteLine ("Show tooltips: " + showTooltips); } static void Close_Button () diff --git a/sample/test/WidgetViewer.cs b/sample/test/WidgetViewer.cs index c90d47aab..3507be01e 100644 --- a/sample/test/WidgetViewer.cs +++ b/sample/test/WidgetViewer.cs @@ -23,7 +23,7 @@ namespace WidgetViewer { { Application.Init (); window = new Window ("Gtk# Widget viewer"); - window.DeleteEvent += new EventHandler (Window_Delete); + window.DeleteEvent += new DeleteEventHandler (Window_Delete); window.SetDefaultSize (250, 200); VBox box1 = new VBox (false, 0); @@ -67,27 +67,25 @@ namespace WidgetViewer { static void AddWindow (Window dialog) { viewer = dialog; - viewer.DeleteEvent += new EventHandler (Viewer_Delete); + viewer.DeleteEvent += new DeleteEventHandler (Viewer_Delete); viewer.ShowAll (); } - static void Window_Delete (object o, EventArgs args) + static void Window_Delete (object o, DeleteEventArgs args) { - SignalArgs sa = (SignalArgs) args; Application.Quit (); - sa.RetVal = true; + args.RetVal = true; } - static void Viewer_Delete (object o, EventArgs args) + static void Viewer_Delete (object o, DeleteEventArgs args) { - SignalArgs sa = (SignalArgs) args; viewer.Destroy (); - sa.RetVal = true; + args.RetVal = true; } static void Close_Button (object o, EventArgs args) { - Window_Delete (o, args); + Window_Delete (o, (DeleteEventArgs) args); } static void Check_Buttons (object o, EventArgs args)