Form.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780
  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.21 $
  27. // $Modtime: $
  28. // $Log: Form.cs,v $
  29. // Revision 1.21 2004/11/04 14:47:58 jordi
  30. // collection completion, drawing issues, missing features
  31. //
  32. // Revision 1.20 2004/10/29 15:55:26 jordi
  33. // Menu key navigation, itemcollection completion, menu fixes
  34. //
  35. // Revision 1.19 2004/10/20 03:56:23 pbartok
  36. // - Added private FormParentWindow class which acts as the container for
  37. // our form and as the non-client area where menus are drawn
  38. // - Added/Moved required tie-ins to Jordi's menus
  39. // - Fixed/Implemented the FormStartPosition functionality
  40. //
  41. // Revision 1.18 2004/10/18 04:47:09 pbartok
  42. // - Fixed Form.ControlCollection to handle owner relations
  43. // - Added Owner/OwnedForms handling
  44. // - Implemented Z-Ordering for owned forms
  45. // - Removed unneeded private overload of ShowDialog
  46. // - Fixed ShowDialog, added the X11 incarnation of modal handling (or so I
  47. // hope)
  48. // - Fixed Close(), had wrong default
  49. // - Added firing of OnLoad event
  50. // - Added some commented out debug code for Ownership handling
  51. //
  52. // Revision 1.17 2004/10/15 12:43:19 jordi
  53. // menu work, mainmenu, subitems, etc
  54. //
  55. // Revision 1.16 2004/10/14 06:17:58 ravindra
  56. // Fixed class signature. ShowDialog (Control) is not a public method.
  57. //
  58. // Revision 1.15 2004/10/08 08:50:29 jordi
  59. // more menu work
  60. //
  61. // Revision 1.14 2004/10/02 19:05:52 pbartok
  62. // - Added KeyPreview property
  63. // - Added Menu property (still incomplete, pending Jordi's menu work)
  64. // - Implemented ProcessCmdKey
  65. // - Implemented ProcessDialogKey
  66. // - Implemented ProcessKeyPreview
  67. //
  68. // Revision 1.13 2004/10/01 17:53:26 jackson
  69. // Implement the Close method so work on MessageBox can continue.
  70. //
  71. // Revision 1.12 2004/09/23 19:08:59 jackson
  72. // Temp build fixage
  73. //
  74. // Revision 1.11 2004/09/22 20:09:44 pbartok
  75. // - Added Form.ControllCollection class
  76. // - Added handling for Form owners: Owner, OwnedForms, AddOwnedForm,
  77. // RemoveOwnedForm (still incomplete, missing on-top and common
  78. // minimize/maximize behaviour)
  79. // - Added StartPosition property (still incomplete, does not use when
  80. // creating the form)
  81. // - Added ShowDialog() methods (still incomplete, missing forcing the dialog
  82. // modal)
  83. //
  84. // Revision 1.10 2004/09/13 16:56:04 pbartok
  85. // - Fixed #region names
  86. // - Moved properties and methods into their proper #regions
  87. //
  88. // Revision 1.9 2004/09/13 16:51:29 pbartok
  89. // - Added Accept and CancelButton properties
  90. // - Added ProcessDialogKey() method
  91. //
  92. // Revision 1.8 2004/09/01 02:05:18 pbartok
  93. // - Added (partial) implementation of DialogResult; rest needs to be
  94. // implemented when the modal loop code is done
  95. //
  96. // Revision 1.7 2004/08/23 22:10:02 pbartok
  97. // - Fixed handling of WM_CLOSE message
  98. // - Removed debug output
  99. //
  100. // Revision 1.6 2004/08/22 21:10:30 pbartok
  101. // - Removed OverlappedWindow style from Control, instead it's default
  102. // now is child
  103. // - Made form windows OverlappedWindow by default
  104. //
  105. // Revision 1.5 2004/08/19 21:30:37 pbartok
  106. // - Added handling of WM_CLOSE
  107. //
  108. // Revision 1.4 2004/08/11 22:20:59 pbartok
  109. // - Signature fixes
  110. //
  111. // Revision 1.3 2004/08/04 21:13:47 pbartok
  112. // - Added AutoScale properties
  113. //
  114. // Revision 1.2 2004/07/13 15:31:45 jordi
  115. // commit: new properties and fixes form size problems
  116. //
  117. // Revision 1.1 2004/07/09 05:21:25 pbartok
  118. // - Initial check-in
  119. //
  120. //
  121. // NOT COMPLETE
  122. using System;
  123. using System.Drawing;
  124. using System.ComponentModel;
  125. using System.Collections;
  126. using System.Runtime.InteropServices;
  127. using System.Threading;
  128. namespace System.Windows.Forms {
  129. public class Form : ContainerControl {
  130. #region Local Variables
  131. internal bool closing;
  132. private static bool autoscale;
  133. private static Size autoscale_base_size;
  134. private bool is_modal;
  135. internal bool end_modal; // This var is being monitored by the application modal loop
  136. private IButtonControl accept_button;
  137. private IButtonControl cancel_button;
  138. private DialogResult dialog_result;
  139. private FormStartPosition start_position;
  140. private Form owner;
  141. private Form.ControlCollection owned_forms;
  142. private bool key_preview;
  143. private MainMenu menu;
  144. internal FormParentWindow form_parent_window;
  145. #endregion // Local Variables
  146. #region Private Classes
  147. // This class will take over for the client area
  148. internal class FormParentWindow : Control {
  149. #region FormParentWindow Class Local Variables
  150. internal Form owner;
  151. #endregion // FormParentWindow Class Local Variables
  152. #region FormParentWindow Class Constructor
  153. internal FormParentWindow(Form owner) : base() {
  154. this.owner = owner;
  155. this.Width = 250;
  156. this.Height = 250;
  157. BackColor = owner.BackColor;
  158. Text = "FormParent";
  159. this.Location = new Point(0, 0);
  160. this.Dock = DockStyle.Fill;
  161. MouseDown += new MouseEventHandler (OnMouseDownForm);
  162. MouseMove += new MouseEventHandler (OnMouseMoveForm);
  163. owner.TextChanged += new EventHandler(OnFormTextChanged);
  164. }
  165. #endregion // FormParentWindow Class Constructor
  166. #region FormParentWindow Class Protected Instance Methods
  167. protected override CreateParams CreateParams {
  168. get {
  169. CreateParams cp;
  170. cp = base.CreateParams;
  171. cp.Style = (int)(WindowStyles.WS_OVERLAPPEDWINDOW |
  172. WindowStyles.WS_VISIBLE |
  173. WindowStyles.WS_CLIPSIBLINGS |
  174. WindowStyles.WS_CLIPCHILDREN);
  175. cp.Width = 250;
  176. cp.Height = 250;
  177. #if later
  178. if (this.IsHandleCreated) {
  179. int x;
  180. int y;
  181. int width;
  182. int height;
  183. int cwidth;
  184. int cheight;
  185. XplatUI.GetWindowPos(this.window.Handle, out x, out y, out width, out height, out cwidth, out cheight);
  186. UpdateBounds(x, y, width, height);
  187. owner.UpdateBounds(x, y, width, height);
  188. }
  189. #endif
  190. return cp;
  191. }
  192. }
  193. protected override void OnResize(EventArgs e) {
  194. base.OnResize(e);
  195. //owner.SetBoundsCore(owner.Bounds.X, owner.Bounds.Y, ClientSize.Width, ClientSize.Height, BoundsSpecified.All);
  196. if (owner.menu == null) {
  197. owner.SetBoundsCore(0, 0, ClientSize.Width, ClientSize.Height, BoundsSpecified.All);
  198. } else {
  199. int menu_height;
  200. menu_height = MenuAPI.MenuBarCalcSize(DeviceContext, owner.Menu.menu_handle, ClientSize.Width);
  201. Invalidate (new Rectangle (0, 0, ClientSize.Width, menu_height));
  202. owner.SetBoundsCore(0, menu_height, ClientSize.Width, ClientSize.Height-menu_height, BoundsSpecified.All);
  203. }
  204. }
  205. protected override void OnPaint(PaintEventArgs pevent) {
  206. OnDrawMenu (pevent.Graphics);
  207. }
  208. protected override void WndProc(ref Message m) {
  209. switch((Msg)m.Msg) {
  210. case Msg.WM_CLOSE: {
  211. CancelEventArgs args = new CancelEventArgs();
  212. owner.OnClosing(args);
  213. if (!args.Cancel) {
  214. owner.OnClosed(EventArgs.Empty);
  215. owner.closing = true;
  216. base.WndProc(ref m);
  217. break;
  218. }
  219. break;
  220. }
  221. default: {
  222. base.WndProc (ref m);
  223. break;
  224. }
  225. }
  226. }
  227. #endregion // FormParentWindow Class Protected Instance Methods
  228. #region FormParentWindow Class Private Methods
  229. private void OnMouseDownForm (object sender, MouseEventArgs e) {
  230. if (owner.menu != null)
  231. owner.menu.OnMouseDown (owner, e);
  232. }
  233. private void OnMouseMoveForm (object sender, MouseEventArgs e) {
  234. if (owner.menu != null)
  235. owner.menu.OnMouseMove (owner, e);
  236. }
  237. private void OnDrawMenu (Graphics dc) {
  238. if (owner.menu != null) {
  239. Rectangle rect = new Rectangle (0,0, Width, 0);
  240. MenuAPI.DrawMenuBar (dc, owner.menu.Handle, rect);
  241. }
  242. }
  243. private void OnFormTextChanged(object sender, EventArgs e) {
  244. this.Text = ((Control)sender).Text;
  245. }
  246. #endregion // FormParentWindow Class Private Methods
  247. }
  248. #endregion // Private Classes
  249. #region Public Classes
  250. public class ControlCollection : Control.ControlCollection {
  251. Form form_owner;
  252. public ControlCollection(Form owner) : base(owner) {
  253. this.form_owner = owner;
  254. }
  255. public override void Add(Control value) {
  256. for (int i=0; i<list.Count; i++) {
  257. if (list[i]==value) {
  258. // Do we need to do anything here?
  259. return;
  260. }
  261. }
  262. list.Add(value);
  263. ((Form)value).owner=(Form)owner;
  264. }
  265. public override void Remove(Control value) {
  266. ((Form)value).owner = null;
  267. base.Remove (value);
  268. }
  269. }
  270. #endregion // Public Classes
  271. #region Public Constructor & Destructor
  272. public Form() {
  273. closing = false;
  274. is_modal = false;
  275. end_modal = false;
  276. dialog_result = DialogResult.None;
  277. start_position = FormStartPosition.WindowsDefaultLocation;
  278. key_preview = false;
  279. menu = null;
  280. owned_forms = new Form.ControlCollection(this);
  281. }
  282. #endregion // Public Constructor & Destructor
  283. #region Public Static Properties
  284. #endregion // Public Static Properties
  285. #region Public Instance Properties
  286. public IButtonControl AcceptButton {
  287. get {
  288. return accept_button;
  289. }
  290. set {
  291. accept_button = value;
  292. }
  293. }
  294. public bool AutoScale {
  295. get {
  296. return autoscale;
  297. }
  298. set {
  299. autoscale=value;
  300. }
  301. }
  302. public virtual Size AutoScaleBaseSize {
  303. get {
  304. return autoscale_base_size;
  305. }
  306. set {
  307. autoscale_base_size=value;
  308. }
  309. }
  310. public IButtonControl CancelButton {
  311. get {
  312. return cancel_button;
  313. }
  314. set {
  315. cancel_button = value;
  316. }
  317. }
  318. public DialogResult DialogResult {
  319. get {
  320. return dialog_result;
  321. }
  322. set {
  323. dialog_result = value;
  324. if (is_modal && (dialog_result != DialogResult.None)) {
  325. end_modal = true;
  326. }
  327. }
  328. }
  329. public bool KeyPreview {
  330. get {
  331. return key_preview;
  332. }
  333. set {
  334. key_preview = value;
  335. }
  336. }
  337. public MainMenu Menu {
  338. get {
  339. return menu;
  340. }
  341. set {
  342. if (menu != value) {
  343. if (value == null) {
  344. form_parent_window.Width = form_parent_window.Width; // Trigger a resize
  345. }
  346. menu = value;
  347. // To simulate the non-client are for menus we create a
  348. // new control as the 'client area' of our form. This
  349. // way, the origin stays 0,0 and we don't have to fiddle with
  350. // coordinates. The menu area is part of the original container
  351. if (menu != null) {
  352. form_parent_window.Width = form_parent_window.Width; // Trigger a resize
  353. }
  354. menu.SetForm (this);
  355. MenuAPI.SetMenuBarWindow (menu.Handle, this);
  356. }
  357. }
  358. }
  359. public bool Modal {
  360. get {
  361. return is_modal;
  362. }
  363. }
  364. public Form[] OwnedForms {
  365. get {
  366. Form[] form_list;
  367. form_list = new Form[owned_forms.Count];
  368. for (int i=0; i<owned_forms.Count; i++) {
  369. form_list[i] = (Form)owned_forms[i];
  370. }
  371. return form_list;
  372. }
  373. }
  374. public Form Owner {
  375. get {
  376. return owner;
  377. }
  378. set {
  379. if (owner != value) {
  380. if (owner != null) {
  381. owner.RemoveOwnedForm(this);
  382. }
  383. owner = value;
  384. owner.AddOwnedForm(this);
  385. if (owner != null) {
  386. XplatUI.SetTopmost(this.window.Handle, true);
  387. } else {
  388. XplatUI.SetTopmost(this.window.Handle, false);
  389. }
  390. }
  391. }
  392. }
  393. public FormStartPosition StartPosition {
  394. get {
  395. return start_position;
  396. }
  397. set {
  398. if (start_position == FormStartPosition.WindowsDefaultLocation) { // Only do this if it's not set yet
  399. start_position = value;
  400. if (form_parent_window.IsHandleCreated) {
  401. switch(start_position) {
  402. case FormStartPosition.CenterParent: {
  403. if (Parent!=null && Width>0 && Height>0) {
  404. this.Location = new Point(Parent.Size.Width/2-Width/2, Parent.Size.Height/2-Height/2);
  405. }
  406. break;
  407. }
  408. case FormStartPosition.CenterScreen: {
  409. if (Width>0 && Height>0) {
  410. Size DisplaySize;
  411. XplatUI.GetDisplaySize(out DisplaySize);
  412. this.Location = new Point(DisplaySize.Width/2-Width/2, DisplaySize.Height/2-Height/2);
  413. }
  414. break;
  415. }
  416. default: {
  417. break;
  418. }
  419. }
  420. }
  421. }
  422. }
  423. }
  424. #endregion // Public Instance Properties
  425. #region Protected Instance Properties
  426. [MonoTODO("Need to add MDI support")]
  427. protected override CreateParams CreateParams {
  428. get {
  429. CreateParams cp = new CreateParams();
  430. if (this.form_parent_window == null) {
  431. form_parent_window = new FormParentWindow(this);
  432. }
  433. cp.Caption = "ClientArea";
  434. cp.ClassName=XplatUI.DefaultClassName;
  435. cp.ClassStyle = 0;
  436. cp.ExStyle=0;
  437. cp.Param=0;
  438. cp.Parent = this.form_parent_window.window.Handle;
  439. cp.X = Left;
  440. cp.Y = Top;
  441. cp.Width = Width;
  442. cp.Height = Height;
  443. cp.Style = (int)WindowStyles.WS_CHILD;
  444. cp.Style |= (int)WindowStyles.WS_VISIBLE;
  445. cp.Style |= (int)WindowStyles.WS_CLIPSIBLINGS;
  446. cp.Style |= (int)WindowStyles.WS_CLIPCHILDREN;
  447. return cp;
  448. }
  449. }
  450. protected override Size DefaultSize {
  451. get {
  452. return new Size (250, 250);
  453. }
  454. }
  455. protected override void OnPaint (PaintEventArgs pevent)
  456. {
  457. base.OnPaint (pevent);
  458. }
  459. #endregion // Protected Instance Properties
  460. #region Public Static Methods
  461. #endregion // Public Static Methods
  462. #region Public Instance Methods
  463. public void AddOwnedForm(Form ownedForm) {
  464. owned_forms.Add(ownedForm);
  465. }
  466. public void RemoveOwnedForm(Form ownedForm) {
  467. owned_forms.Remove(ownedForm);
  468. }
  469. public DialogResult ShowDialog() {
  470. return ShowDialog(null);
  471. }
  472. public DialogResult ShowDialog(IWin32Window ownerWin32) {
  473. Control owner = null;
  474. if (ownerWin32 != null) {
  475. owner = Control.FromHandle(ownerWin32.Handle);
  476. }
  477. if (is_modal) {
  478. return DialogResult.None;
  479. }
  480. if (Visible) {
  481. throw new InvalidOperationException("Already visible forms cannot be displayed as a modal dialog. Set the Visible property to 'false' prior to calling Form.ShowDialog.");
  482. }
  483. if (!IsHandleCreated) {
  484. CreateControl();
  485. }
  486. XplatUI.SetModal(window.Handle, true);
  487. Show();
  488. is_modal = true;
  489. Application.ModalRun(this);
  490. is_modal = false;
  491. Hide();
  492. XplatUI.SetModal(window.Handle, false);
  493. return DialogResult;
  494. }
  495. public void Close ()
  496. {
  497. CancelEventArgs args = new CancelEventArgs ();
  498. OnClosing (args);
  499. if (!args.Cancel) {
  500. OnClosed (EventArgs.Empty);
  501. closing = true;
  502. return;
  503. }
  504. }
  505. #endregion // Public Instance Methods
  506. #region Protected Instance Methods
  507. protected override void CreateHandle() {
  508. base.CreateHandle ();
  509. }
  510. protected override void OnCreateControl() {
  511. base.OnCreateControl ();
  512. OnLoad(EventArgs.Empty);
  513. }
  514. protected override void OnHandleCreated(EventArgs e) {
  515. base.OnHandleCreated (e);
  516. }
  517. protected override void OnHandleDestroyed(EventArgs e) {
  518. base.OnHandleDestroyed (e);
  519. }
  520. protected override void OnResize(EventArgs e) {
  521. base.OnResize(e);
  522. }
  523. protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
  524. if (base.ProcessCmdKey (ref msg, keyData)) {
  525. return true;
  526. }
  527. // Give our menu a shot
  528. if (menu != null) {
  529. return menu.ProcessCmdKey(ref msg, keyData);
  530. }
  531. return false;
  532. }
  533. protected override bool ProcessDialogKey(Keys keyData) {
  534. if (keyData == Keys.Enter && accept_button != null) {
  535. accept_button.PerformClick();
  536. return true;
  537. } else if (keyData == Keys.Enter && cancel_button != null) {
  538. cancel_button.PerformClick();
  539. return true;
  540. }
  541. return base.ProcessDialogKey(keyData);
  542. }
  543. protected override bool ProcessKeyPreview(ref Message msg) {
  544. if (key_preview) {
  545. if (ProcessKeyEventArgs(ref msg)) {
  546. return true;
  547. }
  548. }
  549. return base.ProcessKeyPreview (ref msg);
  550. }
  551. protected override void WndProc(ref Message m) {
  552. switch((Msg)m.Msg) {
  553. case Msg.WM_CLOSE: {
  554. CancelEventArgs args = new CancelEventArgs();
  555. OnClosing(args);
  556. if (!args.Cancel) {
  557. OnClosed(EventArgs.Empty);
  558. closing = true;
  559. base.WndProc(ref m);
  560. break;
  561. }
  562. break;
  563. }
  564. #if topmost_workaround
  565. case Msg.WM_ACTIVATE: {
  566. if (this.OwnedForms.Length>0) {
  567. XplatUI.SetZOrder(this.OwnedForms[0].window.Handle, this.window.Handle, false, false);
  568. }
  569. break;
  570. }
  571. #endif
  572. default: {
  573. base.WndProc (ref m);
  574. break;
  575. }
  576. }
  577. }
  578. #endregion // Protected Instance Methods
  579. #region Events
  580. protected virtual void OnActivated(EventArgs e) {
  581. if (Activated != null) {
  582. Activated(this, e);
  583. }
  584. }
  585. protected virtual void OnClosed(EventArgs e) {
  586. if (Closed != null) {
  587. Closed(this, e);
  588. }
  589. }
  590. protected virtual void OnClosing(System.ComponentModel.CancelEventArgs e) {
  591. if (Closing != null) {
  592. Closing(this, e);
  593. }
  594. }
  595. protected virtual void OnDeactivate(EventArgs e) {
  596. if (Deactivate != null) {
  597. Deactivate(this, e);
  598. }
  599. }
  600. protected virtual void OnInputLanguageChanged(InputLanguageChangedEventArgs e) {
  601. if (InputLanguageChanged!=null) {
  602. InputLanguageChanged(this, e);
  603. }
  604. }
  605. protected virtual void OnInputLanguageChanging(InputLanguageChangingEventArgs e) {
  606. if (InputLanguageChanging!=null) {
  607. InputLanguageChanging(this, e);
  608. }
  609. }
  610. protected virtual void OnLoad(EventArgs e) {
  611. if (Load != null) {
  612. Load(this, e);
  613. }
  614. }
  615. protected virtual void OnMaximizedBoundsChanged(EventArgs e) {
  616. if (MaximizedBoundsChanged != null) {
  617. MaximizedBoundsChanged(this, e);
  618. }
  619. }
  620. protected virtual void OnMaximumSizeChanged(EventArgs e) {
  621. if (MaximumSizeChanged != null) {
  622. MaximumSizeChanged(this, e);
  623. }
  624. }
  625. protected virtual void OnMdiChildActivate(EventArgs e) {
  626. if (MdiChildActivate != null) {
  627. MdiChildActivate(this, e);
  628. }
  629. }
  630. protected virtual void OnMenuComplete(EventArgs e) {
  631. if (MenuComplete != null) {
  632. MenuComplete(this, e);
  633. }
  634. }
  635. protected virtual void OnMenuStart(EventArgs e) {
  636. if (MenuStart != null) {
  637. MenuStart(this, e);
  638. }
  639. }
  640. protected virtual void OnMinimumSizeChanged(EventArgs e) {
  641. if (MinimumSizeChanged != null) {
  642. MinimumSizeChanged(this, e);
  643. }
  644. }
  645. public event EventHandler Activated;
  646. public event EventHandler Closed;
  647. public event CancelEventHandler Closing;
  648. public event EventHandler Deactivate;
  649. public event InputLanguageChangedEventHandler InputLanguageChanged;
  650. public event InputLanguageChangingEventHandler InputLanguageChanging;
  651. public event EventHandler Load;
  652. public event EventHandler MaximizedBoundsChanged;
  653. public event EventHandler MaximumSizeChanged;
  654. public event EventHandler MdiChildActivate;
  655. public event EventHandler MenuComplete;
  656. public event EventHandler MenuStart;
  657. public event EventHandler MinimumSizeChanged;
  658. #endregion // Events
  659. }
  660. }