]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/toplevel.cpp
Avoid do-nothing virtuals in WinCE.
[wxWidgets.git] / src / msw / toplevel.cpp
index 214fbc7718e000b90a8bc37b88724dcdc1bbfd39..4da7baf52816be25353c11a51a1ace4df437e400 100644 (file)
@@ -27,6 +27,7 @@
 #include "wx/toplevel.h"
 
 #ifndef WX_PRECOMP
+    #include "wx/msw/missing.h"
     #include "wx/app.h"
     #include "wx/dialog.h"
     #include "wx/string.h"
@@ -50,7 +51,6 @@
     #include "wx/msw/wince/missing.h"
 #endif
 
-#include "wx/msw/missing.h"
 #include "wx/msw/winundef.h"
 
 #include "wx/display.h"
@@ -503,8 +503,10 @@ bool wxTopLevelWindowMSW::CreateFrame(const wxString& title,
 
     const wxSize sz = IsAlwaysMaximized() ? wxDefaultSize : size;
 
+#ifndef __WXWINCE__
     if ( wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft )
         exflags |= WS_EX_LAYOUTRTL;
+#endif
 
     return MSWCreate(wxCanvasClassName, title, pos, sz, flags, exflags);
 }
@@ -564,13 +566,13 @@ bool wxTopLevelWindowMSW::Create(wxWindow *parent,
 
         // all dialogs are popups
         dlgTemplate->style |= WS_POPUP;
-        
+
+#ifndef __WXWINCE__
         if ( wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft )
         {
             dlgTemplate->dwExtendedStyle |= WS_EX_LAYOUTRTL;
         }
 
-#ifndef __WXWINCE__
         // force 3D-look if necessary, it looks impossibly ugly otherwise
         if ( style & (wxRESIZE_BORDER | wxCAPTION) )
             dlgTemplate->style |= DS_MODALFRAME;
@@ -778,6 +780,79 @@ void wxTopLevelWindowMSW::SetLayoutDirection(wxLayoutDirection dir)
         wxTopLevelWindowBase::SetLayoutDirection(dir);
 }
 
+// ----------------------------------------------------------------------------
+// wxTopLevelWindowMSW geometry
+// ----------------------------------------------------------------------------
+
+#ifndef __WXWINCE__
+
+void wxTopLevelWindowMSW::DoGetPosition(int *x, int *y) const
+{
+    if ( IsIconized() )
+    {
+        WINDOWPLACEMENT wp;
+        wp.length = sizeof(WINDOWPLACEMENT);
+        if ( ::GetWindowPlacement(GetHwnd(), &wp) )
+        {
+            RECT& rc = wp.rcNormalPosition;
+
+            // the position returned by GetWindowPlacement() is in workspace
+            // coordinates except for windows with WS_EX_TOOLWINDOW style
+            if ( !HasFlag(wxFRAME_TOOL_WINDOW) )
+            {
+                // we must use the correct display for the translation as the
+                // task bar might be shown on one display but not the other one
+                int n = wxDisplay::GetFromWindow(this);
+                wxDisplay dpy(n == wxNOT_FOUND ? 0 : n);
+                const wxPoint ptOfs = dpy.GetClientArea().GetPosition() -
+                                      dpy.GetGeometry().GetPosition();
+
+                rc.left += ptOfs.x;
+                rc.top += ptOfs.y;
+            }
+
+            if ( x )
+                *x = rc.left;
+            if ( y )
+                *y = rc.top;
+
+            return;
+        }
+
+        wxLogLastError(_T("GetWindowPlacement"));
+    }
+    //else: normal case
+
+    wxTopLevelWindowBase::DoGetPosition(x, y);
+}
+
+void wxTopLevelWindowMSW::DoGetSize(int *width, int *height) const
+{
+    if ( IsIconized() )
+    {
+        WINDOWPLACEMENT wp;
+        wp.length = sizeof(WINDOWPLACEMENT);
+        if ( ::GetWindowPlacement(GetHwnd(), &wp) )
+        {
+            const RECT& rc = wp.rcNormalPosition;
+
+            if ( width )
+                *width = rc.right - rc.left;
+            if ( height )
+                *height = rc.bottom - rc.top;
+
+            return;
+        }
+
+        wxLogLastError(_T("GetWindowPlacement"));
+    }
+    //else: normal case
+
+    wxTopLevelWindowBase::DoGetSize(width, height);
+}
+
+#endif // __WXWINCE__
+
 // ----------------------------------------------------------------------------
 // wxTopLevelWindowMSW fullscreen
 // ----------------------------------------------------------------------------