- Added method to calculate difference between decorated window and raw
authorPeter Dennis Bartok <pbartok@mono-cvs.ximian.com>
Wed, 11 Aug 2004 18:55:46 +0000 (18:55 -0000)
committerPeter Dennis Bartok <pbartok@mono-cvs.ximian.com>
Wed, 11 Aug 2004 18:55:46 +0000 (18:55 -0000)
  client area

svn path=/trunk/mcs/; revision=32230

mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs

index 803f63a0441a0834b8968c759523964dfccd08c9..a27e436846e14b372a5f7fdac06494e4cdc658cf 100644 (file)
 //     Peter Bartok    pbartok@novell.com
 //
 //
-// $Revision: 1.7 $
+// $Revision: 1.8 $
 // $Modtime: $
 // $Log: XplatUI.cs,v $
+// Revision 1.8  2004/08/11 18:55:46  pbartok
+// - Added method to calculate difference between decorated window and raw
+//   client area
+//
 // Revision 1.7  2004/08/10 17:39:22  pbartok
 // - Added GetWindowPos method
 //
@@ -248,10 +252,15 @@ namespace System.Windows.Forms {
                internal static void GrabWindow(IntPtr hWnd) {
                        driver.GrabWindow(hWnd);
                }
+
                internal static void ReleaseWindow(IntPtr hWnd) {
                        driver.ReleaseWindow(hWnd);
                }
 
+               internal static bool CalculateWindowRect(IntPtr hWnd, ref Rectangle ClientRect, int Style, bool HasMenu, out Rectangle WindowRect) {
+                       return driver.CalculateWindowRect(hWnd, ref ClientRect, Style, HasMenu, out WindowRect);
+               }
+
                // Santa's little helper
                internal static void Where() {
                        Console.WriteLine("Here: {0}", new StackTrace().ToString());
index 21a1d0d45b8edb4bf993b97a34441acaada52947..287e1b3ec4c095c85f731f680f6ef3fa6721147a 100644 (file)
 //     Peter Bartok    pbartok@novell.com
 //
 //
-// $Revision: 1.7 $
+// $Revision: 1.8 $
 // $Modtime: $
 // $Log: XplatUIDriver.cs,v $
+// Revision 1.8  2004/08/11 18:55:46  pbartok
+// - Added method to calculate difference between decorated window and raw
+//   client area
+//
 // Revision 1.7  2004/08/10 17:39:22  pbartok
 // - Added GetWindowPos method
 //
@@ -136,6 +140,8 @@ namespace System.Windows.Forms {
                internal abstract bool MoveWindow(IntPtr hWnd, int x, int y, int width, int height);
                internal abstract bool DispatchMessage(ref MSG msg);
 
+               internal abstract bool CalculateWindowRect(IntPtr hWnd, ref Rectangle ClientRect, int Style, bool HasMenu, out Rectangle WindowRect);
+
                internal abstract void GrabWindow(IntPtr hWnd);
                internal abstract void ReleaseWindow(IntPtr hWnd);
                #endregion      // XplatUI Driver Methods
index 214eb2065a0329a2992a324cf6e441d6e30f2bfe..6d18af313218504b78b330e95221008d5608196d 100644 (file)
 //     Peter Bartok    pbartok@novell.com
 //
 //
-// $Revision: 1.9 $
+// $Revision: 1.10 $
 // $Modtime: $
 // $Log: XplatUIWin32.cs,v $
+// Revision 1.10  2004/08/11 18:55:46  pbartok
+// - Added method to calculate difference between decorated window and raw
+//   client area
+//
 // Revision 1.9  2004/08/10 18:47:16  jordi
 // Calls InvalidateRect before UpdateWindow
 //
@@ -613,6 +617,23 @@ namespace System.Windows.Forms {
                        Win32ReleaseCapture();
                }
 
+               internal override bool CalculateWindowRect(IntPtr hWnd, ref Rectangle ClientRect, int Style, bool HasMenu, out Rectangle WindowRect) {
+                       RECT    rect;
+
+                       rect.left=ClientRect.Left;
+                       rect.top=ClientRect.Top;
+                       rect.right=ClientRect.Right;
+                       rect.bottom=ClientRect.Bottom;
+
+                       if (!Win32AdjustWindowRectEx(ref rect, Style, HasMenu, 0)) {
+                               WindowRect = new Rectangle(ClientRect.Left, ClientRect.Top, ClientRect.Width, ClientRect.Height);
+                               return false;
+                       }
+
+                       WindowRect = new Rectangle(rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top);
+                       return true;
+               }
+
                // Santa's little helper
                static void Where() {
                        Console.WriteLine("Here: {0}", new StackTrace().ToString());
@@ -703,6 +724,12 @@ namespace System.Windows.Forms {
 
                [DllImport ("user32.dll", EntryPoint="SetActiveWindow", CharSet=CharSet.Ansi, CallingConvention=CallingConvention.StdCall)]
                private extern static IntPtr Win32SetActiveWindow(IntPtr hWnd);
+
+               [DllImport ("user32.dll", EntryPoint="PostQuitMessage", CharSet=CharSet.Ansi, CallingConvention=CallingConvention.StdCall)]
+               private extern static IntPtr Win32PostQuitMessage(IntPtr hWnd);
+
+               [DllImport ("user32.dll", EntryPoint="AdjustWindowRectEx", CharSet=CharSet.Ansi, CallingConvention=CallingConvention.StdCall)]
+               private extern static bool Win32AdjustWindowRectEx(ref RECT lpRect, int dwStyle, bool bMenu, int dwExStyle);
                #endregion
 
        }
index d24b160f7943112b83f28fe3ae3d983b4482fca6..458ecf2465b88ddc5780763c5050d1d0a3be31eb 100644 (file)
 //     Peter Bartok    pbartok@novell.com
 //
 //
-// $Revision: 1.16 $
+// $Revision: 1.17 $
 // $Modtime: $
 // $Log: XplatUIX11.cs,v $
+// Revision 1.17  2004/08/11 18:55:46  pbartok
+// - Added method to calculate difference between decorated window and raw
+//   client area
+//
 // Revision 1.16  2004/08/10 17:39:22  pbartok
 // - Added GetWindowPos method
 //
@@ -717,6 +721,11 @@ namespace System.Windows.Forms {
                        XUngrabPointer(DisplayHandle, 0);
                }
 
+               internal override bool CalculateWindowRect(IntPtr hWnd, ref Rectangle ClientRect, int Style, bool HasMenu, out Rectangle WindowRect) {
+                       WindowRect = new Rectangle(ClientRect.Left, ClientRect.Top, ClientRect.Width, ClientRect.Height);
+                       return true;
+               }
+
                // Santa's little helper
                static void Where() {
                        Console.WriteLine("Here: {0}", new StackTrace().ToString());