Form.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. // Permission is hereby granted, free of charge, to any person obtaining
  2. // a copy of this software and associated documentation files (the
  3. // "Software"), to deal in the Software without restriction, including
  4. // without limitation the rights to use, copy, modify, merge, publish,
  5. // distribute, sublicense, and/or sell copies of the Software, and to
  6. // permit persons to whom the Software is furnished to do so, subject to
  7. // the following conditions:
  8. //
  9. // The above copyright notice and this permission notice shall be
  10. // included in all copies or substantial portions of the Software.
  11. //
  12. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  15. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  16. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  17. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  18. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  19. //
  20. // Copyright (c) 2004 Novell, Inc.
  21. //
  22. // Authors:
  23. // Peter Bartok [email protected]
  24. //
  25. //
  26. // $Revision: 1.3 $
  27. // $Modtime: $
  28. // $Log: Form.cs,v $
  29. // Revision 1.3 2004/08/04 21:13:47 pbartok
  30. // - Added AutoScale properties
  31. //
  32. // Revision 1.2 2004/07/13 15:31:45 jordi
  33. // commit: new properties and fixes form size problems
  34. //
  35. // Revision 1.1 2004/07/09 05:21:25 pbartok
  36. // - Initial check-in
  37. //
  38. //
  39. // NOT COMPLETE
  40. using System;
  41. using System.Drawing;
  42. using System.ComponentModel;
  43. using System.Collections;
  44. using System.Runtime.InteropServices;
  45. using System.Threading;
  46. namespace System.Windows.Forms {
  47. public class Form : ContainerControl {
  48. #region Local Variables
  49. private static bool autoscale;
  50. private static Size autoscale_base_size;
  51. #endregion // Local Variables
  52. #region Public Constructor & Destructor
  53. public Form() {
  54. Console.WriteLine("Form Constructor called");
  55. //XplatUI.Version();
  56. }
  57. #endregion // Public Constructor & Destructor
  58. #region Public Static Properties
  59. #endregion // Public Static Properties
  60. #region Public Instance Properties
  61. protected override Size DefaultSize {
  62. get {
  63. return new Size (300, 300);
  64. }
  65. }
  66. #endregion // Public Instance Properties
  67. #region Protected Instance Properties
  68. public bool AutoScale {
  69. get {
  70. return autoscale;
  71. }
  72. set {
  73. autoscale=value;
  74. }
  75. }
  76. public virtual Size AutoScaleBaseSize {
  77. get {
  78. return autoscale_base_size;
  79. }
  80. set {
  81. autoscale_base_size=value;
  82. }
  83. }
  84. #endregion // Public Instance Properties
  85. #region Public Static Methods
  86. #endregion // Public Static Methods
  87. #region Public Instance Methods
  88. [MonoTODO("Need to add MDI support")]
  89. protected override CreateParams CreateParams {
  90. get {
  91. CreateParams create_params = new CreateParams();
  92. create_params.Caption = "";
  93. create_params.ClassName=XplatUI.DefaultClassName;
  94. create_params.ClassStyle = 0;
  95. create_params.ExStyle=0;
  96. create_params.Parent=IntPtr.Zero;
  97. create_params.Param=0;
  98. create_params.X = Left;
  99. create_params.Y = Top;
  100. create_params.Width = Width;
  101. create_params.Height = Height;
  102. create_params.Style |= (int)WindowStyles.WS_OVERLAPPEDWINDOW;
  103. create_params.Style |= (int)WindowStyles.WS_VISIBLE;
  104. return create_params;
  105. }
  106. }
  107. #endregion // Public Instance Methods
  108. #region Protected Instance Methods
  109. #endregion // Protected Instance Methods
  110. #region Events
  111. protected virtual void OnActivated(EventArgs e) {
  112. if (Activated != null) {
  113. Activated(this, e);
  114. }
  115. }
  116. protected virtual void OnClosed(EventArgs e) {
  117. if (Closed != null) {
  118. Closed(this, e);
  119. }
  120. }
  121. protected virtual void OnClosed(System.ComponentModel.CancelEventArgs e) {
  122. if (Closing != null) {
  123. Closing(this, e);
  124. }
  125. }
  126. protected virtual void OnDeactivate(EventArgs e) {
  127. if (Deactivate != null) {
  128. Deactivate(this, e);
  129. }
  130. }
  131. protected virtual void OnInputLanguageChanged(InputLanguageChangedEventArgs e) {
  132. if (InputLanguageChanged!=null) {
  133. InputLanguageChanged(this, e);
  134. }
  135. }
  136. protected virtual void OnInputLanguageChanging(InputLanguageChangingEventArgs e) {
  137. if (InputLanguageChanging!=null) {
  138. InputLanguageChanging(this, e);
  139. }
  140. }
  141. protected virtual void OnLoad(EventArgs e) {
  142. if (Load != null) {
  143. Load(this, e);
  144. }
  145. }
  146. protected virtual void OnMaximizedBoundsChanged(EventArgs e) {
  147. if (MaximizedBoundsChanged != null) {
  148. MaximizedBoundsChanged(this, e);
  149. }
  150. }
  151. protected virtual void OnMaximumSizeChanged(EventArgs e) {
  152. if (MaximumSizeChanged != null) {
  153. MaximumSizeChanged(this, e);
  154. }
  155. }
  156. protected virtual void OnMdiChildActivate(EventArgs e) {
  157. if (MdiChildActivate != null) {
  158. MdiChildActivate(this, e);
  159. }
  160. }
  161. protected virtual void OnMenuComplete(EventArgs e) {
  162. if (MenuComplete != null) {
  163. MenuComplete(this, e);
  164. }
  165. }
  166. protected virtual void OnMenuStart(EventArgs e) {
  167. if (MenuStart != null) {
  168. MenuStart(this, e);
  169. }
  170. }
  171. protected virtual void OnMinimumSizeChanged(EventArgs e) {
  172. if (MinimumSizeChanged != null) {
  173. MinimumSizeChanged(this, e);
  174. }
  175. }
  176. public event EventHandler Activated;
  177. public event EventHandler Closed;
  178. public event CancelEventHandler Closing;
  179. public event EventHandler Deactivate;
  180. public event InputLanguageChangedEventHandler InputLanguageChanged;
  181. public event InputLanguageChangingEventHandler InputLanguageChanging;
  182. public event EventHandler Load;
  183. public event EventHandler MaximizedBoundsChanged;
  184. public event EventHandler MaximumSizeChanged;
  185. public event EventHandler MdiChildActivate;
  186. public event EventHandler MenuComplete;
  187. public event EventHandler MenuStart;
  188. public event EventHandler MinimumSizeChanged;
  189. #endregion // Events
  190. }
  191. }