remove GLib and System.Drawing references

remove workaround for mscorlib
        use Type.GetMembers instead of .GetMethods
        remove Glib.IdleHandler for simplicity

svn path=/trunk/gtk-sharp/; revision=16551
This commit is contained in:
John Luke 2003-07-22 23:58:07 +00:00
parent 31001501ed
commit c8d02f85e0
2 changed files with 40 additions and 40 deletions

View File

@ -1,3 +1,11 @@
2003-07-22 John Luke <jluke@cfl.rr.com>
* sample/TreeViewDemo.cs:
remove GLib and System.Drawing references
remove workaround for mscorlib
use Type.GetMembers instead of .GetMethods
remove Glib.IdleHandler for simplicity
2003-07-22 Mike Kestner <mkestner@speakeasy.net> 2003-07-22 Mike Kestner <mkestner@speakeasy.net>
* generator/Method.cs (GenerateBody): kill the "cast_type" * generator/Method.cs (GenerateBody): kill the "cast_type"

View File

@ -6,10 +6,8 @@
namespace GtkSamples { namespace GtkSamples {
using System; using System;
using System.Drawing;
using System.Reflection; using System.Reflection;
using GLib;
using Gtk; using Gtk;
using GtkSharp; using GtkSharp;
@ -17,12 +15,39 @@ namespace GtkSamples {
private static TreeStore store = null; private static TreeStore store = null;
private static Dialog dialog = null; private static Dialog dialog = null;
private static Label dialog_label = null; private static Label dialog_label = null;
public TreeViewDemo ()
{
Application.Init ();
PopulateStore ();
Window win = new Window ("TreeView demo");
win.DeleteEvent += new DeleteEventHandler (DeleteCB);
win.SetDefaultSize (640,480);
ScrolledWindow sw = new ScrolledWindow ();
win.Add (sw);
TreeView tv = new TreeView (store);
tv.HeadersVisible = true;
tv.AppendColumn ("Name", new CellRendererText (), "text", 0);
tv.AppendColumn ("Type", new CellRendererText (), "text", 1);
sw.Add (tv);
dialog.Destroy ();
dialog = null;
win.ShowAll ();
Application.Run ();
}
private static void ProcessType (TreeIter parent, System.Type t) private static void ProcessType (TreeIter parent, System.Type t)
{ {
// .GetMembers() won't work due to unimplemented foreach (MemberInfo mi in t.GetMembers ()) {
// scary classes.
foreach (MemberInfo mi in t.GetMethods ()) {
store.AppendValues (parent, mi.Name, mi.ToString ()); store.AppendValues (parent, mi.Name, mi.ToString ());
} }
} }
@ -46,9 +71,6 @@ namespace GtkSamples {
store = new TreeStore (typeof (string), typeof (string)); store = new TreeStore (typeof (string), typeof (string));
foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies ()) { foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies ()) {
// we can't show corlib due to some unimplemented
// stuff in some scary class.
if (asm.GetName ().Name == "mscorlib") continue;
UpdateDialog ("Loading {0}", asm.GetName ().Name); UpdateDialog ("Loading {0}", asm.GetName ().Name);
@ -59,37 +81,7 @@ namespace GtkSamples {
public static void Main (string[] args) public static void Main (string[] args)
{ {
Application.Init (); new TreeViewDemo ();
Idle.Add (new IdleHandler (IdleCB));
Application.Run ();
}
public static bool IdleCB ()
{
PopulateStore ();
Window win = new Window ("TreeView demo");
win.DeleteEvent += new DeleteEventHandler (DeleteCB);
win.DefaultSize = new Size (640,480);
ScrolledWindow sw = new ScrolledWindow ();
win.Add (sw);
TreeView tv = new TreeView (store);
tv.HeadersVisible = true;
tv.AppendColumn ("Name", new CellRendererText (), "text", 0);
tv.AppendColumn ("Type", new CellRendererText (), "text", 1);
sw.Add (tv);
dialog.Destroy ();
dialog = null;
win.ShowAll ();
return false;
} }
private static void DeleteCB (System.Object o, DeleteEventArgs args) private static void DeleteCB (System.Object o, DeleteEventArgs args)
@ -107,7 +99,7 @@ namespace GtkSamples {
dialog.Title = "Loading data from assemblies..."; dialog.Title = "Loading data from assemblies...";
dialog.AddButton (Stock.Cancel, 1); dialog.AddButton (Stock.Cancel, 1);
dialog.Response += new ResponseHandler (ResponseCB); dialog.Response += new ResponseHandler (ResponseCB);
dialog.DefaultSize = new Size (480, 100); dialog.SetDefaultSize (480, 100);
VBox vbox = dialog.VBox; VBox vbox = dialog.VBox;
HBox hbox = new HBox (false, 4); HBox hbox = new HBox (false, 4);