Author: rolf
Date: 2007-01-16 06:55:08 -0500 (Tue, 16 Jan 2007)
New Revision: 71120
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiWindowManager.cs
Log:
2007-01-16 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
* MdiWindowManager.cs: Fix NRE when merging menus and main form
doesn't have a menu.
* Form.cs: Request NCRecalc after creating a mdi child window.
Implement mdi key handling (Ctrl+F4, Ctrl+Shift+F4, Ctrl+Tab,
Ctrl+Shift+Tab, Ctrl+F6 and Ctrl+Shift+F6).
* MdiClient.cs: Add new method SendFocusToActiveChild that either
sends keyboard focus to the active child, or to the MdiClient
if there are no child forms.
*
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-01-16 11:52:32 UTC (rev 71119)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-01-16 11:55:08 UTC (rev 71120)
@@ -1,3 +1,17 @@
+2007-01-16 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
+
+ * MdiWindowManager.cs: Fix NRE when merging menus and main form
+ doesn't have a menu.
+
+ * Form.cs: Request NCRecalc after creating a mdi child window.
+ Implement mdi key handling (Ctrl+F4, Ctrl+Shift+F4, Ctrl+Tab,
+ Ctrl+Shift+Tab, Ctrl+F6 and Ctrl+Shift+F6).
+
+ * MdiClient.cs: Add new method SendFocusToActiveChild that either
+ sends keyboard focus to the active child, or to the MdiClient
+ if there are no child forms.
+
+ *
2007-01-15 Chris Toshok <[EMAIL PROTECTED]>
* ListView.cs: drop the *Internal overrides, just do our work in
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
2007-01-16 11:52:32 UTC (rev 71119)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
2007-01-16 11:55:08 UTC (rev 71120)
@@ -127,7 +127,7 @@
private void SelectActiveControl ()
{
if (this.IsMdiContainer) {
- SendControlFocus (this.mdi_container);
+ mdi_container.SendFocusToActiveChild ();
return;
}
@@ -1262,7 +1262,7 @@
if (IsMdiChild) {
MdiParent.ActivateMdiChild (this);
} else if (IsMdiContainer) {
- SendControlFocus (mdi_container);
+ mdi_container.SendFocusToActiveChild ();
} else {
active = ActiveForm;
if ((active != null) && (this !=
active)) {
@@ -1523,8 +1523,11 @@
XplatUI.SetTopmost(owned_forms[i].window.Handle, window.Handle, true);
}
- if (window_manager != null && window_state !=
FormWindowState.Normal) {
- window_manager.SetWindowState
(FormWindowState.Normal, window_state);
+ if (window_manager != null) {
+ if (window_state != FormWindowState.Normal) {
+ window_manager.SetWindowState
(FormWindowState.Normal, window_state);
+ }
+ XplatUI.RequestNCRecalc (window.Handle);
}
}
@@ -1742,6 +1745,24 @@
return ActiveMenu.ProcessCmdKey(ref msg,
keyData);
}
+ if (IsMdiChild) {
+ switch (keyData)
+ {
+ case Keys.Control | Keys.F4:
+ case Keys.Control | Keys.Shift | Keys.F4:
+ Close ();
+ return true;
+ case Keys.Control | Keys.Tab:
+ case Keys.Control | Keys.F6:
+ MdiParent.SelectNextControl
(MdiParent.ActiveControl, false, false, true, true);
+ return true;
+ case Keys.Control | Keys.Shift | Keys.Tab:
+ case Keys.Control | Keys.Shift | Keys.F6:
+ MdiParent.SelectNextControl
(MdiParent.ActiveControl, true, false, true, true);
+ return true;
+ }
+ }
+
return false;
}
@@ -1982,6 +2003,10 @@
ActiveControl.Focus();
return; // FIXME - do we need
to run base.WndProc, even though we just changed focus?
}
+ if (IsMdiContainer) {
+
mdi_container.SendFocusToActiveChild ();
+ return;
+ }
base.WndProc(ref m);
return;
}
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs
2007-01-16 11:52:32 UTC (rev 71119)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs
2007-01-16 11:55:08 UTC (rev 71120)
@@ -107,6 +107,16 @@
}
#endregion // Public Constructors
+ internal void SendFocusToActiveChild ()
+ {
+ Form active = this.ActiveMdiChild;
+ if (active == null) {
+ ParentForm.SendControlFocus (this);
+ } else {
+ active.SendControlFocus (active);
+ }
+ }
+
internal bool HorizontalScrollbarVisible {
get { return hbar != null && hbar.Visible; }
}
@@ -158,14 +168,6 @@
}
protected override void WndProc(ref Message m) {
- /*
- switch ((Msg) m.Msg) {
- case Msg.WM_PAINT: {
- Console.WriteLine ("ignoring paint");
- return;
- }
- }
- */
switch ((Msg)m.Msg) {
case Msg.WM_NCCALCSIZE:
XplatUIWin32.NCCALCSIZE_PARAMS ncp;
@@ -672,6 +674,7 @@
Form current = (Form) Controls [0];
form.SuspendLayout ();
form.BringToFront ();
+ form.SendControlFocus (form);
form.ResumeLayout(false);
SetWindowStates ((MdiWindowManager)
form.window_manager);
if (current != form) {
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiWindowManager.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiWindowManager.cs
2007-01-16 11:52:32 UTC (rev 71119)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiWindowManager.cs
2007-01-16 11:55:08 UTC (rev 71120)
@@ -131,7 +131,12 @@
private MainMenu CreateMergedMenu ()
{
Form parent = (Form) mdi_container.Parent;
- MainMenu clone = (MainMenu) parent.Menu.CloneMenu ();
+ MainMenu clone;
+ if (parent.Menu != null)
+ clone = (MainMenu) parent.Menu.CloneMenu ();
+ else
+ clone = new MainMenu ();
+
if (form.WindowState == FormWindowState.Maximized) {
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches