]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/window.cpp
fix GCC warning
[wxWidgets.git] / src / os2 / window.cpp
index 444a0756c2312a3224852fa1a1a630ac1fdde6c4..2974b884e33aa61b55f5c132ea31759a82fc693f 100644 (file)
@@ -170,9 +170,7 @@ static wxWindow*                    gpWinBeingCreated = NULL;
 // method
 #ifdef __WXUNIVERSAL__
     IMPLEMENT_ABSTRACT_CLASS(wxWindowOS2, wxWindowBase)
 // 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)
 
 BEGIN_EVENT_TABLE(wxWindowOS2, wxWindowBase)
     EVT_ERASE_BACKGROUND(wxWindowOS2::OnEraseBackground)
@@ -334,7 +332,7 @@ void wxWindowOS2::Init()
 //
 wxWindowOS2::~wxWindowOS2()
 {
 //
 wxWindowOS2::~wxWindowOS2()
 {
-    m_isBeingDeleted = true;
+    SendDestroyEvent();
 
     for (wxWindow* pWin = GetParent(); pWin; pWin = pWin->GetParent())
     {
 
     for (wxWindow* pWin = GetParent(); pWin; pWin = pWin->GetParent())
     {
@@ -352,7 +350,9 @@ wxWindowOS2::~wxWindowOS2()
     if (m_hWnd)
     {
         if(!::WinDestroyWindow(GetHWND()))
     if (m_hWnd)
     {
         if(!::WinDestroyWindow(GetHWND()))
+        {
             wxLogLastError(wxT("DestroyWindow"));
             wxLogLastError(wxT("DestroyWindow"));
+        }
         //
         // remove hWnd <-> wxWindow association
         //
         //
         // remove hWnd <-> wxWindow association
         //
@@ -384,7 +384,7 @@ bool wxWindowOS2::Create( wxWindow*       pParent,
     // static box
     //
     wxASSERT_MSG( !wxDynamicCast(pParent, wxStaticBox),
     // 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
 #endif // wxUSE_STATBOX
 
      // Ensure groupbox backgrounds are painted
@@ -454,7 +454,7 @@ bool wxWindowOS2::Create( wxWindow*       pParent,
 void wxWindowOS2::SetFocus()
 {
     HWND                            hWnd = GetHwnd();
 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);
 
     if (hWnd)
         ::WinSetFocus(HWND_DESKTOP, hWnd);
@@ -545,7 +545,7 @@ void wxWindowOS2::DoReleaseMouse()
 /* static */ wxWindow* wxWindowBase::GetCapture()
 {
     HWND hwnd = ::WinQueryCapture(HWND_DESKTOP);
 /* 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 )
 } // end of wxWindowBase::GetCapture
 
 bool wxWindowOS2::SetFont( const wxFont& rFont )
@@ -1087,8 +1087,6 @@ void wxWindowOS2::OnIdle(
             (void)HandleWindowEvent(rEvent);
         }
     }
             (void)HandleWindowEvent(rEvent);
         }
     }
-    if (wxUpdateUIEvent::CanUpdate(this))
-        UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
 } // end of wxWindowOS2::OnIdle
 
 //
 } // end of wxWindowOS2::OnIdle
 
 //
@@ -1661,12 +1659,12 @@ int wxWindowOS2::GetCharWidth() const
     return(vFontMetrics.lAveCharWidth);
 } // end of wxWindowOS2::GetCharWidth
 
     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;
 {
     POINTL      avPoint[TXTBOX_COUNT];
     POINTL      vPtMin;
@@ -1750,7 +1748,7 @@ void wxWindowOS2::GetTextExtent( const wxString& rString,
             *pExternalLeading = 0;
     }
     ::WinReleasePS(hPS);
             *pExternalLeading = 0;
     }
     ::WinReleasePS(hPS);
-} // end of wxWindow::GetTextExtent
+} // end of wxWindow::DoGetTextExtent
 
 bool wxWindowOS2::IsMouseInWindow() const
 {
 
 bool wxWindowOS2::IsMouseInWindow() const
 {
@@ -1786,7 +1784,6 @@ bool wxWindowOS2::DoPopupMenu( wxMenu* pMenu, int nX, int nY )
     bool bIsWaiting = true;
     int nHeight;
 
     bool bIsWaiting = true;
     int nHeight;
 
-    pMenu->SetInvokingWindow(this);
     pMenu->UpdateUI();
 
     if ( nX == -1 && nY == -1 )
     pMenu->UpdateUI();
 
     if ( nX == -1 && nY == -1 )
@@ -1822,7 +1819,6 @@ bool wxWindowOS2::DoPopupMenu( wxMenu* pMenu, int nX, int nY )
         ::WinDispatchMsg(vHabmain, (PQMSG)&vMsg);
     }
 
         ::WinDispatchMsg(vHabmain, (PQMSG)&vMsg);
     }
 
-    pMenu->SetInvokingWindow(NULL);
     return true;
 } // end of wxWindowOS2::DoPopupMenu
 #endif // wxUSE_MENUS_NATIVE
     return true;
 } // end of wxWindowOS2::DoPopupMenu
 #endif // wxUSE_MENUS_NATIVE
@@ -2548,7 +2544,7 @@ MRESULT wxWindowOS2::OS2WindowProc( WXUINT uMsg,
                             (pPage->ulPageIdNew > 0L && pPage->ulPageIdCur > 0L))
                         {
                             wxWindowOS2*        pWin = wxFindWinFromHandle(pPage->hwndBook);
                             (pPage->ulPageIdNew > 0L && pPage->ulPageIdCur > 0L))
                         {
                             wxWindowOS2*        pWin = wxFindWinFromHandle(pPage->hwndBook);
-                            wxNotebookEvent     vEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
+                            wxBookCtrlEvent     vEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
                                                        ,(int)SHORT1FROMMP(wParam)
                                                        ,(int)pPage->ulPageIdNew
                                                        ,(int)pPage->ulPageIdCur
                                                        ,(int)SHORT1FROMMP(wParam)
                                                        ,(int)pPage->ulPageIdNew
                                                        ,(int)pPage->ulPageIdCur
@@ -2853,7 +2849,7 @@ void wxAssociateWinWithHandle(
     {
         wxString  Newstr(pWin->GetClassInfo()->GetClassName());
         wxString Oldstr(pOldWin->GetClassInfo()->GetClassName());
     {
         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()
                     Newstr.c_str(),
                     (int)hWnd,
                     Oldstr.c_str()
@@ -2999,7 +2995,7 @@ bool wxWindowOS2::OS2Create( PSZ            zClass,
     {
         vError = ::WinGetLastError(vHabmain);
         sError = wxPMErrorToStr(vError);
     {
         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
         return false;
     }
     SetSize( nX
@@ -3038,11 +3034,7 @@ bool wxWindowOS2::HandleDestroy()
     // Delete our drop target if we've got one
     //
 #if wxUSE_DRAG_AND_DROP
     // 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
 
     //
 #endif // wxUSE_DRAG_AND_DROP
 
     //
@@ -3222,7 +3214,7 @@ bool wxWindowOS2::OS2OnDrawItem( int vId,
                                           ,pMeasureStruct->rclItem.yTop - pMeasureStruct->rclItem.yBottom
                                          );
 
                                           ,pMeasureStruct->rclItem.yTop - pMeasureStruct->rclItem.yBottom
                                          );
 
-       wxPMDCImpl *impl = (wxPMDCImpl*) vDc.GetImpl();
+        wxPMDCImpl *impl = (wxPMDCImpl*) vDc.GetImpl();
         impl->SetHDC( hDC, false );
         impl->SetHPS( pMeasureStruct->hps );
         //
         impl->SetHDC( hDC, false );
         impl->SetHPS( pMeasureStruct->hps );
         //
@@ -3238,7 +3230,7 @@ bool wxWindowOS2::OS2OnDrawItem( int vId,
         {
             vError = ::WinGetLastError(vHabmain);
             sError = wxPMErrorToStr(vError);
         {
             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
         }
         //
         // Set the color table to RGB mode
@@ -3253,7 +3245,7 @@ bool wxWindowOS2::OS2OnDrawItem( int vId,
         {
             vError = ::WinGetLastError(vHabmain);
             sError = wxPMErrorToStr(vError);
         {
             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 );
         }
 
         wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE );