]> git.saurik.com Git - wxWidgets.git/commitdiff
More OS/2 Updates
authorDavid Webster <Dave.Webster@bhmi.com>
Mon, 20 Nov 2000 05:18:32 +0000 (05:18 +0000)
committerDavid Webster <Dave.Webster@bhmi.com>
Mon, 20 Nov 2000 05:18:32 +0000 (05:18 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8756 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/os2/frame.h
src/os2/frame.cpp
src/os2/window.cpp

index 7df92f7e21e7604acd61efa21339b6b33ffe329c..dc64bf4ae7d41a4e01eb1443e34961f6d3dd43cc 100644 (file)
@@ -143,6 +143,7 @@ public:
     void      SetClient(WXHWND    c_Hwnd);
     void      SetClient(wxWindow* c_Window);
     wxWindow *GetClient();
+    HWND      GetFrame(void) const { return m_hFrame; }
 
  friend MRESULT EXPENTRY wxFrameWndProc(HWND  hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam);
  friend MRESULT EXPENTRY wxFrameMainWndProc(HWND  hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam);
index edc8f919d2e498b1429dbfa1bd25c66e94b0ab20..ff036110693005c6c7c77b06b375fad15b7ea364 100644 (file)
@@ -55,7 +55,9 @@ extern wxList WXDLLEXPORT wxPendingDelete;
 extern wxChar wxFrameClassName[];
 extern wxMenu *wxCurrentPopupMenu;
 
-extern void  wxAssociateWinWithHandle( HWND hWnd,wxWindow* pWin);
+extern void  wxAssociateWinWithHandle( HWND      hWnd
+                                      ,wxWindow* pWin
+                                     );
 
 // ----------------------------------------------------------------------------
 // event tables
@@ -630,7 +632,7 @@ void wxFrame::InternalSetMenuBar()
         sError = wxPMErrorToStr(vError);
         wxLogError("Error setting parent for submenu. Error: %s\n", sError);
     }
-    WinSendMsg(m_hFrame, WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0);
+    ::WinSendMsg(m_hFrame, WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0);
 } // end of wxFrame::InternalSetMenuBar
 
 //
@@ -706,9 +708,9 @@ bool wxFrame::ShowFullScreen(
 
         if (lStyle & wxFULLSCREEN_NOMENUBAR)
         {
-            ::WinSetParent(m_hMenu, GetHWND(), FALSE);
-            ::WinSetOwner(m_hMenu, GetHWND());
-            ::WinSendMsg((HWND)GetHWND(), WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0);
+            ::WinSetParent(m_hMenu, m_hFrame, FALSE);
+            ::WinSetOwner(m_hMenu, m_hFrame);
+            ::WinSendMsg((HWND)m_hFrame, WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0);
         }
 
 #if wxUSE_STATUSBAR
@@ -732,16 +734,16 @@ bool wxFrame::ShowFullScreen(
         //
         // Save the 'normal' window style
         //
-        m_lFsOldWindowStyle = ::WinQueryWindowULong((HWND)GetHWND(), QWL_STYLE);
+        m_lFsOldWindowStyle = ::WinQueryWindowULong(m_hFrame, QWL_STYLE);
 
         //
-           // Save the old position, width & height, maximize state
+        // Save the old position, width & height, maximize state
         //
         m_vFsOldSize = GetRect();
         m_bFsIsMaximized = IsMaximized();
 
         //
-            // Decide which window style flags to turn off
+        // Decide which window style flags to turn off
         //
         LONG                        lNewStyle = m_lFsOldWindowStyle;
         LONG                        lOffFlags = 0;
@@ -756,7 +758,7 @@ bool wxFrame::ShowFullScreen(
         //
         // Change our window style to be compatible with full-screen mode
         //
-        ::WinSetWindowULong((HWND)GetHWND(), QWL_STYLE, (ULONG)lNewStyle);
+        ::WinSetWindowULong((HWND)m_hFrame, QWL_STYLE, (ULONG)lNewStyle);
 
         //
         // Resize to the size of the desktop
@@ -827,13 +829,13 @@ bool wxFrame::ShowFullScreen(
 
         if ((m_lFsStyle & wxFULLSCREEN_NOMENUBAR) && (m_hMenu != 0))
         {
-            ::WinSetParent(m_hMenu, GetHWND(), FALSE);
-            ::WinSetOwner(m_hMenu, GetHWND());
-            ::WinSendMsg((HWND)GetHWND(), WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0);
+            ::WinSetParent(m_hMenu, m_hFrame, FALSE);
+            ::WinSetOwner(m_hMenu, m_hFrame);
+            ::WinSendMsg(m_hFrame, WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0);
         }
         Maximize(m_bFsIsMaximized);
 
-        ::WinSetWindowULong( (HWND)GetHWND()
+        ::WinSetWindowULong( m_hFrame
                             ,QWL_STYLE
                             ,(ULONG)m_lFsOldWindowStyle
                            );
@@ -1253,7 +1255,7 @@ bool wxFrame::HandlePaint()
             HPOINTER                hIcon;
 
             if (m_icon.Ok())
-                hIcon = (HPOINTER)::WinSendMsg(GetHWND(), WM_QUERYICON, 0L, 0L);
+                hIcon = (HPOINTER)::WinSendMsg(m_hFrame, WM_QUERYICON, 0L, 0L);
             else
                 hIcon = (HPOINTER)m_hDefaultIcon;
 
@@ -1721,7 +1723,7 @@ void wxFrame::SetClient(
         pOldClient->Show( FALSE );
         ::WinSetWindowUShort(pOldClient->GetHWND(), QWS_ID, (USHORT)pOldClient->GetId());
         // to avoid OS/2 bug need to update frame
-        ::WinSendMsg((HWND)this->GetHWND(), WM_UPDATEFRAME, (MPARAM)~0, 0);
+        ::WinSendMsg((HWND)this->GetFrame(), WM_UPDATEFRAME, (MPARAM)~0, 0);
         return;
     }
 
@@ -1746,11 +1748,11 @@ void wxFrame::SetClient(
     if( this->IsShown() )
     {
         this->Show();
-        ::WinSendMsg(GetHWND(), WM_UPDATEFRAME, (MPARAM)~0, 0);
+        ::WinSendMsg(m_hFrame, WM_UPDATEFRAME, (MPARAM)~0, 0);
     }
 }
 
 wxWindow* wxFrame::GetClient()
 {
-    return wxFindWinFromHandle((WXHWND)::WinWindowFromID(GetHWND(), FID_CLIENT));
+    return wxFindWinFromHandle((WXHWND)::WinWindowFromID(m_hFrame, FID_CLIENT));
 }
index fc19d433724e3f34d04dfa3c40ca54bc5ed2c21f..c1ea3d70685fcda3826b8eca8647f524e43cfcd3 100644 (file)
     #include <stdio.h>
 #endif
 
-#define DEBUG_PRINTF(NAME)   { static int raz=0; \
-  printf( #NAME " %i\n",raz); fflush(stdout);       \
-   raz++;                                        \
- }
-
 #if     wxUSE_OWNER_DRAWN
     #include "wx/ownerdrw.h"
 #endif
@@ -250,9 +245,6 @@ bool wxWindow::OS2Command(
 , WXWORD                            WXUNUSED(uId)
 )
 {
-
-DEBUG_PRINTF(wxWindow::OS2Command);
-
     return(FALSE);
 }
 
@@ -302,9 +294,6 @@ void wxWindow::Init()
     m_lLastMouseY = -1;
     m_nLastMouseEvent = -1;
 #endif // wxUSE_MOUSEEVENT_HACK
-
-DEBUG_PRINTF(wxWindow::Init-End);
-
 } // wxWindow::Init
 
 //
@@ -312,7 +301,6 @@ DEBUG_PRINTF(wxWindow::Init-End);
 //
 wxWindow::~wxWindow()
 {
-DEBUG_PRINTF(wxWindow::~wxWindow-Start);
     m_isBeingDeleted = TRUE;
 
     OS2DetachWindowMenu();
@@ -329,7 +317,6 @@ DEBUG_PRINTF(wxWindow::~wxWindow-Start);
         //
         wxRemoveHandleAssociation(this);
     }
-DEBUG_PRINTF(wxWindow::~wxWindow-End);
 } // end of wxWindow::~wxWindow
 
 bool wxWindow::Create(
@@ -518,7 +505,6 @@ bool wxWindow::SetFont(
   const wxFont&                     rFont
 )
 {
-DEBUG_PRINTF(wxWindow::SetFont);
     if (!wxWindowBase::SetFont(rFont))
     {
         // nothing to do
@@ -1338,10 +1324,12 @@ int wxWindow::GetCharHeight() const
     hPs = ::WinGetPS(GetHwnd());
 
     if(!GpiQueryFontMetrics(hPs, sizeof(FONTMETRICS), &vFontMetrics))
+    {
+        ::WinReleasePS(hPs);
         return (0);
-    else
-        return(vFontMetrics.lMaxAscender + vFontMetrics.lMaxDescender);
+    }
     ::WinReleasePS(hPs);
+    return(vFontMetrics.lMaxAscender + vFontMetrics.lMaxDescender);
 } // end of wxWindow::GetCharHeight
 
 int wxWindow::GetCharWidth() const
@@ -1352,10 +1340,12 @@ int wxWindow::GetCharWidth() const
     hPs = ::WinGetPS(GetHwnd());
 
     if(!GpiQueryFontMetrics(hPs, sizeof(FONTMETRICS), &vFontMetrics))
+    {
+        ::WinReleasePS(hPs);
         return (0);
-    else
-        return(vFontMetrics.lAveCharWidth);
+    }
     ::WinReleasePS(hPs);
+    return(vFontMetrics.lAveCharWidth);
 } // end of wxWindow::GetCharWidth
 
 void wxWindow::GetTextExtent(
@@ -1519,8 +1509,6 @@ MRESULT wxWindow::OS2DefWindowProc(
 , WXLPARAM                          lParam
 )
 {
-DEBUG_PRINTF(wxWindow::OS2DefWindowProc);
-
     if (m_fnOldWndProc)
         return (MRESULT)m_fnOldWndProc(GetHWND(), (ULONG)uMsg, (MPARAM)wParam, (MPARAM)lParam);
     else
@@ -1804,7 +1792,6 @@ MRESULT EXPENTRY wxWndProc(
     // Trace all ulMsgs - useful for the debugging
     //
 #ifdef __WXDEBUG__
-DEBUG_PRINTF(__WXDEBUG__wxWndProc);
     wxLogTrace(wxTraceMessages, wxT("Processing %s(wParam=%8lx, lParam=%8lx)"),
                wxGetMessageName(ulMsg), wParam, lParam);
 #endif // __WXDEBUG__
@@ -1933,7 +1920,6 @@ MRESULT wxWindow::OS2WindowProc(
             break;
 
         case WM_PAINT:
-DEBUG_PRINTF(WM_PAINT)
             bProcessed = HandlePaint();
             break;
 
@@ -1944,11 +1930,9 @@ DEBUG_PRINTF(WM_PAINT)
             //
             bProcessed = TRUE;
             mResult = (MRESULT)TRUE;
-DEBUG_PRINTF(WM_CLOSE)
             break;
 
         case WM_SHOW:
-DEBUG_PRINTF(WM_SHOW)
             bProcessed = HandleShow(wParam != 0, (int)lParam);
             break;
 
@@ -1987,11 +1971,9 @@ DEBUG_PRINTF(WM_SHOW)
             {
                 WORD id, cmd;
                 WXHWND hwnd;
-DEBUG_PRINTF(WM_COMMAND-in)
                 UnpackCommand(wParam, lParam, &id, &hwnd, &cmd);
 
                 bProcessed = HandleCommand(id, cmd, hwnd);
-DEBUG_PRINTF(WM_COMMAND-out)
             }
             break;