]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/wincmn.cpp
Stripped out miscellaneous Motif/Xt-specific code
[wxWidgets.git] / src / common / wincmn.cpp
index a72ede3d9ffe098f0ace7bcfaf5680c84f435e1f..ce68b5ac34ac2e916e0eaa1d26ae815de77ce137 100644 (file)
@@ -214,6 +214,8 @@ bool wxWindowBase::CreateBase(wxWindowBase *parent,
 // common clean up
 wxWindowBase::~wxWindowBase()
 {
+    wxASSERT_MSG( GetCapture() != this, wxT("attempt to destroy window with mouse capture") );
+
     // FIXME if these 2 cases result from programming errors in the user code
     //       we should probably assert here instead of silently fixing them
 
@@ -631,6 +633,41 @@ wxEvtHandler *wxWindowBase::PopEventHandler(bool deleteHandler)
     return handlerA;
 }
 
+bool wxWindowBase::RemoveEventHandler(wxEvtHandler *handler)
+{
+    wxCHECK_MSG( handler, FALSE, _T("RemoveEventHandler(NULL) called") );
+
+    wxEvtHandler *handlerPrev = NULL,
+                 *handlerCur = GetEventHandler();
+    while ( handlerCur )
+    {
+        wxEvtHandler *handlerNext = handlerCur->GetNextHandler();
+
+        if ( handlerCur == handler )
+        {
+            if ( handlerPrev )
+            {
+                handlerPrev->SetNextHandler(handlerNext);
+            }
+            else
+            {
+                SetEventHandler(handlerNext);
+            }
+
+            handler->SetNextHandler(NULL);
+
+            return TRUE;
+        }
+
+        handlerPrev = handlerCur;
+        handlerCur = handlerNext;
+    }
+
+    wxFAIL_MSG( _T("where has the event handler gone?") );
+
+    return FALSE;
+}
+
 // ----------------------------------------------------------------------------
 // cursors, fonts &c
 // ----------------------------------------------------------------------------
@@ -1124,6 +1161,9 @@ bool wxWindowBase::Layout()
         GetClientSize(&w, &h);
 
         GetSizer()->SetDimension( 0, 0, w, h );
+#if defined __WXPM__
+        OS2Layout(w, h);
+#endif
     }
     else
     {
@@ -1511,6 +1551,11 @@ void wxWindowBase::OnMiddleClick( wxMouseEvent& event )
     {
         // don't translate these strings
         wxString port;
+
+#ifdef __WXUNIVERSAL__
+        port = _T("Univ/");
+#endif // __WXUNIVERSAL__
+
         switch ( wxGetOsVersion() )
         {
             case wxMOTIF_X:     port = _T("Motif"); break;
@@ -1538,7 +1583,7 @@ void wxWindowBase::OnMiddleClick( wxMouseEvent& event )
 
         wxMessageBox(wxString::Format(
                                       _T(
-                                        "       wxWindows Library (%s port)\nVersion %u.%u.%u%s, compiled at %s %s\n   Copyright (c) 1995-2001 wxWindows team"
+                                        "       wxWindows Library (%s port)\nVersion %u.%u.%u%s, compiled at %s %s\n   Copyright (c) 1995-2002 wxWindows team"
                                         ),
                                       port.c_str(),
                                       wxMAJOR_VERSION,
@@ -1620,7 +1665,7 @@ struct WXDLLEXPORT wxWindowNext
 {
     wxWindow *win;
     wxWindowNext *next;
-} *wxWindow::ms_winCaptureNext = NULL;
+} *wxWindowBase::ms_winCaptureNext = NULL;
 
 void wxWindowBase::CaptureMouse()
 {
@@ -1642,6 +1687,10 @@ void wxWindowBase::CaptureMouse()
 
 void wxWindowBase::ReleaseMouse()
 {
+    wxLogTrace(_T("mousecapture"), _T("ReleaseMouse(0x%08x)"), this);
+
+    wxASSERT_MSG( GetCapture() == this, wxT("attempt to release mouse, but this window hasn't captured it") )
+
     DoReleaseMouse();
 
     if ( ms_winCaptureNext )