From 807b6ea6459c3be03a9ec165b93d0db67d855d47 Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Wed, 7 Nov 2001 23:13:05 +0000 Subject: [PATCH] 2001-11-07 Mike Kestner * codegen/defs-parse.pl (gen_object): Insert using statements. Insert class members from corresponding .custom file. * gtk/Window.custom : Renamed file from Window.cs. Removed all the automatically generated members. This will be the mechanism used to improve upon the mechanically generated binding. svn path=/trunk/gtk-sharp/; revision=1282 --- ChangeLog | 8 ++ codegen/defs-parse.pl | 12 +- gtk/Window.cs | 265 ------------------------------------------ gtk/Window.custom | 55 +++++++++ 4 files changed, 74 insertions(+), 266 deletions(-) delete mode 100755 gtk/Window.cs create mode 100755 gtk/Window.custom diff --git a/ChangeLog b/ChangeLog index 8e80740ec..1214456dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-11-07 Mike Kestner + + * codegen/defs-parse.pl (gen_object): Insert using statements. Insert + class members from corresponding .custom file. + * gtk/Window.custom : Renamed file from Window.cs. Removed all the + automatically generated members. This will be the mechanism used to + improve upon the mechanically generated binding. + 2001-11-05 Mike Kestner * codegen/defs-parse.pl (gen_object): Generate a ctor (IntPtr obj) for diff --git a/codegen/defs-parse.pl b/codegen/defs-parse.pl index 03f4668c2..696960a9b 100755 --- a/codegen/defs-parse.pl +++ b/codegen/defs-parse.pl @@ -16,6 +16,11 @@ 'guint32', "uint", 'const-gchar', "IntPtr", 'GObject', "IntPtr", 'gchar', "IntPtr", 'gfloat', "float", 'gdouble', "double"); + +%usings = ( + 'Gdk', "System,System.Runtime.InteropServices,GLib", + 'Gtk', "System,System.Runtime.InteropServices,GLib,Gdk"); + `mkdir -p ../gdk/generated`; `mkdir -p ../gtk/generated`; @@ -227,7 +232,10 @@ sub gen_object print OUTFILE "// Generated file: Do not modify\n\n"; print OUTFILE "namespace $namespace {\n\n"; - print OUTFILE "\t/// $typename Class \n"; + foreach $ns (split (/,/, $usings{$namespace})) { + print OUTFILE "\tusing $ns;\n"; + } + print OUTFILE "\n\t/// $typename Class \n"; print OUTFILE "\t/// \n\t///\t FIXME: Generate docs\n"; print OUTFILE "\t/// \n\n"; print OUTFILE "\tpublic "; @@ -256,6 +264,8 @@ sub gen_object print OUTFILE gen_method ($key, $methods{$key}, "gtk-1.3.dll"); } + $custom = "../" . lc ($namespace) . "/$typename.custom"; + print OUTFILE `cat $custom` if -e $custom; print OUTFILE "\t}\n}\n"; close (OUTFILE); print "done\n"; diff --git a/gtk/Window.cs b/gtk/Window.cs deleted file mode 100755 index 5b502ab55..000000000 --- a/gtk/Window.cs +++ /dev/null @@ -1,265 +0,0 @@ -// Gtk.Window.cs - GTK Window class implementation -// -// Author: Mike Kestner -// -// (c) 2001 Mike Kestner - -namespace Gtk { - - using GLib; - using System; - using System.Drawing; - using System.Runtime.InteropServices; - - /// - /// Window Class - /// - /// - /// - /// A Top Level Window object. - /// - - public class Window : Container { - - /// - /// Window Object Constructor - /// - /// - /// - /// Constructs a Window Wrapper. - /// - - public Window (IntPtr o) - { - RawObject = o; - } - - /// - /// Window Constructor - /// - /// - /// - /// Constructs a new Window of type TopLevel. - /// - - [DllImport("gtk-1.3.dll")] - static extern IntPtr gtk_window_new (WindowType type); - - public Window () - { - RawObject = gtk_window_new (WindowType.Toplevel); - } - - /// - /// Window Constructor - /// - /// - /// - /// Constructs a new Window of type TopLevel with the - /// specified Title. - /// - - public Window (String title) : this () - { - this.Title = title; - } - - /// - /// AllowGrow Property - /// - /// - /// - /// Indicates if the Window can be resized to larger than - /// the default size. - /// - - public bool AllowGrow { - get { - bool val; - GetProperty ("allow-grow", out val); - return (val); - } - set { - SetProperty ("allow-grow", value); - } - } - - /// - /// AllowShrink Property - /// - /// - /// - /// Indicates if the Window can be resized to smaller than - /// the default size. - /// - - public bool AllowShrink { - get { - bool val; - GetProperty ("allow-shrink", out val); - return (val); - } - set { - SetProperty ("allow-shrink", value); - } - } - - /// - /// DefaultHeight Property - /// - /// - /// - /// The default Height of the Window in Pixels. - /// - - public int DefaultHeight { - get { - int val; - GetProperty ("default-height", out val); - return (val); - } - set { - SetProperty ("default-height", value); - } - } - - /// - /// DefaultSize Property - /// - /// - /// - /// The default Size of the Window in Screen Coordinates. - /// - - public Size DefaultSize { - get { - return new Size (DefaultWidth, DefaultHeight); - } - set { - DefaultWidth = value.Width; - DefaultHeight = value.Height; - } - } - - /// - /// DefaultWidth Property - /// - /// - /// - /// The default Width of the Window in Pixels. - /// - - public int DefaultWidth { - get { - int val; - GetProperty ("default-width", out val); - return (val); - } - set { - SetProperty ("default-width", value); - } - } - - - /// - /// DestroyWithParent Property - /// - /// - /// - /// Indicates if the Window should be destroyed when any - /// associated parent Windows are destroyed. - /// - - public bool DestroyWithParent { - get { - bool val; - GetProperty ("destroy-with-parent", out val); - return (val); - } - set { - SetProperty ("destroy-with-parent", value); - } - } - - /// - /// Modal Property - /// - /// - /// - /// Indicates if the Window is Modal. If true, the input - /// focus is grabbed by the Window and other Windows in - /// the application will not accept input until the Window - /// is closed. - /// - - public bool Modal { - get { - bool val; - GetProperty ("modal", out val); - return (val); - } - set { - SetProperty ("modal", value); - } - } - - /// - /// Position Property - /// - /// - /// - /// The Position of the Window in Screen Coordinates. - /// - - [DllImport("gtk-1.3.dll")] - static extern void gtk_window_set_position (IntPtr hnd, - int x, int y); - - public Point Position { - set - { - gtk_window_set_position ( - RawObject, value.X, value.Y); - } - } - - /// - /// Resizable Property - /// - /// - /// - /// Indicates if the Height and Width of the Window can be - /// altered by the user. - /// - - public bool Resizable { - get { - bool val; - GetProperty ("resizable", out val); - return (val); - } - set { - SetProperty ("resizable", value); - } - } - - /// - /// Title Property - /// - /// - /// - /// The Title displayed in the Window's Title Bar. - /// - - public String Title { - get { - String val; - GetProperty ("title", out val); - return val; - } - set { - SetProperty ("title", value); - } - } - } -} diff --git a/gtk/Window.custom b/gtk/Window.custom new file mode 100755 index 000000000..8e8a4206a --- /dev/null +++ b/gtk/Window.custom @@ -0,0 +1,55 @@ +// Gtk.Window.custom - Gtk Window class customizations +// +// Author: Mike Kestner +// +// (c) 2001 Mike Kestner +// +// This code is inserted after the automatically generated code. + + + /// + /// Window Constructor + /// + /// + /// + /// Constructs a new Window of type TopLevel. + /// + + public Window () + { + RawObject = gtk_window_new (WindowType.Toplevel); + } + + /// + /// Window Constructor + /// + /// + /// + /// Constructs a new Window of type TopLevel with the + /// specified Title. + /// + + public Window (String title) : this () + { + this.Title = title; + } + + /// + /// DefaultSize Property + /// + /// + /// + /// The default Size of the Window in Screen Coordinates. + /// + + public System.Drawing.Size DefaultSize { + get { + return new System.Drawing.Size ( + DefaultWidth, DefaultHeight); + } + set { + DefaultWidth = value.Width; + DefaultHeight = value.Height; + } + } +