Button.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. //
  2. // System.Windows.Forms.Button.cs
  3. //
  4. // Author:
  5. // stubbed out by Jaak Simm ([email protected])
  6. // implemented for Gtk+ by Rachel Hestilow ([email protected])
  7. // Dennis Hayes ([email protected])
  8. // WINELib implementation started by John Sohn ([email protected])
  9. //
  10. // (C) Ximian, Inc., 2002
  11. //
  12. namespace System.Windows.Forms {
  13. /// <summary>
  14. /// Represents a Windows button control.
  15. /// </summary>
  16. public class Button : ButtonBase, IButtonControl {
  17. // private fields
  18. DialogResult dialogResult;
  19. // --- Constructor ---
  20. public Button() : base()
  21. {
  22. dialogResult = DialogResult.None;
  23. }
  24. // --- Properties ---
  25. protected override CreateParams CreateParams {
  26. get {
  27. CreateParams createParams = new CreateParams ();
  28. window = new ControlNativeWindow (this);
  29. createParams.Caption = Text;
  30. createParams.ClassName = "BUTTON";
  31. createParams.X = Left;
  32. createParams.Y = Top;
  33. createParams.Width = Width;
  34. createParams.Height = Height;
  35. createParams.ClassStyle = 0;
  36. createParams.ExStyle = 0;
  37. createParams.Param = 0;
  38. createParams.Parent = Parent.Handle;
  39. createParams.Style = (int) (
  40. Win32.WS_CHILD |
  41. Win32.WS_VISIBLE);
  42. window.CreateHandle (createParams);
  43. return createParams;
  44. }
  45. }
  46. // --- IButtonControl property ---
  47. public virtual DialogResult DialogResult {
  48. get { return dialogResult; }
  49. set { dialogResult = value; }
  50. }
  51. // --- IButtonControl method ---
  52. [MonoTODO]
  53. public virtual void NotifyDefault(bool value)
  54. {
  55. throw new NotImplementedException ();
  56. }
  57. [MonoTODO]
  58. public void PerformClick()
  59. {
  60. throw new NotImplementedException ();
  61. }
  62. // --- Button methods for events ---
  63. protected override void OnClick(EventArgs e)
  64. {
  65. base.OnClick (e);
  66. }
  67. protected override void OnMouseUp(MouseEventArgs e)
  68. {
  69. base.OnMouseUp (e);
  70. }
  71. // --- Button methods ---
  72. protected override bool ProcessMnemonic (char charCode)
  73. {
  74. return base.ProcessMnemonic (charCode);
  75. }
  76. [MonoTODO]
  77. public override string ToString ()
  78. {
  79. throw new NotImplementedException ();
  80. }
  81. protected override void WndProc (ref Message m)
  82. {
  83. base.WndProc (ref m);
  84. }
  85. /// --- Button events ---
  86. /// commented out, cause it only supports the .NET Framework infrastructure
  87. /*
  88. [MonoTODO]
  89. public new event EventHandler DoubleClick {
  90. add {
  91. throw new NotImplementedException ();
  92. }
  93. remove {
  94. throw new NotImplementedException ();
  95. }
  96. }
  97. */
  98. }
  99. }