diff options
author | John Sohn <jsohn@mono-cvs.ximian.com> | 2002-10-13 03:08:44 +0400 |
---|---|---|
committer | John Sohn <jsohn@mono-cvs.ximian.com> | 2002-10-13 03:08:44 +0400 |
commit | 6bdc1a4369956603ef2b77b7c988e1dc1e81fcf6 (patch) | |
tree | 2bf9c118243cfd5a0221d04bf50c71f8fe2d63a8 /mcs | |
parent | 4f7b717a86279755502b95577a461d9092f490bd (diff) |
* ButtonBase.cs:
* Button.cs: initial implementation of Button class
* FormTest.cs: added Button to form
* makefile: added Button.cs and ButtonBase.cs to makefile
svn path=/trunk/mcs/; revision=8206
Diffstat (limited to 'mcs')
9 files changed, 652 insertions, 1 deletions
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Button.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Button.cs new file mode 100644 index 00000000000..044dba7ffc9 --- /dev/null +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Button.cs @@ -0,0 +1,115 @@ +//
+// System.Windows.Forms.Button.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// implemented for Gtk+ by Rachel Hestilow (hestilow@ximian.com)
+// Dennis Hayes (dennish@raytek.com)
+// WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents a Windows button control.
+ /// </summary>
+
+ public class Button : ButtonBase, IButtonControl {
+
+ // private fields
+ DialogResult dialogResult;
+
+ // --- Constructor ---
+ public Button() : base()
+ {
+ dialogResult = DialogResult.None;
+ }
+
+ // --- Properties ---
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "BUTTON";
+ createParams.X = Top;
+ createParams.Y = Left;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ Win32.WS_CHILD |
+ Win32.WS_VISIBLE);
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+
+ // --- IButtonControl property ---
+ public virtual DialogResult DialogResult {
+ get { return dialogResult; }
+ set { dialogResult = value; }
+ }
+
+ // --- IButtonControl method ---
+ [MonoTODO]
+ public virtual void NotifyDefault(bool value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void PerformClick()
+ {
+ throw new NotImplementedException ();
+ }
+
+ // --- Button methods for events ---
+ protected override void OnClick(EventArgs e)
+ {
+ base.OnClick (e);
+ }
+
+ protected override void OnMouseUp(MouseEventArgs e)
+ {
+ base.OnMouseUp (e);
+ }
+
+ // --- Button methods ---
+ protected override bool ProcessMnemonic (char charCode)
+ {
+ return base.ProcessMnemonic (charCode);
+ }
+
+ [MonoTODO]
+ public override string ToString ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected override void WndProc (ref Message m)
+ {
+ base.WndProc (ref m);
+ }
+
+ /// --- Button events ---
+ /// commented out, cause it only supports the .NET Framework infrastructure
+ /*
+ [MonoTODO]
+ public new event EventHandler DoubleClick {
+ add {
+ throw new NotImplementedException ();
+ }
+ remove {
+ throw new NotImplementedException ();
+ }
+ }
+ */
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ButtonBase.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ButtonBase.cs new file mode 100644 index 00000000000..af28a639730 --- /dev/null +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ButtonBase.cs @@ -0,0 +1,198 @@ +//
+// System.Windows.Forms.ButtonBase.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// implemented for Gtk+ by Rachel Hestilow (hestilow@ximian.com)
+// Dennis Hayes (dennish@Raytek.com)
+// WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Implements the basic functionality common to button controls.
+ /// ToDo note:
+ /// - no methods are implemented
+ /// </summary>
+
+ public abstract class ButtonBase : Control {
+
+ // private fields
+ FlatStyle flatStyle;
+ Image image;
+ ContentAlignment imageAlign;
+ int imageIndex;
+ ContentAlignment textAlign;
+ ImeMode imeMode;
+ bool isDefault;
+ CreateParams createParams;
+//
+// // --- Constructor ---
+ protected ButtonBase() : base()
+ {
+ flatStyle = FlatStyle.Standard;
+ image = null;
+ imageAlign = ContentAlignment.MiddleCenter;
+ imageIndex = -1;
+ textAlign = ContentAlignment.MiddleCenter;
+ imeMode = ImeMode.Inherit;
+ isDefault = false;
+ }
+
+ // --- Properties ---
+ protected override CreateParams CreateParams {
+ get { return createParams; }
+ }
+
+ protected override ImeMode DefaultImeMode {
+ get {
+ return ImeMode.Inherit;
+ }
+ }
+
+ protected override Size DefaultSize {
+ get { return base.DefaultSize; }
+ }
+
+ public FlatStyle FlatStyle {
+ get { return flatStyle; }
+ set { flatStyle=value; }
+ }
+
+ public Image Image {
+ get { return image; }
+ set { image=value; }
+ }
+
+ public ContentAlignment ImageAlign {
+ get { return imageAlign; }
+ set { imageAlign=value; }
+ }
+
+ public int ImageIndex {
+ get { return imageIndex; }
+ set { imageIndex=value; }
+ }
+
+ public new ImeMode ImeMode {
+ get {
+ return imeMode; }
+ set {
+ imeMode = value;
+ }
+ }
+
+ protected bool IsDefault {
+ get {
+ return isDefault;
+ }
+ set {
+ isDefault = value;
+ }
+ }
+
+ [MonoTODO]
+ //public virtual ContentAlignment TextAlign {
+ // get { return label.TextAlign; }
+ // set { label.TextAlign = value; }
+ //}
+
+ /// --- Methods ---
+ /// internal .NET framework supporting methods, not stubbed out:
+ /// - protected override void Dispose(bool);
+ /// - protected void ResetFlagsandPaint();
+
+
+ // I do not think this is part of the spec.
+ //protected override AccessibleObject CreateAccessibilityInstance()
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ /// [methods for events]
+ protected override void OnEnabledChanged (EventArgs e)
+ {
+ base.OnEnabledChanged (e);
+ }
+
+ protected override void OnGotFocus (EventArgs e)
+ {
+ base.OnGotFocus (e);
+ }
+
+ protected override void OnKeyDown (KeyEventArgs kevent)
+ {
+ base.OnKeyDown (kevent);
+ }
+
+ protected override void OnKeyUp (KeyEventArgs kevent)
+ {
+ base.OnKeyUp (kevent);
+ }
+
+ protected override void OnLostFocus (EventArgs e)
+ {
+ base.OnLostFocus (e);
+ }
+
+ protected override void OnMouseDown (MouseEventArgs e)
+ {
+ base.OnMouseDown (e);
+ }
+
+ protected override void OnMouseEnter (EventArgs e)
+ {
+ base.OnMouseEnter (e);
+ }
+
+ protected override void OnMouseLeave (EventArgs e)
+ {
+ base.OnMouseLeave (e);
+ }
+
+ protected override void OnMouseMove (MouseEventArgs e)
+ {
+ base.OnMouseMove (e);
+ }
+
+ protected override void OnMouseUp (MouseEventArgs e)
+ {
+ base.OnMouseUp (e);
+ }
+
+ protected override void OnPaint (PaintEventArgs e)
+ {
+ base.OnPaint (e);
+ }
+
+ protected override void OnParentChanged (EventArgs e)
+ {
+ base.OnParentChanged (e);
+ }
+
+ protected override void OnTextChanged (EventArgs e)
+ {
+ base.OnTextChanged (e);
+ }
+
+ protected override void OnVisibleChanged (EventArgs e)
+ {
+ base.OnVisibleChanged (e);
+ }
+ /// end of [methods for events]
+
+ protected override void WndProc (ref Message m)
+ {
+ base.WndProc (ref m);
+ }
+
+ /// --- ButtonBase.ButtonBaseAccessibleObject ---
+ /// the class is not stubbed, cause it's only used for .NET framework
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/makefile b/mcs/class/System.Windows.Forms/System.Windows.Forms/makefile index 6fd17636772..4d15405e467 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/makefile +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/makefile @@ -96,6 +96,8 @@ SOURCES = \ Form.cs \ Application.cs \ NativeWindow.cs \ + ButtonBase.cs \ + Button.cs \ MessageBox.cs all: monostub.exe.so System.Windows.Forms.dll NativeWindowTest.exe \ diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ochangelog b/mcs/class/System.Windows.Forms/System.Windows.Forms/ochangelog index 583da8cfd17..88b06264f8a 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/ochangelog +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ochangelog @@ -1,4 +1,10 @@ 2002-10-12 John Sohn <jsohn@columbus.rr.com>
+ * ButtonBase.cs:
+ * Button.cs: initial implementation of Button class
+ * FormTest.cs: added Button to form
+ * makefile: added Button.cs and ButtonBase.cs to makefile
+
+2002-10-12 John Sohn <jsohn@columbus.rr.com>
* Control.cs:
* Label.cs: changed CreateHandle method to use CreateParams property
* README: added instructions for building and using project
diff --git a/mcs/class/System.Windows.Forms/WINELib/Button.cs b/mcs/class/System.Windows.Forms/WINELib/Button.cs new file mode 100644 index 00000000000..044dba7ffc9 --- /dev/null +++ b/mcs/class/System.Windows.Forms/WINELib/Button.cs @@ -0,0 +1,115 @@ +//
+// System.Windows.Forms.Button.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// implemented for Gtk+ by Rachel Hestilow (hestilow@ximian.com)
+// Dennis Hayes (dennish@raytek.com)
+// WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents a Windows button control.
+ /// </summary>
+
+ public class Button : ButtonBase, IButtonControl {
+
+ // private fields
+ DialogResult dialogResult;
+
+ // --- Constructor ---
+ public Button() : base()
+ {
+ dialogResult = DialogResult.None;
+ }
+
+ // --- Properties ---
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "BUTTON";
+ createParams.X = Top;
+ createParams.Y = Left;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ Win32.WS_CHILD |
+ Win32.WS_VISIBLE);
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+
+ // --- IButtonControl property ---
+ public virtual DialogResult DialogResult {
+ get { return dialogResult; }
+ set { dialogResult = value; }
+ }
+
+ // --- IButtonControl method ---
+ [MonoTODO]
+ public virtual void NotifyDefault(bool value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void PerformClick()
+ {
+ throw new NotImplementedException ();
+ }
+
+ // --- Button methods for events ---
+ protected override void OnClick(EventArgs e)
+ {
+ base.OnClick (e);
+ }
+
+ protected override void OnMouseUp(MouseEventArgs e)
+ {
+ base.OnMouseUp (e);
+ }
+
+ // --- Button methods ---
+ protected override bool ProcessMnemonic (char charCode)
+ {
+ return base.ProcessMnemonic (charCode);
+ }
+
+ [MonoTODO]
+ public override string ToString ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected override void WndProc (ref Message m)
+ {
+ base.WndProc (ref m);
+ }
+
+ /// --- Button events ---
+ /// commented out, cause it only supports the .NET Framework infrastructure
+ /*
+ [MonoTODO]
+ public new event EventHandler DoubleClick {
+ add {
+ throw new NotImplementedException ();
+ }
+ remove {
+ throw new NotImplementedException ();
+ }
+ }
+ */
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ButtonBase.cs b/mcs/class/System.Windows.Forms/WINELib/ButtonBase.cs new file mode 100644 index 00000000000..af28a639730 --- /dev/null +++ b/mcs/class/System.Windows.Forms/WINELib/ButtonBase.cs @@ -0,0 +1,198 @@ +//
+// System.Windows.Forms.ButtonBase.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// implemented for Gtk+ by Rachel Hestilow (hestilow@ximian.com)
+// Dennis Hayes (dennish@Raytek.com)
+// WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Implements the basic functionality common to button controls.
+ /// ToDo note:
+ /// - no methods are implemented
+ /// </summary>
+
+ public abstract class ButtonBase : Control {
+
+ // private fields
+ FlatStyle flatStyle;
+ Image image;
+ ContentAlignment imageAlign;
+ int imageIndex;
+ ContentAlignment textAlign;
+ ImeMode imeMode;
+ bool isDefault;
+ CreateParams createParams;
+//
+// // --- Constructor ---
+ protected ButtonBase() : base()
+ {
+ flatStyle = FlatStyle.Standard;
+ image = null;
+ imageAlign = ContentAlignment.MiddleCenter;
+ imageIndex = -1;
+ textAlign = ContentAlignment.MiddleCenter;
+ imeMode = ImeMode.Inherit;
+ isDefault = false;
+ }
+
+ // --- Properties ---
+ protected override CreateParams CreateParams {
+ get { return createParams; }
+ }
+
+ protected override ImeMode DefaultImeMode {
+ get {
+ return ImeMode.Inherit;
+ }
+ }
+
+ protected override Size DefaultSize {
+ get { return base.DefaultSize; }
+ }
+
+ public FlatStyle FlatStyle {
+ get { return flatStyle; }
+ set { flatStyle=value; }
+ }
+
+ public Image Image {
+ get { return image; }
+ set { image=value; }
+ }
+
+ public ContentAlignment ImageAlign {
+ get { return imageAlign; }
+ set { imageAlign=value; }
+ }
+
+ public int ImageIndex {
+ get { return imageIndex; }
+ set { imageIndex=value; }
+ }
+
+ public new ImeMode ImeMode {
+ get {
+ return imeMode; }
+ set {
+ imeMode = value;
+ }
+ }
+
+ protected bool IsDefault {
+ get {
+ return isDefault;
+ }
+ set {
+ isDefault = value;
+ }
+ }
+
+ [MonoTODO]
+ //public virtual ContentAlignment TextAlign {
+ // get { return label.TextAlign; }
+ // set { label.TextAlign = value; }
+ //}
+
+ /// --- Methods ---
+ /// internal .NET framework supporting methods, not stubbed out:
+ /// - protected override void Dispose(bool);
+ /// - protected void ResetFlagsandPaint();
+
+
+ // I do not think this is part of the spec.
+ //protected override AccessibleObject CreateAccessibilityInstance()
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ /// [methods for events]
+ protected override void OnEnabledChanged (EventArgs e)
+ {
+ base.OnEnabledChanged (e);
+ }
+
+ protected override void OnGotFocus (EventArgs e)
+ {
+ base.OnGotFocus (e);
+ }
+
+ protected override void OnKeyDown (KeyEventArgs kevent)
+ {
+ base.OnKeyDown (kevent);
+ }
+
+ protected override void OnKeyUp (KeyEventArgs kevent)
+ {
+ base.OnKeyUp (kevent);
+ }
+
+ protected override void OnLostFocus (EventArgs e)
+ {
+ base.OnLostFocus (e);
+ }
+
+ protected override void OnMouseDown (MouseEventArgs e)
+ {
+ base.OnMouseDown (e);
+ }
+
+ protected override void OnMouseEnter (EventArgs e)
+ {
+ base.OnMouseEnter (e);
+ }
+
+ protected override void OnMouseLeave (EventArgs e)
+ {
+ base.OnMouseLeave (e);
+ }
+
+ protected override void OnMouseMove (MouseEventArgs e)
+ {
+ base.OnMouseMove (e);
+ }
+
+ protected override void OnMouseUp (MouseEventArgs e)
+ {
+ base.OnMouseUp (e);
+ }
+
+ protected override void OnPaint (PaintEventArgs e)
+ {
+ base.OnPaint (e);
+ }
+
+ protected override void OnParentChanged (EventArgs e)
+ {
+ base.OnParentChanged (e);
+ }
+
+ protected override void OnTextChanged (EventArgs e)
+ {
+ base.OnTextChanged (e);
+ }
+
+ protected override void OnVisibleChanged (EventArgs e)
+ {
+ base.OnVisibleChanged (e);
+ }
+ /// end of [methods for events]
+
+ protected override void WndProc (ref Message m)
+ {
+ base.WndProc (ref m);
+ }
+
+ /// --- ButtonBase.ButtonBaseAccessibleObject ---
+ /// the class is not stubbed, cause it's only used for .NET framework
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/FormTest.cs b/mcs/class/System.Windows.Forms/WINELib/FormTest.cs index 2ae513f970c..721795e33b8 100644 --- a/mcs/class/System.Windows.Forms/WINELib/FormTest.cs +++ b/mcs/class/System.Windows.Forms/WINELib/FormTest.cs @@ -5,6 +5,7 @@ using System.Windows.Forms; class FormTest : Form { Label label; + Button button; public FormTest () : base () { @@ -14,7 +15,15 @@ class FormTest : Form { label.Width = 50; label.Height = 50; label.Parent = this; - label.Text = "Hello"; + label.Text = "Label"; + + button = new Button (); + button.Top = 120; + button.Left = 120; + button.Width = 50; + button.Height = 50; + button.Parent = this; + button.Text = "Button"; } // - verifies the WndProc can be overridden propery diff --git a/mcs/class/System.Windows.Forms/WINELib/changelog b/mcs/class/System.Windows.Forms/WINELib/changelog index 583da8cfd17..88b06264f8a 100644 --- a/mcs/class/System.Windows.Forms/WINELib/changelog +++ b/mcs/class/System.Windows.Forms/WINELib/changelog @@ -1,4 +1,10 @@ 2002-10-12 John Sohn <jsohn@columbus.rr.com>
+ * ButtonBase.cs:
+ * Button.cs: initial implementation of Button class
+ * FormTest.cs: added Button to form
+ * makefile: added Button.cs and ButtonBase.cs to makefile
+
+2002-10-12 John Sohn <jsohn@columbus.rr.com>
* Control.cs:
* Label.cs: changed CreateHandle method to use CreateParams property
* README: added instructions for building and using project
diff --git a/mcs/class/System.Windows.Forms/WINELib/makefile b/mcs/class/System.Windows.Forms/WINELib/makefile index 6fd17636772..4d15405e467 100644 --- a/mcs/class/System.Windows.Forms/WINELib/makefile +++ b/mcs/class/System.Windows.Forms/WINELib/makefile @@ -96,6 +96,8 @@ SOURCES = \ Form.cs \ Application.cs \ NativeWindow.cs \ + ButtonBase.cs \ + Button.cs \ MessageBox.cs all: monostub.exe.so System.Windows.Forms.dll NativeWindowTest.exe \ |