]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/object.cpp
invalidate the best size when adding or deleting items
[wxWidgets.git] / src / common / object.cpp
index 0a77aab57b8ee2a0514885b5769f73470ab634d2..6b4d7e2ae9ca6c4d59bbee88f74ee166aa2f0223 100644 (file)
@@ -288,6 +288,48 @@ wxObject *wxCreateDynamicObject(const wxChar *name)
     }
 }
 
+// iterator interface
+wxClassInfo::const_iterator::value_type
+wxClassInfo::const_iterator::operator*() const
+{
+    return (wxClassInfo*)m_node->GetData();
+}
+
+wxClassInfo::const_iterator& wxClassInfo::const_iterator::operator++()
+{
+    m_node = m_table->Next();
+    return *this;
+}
+
+const wxClassInfo::const_iterator wxClassInfo::const_iterator::operator++(int)
+{
+    wxClassInfo::const_iterator tmp = *this;
+    m_node = m_table->Next();
+    return tmp;
+}
+
+wxClassInfo::const_iterator wxClassInfo::begin_classinfo()
+{
+    sm_classTable->BeginFind();
+
+    return const_iterator(sm_classTable->Next(), sm_classTable);
+}
+
+wxClassInfo::const_iterator wxClassInfo::end_classinfo()
+{
+    return const_iterator(NULL, NULL);
+}
+
+// ----------------------------------------------------------------------------
+// wxObjectRefData
+// ----------------------------------------------------------------------------
+
+void wxObjectRefData::DecRef()
+{
+    if ( --m_count == 0 )
+        delete this;
+}
+
 
 // ----------------------------------------------------------------------------
 // wxObject
@@ -310,7 +352,7 @@ void wxObject::Ref(const wxObject& clone)
     if ( clone.m_refData )
     {
         m_refData = clone.m_refData;
-        ++(m_refData->m_count);
+        m_refData->IncRef();
     }
 }
 
@@ -320,8 +362,7 @@ void wxObject::UnRef()
     {
         wxASSERT_MSG( m_refData->m_count > 0, _T("invalid ref data count") );
 
-        if ( --m_refData->m_count == 0 )
-            delete m_refData;
+        m_refData->DecRef();
         m_refData = NULL;
     }
 }