- public:
- char *className;
- char *baseClassName1;
- char *baseClassName2;
- int objectSize;
- wxObjectConstructorFn objectConstructor;
-
- // Pointers to base wxClassInfos: set in InitializeClasses
- // called from wx_main.cc
- wxClassInfo *baseInfo1;
- wxClassInfo *baseInfo2;
-
- static wxClassInfo *first;
- wxClassInfo *next;
-
- wxClassInfo(char *cName, char *baseName1, char *baseName2, int sz, wxObjectConstructorFn fn);
-
- wxObject *CreateObject(void);
-
- inline char *GetClassName(void) const { return className; }
- inline char *GetBaseClassName1(void) const { return baseClassName1; }
- inline char *GetBaseClassName2(void) const { return baseClassName2; }
- inline int GetSize(void) const { return objectSize; }
- bool IsKindOf(wxClassInfo *info);
-
- static wxClassInfo *FindClass(char *c);
- // Initializes parent pointers for fast searching.
- static void InitializeClasses(void);
+public:
+ wxClassInfo( const wxChar *className,
+ const wxClassInfo *baseInfo1,
+ const wxClassInfo *baseInfo2,
+ int size,
+ wxObjectConstructorFn ctor )
+ : m_className(className)
+ , m_objectSize(size)
+ , m_objectConstructor(ctor)
+ , m_baseInfo1(baseInfo1)
+ , m_baseInfo2(baseInfo2)
+ , m_next(sm_first)
+ {
+ sm_first = this;
+ Register();
+ }
+
+ ~wxClassInfo();
+
+ wxObject *CreateObject() { return m_objectConstructor ? (*m_objectConstructor)() : 0; }
+
+ const wxChar *GetClassName() const { return m_className; }
+ const wxChar *GetBaseClassName1() const
+ { return m_baseInfo1 ? m_baseInfo1->GetClassName() : NULL; }
+ const wxChar *GetBaseClassName2() const
+ { return m_baseInfo2 ? m_baseInfo2->GetClassName() : NULL; }
+ const wxClassInfo *GetBaseClass1() const { return m_baseInfo1; }
+ const wxClassInfo *GetBaseClass2() const { return m_baseInfo2; }
+ int GetSize() const { return m_objectSize; }
+
+ wxObjectConstructorFn GetConstructor() const { return m_objectConstructor; }
+ static const wxClassInfo *GetFirst() { return sm_first; }
+ const wxClassInfo *GetNext() const { return m_next; }
+ static wxClassInfo *FindClass(const wxChar *className);
+
+ // Climb upwards through inheritance hierarchy.
+ // Dual inheritance is catered for.
+
+ bool IsKindOf(const wxClassInfo *info) const
+ {
+ return info != 0 &&
+ ( info == this ||
+ ( m_baseInfo1 && m_baseInfo1->IsKindOf(info) ) ||
+ ( m_baseInfo2 && m_baseInfo2->IsKindOf(info) ) );
+ }
+
+#if WXWIN_COMPATIBILITY_2_4
+ // Initializes parent pointers and hash table for fast searching.
+ wxDEPRECATED( static void InitializeClasses() );
+ // Cleans up hash table used for fast searching.
+ wxDEPRECATED( static void CleanUpClasses() );
+#endif
+ static void CleanUp();
+
+public:
+ const wxChar *m_className;
+ int m_objectSize;
+ wxObjectConstructorFn m_objectConstructor;
+
+ // Pointers to base wxClassInfos: set in InitializeClasses
+
+ const wxClassInfo *m_baseInfo1;
+ const wxClassInfo *m_baseInfo2;
+
+ // class info object live in a linked list:
+ // pointers to its head and the next element in it
+
+ static wxClassInfo *sm_first;
+ wxClassInfo *m_next;
+
+ // FIXME: this should be private (currently used directly by way too
+ // many clients)
+ static wxHashTable *sm_classTable;
+
+private:
+ // InitializeClasses() helper
+ static wxClassInfo *GetBaseByName(const wxChar *name);
+
+ DECLARE_NO_COPY_CLASS(wxClassInfo)
+
+protected:
+ // registers the class
+ void Register();
+ void Unregister();