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

* 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
This commit is contained in:
Duncan Mak 2002-07-17 08:59:11 +00:00
parent 8b85bf647a
commit ec3f7ead3e
4 changed files with 41 additions and 22 deletions

View file

@ -1,3 +1,11 @@
2002-07-17 Duncan Mak <duncan@ximian.com>
* 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 <duncan@ximian.com>
* TestCheckButton.cs:

View file

@ -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 ();

View file

@ -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 ()

View file

@ -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)