GtkSharp/sample/test/TestToolbar.cs
Rachel Hestilow c8d090f62f 2002-08-31 Rachel Hestilow <hestilow@ximian.com>
Proper GList, GSList support. Read-only for now.

	* glue/list.c: Added.
	* glue/Makefile.am: Add list.c
	* glue/type.c: Add function gtksharp_is_object.

	* glib/ListBase.cs, List.cs: Added.
	* glib/SList.cs: Inherit from ListBase.
	* glib/Object.cs: Add static method "IsObject".

	* generator/Method.cs: Pass on element_type to constructor
	if specified.
	* generator/SymbolTable.cs: Move GList to manual types.

	* sample/GladeViewer.cs: Remove list hacks.

	* sources/Gnome.metadata: Specify element types for
	CanvasPathDef.Split and IconList.GetSelection. Rename
	CanvasPathDef *to methods to properly capitalized *To.
	* sources/Gtk.metadata: Hide Widget.ListAccelClosures until
	GClosure is handled properly.
	* sources/Pango.metadata: Added.

	* sample/test/TestToolbar.cs: Compile with recent delegate changes.

svn path=/trunk/gtk-sharp/; revision=7166
2002-09-01 04:46:38 +00:00

133 lines
3.3 KiB
C#

//
// TestToolbar.cs
//
// Author: Duncan Mak (duncan@ximian.com)
//
// Copyright (C) 2002, Duncan Mak, Ximian Inc.
//
using System;
using Gtk;
using GtkSharp;
namespace WidgetViewer {
public class TestToolbar {
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",
new SignalFunc (set_small_icon), -1);
toolbar.InsertStock (Stock.Open, "Stock icon: Open", "Toolbar/Open",
new SignalFunc (set_large_icon), -1);
toolbar.AppendSpace ();
toolbar.AppendItem ("Toggle tooltips", "toggle showing of tooltips", "Toolbar/Tooltips",
new Image (Stock.DialogInfo, IconSize.LargeToolbar),
new SignalFunc (toggle_tooltips));
toolbar.AppendSpace ();
toolbar.AppendItem ("Horizontal", "Horizontal layout", "Toolbar/Horizontal",
new Image (Stock.GoForward, IconSize.LargeToolbar),
new SignalFunc (set_horizontal));
toolbar.AppendItem ("Vertical", "Vertical layout", "Toolbar/Vertical",
new Image (Stock.GoUp, IconSize.LargeToolbar),
new SignalFunc (set_vertical));
toolbar.AppendSpace ();
toolbar.AppendItem ("Icons", "Only show icons", "Toolbar/IconsOnly",
new Image (Stock.Home, IconSize.LargeToolbar),
new SignalFunc (set_icon_only));
toolbar.AppendItem ("Text", "Only show Text", "Toolbar/TextOnly",
new Image (Stock.JustifyFill, IconSize.LargeToolbar),
new SignalFunc (set_text_only));
toolbar.AppendItem ("Both", "Show both Icon & Text", "Toolbar/Both",
new Image (Stock.Index, IconSize.LargeToolbar),
new SignalFunc (set_both));
toolbar.AppendItem ("Both (Horizontal)", "Show Icon & Text horizontally", "Toolbar/BothHoriz",
new Image (Stock.Index, IconSize.LargeToolbar),
new SignalFunc (set_both_horiz));
toolbar.AppendSpace ();
toolbar.InsertStock (Stock.Close, "Stock icon: Close", "Toolbar/Close",
new SignalFunc (Close_Button), -1);
window.Add (toolbar);
window.ShowAll ();
return window;
}
static void set_small_icon (Gtk.Object obj)
{
toolbar.IconSize = IconSize.SmallToolbar;
}
static void set_large_icon (Gtk.Object obj)
{
toolbar.IconSize = IconSize.LargeToolbar;
}
static void set_icon_only (Gtk.Object obj)
{
toolbar.ToolbarStyle = ToolbarStyle.Icons;
}
static void set_text_only (Gtk.Object obj)
{
toolbar.ToolbarStyle = ToolbarStyle.Text;
}
static void set_horizontal (Gtk.Object obj)
{
toolbar.Orientation = Orientation.Horizontal;
}
static void set_vertical (Gtk.Object obj)
{
toolbar.Orientation = Orientation.Vertical;
}
static void set_both (Gtk.Object obj)
{
toolbar.ToolbarStyle = ToolbarStyle.Both;
}
static void set_both_horiz (Gtk.Object obj)
{
toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
}
static void toggle_tooltips (Gtk.Object obj)
{
if (showTooltips == true)
showTooltips = false;
else
showTooltips = true;
toolbar.Tooltips = showTooltips;
Console.WriteLine ("Show tooltips: " + showTooltips);
}
static void Close_Button (Gtk.Object obj)
{
window.Destroy ();
}
}
}