From b7084589db4dcab0442fa652672fb4d5c0aa6949 Mon Sep 17 00:00:00 2001 From: David Webster Date: Mon, 20 Nov 2000 05:18:32 +0000 Subject: [PATCH] More OS/2 Updates git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8756 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/os2/frame.h | 1 + src/os2/frame.cpp | 36 +++++++++++++++++++----------------- src/os2/window.cpp | 34 ++++++++-------------------------- 3 files changed, 28 insertions(+), 43 deletions(-) diff --git a/include/wx/os2/frame.h b/include/wx/os2/frame.h index 7df92f7e21..dc64bf4ae7 100644 --- a/include/wx/os2/frame.h +++ b/include/wx/os2/frame.h @@ -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); diff --git a/src/os2/frame.cpp b/src/os2/frame.cpp index edc8f919d2..ff03611069 100644 --- a/src/os2/frame.cpp +++ b/src/os2/frame.cpp @@ -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)); } diff --git a/src/os2/window.cpp b/src/os2/window.cpp index fc19d43372..c1ea3d7068 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -37,11 +37,6 @@ #include #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; -- 2.45.2