X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a289b10d2ce67a39d5e18d49716afdbcfce2c188..5278469615164a60b22435aae4734e106aba540d:/src/os2/window.cpp?ds=sidebyside diff --git a/src/os2/window.cpp b/src/os2/window.cpp index 444a0756c2..8a7945ab51 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -4,7 +4,6 @@ // Author: David Webster // Modified by: // Created: 10/12/99 -// RCS-ID: $Id$ // Copyright: (c) David Webster // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -170,9 +169,7 @@ static wxWindow* gpWinBeingCreated = NULL; // method #ifdef __WXUNIVERSAL__ IMPLEMENT_ABSTRACT_CLASS(wxWindowOS2, wxWindowBase) -#else // __WXPM__ - IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase) -#endif // __WXUNIVERSAL__/__WXPM__ +#endif // __WXUNIVERSAL__ BEGIN_EVENT_TABLE(wxWindowOS2, wxWindowBase) EVT_ERASE_BACKGROUND(wxWindowOS2::OnEraseBackground) @@ -334,7 +331,7 @@ void wxWindowOS2::Init() // wxWindowOS2::~wxWindowOS2() { - m_isBeingDeleted = true; + SendDestroyEvent(); for (wxWindow* pWin = GetParent(); pWin; pWin = pWin->GetParent()) { @@ -352,7 +349,9 @@ wxWindowOS2::~wxWindowOS2() if (m_hWnd) { if(!::WinDestroyWindow(GetHWND())) + { wxLogLastError(wxT("DestroyWindow")); + } // // remove hWnd <-> wxWindow association // @@ -384,7 +383,7 @@ bool wxWindowOS2::Create( wxWindow* pParent, // static box // wxASSERT_MSG( !wxDynamicCast(pParent, wxStaticBox), - _T("wxStaticBox can't be used as a window parent!") ); + wxT("wxStaticBox can't be used as a window parent!") ); #endif // wxUSE_STATBOX // Ensure groupbox backgrounds are painted @@ -454,7 +453,7 @@ bool wxWindowOS2::Create( wxWindow* pParent, void wxWindowOS2::SetFocus() { HWND hWnd = GetHwnd(); - wxCHECK_RET( hWnd, _T("can't set focus to invalid window") ); + wxCHECK_RET( hWnd, wxT("can't set focus to invalid window") ); if (hWnd) ::WinSetFocus(HWND_DESKTOP, hWnd); @@ -545,7 +544,7 @@ void wxWindowOS2::DoReleaseMouse() /* static */ wxWindow* wxWindowBase::GetCapture() { HWND hwnd = ::WinQueryCapture(HWND_DESKTOP); - return hwnd ? wxFindWinFromHandle((WXHWND)hwnd) : (wxWindow *)NULL; + return hwnd ? wxFindWinFromHandle((WXHWND)hwnd) : NULL; } // end of wxWindowBase::GetCapture bool wxWindowOS2::SetFont( const wxFont& rFont ) @@ -571,7 +570,7 @@ bool wxWindowOS2::SetCursor( const wxCursor& rCursor) return false; } - if ( m_cursor.Ok() ) { + if ( m_cursor.IsOk() ) { HWND hWnd = GetHwnd(); POINTL vPoint; RECTL vRect; @@ -1087,8 +1086,6 @@ void wxWindowOS2::OnIdle( (void)HandleWindowEvent(rEvent); } } - if (wxUpdateUIEvent::CanUpdate(this)) - UpdateWindowUI(wxUPDATE_UI_FROMIDLE); } // end of wxWindowOS2::OnIdle // @@ -1253,7 +1250,7 @@ void wxWindowOS2::DoGetPosition( // use WinQueryWindowPos. This call, unlike the WIN32 call, however, // returns a position relative to it's parent, so no parent adujstments // are needed under OS/2. Also, windows should be created using - // wxWindow coordinates, i.e 0,0 is the TOP left. + // wxWindow coordinates, i.e. 0,0 is the TOP left. // if (IsKindOf(CLASSINFO(wxFrame))) { @@ -1661,12 +1658,12 @@ int wxWindowOS2::GetCharWidth() const return(vFontMetrics.lAveCharWidth); } // end of wxWindowOS2::GetCharWidth -void wxWindowOS2::GetTextExtent( const wxString& rString, - int* pX, - int* pY, - int* pDescent, - int* pExternalLeading, - const wxFont* WXUNUSED(pTheFont) ) const +void wxWindowOS2::DoGetTextExtent( const wxString& rString, + int* pX, + int* pY, + int* pDescent, + int* pExternalLeading, + const wxFont* WXUNUSED(pTheFont) ) const { POINTL avPoint[TXTBOX_COUNT]; POINTL vPtMin; @@ -1750,7 +1747,7 @@ void wxWindowOS2::GetTextExtent( const wxString& rString, *pExternalLeading = 0; } ::WinReleasePS(hPS); -} // end of wxWindow::GetTextExtent +} // end of wxWindow::DoGetTextExtent bool wxWindowOS2::IsMouseInWindow() const { @@ -1786,7 +1783,6 @@ bool wxWindowOS2::DoPopupMenu( wxMenu* pMenu, int nX, int nY ) bool bIsWaiting = true; int nHeight; - pMenu->SetInvokingWindow(this); pMenu->UpdateUI(); if ( nX == -1 && nY == -1 ) @@ -1822,7 +1818,6 @@ bool wxWindowOS2::DoPopupMenu( wxMenu* pMenu, int nX, int nY ) ::WinDispatchMsg(vHabmain, (PQMSG)&vMsg); } - pMenu->SetInvokingWindow(NULL); return true; } // end of wxWindowOS2::DoPopupMenu #endif // wxUSE_MENUS_NATIVE @@ -2548,7 +2543,7 @@ MRESULT wxWindowOS2::OS2WindowProc( WXUINT uMsg, (pPage->ulPageIdNew > 0L && pPage->ulPageIdCur > 0L)) { wxWindowOS2* pWin = wxFindWinFromHandle(pPage->hwndBook); - wxNotebookEvent vEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED + wxBookCtrlEvent vEvent( wxEVT_NOTEBOOK_PAGE_CHANGED ,(int)SHORT1FROMMP(wParam) ,(int)pPage->ulPageIdNew ,(int)pPage->ulPageIdCur @@ -2853,7 +2848,7 @@ void wxAssociateWinWithHandle( { wxString Newstr(pWin->GetClassInfo()->GetClassName()); wxString Oldstr(pOldWin->GetClassInfo()->GetClassName()); - wxLogError( _T("Bug! New window of class %s has same HWND %X as old window of class %s"), + wxLogError( wxT("Bug! New window of class %s has same HWND %X as old window of class %s"), Newstr.c_str(), (int)hWnd, Oldstr.c_str() @@ -2999,7 +2994,7 @@ bool wxWindowOS2::OS2Create( PSZ zClass, { vError = ::WinGetLastError(vHabmain); sError = wxPMErrorToStr(vError); - wxLogError(_T("Error creating frame. Error: %s\n"), sError.c_str()); + wxLogError(wxT("Error creating frame. Error: %s\n"), sError.c_str()); return false; } SetSize( nX @@ -3038,11 +3033,7 @@ bool wxWindowOS2::HandleDestroy() // Delete our drop target if we've got one // #if wxUSE_DRAG_AND_DROP - if (m_dropTarget != NULL) - { - delete m_dropTarget; - m_dropTarget = NULL; - } + wxDELETE(m_dropTarget); #endif // wxUSE_DRAG_AND_DROP // @@ -3222,7 +3213,7 @@ bool wxWindowOS2::OS2OnDrawItem( int vId, ,pMeasureStruct->rclItem.yTop - pMeasureStruct->rclItem.yBottom ); - wxPMDCImpl *impl = (wxPMDCImpl*) vDc.GetImpl(); + wxPMDCImpl *impl = (wxPMDCImpl*) vDc.GetImpl(); impl->SetHDC( hDC, false ); impl->SetHPS( pMeasureStruct->hps ); // @@ -3238,7 +3229,7 @@ bool wxWindowOS2::OS2OnDrawItem( int vId, { vError = ::WinGetLastError(vHabmain); sError = wxPMErrorToStr(vError); - wxLogError(_T("Unable to set current color table (1). Error: %s\n"), sError.c_str()); + wxLogError(wxT("Unable to set current color table (1). Error: %s\n"), sError.c_str()); } // // Set the color table to RGB mode @@ -3253,7 +3244,7 @@ bool wxWindowOS2::OS2OnDrawItem( int vId, { vError = ::WinGetLastError(vHabmain); sError = wxPMErrorToStr(vError); - wxLogError(_T("Unable to set current color table (2). Error: %s\n"), sError.c_str()); + wxLogError(wxT("Unable to set current color table (2). Error: %s\n"), sError.c_str()); } wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE );