]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/wincmn.cpp
replaced C++ comments with C ones
[wxWidgets.git] / src / common / wincmn.cpp
index 864bb24f1a507c783f3a9bafebb4a505c02eb967..92480ea046b8528412c85f90f93f0e9fb04381c1 100644 (file)
@@ -268,6 +268,12 @@ wxWindowBase::~wxWindowBase()
     if ( m_tooltip )
         delete m_tooltip;
 #endif // wxUSE_TOOLTIPS
+
+    // reset the dangling pointer our parent window may keep to us
+    if ( m_parent && m_parent->GetDefaultItem() == this )
+    {
+        m_parent->SetDefaultItem(NULL);
+    }
 }
 
 bool wxWindowBase::Destroy()
@@ -1271,7 +1277,7 @@ void wxWindowBase::SetConstraintSizes(bool recurse)
         while (node)
         {
             wxWindow *win = node->GetData();
-            if ( !win->IsTopLevel() )
+            if ( !win->IsTopLevel() && win->GetConstraints() )
                 win->SetConstraintSizes();
             node = node->GetNext();
         }
@@ -1349,6 +1355,23 @@ void wxWindowBase::GetClientSizeConstraint(int *w, int *h) const
         GetClientSize(w, h);
 }
 
+void wxWindowBase::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags)
+{
+    // don't do it for the dialogs/frames - they float independently of their
+    // parent
+    if ( !IsTopLevel() )
+    {
+        wxWindow *parent = GetParent();
+        if ( !(sizeFlags & wxSIZE_NO_ADJUSTMENTS) && parent )
+        {
+            wxPoint pt(parent->GetClientAreaOrigin());
+            x += pt.x;
+            y += pt.y;
+        }
+    }
+}
+
+
 void wxWindowBase::GetPositionConstraint(int *x, int *y) const
 {
     wxLayoutConstraints *constr = GetConstraints();
@@ -1384,7 +1407,7 @@ void wxWindowBase::UpdateWindowUI()
 
         if ( event.GetSetText() )
         {
-            wxControl *control = wxDynamicThisCast(this, wxControl);
+            wxControl *control = wxDynamicCastThis(wxControl);
             if ( control )
             {
 #if wxUSE_TEXTCTRL
@@ -1398,7 +1421,7 @@ void wxWindowBase::UpdateWindowUI()
         }
 
 #if wxUSE_CHECKBOX
-        wxCheckBox *checkbox = wxDynamicThisCast(this, wxCheckBox);
+        wxCheckBox *checkbox = wxDynamicCastThis(wxCheckBox);
         if ( checkbox )
         {
             if ( event.GetSetChecked() )
@@ -1407,7 +1430,7 @@ void wxWindowBase::UpdateWindowUI()
 #endif // wxUSE_CHECKBOX
 
 #if wxUSE_RADIOBTN
-        wxRadioButton *radiobtn = wxDynamicThisCast(this, wxRadioButton);
+        wxRadioButton *radiobtn = wxDynamicCastThis(wxRadioButton);
         if ( radiobtn )
         {
             if ( event.GetSetChecked() )
@@ -1556,7 +1579,7 @@ void wxWindowBase::OnMiddleClick( wxMouseEvent& event )
 
         wxMessageBox(wxString::Format(
                                       _T(
-                                        "       wxWindows Library (%s port)\nVersion %u.%u.%u, compiled at %s %s\n   Copyright (c) 1995-2000 wxWindows team"
+                                        "       wxWindows Library (%s port)\nVersion %u.%u.%u, compiled at %s %s\n   Copyright (c) 1995-2001 wxWindows team"
                                         ),
                                       port.c_str(),
                                       wxMAJOR_VERSION,