- 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 wxChar *baseName1,
+ const wxChar *baseName2,
+ int size,
+ wxObjectConstructorFn ctor )
+ : m_className(className)
+ , m_baseClassName1(baseName1)
+ , m_baseClassName2(baseName2)
+ , m_objectSize(size)
+ , m_objectConstructor(ctor)
+ , m_baseInfo1(0)
+ , m_baseInfo2(0)
+ , m_next(sm_first)
+ { sm_first = this; }
+
+ wxObject *CreateObject() { return m_objectConstructor ? (*m_objectConstructor)() : 0; }
+
+ const wxChar *GetClassName() const { return m_className; }
+ const wxChar *GetBaseClassName1() const { return m_baseClassName1; }
+ const wxChar *GetBaseClassName2() const { return m_baseClassName2; }
+ 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) ) );
+ }
+
+ // Initializes parent pointers and hash table for fast searching.
+
+ static void InitializeClasses();
+
+ // Cleans up hash table used for fast searching.
+
+ static void CleanUpClasses();
+
+public:
+ const wxChar *m_className;
+ const wxChar *m_baseClassName1;
+ const wxChar *m_baseClassName2;
+ 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);