Author: pbartok
Date: 2005-03-01 04:52:47 -0500 (Tue, 01 Mar 2005)
New Revision: 41311

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
Log:
2005-03-01  Peter Bartok  <[EMAIL PROTECTED]>

        * Control.cs:
          - Fixed Visible property, now follows (once again) parent chain
            to return false if any control in the chain is visible=false
          - Fixed OnParentVisibleChanged, now just calls OnVisibleChanged event
          - Fixed several places where is_visible instead of Visible was used
          - Implemented FIXME related to focus selection when setting focused
            control to be invisible

        * XplatUIWin32.cs: Now using proper method to find out if window is
          visible. Thanks to Jordi for pointing it out



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2005-03-01 08:45:38 UTC (rev 41310)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2005-03-01 09:52:47 UTC (rev 41311)
@@ -1,3 +1,16 @@
+2005-03-01  Peter Bartok  <[EMAIL PROTECTED]>
+
+       * Control.cs:
+         - Fixed Visible property, now follows (once again) parent chain
+           to return false if any control in the chain is visible=false
+         - Fixed OnParentVisibleChanged, now just calls OnVisibleChanged event
+         - Fixed several places where is_visible instead of Visible was used
+         - Implemented FIXME related to focus selection when setting focused
+           control to be invisible
+
+       * XplatUIWin32.cs: Now using proper method to find out if window is
+         visible. Thanks to Jordi for pointing it out
+
 2005-02-28  Jordi Mas i Hernandez <[EMAIL PROTECTED]>
 
        * ComboBox.cs: show/hide scrollbar instead of creating it

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2005-03-01 08:45:38 UTC (rev 41310)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2005-03-01 09:52:47 UTC (rev 41311)
@@ -716,7 +716,7 @@
 
                        if (((control.control_style & ControlStyles.Selectable) 
!=0)  && (parent != null)) {
                                while (parent != null) {
-                                       if (!parent.is_visible || 
!parent.is_enabled) {
+                                       if (!parent.Visible || 
!parent.is_enabled) {
                                                return false;
                                        }
                                        parent = parent.parent;
@@ -1119,7 +1119,7 @@
                
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
                public bool CanFocus {
                        get {
-                               if (is_visible && is_enabled && 
GetStyle(ControlStyles.Selectable)) {
+                               if (Visible && is_enabled && 
GetStyle(ControlStyles.Selectable)) {
                                        return true;
                                }
                                return false;
@@ -1139,7 +1139,7 @@
 
                                parent = this.parent;
                                while (parent != null) {
-                                       if (!parent.is_visible || 
!parent.is_enabled) {
+                                       if (!parent.Visible || 
!parent.is_enabled) {
                                                return false;
                                        }
 
@@ -1807,6 +1807,8 @@
                        get {
                                if (!is_visible) {
                                        return false;
+                               } else if (parent != null) {
+                                       return parent.Visible;
                                }
 
                                return true;
@@ -3019,8 +3021,16 @@
                                        this.CreateBuffers(bounds.Width, 
bounds.Height);
                                }
 
-                               // FIXME - deal with focus
+                               if (value == false && parent != null) {
+                                       Control container;
 
+                                       // Need to start at parent, 
GetContainerControl might return ourselves if we're a container
+                                       container = 
(Control)parent.GetContainerControl();
+                                       if (container != null) {
+                                               
container.SelectNextControl(this, true, true, true, true);
+                                       }
+                               }
+
                                if (parent != null) {
                                        parent.PerformLayout(this, "visible");
                                } else {
@@ -3706,9 +3716,7 @@
 
                [EditorBrowsable(EditorBrowsableState.Advanced)]
                protected virtual void OnParentVisibleChanged(EventArgs e) {
-                       if (is_visible!=Parent.is_visible) {
-                               is_visible=false;
-                               Invalidate();
+                       if (is_visible) {
                                OnVisibleChanged(e);
                        }
                }

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs  
2005-03-01 08:45:38 UTC (rev 41310)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs  
2005-03-01 09:52:47 UTC (rev 41311)
@@ -1140,15 +1140,7 @@
                }
 
                internal override bool IsVisible(IntPtr handle) {
-                       WINDOWPLACEMENT wndpl;
-
-                       wndpl = new WINDOWPLACEMENT();
-                       wndpl.length=(uint)Marshal.SizeOf(wndpl);
-                       Win32GetWindowPlacement(handle, ref wndpl);
-                       if ((wndpl.showCmd == 
WindowPlacementFlags.SW_SHOWMINIMIZED)) {
-                               return false;
-                       }
-                       return true;
+                       return IsWindowVisible (handle);
                }
 
                internal override IntPtr SetParent(IntPtr handle, IntPtr 
parent) {
@@ -1208,7 +1200,6 @@
                        override_cursor = cursor;
                }
 
-               
                internal override IntPtr DefineCursor(Bitmap bitmap, Bitmap 
mask, Color cursor_pixel, Color mask_pixel, int xHotSpot, int yHotSpot) {
                        IntPtr  cursor;
                        Bitmap  cursor_bitmap;
@@ -1811,6 +1802,9 @@
 
                [DllImport ("gdi32.dll", EntryPoint="CreateRectRgn", 
CallingConvention=CallingConvention.StdCall)]
                internal extern static IntPtr Win32CreateRectRgn(int nLeftRect, 
int nTopRect, int nRightRect, int nBottomRect);
+
+               [DllImport ("user32.dll", EntryPoint="IsWindowVisible", 
CallingConvention=CallingConvention.StdCall)]
+               private extern static bool IsWindowVisible(IntPtr hwnd);
                #endregion
        }
 }

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

Reply via email to