]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/object.h
Lots of updates for color dialog and sliders
[wxWidgets.git] / include / wx / object.h
index 289263764593b448c24675dab63a15dabe650d1c..7c161ab1135b867e9f64a6bb4e0801980ed16783 100644 (file)
@@ -72,16 +72,28 @@ public:
         , m_baseInfo1(0)
         , m_baseInfo2(0)
         , m_next(sm_first)
+        { sm_first = this; }
+
+    ~wxClassInfo()
+    {
+        if (sm_first == this)
         {
-#ifdef __WXDEBUG__
-            if (sm_classTable != NULL) {
-                wxString msg(_T("too late binding of class info (lazy binding) for "));
-                msg += className;
-                wxFAIL_MSG(msg);
+            sm_first = m_next;
+        }
+        else
+        {
+            wxClassInfo * info = sm_first;
+            while (info)
+            {
+                if (info->m_next == this)
+                {
+                    info->m_next = m_next;
+                    break;
+                }
+                info = info->m_next;
             }
-#endif
-            sm_first = this;
         }
+    }
 
     wxObject *CreateObject() { return m_objectConstructor ? (*m_objectConstructor)() : 0; }
 
@@ -411,12 +423,29 @@ inline void wxCheckCast(void *ptr)
 class WXDLLEXPORT wxObject
 {
     DECLARE_ABSTRACT_CLASS(wxObject)
-    DECLARE_NO_COPY_CLASS(wxObject)
 
+private:
+    void InitFrom(const wxObject& other);
+    
 public:
     wxObject() { m_refData = NULL; }
     virtual ~wxObject() { UnRef(); }
     
+    wxObject(const wxObject& other)
+        {
+            InitFrom(other);
+        }
+    
+    wxObject& operator=(const wxObject& other)
+    {
+        if ( this != &other )
+        {
+            UnRef();
+            InitFrom(other);
+        }
+        return *this;
+    }
+
     bool IsKindOf(wxClassInfo *info) const;