]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/wincmn.cpp
Removed rundant files, updated readme.txt.
[wxWidgets.git] / src / common / wincmn.cpp
index 6f9473274833ee1610804d37e0a283dfe0ca4f8d..205402dd18eb1f9053806683ffef5f9d579d4f48 100644 (file)
 // static data
 // ----------------------------------------------------------------------------
 
 // static data
 // ----------------------------------------------------------------------------
 
+#if defined(__WXPM__)
+int wxWindowBase::ms_lastControlId = 2000;
+#else
 int wxWindowBase::ms_lastControlId = -200;
 int wxWindowBase::ms_lastControlId = -200;
+#endif
 
 IMPLEMENT_ABSTRACT_CLASS(wxWindowBase, wxEvtHandler)
 
 
 IMPLEMENT_ABSTRACT_CLASS(wxWindowBase, wxEvtHandler)
 
@@ -722,8 +726,13 @@ bool wxWindowBase::Reparent(wxWindowBase *newParent)
 
 void wxWindowBase::PushEventHandler(wxEvtHandler *handler)
 {
 
 void wxWindowBase::PushEventHandler(wxEvtHandler *handler)
 {
-    handler->SetNextHandler(GetEventHandler());
-    GetEventHandler()->SetPreviousHandler(handler);
+    wxEvtHandler *handlerOld = GetEventHandler();
+
+    handler->SetNextHandler(handlerOld);
+
+    if ( handlerOld )
+        GetEventHandler()->SetPreviousHandler(handler);
+
     SetEventHandler(handler);
 }
 
     SetEventHandler(handler);
 }
 
@@ -734,8 +743,11 @@ wxEvtHandler *wxWindowBase::PopEventHandler(bool deleteHandler)
     {
         wxEvtHandler *handlerB = handlerA->GetNextHandler();
         handlerA->SetNextHandler((wxEvtHandler *)NULL);
     {
         wxEvtHandler *handlerB = handlerA->GetNextHandler();
         handlerA->SetNextHandler((wxEvtHandler *)NULL);
-        handlerB->SetPreviousHandler((wxEvtHandler *)NULL);
+
+        if ( handlerB )
+            handlerB->SetPreviousHandler((wxEvtHandler *)NULL);
         SetEventHandler(handlerB);
         SetEventHandler(handlerB);
+
         if ( deleteHandler )
         {
             delete handlerA;
         if ( deleteHandler )
         {
             delete handlerA;
@@ -1964,7 +1976,7 @@ void wxWindowBase::CaptureMouse()
     if ( winOld )
     {
         ((wxWindowBase*) winOld)->DoReleaseMouse();
     if ( winOld )
     {
         ((wxWindowBase*) winOld)->DoReleaseMouse();
-       
+
         // save it on stack
         wxWindowNext *item = new wxWindowNext;
         item->win = winOld;
         // save it on stack
         wxWindowNext *item = new wxWindowNext;
         item->win = winOld;
@@ -1987,7 +1999,7 @@ void wxWindowBase::ReleaseMouse()
     if ( ms_winCaptureNext )
     {
         ((wxWindowBase*)ms_winCaptureNext->win)->DoCaptureMouse();
     if ( ms_winCaptureNext )
     {
         ((wxWindowBase*)ms_winCaptureNext->win)->DoCaptureMouse();
-       
+
         wxWindowNext *item = ms_winCaptureNext;
         ms_winCaptureNext = item->next;
         delete item;
         wxWindowNext *item = ms_winCaptureNext;
         ms_winCaptureNext = item->next;
         delete item;