]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/toplevel.cpp
corrected path splitting for mac relative paths
[wxWidgets.git] / src / os2 / toplevel.cpp
index 3f5b059d664c85a2a344c91eb0297f413a6c113e..0d30d6217131dd021e19af0ef572623833bf8254 100644 (file)
@@ -35,6 +35,7 @@
     #include "wx/log.h"
     #include "wx/intl.h"
     #include "wx/frame.h"
+    #include "wx/control.h"
 #endif //WX_PRECOMP
 
 #include "wx/os2/private.h"
@@ -52,8 +53,6 @@
 wxWindowList wxModelessWindows;
 
 // the name of the default wxWindows class
-extern const wxChar* wxCanvasClassName;
-extern const wxChar* wxFrameClassName;
 extern void          wxAssociateWinWithHandle( HWND         hWnd
                                               ,wxWindowOS2* pWin
                                              );
@@ -199,15 +198,15 @@ bool wxTopLevelWindowOS2::CreateDialog(
     }
 
     HWND                            hWndDlg;
-    HWND                            hWndParent;
+    HWND                            hWndOwner;
 
     if (pParent)
-        hWndParent = GetHwndOf(pParent);
+        hWndOwner = GetHwndOf(pParent);
     else
-        hWndParent = HWND_DESKTOP;
+        hWndOwner = HWND_DESKTOP;
 
-    hWndDlg = ::WinLoadDlg( hWndParent
-                           ,hWndParent
+    hWndDlg = ::WinLoadDlg( HWND_DESKTOP
+                           ,hWndOwner
                            ,(PFNWP)wxDlgProc
                            ,NULL
                            ,(ULONG)ulDlgTemplate
@@ -278,10 +277,6 @@ bool wxTopLevelWindowOS2::CreateDialog(
                       ,nHeight
                       ,SWP_MOVE | SWP_SIZE | SWP_ZORDER | SWP_SHOW
                      );
-    if (!rsTitle.IsNull())
-    {
-        ::WinSetWindowText(GetHwnd(), rsTitle.c_str());
-    }
     SubclassWin(m_hWnd);
     return TRUE;
 } // end of wxTopLevelWindowOS2::CreateDialog
@@ -356,7 +351,7 @@ bool wxTopLevelWindowOS2::CreateFrame(
     wxAssociateWinWithHandle(m_hWnd, this);
     wxAssociateWinWithHandle(m_hFrame, this);
 
-    m_backgroundColour.Set(wxString("GREY"));
+    m_backgroundColour.Set(wxString("MEDIUM GREY"));
 
     LONG                            lColor = (LONG)m_backgroundColour.GetPixel();
 
@@ -408,6 +403,14 @@ bool wxTopLevelWindowOS2::CreateFrame(
         wxLogError("Error sizing frame. Error: %s\n", sError);
         return FALSE;
     }
+    lStyle =  ::WinQueryWindowULong( m_hWnd
+                                    ,QWL_STYLE
+                                   );
+    lStyle |= WS_CLIPCHILDREN;
+    ::WinSetWindowULong( m_hWnd
+                        ,QWL_STYLE
+                        ,lStyle
+                       );
     return TRUE;
 } // end of wxTopLevelWindowOS2::CreateFrame
 
@@ -589,7 +592,12 @@ void wxTopLevelWindowOS2::DoShowWindow(
   int                               nShowCmd
 )
 {
-    ::WinShowWindow(m_hFrame, (BOOL)nShowCmd);
+    ::WinShowWindow(m_hFrame, (BOOL)(nShowCmd & SWP_SHOW));
+
+    //
+    // Need to artificially send a size event as wxApps often expect to do some
+    // final child control sizing
+    SendSizeEvent();
     m_bIconized = nShowCmd == SWP_MINIMIZE;
 } // end of wxTopLevelWindowOS2::DoShowWindow
 
@@ -605,12 +613,12 @@ bool wxTopLevelWindowOS2::Show(
     {
         if (m_bMaximizeOnShow)
         {
-            nShowCmd = SWP_SHOW;
+            nShowCmd = SWP_MAXIMIZE;
             m_bMaximizeOnShow = FALSE;
         }
         else
         {
-            nShowCmd = SWP_HIDE;
+            nShowCmd = SWP_SHOW;
         }
     }
     else // hide
@@ -713,6 +721,21 @@ void wxTopLevelWindowOS2::Restore()
     DoShowWindow(SWP_RESTORE);
 } // end of wxTopLevelWindowOS2::Restore
 
+// generate an artificial resize event
+void wxTopLevelWindowOS2::SendSizeEvent()
+{
+    if (!m_bIconized)
+    {
+        RECTL                       vRect = wxGetWindowRect(GetHwnd());
+
+        (void)::WinPostMsg( m_hFrame
+                           ,WM_SIZE
+                           ,MPFROM2SHORT(vRect.xRight - vRect.xLeft, vRect.yTop - vRect.yBottom)
+                           ,MPFROM2SHORT(vRect.xRight - vRect.xLeft, vRect.yTop - vRect.yBottom)
+                          );
+    }
+} // end of wxTopLevelWindowOS2::SendSizeEvent
+
 // ----------------------------------------------------------------------------
 // wxTopLevelWindowOS2 fullscreen
 // ----------------------------------------------------------------------------