]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/wincmn.cpp
modifications to URL<->filename conversion: take wxFileName, rename
[wxWidgets.git] / src / common / wincmn.cpp
index 91bdb40bc8f596efda8f1593a3b6c2dae5ca5532..7c40f7ce74a588e0f59a350989752f85a5cdfa3e 100644 (file)
 // static data
 // ----------------------------------------------------------------------------
 
+#if defined(__WXPM__)
+int wxWindowBase::ms_lastControlId = 2000;
+#else
 int wxWindowBase::ms_lastControlId = -200;
+#endif
 
 IMPLEMENT_ABSTRACT_CLASS(wxWindowBase, wxEvtHandler)
 
@@ -466,6 +470,15 @@ void wxWindowBase::Fit()
     //else: do nothing if we have no children
 }
 
+// fits virtual size (ie. scrolled area etc.) around children
+void wxWindowBase::FitInside()
+{
+    if ( GetChildren().GetCount() > 0 )
+    {
+        SetVirtualSize( GetBestVirtualSize() );
+    }
+}
+
 // return the size best suited for the current window
 wxSize wxWindowBase::DoGetBestSize() const
 {
@@ -589,8 +602,6 @@ void wxWindowBase::SetVirtualSizeHints( int minW, int minH,
     m_maxVirtualWidth = maxW;
     m_minVirtualHeight = minH;
     m_maxVirtualHeight = maxH;
-
-    SetVirtualSize( GetClientSize() );
 }
 
 void wxWindowBase::DoSetVirtualSize( int x, int y )
@@ -722,7 +733,13 @@ bool wxWindowBase::Reparent(wxWindowBase *newParent)
 
 void wxWindowBase::PushEventHandler(wxEvtHandler *handler)
 {
-    handler->SetNextHandler(GetEventHandler());
+    wxEvtHandler *handlerOld = GetEventHandler();
+
+    handler->SetNextHandler(handlerOld);
+
+    if ( handlerOld )
+        GetEventHandler()->SetPreviousHandler(handler);
+
     SetEventHandler(handler);
 }
 
@@ -733,7 +750,11 @@ wxEvtHandler *wxWindowBase::PopEventHandler(bool deleteHandler)
     {
         wxEvtHandler *handlerB = handlerA->GetNextHandler();
         handlerA->SetNextHandler((wxEvtHandler *)NULL);
+
+        if ( handlerB )
+            handlerB->SetPreviousHandler((wxEvtHandler *)NULL);
         SetEventHandler(handlerB);
+
         if ( deleteHandler )
         {
             delete handlerA;
@@ -765,6 +786,10 @@ bool wxWindowBase::RemoveEventHandler(wxEvtHandler *handler)
                 SetEventHandler(handlerNext);
             }
 
+            if ( handlerNext )
+            {
+                handlerNext->SetPreviousHandler ( handlerPrev );
+            }
             handler->SetNextHandler(NULL);
 
             return TRUE;
@@ -1739,10 +1764,16 @@ void wxWindowBase::UpdateWindowUI()
 #if wxUSE_TEXTCTRL
                 wxTextCtrl *text = wxDynamicCast(control, wxTextCtrl);
                 if ( text )
-                    text->SetValue(event.GetText());
+                {
+                       if ( event.GetText() != text->GetValue() )
+                       text->SetValue(event.GetText());
+                }
                 else
 #endif // wxUSE_TEXTCTRL
-                    control->SetLabel(event.GetText());
+                               {
+                                       if ( event.GetText() != control->GetLabel() )
+                       control->SetLabel(event.GetText());
+                }
             }
         }
 
@@ -1952,13 +1983,13 @@ struct WXDLLEXPORT wxWindowNext
 
 void wxWindowBase::CaptureMouse()
 {
-    wxLogTrace(_T("mousecapture"), _T("CaptureMouse(0x%08x)"), this);
+    wxLogTrace(_T("mousecapture"), _T("CaptureMouse(%p)"), this);
 
     wxWindow *winOld = GetCapture();
     if ( winOld )
     {
         ((wxWindowBase*) winOld)->DoReleaseMouse();
-       
+
         // save it on stack
         wxWindowNext *item = new wxWindowNext;
         item->win = winOld;
@@ -1972,7 +2003,7 @@ void wxWindowBase::CaptureMouse()
 
 void wxWindowBase::ReleaseMouse()
 {
-    wxLogTrace(_T("mousecapture"), _T("ReleaseMouse(0x%08x)"), this);
+    wxLogTrace(_T("mousecapture"), _T("ReleaseMouse(%p)"), this);
 
     wxASSERT_MSG( GetCapture() == this, wxT("attempt to release mouse, but this window hasn't captured it") );
 
@@ -1981,7 +2012,7 @@ void wxWindowBase::ReleaseMouse()
     if ( ms_winCaptureNext )
     {
         ((wxWindowBase*)ms_winCaptureNext->win)->DoCaptureMouse();
-       
+
         wxWindowNext *item = ms_winCaptureNext;
         ms_winCaptureNext = item->next;
         delete item;
@@ -1989,7 +2020,7 @@ void wxWindowBase::ReleaseMouse()
     //else: stack is empty, no previous capture
 
     wxLogTrace(_T("mousecapture"),
-               _T("After ReleaseMouse() mouse is captured by 0x%08x"),
+               _T("After ReleaseMouse() mouse is captured by %p"),
                GetCapture());
 }
 
@@ -2005,3 +2036,4 @@ wxWindow* wxGetTopLevelParent(wxWindow *win)
     return win;
 }
 
+// vi:sts=4:sw=4:et