Author: jpobst
Date: 2007-03-07 17:31:11 -0500 (Wed, 07 Mar 2007)
New Revision: 73921
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripDropDown.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
Log:
2007-03-07 Jonathan Pobst <[EMAIL PROTECTED]>
* XplatUIWin32.cs: The no_activate stuff was forcing us to create a
Handle before we were supposed to. Now checks ActivateOnShow property
in Control.
* Control.cs: Add internal ActivateOnShow property.
* ComboBox.cs, Form.cs, MenuAPI.cs, ToolStripDropDown.cs: Return false
for ActivateOnShow.
* Hwnd.cs Remove no longer needed no_activate field.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-03-07 22:30:44 UTC (rev 73920)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-03-07 22:31:11 UTC (rev 73921)
@@ -1,3 +1,13 @@
+2007-03-07 Jonathan Pobst <[EMAIL PROTECTED]>
+
+ * XplatUIWin32.cs: The no_activate stuff was forcing us to create a
+ Handle before we were supposed to. Now checks ActivateOnShow property
+ in Control.
+ * Control.cs: Add internal ActivateOnShow property.
+ * ComboBox.cs, Form.cs, MenuAPI.cs, ToolStripDropDown.cs: Return false
+ for ActivateOnShow.
+ * Hwnd.cs Remove no longer needed no_activate field.
+
2007-03-07 Jackson Harper <[EMAIL PROTECTED]>
* TreeView.cs: Implement owner draw tree nodes. And a couple more
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
2007-03-07 22:30:44 UTC (rev 73920)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
2007-03-07 22:31:11 UTC (rev 73921)
@@ -1967,7 +1967,6 @@
SetStyle (ControlStyles.ResizeRedraw |
ControlStyles.Opaque, true);
this.is_visible = false;
- Hwnd.ObjectFromHandle (this.Handle).no_activate
= true;
if (owner.DropDownStyle == ComboBoxStyle.Simple)
InternalBorderStyle =
BorderStyle.Fixed3D;
@@ -2003,6 +2002,7 @@
}
}
+ internal override bool ActivateOnShow { get { return
false; } }
#region Private Methods
// Calcs the listbox area
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
2007-03-07 22:30:44 UTC (rev 73920)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
2007-03-07 22:31:11 UTC (rev 73921)
@@ -1101,6 +1101,8 @@
}
}
}
+
+ internal virtual bool ActivateOnShow { get { return true; } }
#endregion // Internal Properties
#region Private & Internal Methods
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
2007-03-07 22:30:44 UTC (rev 73920)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
2007-03-07 22:31:11 UTC (rev 73921)
@@ -1303,12 +1303,16 @@
}
}
}
-#if NET_2_0
+
+#if !NET_2_0
+ internal
+#else
[MonoTODO ("Implemented for Win32, needs X11 implementation")]
- protected virtual bool ShowWithoutActivation {
+ protected
+#endif
+ virtual bool ShowWithoutActivation {
get { return false; }
}
-#endif
#endregion // Protected Instance Properties
#region Public Static Methods
@@ -1626,11 +1630,6 @@
}
}
-#if NET_2_0
- if (this.ShowWithoutActivation)
- Hwnd.ObjectFromHandle (this.Handle).no_activate
= true;
-#endif
-
XplatUI.SetWindowMinMax(window.Handle,
maximized_bounds, minimum_size, maximum_size);
if ((FormBorderStyle != FormBorderStyle.FixedDialog) &&
(icon != null)) {
XplatUI.SetIcon(window.Handle, icon);
@@ -2420,6 +2419,8 @@
}
}
}
+
+ internal override bool ActivateOnShow { get { return
!this.ShowWithoutActivation; } }
#region Events
static object ActivatedEvent = new object ();
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs
2007-03-07 22:30:44 UTC (rev 73920)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs
2007-03-07 22:31:11 UTC (rev 73921)
@@ -78,7 +78,6 @@
internal static Bitmap bmp = new Bitmap(1, 1,
System.Drawing.Imaging.PixelFormat.Format32bppArgb);
internal static Graphics bmp_g = Graphics.FromImage (bmp);
internal XEventQueue queue;
- internal bool no_activate; // For Win32, popup
windows will not steal focus
internal WindowExStyles initial_ex_style;
#endregion // Local Variables
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs
2007-03-07 22:30:44 UTC (rev 73920)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs
2007-03-07 22:31:11 UTC (rev 73921)
@@ -735,7 +735,6 @@
SetStyle (ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint, true);
SetStyle (ControlStyles.ResizeRedraw |
ControlStyles.Opaque, true);
is_visible = false;
- Hwnd.ObjectFromHandle (this.Handle).no_activate = true;
}
protected override CreateParams CreateParams
@@ -801,6 +800,8 @@
Width = menu.Rect.Width;
Height = menu.Rect.Height;
}
+
+ internal override bool ActivateOnShow { get { return false; } }
}
}
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripDropDown.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripDropDown.cs
2007-03-07 22:30:44 UTC (rev 73920)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripDropDown.cs
2007-03-07 22:31:11 UTC (rev 73921)
@@ -51,7 +51,6 @@
this.auto_close = true;
is_visible = false;
- Hwnd.ObjectFromHandle (this.Handle).no_activate = true;
this.GripStyle = ToolStripGripStyle.Hidden;
}
#endregion
@@ -68,10 +67,12 @@
if ((XplatUI.SupportsTransparency () &
TransparencySupport.Set) != 0) {
allow_transparency = value;
- if (value)
- XplatUI.SetWindowTransparency
(Handle, Opacity, Color.Empty);
- else
- UpdateStyles (); // Remove the
WS_EX_LAYERED style
+ if (this.IsHandleCreated) {
+ if (value)
+
XplatUI.SetWindowTransparency (Handle, Opacity, Color.Empty);
+ else
+ UpdateStyles (); //
Remove the WS_EX_LAYERED style
+ }
}
}
}
@@ -182,14 +183,16 @@
public double Opacity {
get { return this.opacity; }
set {
- if (this.opacity == value)
- return;
+ if (this.opacity == value)
+ return;
+
+ this.opacity = value;
+ this.allow_transparency = true;
- this.opacity = value;
- this.allow_transparency = true;
-
- UpdateStyles ();
- XplatUI.SetWindowTransparency (Handle, opacity,
Color.Empty);
+ if (this.IsHandleCreated) {
+ UpdateStyles ();
+ XplatUI.SetWindowTransparency
(Handle, opacity, Color.Empty);
+ }
}
}
@@ -782,6 +785,10 @@
this.Close (ToolStripDropDownCloseReason.AppClicked);
}
#endregion
+
+ #region Internal Properties
+ internal override bool ActivateOnShow { get { return false; } }
+ #endregion
}
}
#endif
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
2007-03-07 22:30:44 UTC (rev 73920)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
2007-03-07 22:31:11 UTC (rev 73921)
@@ -1778,7 +1778,8 @@
internal override bool SetVisible (IntPtr handle, bool visible,
bool activate)
{
if (visible) {
- if (Control.FromHandle (handle) is Form) {
+ Control c = Control.FromHandle (handle);
+ if (c is Form) {
Form f;
f = (Form)Control.FromHandle (handle);
@@ -1789,16 +1790,16 @@
case FormWindowState.Maximized:
flags = WindowPlacementFlags.SW_MAXIMIZE; break;
}
- if (Hwnd.ObjectFromHandle
(handle).no_activate)
+ if (!f.ActivateOnShow)
flags =
WindowPlacementFlags.SW_SHOWNOACTIVATE;
Win32ShowWindow (handle, flags);
}
else {
- if (Hwnd.ObjectFromHandle
(handle).no_activate)
+ if (c.ActivateOnShow)
+ Win32ShowWindow (handle,
WindowPlacementFlags.SW_SHOWNORMAL);
+ else
Win32ShowWindow (handle,
WindowPlacementFlags.SW_SHOWNOACTIVATE);
- else
- Win32ShowWindow (handle,
WindowPlacementFlags.SW_SHOWNORMAL);
}
}
else {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches