[Mono-list] Small patch adding Size and Name properties to mcs/class/System.Windows.Forms/Gtk/ also an updated demo application and makefile

Joel Basson jstrike@mweb.co.za
16 Feb 2003 05:51:04 +0200


--=-Z6YHe525yEiMjAgEMPk4
Content-Type: text/plain
Content-Transfer-Encoding: 7bit





--=-Z6YHe525yEiMjAgEMPk4
Content-Disposition: attachment; filename=file.diff
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; name=file.diff; charset=UTF-8

? System.Windows.Forms.dll
? file.diff
Index: Control.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /mono/mcs/class/System.Windows.Forms/Gtk/Control.cs,v
retrieving revision 1.4
diff -u -r1.4 Control.cs
--- Control.cs	9 Jan 2003 22:25:56 -0000	1.4
+++ Control.cs	16 Feb 2003 03:43:40 -0000
@@ -19,10 +19,11 @@
 	public class Control : Component {
 		internal Widget widget;
 		Control parent;
-		string text;
+		string text, name;
+		Size size;
 		int left, top, width, height;
 		ControlCollection controls;
-		Point location =3D new Point (0, 0);
+		Point location =3D new System.Drawing.Point (0, 0);
 		Gtk.Layout layout =3D null;
 		AnchorStyles anchor =3D AnchorStyles.Top|AnchorStyles.Left;
 	=09
@@ -135,11 +136,12 @@
 		}
=20
 		public Control (string text, int left, int top, int width, int height)
-		{
+		{		=09
 		}
=20
 		public Control (Control parent, string text, int left, int top, int widt=
h, int height)
 		{
+		=09
 		}
=20
 		internal Widget Widget {
@@ -174,7 +176,30 @@
 			if (TextChanged !=3D null)
 			 TextChanged (this, e);
 		}
-	=09
+
+
+		public virtual string Name {=0D
+           		 get {=0D
+                     	  	return name;=09=0D
+              		 }=0D
+        =20=0D
+         		 set {=20
+				name =3D value;
+			 	Widget.Name =3D value;
+			 }=0D
+          	}
+	=09
+		public Size Size {
+			get {=20
+				return size;
+			}
+			set {
+				size =3D value;
+				Widget.SetSizeRequest (value.Width,value.Height);
+			}
+		}
+
+
 		public void Show ()
 		{
 			Widget.Show ();
@@ -231,6 +256,7 @@
 			if (ControlRemoved !=3D null)
 				ControlRemoved (this, e);
 		}
+
=20
 		public Point Location {
 			get { return location; }
Index: ProgressBar.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /mono/mcs/class/System.Windows.Forms/Gtk/ProgressBar.cs,v
retrieving revision 1.1
diff -u -r1.1 ProgressBar.cs
--- ProgressBar.cs	8 Aug 2002 01:53:30 -0000	1.1
+++ ProgressBar.cs	16 Feb 2003 03:43:40 -0000
@@ -85,7 +85,7 @@
=20=0D
 		[MonoTODO]=0D
 		protected override Size DefaultSize {=0D
-			get { throw new NotImplementedException (); }=0D
+			get { throw new NotImplementedException (); }	=09
 		}=0D
 	=09=0D
 		[MonoTODO]=0D
Index: TextBoxBase.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /mono/mcs/class/System.Windows.Forms/Gtk/TextBoxBase.cs,v
retrieving revision 1.1
diff -u -r1.1 TextBoxBase.cs
--- TextBoxBase.cs	8 Aug 2002 01:53:30 -0000	1.1
+++ TextBoxBase.cs	16 Feb 2003 03:43:41 -0000
@@ -56,7 +56,7 @@
 				throw new NotImplementedException ();=0D
 			}=0D
 			set=0D
-			{=0D
+			{
 				throw new NotImplementedException ();=0D
 			}=0D
 		}=0D
@@ -201,8 +201,8 @@
 			get=0D
 			{=0D
 				String selection =3D "";=0D
-				Gtk.TextIter start;=0D
-				Gtk.TextIter end;=0D
+				Gtk.TextIter start =3D new Gtk.TextIter ();=0D
+				Gtk.TextIter end =3D new Gtk.TextIter ();=0D
 	=09=0D
 				if (TextBuffer.GetSelectionBounds(ref start, ref end))=0D
 					selection =3D TextBuffer.GetText(start, end, true);=0D
Index: changelog
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /mono/mcs/class/System.Windows.Forms/Gtk/changelog,v
retrieving revision 1.1
diff -u -r1.1 changelog
--- changelog	8 Aug 2002 01:53:30 -0000	1.1
+++ changelog	16 Feb 2003 03:43:41 -0000
@@ -11,3 +11,7 @@
 * TextBox.cs=0D
 * TextBoxBase.cs=0D
 * added new files with some functinality=0D
+
+2003-2-15  Joel Basson <jstrike@mweb.co.za>
+
+* Added Size and Name properties
\ No newline at end of file
Index: demo.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /mono/mcs/class/System.Windows.Forms/Gtk/demo.cs,v
retrieving revision 1.4
diff -u -r1.4 demo.cs
--- demo.cs	30 Jun 2002 21:21:55 -0000	1.4
+++ demo.cs	16 Feb 2003 03:43:41 -0000
@@ -1,58 +1,65 @@
 using System;
-using System.Drawing;
-using System.Windows.Forms;
-
-class X {
-	static void Clicked (object o, EventArgs args)
-	{
-		Console.WriteLine ("the button was clicked");
-	}
-=09
-	static void Demo_Window ()
-	{
-		Form form =3D new Form ();
-
-		form.Text =3D "hello";
-
-		Label l =3D new Label ();
-		l.Location =3D new Point (20, 20);
-		l.Text =3D "Hello world";
-		form.Controls.Add (l);
-
-		Button b =3D new Button ();
-		b.Text =3D "a button";
-		b.Location =3D new Point (20, 60);
-		b.Click +=3D new EventHandler (Clicked);
-		form.Controls.Add (b);
-
-		form.Visible =3D true;
-
-		Application.Run ();
-	}
-
-	static void Demo_AppRun ()
-	{
-		Form form =3D new Form ();
-
-		form.Text =3D "hello";
-	=09
-		Application.Run (form);
-	}
-=09
-	static void Main (string [] args)
-	{
-		string demo =3D "window";
-
-		if (args.Length > 0)
-			demo =3D args [0];
-	=09
-		switch (demo){
-		case "window":
-			Demo_Window ();
-			break;
-		case "app_run":
-			Demo_AppRun ();
-			break;
+using System.Drawing;=0D
+using System.Windows.Forms;=0D
+=0D
+namespace demo=0D
+{=0D
+=09=0D
+	public class GtkForm : System.Windows.Forms.Form=0D
+	{=0D
+	    	private Button button1 =3D new Button();=20
+			private Label label1 =3D new Label();=0D
+	    	private TextBox text1 =3D new TextBox();=20=0D
+	    	private ProgressBar bar1 =3D new ProgressBar();=0D
+	   =20
+	    	private void InitializeWidgets()=0D
+	    	{=0D
+    		  	button1.Location =3D new Point(64, 28);=0D
+       	  	button1.Name =3D "button1";=0D
+    	  	  	button1.Size =3D new Size(128, 44);=0D
+       	 	button1.Text =3D "Hello world!";=0D
+    	  		button1.Click +=3D new EventHandler(this.button1_Click);   =20=0D
+           =20=0D
+    	    	text1.Location =3D new Point(200,48);=0D
+    	    	text1.Name =3D "textBox1";=0D
+   	    	text1.Size =3D new Size(256, 22);
+	 			text1.Text =3D this.button1.Name;=0D
+     =20
+	    		bar1.Location =3D new Point(0, 108);
+	    		bar1.Size =3D new Size(512, 20);
+	    		bar1.Text =3D "This ProgressBar does nothing yet";
+
+  	    		label1.Location =3D new Point(220, 20);
+	    		label1.Text =3D "This is a label";=09=0D
+      =20=0D
+          Controls.AddRange(new System.Windows.Forms.Control[] {=20
+									this.button1,=0D
+                     	this.text1,=20
+									this.bar1,=20
+									this.label1 });=0D
+          this.Size =3D new Size(512, 128);=0D
+    		}=0D
+    =09=0D
+    	public GtkForm()=0D
+    	{=0D
+    	    InitializeWidgets();=0D
+    	}=0D
+=0D
+		private void button1_Click(object sender, EventArgs e)=0D
+		{ button1.Text =3D "Clicked!";
 		}
-	}
-}
+	=09=0D
+    }=0D
+=0D
+=09=0D
+	public class GtkMain=0D
+	{=0D
+		public static void Main()=0D
+		{=0D
+			GtkForm form1 =3D new GtkForm ();=0D
+			form1.Text =3D "System.Windows.Forms at work!";		=09=0D
+			Application.Run(form1);=0D
+		}=0D
+	}=0D
+}=0D
+
Index: makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /mono/mcs/class/System.Windows.Forms/Gtk/makefile,v
retrieving revision 1.3
diff -u -r1.3 makefile
--- makefile	30 Jun 2002 21:21:55 -0000	1.3
+++ makefile	16 Feb 2003 03:43:41 -0000
@@ -1,5 +1,5 @@
 CSC=3Dmcs
-SWFF=3D-r gtk-sharp -r glib-sharp -r System.Drawing=20
+SWFF=3D-r gdk-sharp -r gtk-sharp -r glib-sharp -r System.Drawing=20
=20
 SOURCES =3D \
 	AnchorStyles.cs		\
@@ -15,7 +15,12 @@
 	IButtonControl.cs	\
 	IContainerControl.cs	\
 	Label.cs		\
-	ScrollableControl.cs
+	ScrollableControl.cs	\
+	TextBoxBase.cs		\
+	TextBox.cs		\
+	ScrollBars.cs		\
+	ProgressBar.cs		\
+	HorizontalAlignment.cs
=20
 all: demo.exe
=20

--=-Z6YHe525yEiMjAgEMPk4--