Form.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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.4 $
  27. // $Modtime: $
  28. // $Log: Form.cs,v $
  29. // Revision 1.4 2004/08/11 22:20:59 pbartok
  30. // - Signature fixes
  31. //
  32. // Revision 1.3 2004/08/04 21:13:47 pbartok
  33. // - Added AutoScale properties
  34. //
  35. // Revision 1.2 2004/07/13 15:31:45 jordi
  36. // commit: new properties and fixes form size problems
  37. //
  38. // Revision 1.1 2004/07/09 05:21:25 pbartok
  39. // - Initial check-in
  40. //
  41. //
  42. // NOT COMPLETE
  43. using System;
  44. using System.Drawing;
  45. using System.ComponentModel;
  46. using System.Collections;
  47. using System.Runtime.InteropServices;
  48. using System.Threading;
  49. namespace System.Windows.Forms {
  50. public class Form : ContainerControl {
  51. #region Local Variables
  52. private static bool autoscale;
  53. private static Size autoscale_base_size;
  54. #endregion // Local Variables
  55. #region Public Constructor & Destructor
  56. public Form() {
  57. Console.WriteLine("Form Constructor called");
  58. //XplatUI.Version();
  59. }
  60. #endregion // Public Constructor & Destructor
  61. #region Public Static Properties
  62. #endregion // Public Static Properties
  63. #region Public Instance Properties
  64. protected override Size DefaultSize {
  65. get {
  66. return new Size (300, 300);
  67. }
  68. }
  69. #endregion // Public Instance Properties
  70. #region Protected Instance Properties
  71. public bool AutoScale {
  72. get {
  73. return autoscale;
  74. }
  75. set {
  76. autoscale=value;
  77. }
  78. }
  79. public virtual Size AutoScaleBaseSize {
  80. get {
  81. return autoscale_base_size;
  82. }
  83. set {
  84. autoscale_base_size=value;
  85. }
  86. }
  87. #endregion // Public Instance Properties
  88. #region Public Static Methods
  89. #endregion // Public Static Methods
  90. #region Public Instance Methods
  91. [MonoTODO("Need to add MDI support")]
  92. protected override CreateParams CreateParams {
  93. get {
  94. CreateParams create_params = new CreateParams();
  95. create_params.Caption = "";
  96. create_params.ClassName=XplatUI.DefaultClassName;
  97. create_params.ClassStyle = 0;
  98. create_params.ExStyle=0;
  99. create_params.Parent=IntPtr.Zero;
  100. create_params.Param=0;
  101. create_params.X = Left;
  102. create_params.Y = Top;
  103. create_params.Width = Width;
  104. create_params.Height = Height;
  105. create_params.Style |= (int)WindowStyles.WS_OVERLAPPEDWINDOW;
  106. create_params.Style |= (int)WindowStyles.WS_VISIBLE;
  107. return create_params;
  108. }
  109. }
  110. #endregion // Public Instance Methods
  111. #region Protected Instance Methods
  112. #endregion // Protected Instance Methods
  113. #region Events
  114. protected virtual void OnActivated(EventArgs e) {
  115. if (Activated != null) {
  116. Activated(this, e);
  117. }
  118. }
  119. protected virtual void OnClosed(EventArgs e) {
  120. if (Closed != null) {
  121. Closed(this, e);
  122. }
  123. }
  124. protected virtual void OnClosing(System.ComponentModel.CancelEventArgs e) {
  125. if (Closing != null) {
  126. Closing(this, e);
  127. }
  128. }
  129. protected virtual void OnDeactivate(EventArgs e) {
  130. if (Deactivate != null) {
  131. Deactivate(this, e);
  132. }
  133. }
  134. protected virtual void OnInputLanguageChanged(InputLanguageChangedEventArgs e) {
  135. if (InputLanguageChanged!=null) {
  136. InputLanguageChanged(this, e);
  137. }
  138. }
  139. protected virtual void OnInputLanguageChanging(InputLanguageChangingEventArgs e) {
  140. if (InputLanguageChanging!=null) {
  141. InputLanguageChanging(this, e);
  142. }
  143. }
  144. protected virtual void OnLoad(EventArgs e) {
  145. if (Load != null) {
  146. Load(this, e);
  147. }
  148. }
  149. protected virtual void OnMaximizedBoundsChanged(EventArgs e) {
  150. if (MaximizedBoundsChanged != null) {
  151. MaximizedBoundsChanged(this, e);
  152. }
  153. }
  154. protected virtual void OnMaximumSizeChanged(EventArgs e) {
  155. if (MaximumSizeChanged != null) {
  156. MaximumSizeChanged(this, e);
  157. }
  158. }
  159. protected virtual void OnMdiChildActivate(EventArgs e) {
  160. if (MdiChildActivate != null) {
  161. MdiChildActivate(this, e);
  162. }
  163. }
  164. protected virtual void OnMenuComplete(EventArgs e) {
  165. if (MenuComplete != null) {
  166. MenuComplete(this, e);
  167. }
  168. }
  169. protected virtual void OnMenuStart(EventArgs e) {
  170. if (MenuStart != null) {
  171. MenuStart(this, e);
  172. }
  173. }
  174. protected virtual void OnMinimumSizeChanged(EventArgs e) {
  175. if (MinimumSizeChanged != null) {
  176. MinimumSizeChanged(this, e);
  177. }
  178. }
  179. public event EventHandler Activated;
  180. public event EventHandler Closed;
  181. public event CancelEventHandler Closing;
  182. public event EventHandler Deactivate;
  183. public event InputLanguageChangedEventHandler InputLanguageChanged;
  184. public event InputLanguageChangingEventHandler InputLanguageChanging;
  185. public event EventHandler Load;
  186. public event EventHandler MaximizedBoundsChanged;
  187. public event EventHandler MaximumSizeChanged;
  188. public event EventHandler MdiChildActivate;
  189. public event EventHandler MenuComplete;
  190. public event EventHandler MenuStart;
  191. public event EventHandler MinimumSizeChanged;
  192. #endregion // Events
  193. }
  194. }