Author: pbartok
Date: 2006-01-14 01:53:16 -0500 (Sat, 14 Jan 2006)
New Revision: 55571

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/XplatUIWin32.cs
Log:
2006-01-13  Peter Dennis Bartok  <[EMAIL PROTECTED]>

        * Form.cs: 
          - Added RecreateHandle call when changing taskbar visibility to 
            trigger reparenting in Win32 driver (Fixes #75719)
          - If a window has minimize or maximize buttons, it cannot have
            a help button
        * XplatUIWin32.cs:
          - CreateWindow: When no WS_EX_APPWINDOW style is found we parent
            the toplevel form with FosterParent (A toolwindow not on the
            taskbar) (Fixes #75719)
          - Made FosterParent a toolwindow



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-01-14 06:45:37 UTC (rev 55570)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-01-14 06:53:16 UTC (rev 55571)
@@ -1,3 +1,16 @@
+2006-01-13  Peter Dennis Bartok  <[EMAIL PROTECTED]>
+
+       * Form.cs: 
+         - Added RecreateHandle call when changing taskbar visibility to 
+           trigger reparenting in Win32 driver (Fixes #75719)
+         - If a window has minimize or maximize buttons, it cannot have
+           a help button
+       * XplatUIWin32.cs:
+         - CreateWindow: When no WS_EX_APPWINDOW style is found we parent
+           the toplevel form with FosterParent (A toolwindow not on the
+           taskbar) (Fixes #75719)
+         - Made FosterParent a toolwindow
+
 2006-01-13  Alexander Olk  <[EMAIL PROTECTED]>
 
        * FileDialog.cs: Don't crash if InitialDirectory doesn't exist

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs  
2006-01-14 06:45:37 UTC (rev 55570)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs  
2006-01-14 06:53:16 UTC (rev 55571)
@@ -668,6 +668,9 @@
                        set {
                                if (show_in_taskbar != value) {
                                        show_in_taskbar = value;
+                                       if (IsHandleCreated) {
+                                               RecreateHandle();
+                                       }
                                        UpdateStyles();
                                }
                        }
@@ -806,6 +809,7 @@
                                cp.Caption = Text;
                                cp.ClassName = XplatUI.DefaultClassName;
                                cp.ClassStyle = 0;
+                               cp.Style = 0;
                                cp.ExStyle = 0;
                                cp.Param = 0;
                                cp.Parent = IntPtr.Zero;
@@ -820,7 +824,7 @@
                                cp.Width = Width;
                                cp.Height = Height;
 
-                               cp.Style |= (int)WindowStyles.WS_CLIPCHILDREN | 
(int)WindowStyles.WS_CLIPSIBLINGS;
+                               cp.Style = (int)(WindowStyles.WS_CLIPCHILDREN | 
WindowStyles.WS_CLIPSIBLINGS | WindowStyles.WS_CAPTION);
 
                                if (IsMdiChild) {
                                        cp.Style |= (int)WindowStyles.WS_CHILD;
@@ -840,12 +844,10 @@
                                        }
                                        
                                } else {
-
                                        switch (FormBorderStyle) {
-
                                        case FormBorderStyle.Fixed3D: {
                                                cp.Style |= 
(int)WindowStyles.WS_CAPTION;
-                                               cp.ExStyle |= 
(int)WindowStyles.WS_EX_OVERLAPPEDWINDOW;
+                                               cp.ExStyle |= 
(int)WindowStyles.WS_EX_OVERLAPPEDWINDOW; 
                                                break;
                                        }
 
@@ -861,20 +863,20 @@
                                                break;
                                        }
 
-                                       case FormBorderStyle.FixedToolWindow: {
+                                       case FormBorderStyle.FixedToolWindow: { 
                                                cp.Style |= 
(int)WindowStyles.WS_CAPTION;
                                                cp.ExStyle |= 
(int)(WindowStyles.WS_EX_WINDOWEDGE | WindowStyles.WS_EX_TOOLWINDOW);
                                                break;
                                        }
 
                                        case FormBorderStyle.Sizable: {
-                                               cp.Style |= 
(int)WindowStyles.WS_OVERLAPPEDWINDOW;
+                                               cp.Style |= 
(int)WindowStyles.WS_OVERLAPPEDWINDOW; 
                                                cp.ExStyle |= 
(int)(WindowStyles.WS_EX_WINDOWEDGE);
                                                break;
                                        }
 
                                        case FormBorderStyle.SizableToolWindow: 
{
-                                               cp.Style |= 
(int)WindowStyles.WS_OVERLAPPEDWINDOW;
+                                               cp.Style |= 
(int)WindowStyles.WS_OVERLAPPEDWINDOW; 
                                                cp.ExStyle |= 
(int)(WindowStyles.WS_EX_WINDOWEDGE | WindowStyles.WS_EX_TOOLWINDOW);
                                                break;
                                        }
@@ -897,7 +899,7 @@
                                        cp.Style |= 
(int)WindowStyles.WS_SYSMENU;
                                }
 
-                               if (HelpButton) {
+                               if (HelpButton && !MaximizeBox && !MinimizeBox) 
{
                                        cp.ExStyle |= 
(int)WindowStyles.WS_EX_CONTEXTHELP;
                                }
                                

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs  
2006-01-14 06:45:37 UTC (rev 55570)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs  
2006-01-14 06:53:16 UTC (rev 55571)
@@ -660,7 +660,7 @@
                                Win32MessageBox(IntPtr.Zero, "Could not 
register the "+XplatUI.DefaultClassName+" window class, win32 error " + 
Win32GetLastError().ToString(), "Oops", 0);
                        }
 
-                       FosterParent=Win32CreateWindow(0, "static", "Foster 
Parent Window", (int)WindowStyles.WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, IntPtr.Zero, 
IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
+                       FosterParent=Win32CreateWindow(0, "static", "Foster 
Parent Window", (int)(WindowStyles.WS_OVERLAPPEDWINDOW | 
WindowStyles.WS_EX_TOOLWINDOW), 0, 0, 0, 0, IntPtr.Zero, IntPtr.Zero, 
IntPtr.Zero, IntPtr.Zero);
 
                        if (FosterParent==IntPtr.Zero) {
                                Win32MessageBox(IntPtr.Zero, "Could not create 
foster window, win32 error " + Win32GetLastError().ToString(), "Oops", 0);
@@ -1030,9 +1030,15 @@
 
                        if ((ParentHandle==IntPtr.Zero) && (cp.Style & 
(int)(WindowStyles.WS_CHILD))!=0) {
                                // We need to use our foster parent window 
until this poor child gets it's parent assigned
-                               ParentHandle=FosterParent;
+                               ParentHandle = FosterParent;
                        }
 
+                       if ( ((cp.Style & (int)(WindowStyles.WS_CHILD))==0) && 
((cp.ExStyle & (int)WindowStyles.WS_EX_APPWINDOW) == 0)) {
+                               // If we want to be hidden from the taskbar we 
need to be 'owned' by 
+                               // something not on the taskbar. FosterParent 
is just that
+                               ParentHandle = FosterParent;
+                       }
+
                        lParam = IntPtr.Zero;
                        if (cp.Param != null && cp.Param is CLIENTCREATESTRUCT) 
{
                                lParam = 
Marshal.AllocHGlobal(Marshal.SizeOf(cp.Param));

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to