]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/object.h
Implement monitoring of file descriptors in wxMotif event loop.
[wxWidgets.git] / include / wx / object.h
index 26bfc5b1e4f5ef426aae3852bba8228f3c55c1f6..cb9d8f8c98ff700ce587223aae669ae5fb4ebc5c 100644 (file)
 
 #include "wx/memory.h"
 
+#define wxDECLARE_CLASS_INFO_ITERATORS()                                     \
+class WXDLLIMPEXP_BASE const_iterator                                    \
+    {                                                                        \
+    typedef wxHashTable_Node Node;                                       \
+    public:                                                                  \
+    typedef const wxClassInfo* value_type;                               \
+    typedef const value_type& const_reference;                           \
+    typedef const_iterator itor;                                         \
+    typedef value_type* ptr_type;                                        \
+    \
+    Node* m_node;                                                        \
+    wxHashTable* m_table;                                                \
+    public:                                                                  \
+    typedef const_reference reference_type;                              \
+    typedef ptr_type pointer_type;                                       \
+    \
+    const_iterator(Node* node, wxHashTable* table)                       \
+    : m_node(node), m_table(table) { }                               \
+    const_iterator() : m_node(NULL), m_table(NULL) { }                   \
+    value_type operator*() const;                                        \
+    itor& operator++();                                                  \
+    const itor operator++(int);                                          \
+    bool operator!=(const itor& it) const                                \
+            { return it.m_node != m_node; }                                  \
+            bool operator==(const itor& it) const                                \
+            { return it.m_node == m_node; }                                  \
+    };                                                                       \
+    \
+    static const_iterator begin_classinfo();                                 \
+    static const_iterator end_classinfo()
+
 // based on the value of wxUSE_EXTENDED_RTTI symbol,
 // only one of the RTTI system will be compiled:
 // - the "old" one (defined by rtti.h) or
 #include "wx/xti.h"
 #include "wx/rtti.h"
 
+#define wxIMPLEMENT_CLASS(name, basename)                                     \
+    wxIMPLEMENT_ABSTRACT_CLASS(name, basename)
+
+#define wxIMPLEMENT_CLASS2(name, basename1, basename2)                        \
+    wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2)
+
 // -----------------------------------
 // for pluggable classes
 // -----------------------------------
@@ -158,9 +195,8 @@ inline T *wxCheckCast(const void *ptr, T * = NULL)
     #define _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET
 #endif
 
-// Only VC++ 6 and CodeWarrior get overloaded delete that matches new
-#if (defined(__VISUALC__) && (__VISUALC__ >= 1200)) || \
-        (defined(__MWERKS__) && (__MWERKS__ >= 0x2400))
+// Only VC++ 6 gets overloaded delete that matches new
+#if (defined(__VISUALC__) && (__VISUALC__ >= 1200))
     #define _WX_WANT_DELETE_VOID_WXCHAR_INT
 #endif
 
@@ -176,16 +212,29 @@ inline T *wxCheckCast(const void *ptr, T * = NULL)
     #if !defined(__VISUALC__)
         #define _WX_WANT_ARRAY_DELETE_VOID
     #endif
-
-    // Only CodeWarrior 6 or higher
-    #if defined(__MWERKS__) && (__MWERKS__ >= 0x2400)
-        #define _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT
-    #endif
-
 #endif // wxUSE_ARRAY_MEMORY_OPERATORS
 
 #endif // wxUSE_MEMORY_TRACING
 
+// ----------------------------------------------------------------------------
+// Compatibility macro aliases DECLARE group
+// ----------------------------------------------------------------------------
+// deprecated variants _not_ requiring a semicolon after them and without wx prefix.
+// (note that also some wx-prefixed macro do _not_ require a semicolon because
+//  it's not always possible to force the compire to require it)
+
+#define DECLARE_CLASS_INFO_ITERATORS()                              wxDECLARE_CLASS_INFO_ITERATORS();
+#define DECLARE_ABSTRACT_CLASS(n)                                   wxDECLARE_ABSTRACT_CLASS(n);
+#define DECLARE_DYNAMIC_CLASS_NO_ASSIGN(n)                          wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(n);
+#define DECLARE_DYNAMIC_CLASS_NO_COPY(n)                            wxDECLARE_DYNAMIC_CLASS_NO_COPY(n);
+#define DECLARE_DYNAMIC_CLASS(n)                                    wxDECLARE_DYNAMIC_CLASS(n);
+#define DECLARE_CLASS(n)                                            wxDECLARE_CLASS(n);
+
+#define DECLARE_PLUGGABLE_CLASS(n)                                  wxDECLARE_PLUGGABLE_CLASS(n);
+#define DECLARE_ABSTRACT_PLUGGABLE_CLASS(n)                         wxDECLARE_ABSTRACT_PLUGGABLE_CLASS(n);
+#define DECLARE_USER_EXPORTED_PLUGGABLE_CLASS(n,u)                  wxDECLARE_USER_EXPORTED_PLUGGABLE_CLASS(n,u);
+#define DECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,u)         wxDECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,u);
+
 // ----------------------------------------------------------------------------
 // wxRefCounter: ref counted data "manager"
 // ----------------------------------------------------------------------------
@@ -222,7 +271,6 @@ private:
 
 typedef wxRefCounter wxObjectRefData;
 
-
 // ----------------------------------------------------------------------------
 // wxObjectDataPtr: helper class to avoid memleaks because of missing calls
 //                  to wxObjectRefData::DecRef
@@ -403,46 +451,7 @@ inline wxObject *wxCheckDynamicCast(wxObject *obj, wxClassInfo *classInfo)
     return obj && obj->GetClassInfo()->IsKindOf(classInfo) ? obj : NULL;
 }
 
-#if wxUSE_EXTENDED_RTTI
-class WXDLLIMPEXP_BASE wxDynamicObject : public wxObject
-{
-    friend class WXDLLIMPEXP_FWD_BASE wxDynamicClassInfo ;
-public:
-    // instantiates this object with an instance of its superclass
-    wxDynamicObject(wxObject* superClassInstance, const wxDynamicClassInfo *info) ;
-    virtual ~wxDynamicObject();
-
-    void SetProperty (const wxChar *propertyName, const wxxVariant &value);
-    wxxVariant GetProperty (const wxChar *propertyName) const ;
-
-    // get the runtime identity of this object
-    wxClassInfo *GetClassInfo() const
-    {
-#ifdef _MSC_VER
-        return (wxClassInfo*) m_classInfo;
-#else
-        wxDynamicClassInfo *nonconst = const_cast<wxDynamicClassInfo *>(m_classInfo);
-        return static_cast<wxClassInfo *>(nonconst);
-#endif
-    }
-
-    wxObject* GetSuperClassInstance() const
-    {
-        return m_superClassInstance ;
-    }
-private :
-    // removes an existing runtime-property
-    void RemoveProperty( const wxChar *propertyName ) ;
-
-    // renames an existing runtime-property
-    void RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) ;
-
-    wxObject *m_superClassInstance ;
-    const wxDynamicClassInfo *m_classInfo;
-    struct wxDynamicObjectInternal;
-    wxDynamicObjectInternal *m_data;
-};
-#endif
+#include "wx/xti2.h"
 
 // ----------------------------------------------------------------------------
 // more debugging macros
@@ -461,20 +470,13 @@ private :
 #endif // wxUSE_DEBUG_NEW_ALWAYS
 
 // ----------------------------------------------------------------------------
-// Compatibility macro aliases
+// Compatibility macro aliases IMPLEMENT group
 // ----------------------------------------------------------------------------
 
 // deprecated variants _not_ requiring a semicolon after them and without wx prefix.
 // (note that also some wx-prefixed macro do _not_ require a semicolon because
 //  it's not always possible to force the compire to require it)
 
-#define DECLARE_CLASS_INFO_ITERATORS()                              wxDECLARE_CLASS_INFO_ITERATORS();
-#define DECLARE_ABSTRACT_CLASS(n)                                   wxDECLARE_ABSTRACT_CLASS(n);
-#define DECLARE_DYNAMIC_CLASS_NO_ASSIGN(n)                          wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(n);
-#define DECLARE_DYNAMIC_CLASS_NO_COPY(n)                            wxDECLARE_DYNAMIC_CLASS_NO_COPY(n);
-#define DECLARE_DYNAMIC_CLASS(n)                                    wxDECLARE_DYNAMIC_CLASS(n);
-#define DECLARE_CLASS(n)                                            wxDECLARE_CLASS(n);
-
 #define IMPLEMENT_DYNAMIC_CLASS(n,b)                                wxIMPLEMENT_DYNAMIC_CLASS(n,b)
 #define IMPLEMENT_DYNAMIC_CLASS2(n,b1,b2)                           wxIMPLEMENT_DYNAMIC_CLASS2(n,b1,b2)
 #define IMPLEMENT_ABSTRACT_CLASS(n,b)                               wxIMPLEMENT_ABSTRACT_CLASS(n,b)
@@ -482,11 +484,6 @@ private :
 #define IMPLEMENT_CLASS(n,b)                                        wxIMPLEMENT_CLASS(n,b)
 #define IMPLEMENT_CLASS2(n,b1,b2)                                   wxIMPLEMENT_CLASS2(n,b1,b2)
 
-#define DECLARE_PLUGGABLE_CLASS(n)                                  wxDECLARE_PLUGGABLE_CLASS(n);
-#define DECLARE_ABSTRACT_PLUGGABLE_CLASS(n)                         wxDECLARE_ABSTRACT_PLUGGABLE_CLASS(n);
-#define DECLARE_USER_EXPORTED_PLUGGABLE_CLASS(n,u)                  wxDECLARE_USER_EXPORTED_PLUGGABLE_CLASS(n,u);
-#define DECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,u)         wxDECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,u);
-
 #define IMPLEMENT_PLUGGABLE_CLASS(n,b)                              wxIMPLEMENT_PLUGGABLE_CLASS(n,b)
 #define IMPLEMENT_PLUGGABLE_CLASS2(n,b,b2)                          wxIMPLEMENT_PLUGGABLE_CLASS2(n,b,b2)
 #define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(n,b)                     wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(n,b)