]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
b2edef6f | 2 | // Name: wx/object.h |
c801d85f KB |
3 | // Purpose: wxObject class, plus run-time type information macros |
4 | // Author: Julian Smart | |
0b9ab0bd | 5 | // Modified by: Ron Lee |
c801d85f KB |
6 | // Created: 01/02/97 |
7 | // RCS-ID: $Id$ | |
371a5b4e | 8 | // Copyright: (c) 1997 Julian Smart |
0b9ab0bd | 9 | // (c) 2001 Ron Lee <ron@debian.org> |
65571936 | 10 | // Licence: wxWindows licence |
c801d85f KB |
11 | ///////////////////////////////////////////////////////////////////////////// |
12 | ||
34138703 JS |
13 | #ifndef _WX_OBJECTH__ |
14 | #define _WX_OBJECTH__ | |
c801d85f | 15 | |
0b9ab0bd RL |
16 | // ---------------------------------------------------------------------------- |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
e55ad60e | 20 | #include "wx/memory.h" |
c801d85f | 21 | |
28953245 SC |
22 | // based on the value of wxUSE_EXTENDED_RTTI symbol, |
23 | // only one of the RTTI system will be compiled: | |
24 | // - the "old" one (defined by rtti.h) or | |
25 | // - the "new" one (defined by xti.h) | |
a095505c | 26 | #include "wx/xti.h" |
28953245 | 27 | #include "wx/rtti.h" |
a095505c | 28 | |
0b9ab0bd RL |
29 | // ----------------------------------- |
30 | // for pluggable classes | |
31 | // ----------------------------------- | |
32 | ||
33 | // NOTE: this should probably be the very first statement | |
34 | // in the class declaration so wxPluginSentinel is | |
35 | // the first member initialised and the last destroyed. | |
36 | ||
37 | // _DECLARE_DL_SENTINEL(name) wxPluginSentinel m_pluginsentinel; | |
38 | ||
39 | #if wxUSE_NESTED_CLASSES | |
40 | ||
60b73526 RL |
41 | #define _DECLARE_DL_SENTINEL(name, exportdecl) \ |
42 | class exportdecl name##PluginSentinel { \ | |
43 | private: \ | |
44 | static const wxString sm_className; \ | |
45 | public: \ | |
46 | name##PluginSentinel(); \ | |
2e0b1b11 | 47 | ~name##PluginSentinel(); \ |
60b73526 | 48 | }; \ |
b19b28c8 | 49 | name##PluginSentinel m_pluginsentinel |
0b9ab0bd RL |
50 | |
51 | #define _IMPLEMENT_DL_SENTINEL(name) \ | |
52 | const wxString name::name##PluginSentinel::sm_className(#name); \ | |
53 | name::name##PluginSentinel::name##PluginSentinel() { \ | |
4f89dbc4 | 54 | wxPluginLibrary *e = (wxPluginLibrary*) wxPluginLibrary::ms_classes.Get(#name); \ |
7c1e2b44 | 55 | if( e != 0 ) { e->RefObj(); } \ |
0b9ab0bd | 56 | } \ |
abad5367 | 57 | name::name##PluginSentinel::~name##PluginSentinel() { \ |
4f89dbc4 | 58 | wxPluginLibrary *e = (wxPluginLibrary*) wxPluginLibrary::ms_classes.Get(#name); \ |
7c1e2b44 | 59 | if( e != 0 ) { e->UnrefObj(); } \ |
0b9ab0bd RL |
60 | } |
61 | #else | |
62 | ||
63 | #define _DECLARE_DL_SENTINEL(name) | |
64 | #define _IMPLEMENT_DL_SENTINEL(name) | |
65 | ||
66 | #endif // wxUSE_NESTED_CLASSES | |
67 | ||
b19b28c8 FM |
68 | #define wxDECLARE_PLUGGABLE_CLASS(name) \ |
69 | wxDECLARE_DYNAMIC_CLASS(name); _DECLARE_DL_SENTINEL(name, WXDLLIMPEXP_CORE) | |
70 | #define wxDECLARE_ABSTRACT_PLUGGABLE_CLASS(name) \ | |
71 | wxDECLARE_ABSTRACT_CLASS(name); _DECLARE_DL_SENTINEL(name, WXDLLIMPEXP_CORE) | |
72 | ||
73 | #define wxDECLARE_USER_EXPORTED_PLUGGABLE_CLASS(name, usergoo) \ | |
74 | wxDECLARE_DYNAMIC_CLASS(name); _DECLARE_DL_SENTINEL(name, usergoo) | |
75 | #define wxDECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, usergoo) \ | |
76 | wxDECLARE_ABSTRACT_CLASS(name); _DECLARE_DL_SENTINEL(name, usergoo) | |
77 | ||
78 | #define wxIMPLEMENT_PLUGGABLE_CLASS(name, basename) \ | |
79 | wxIMPLEMENT_DYNAMIC_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name) | |
80 | #define wxIMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2) \ | |
81 | wxIMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name) | |
82 | #define wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename) \ | |
83 | wxIMPLEMENT_ABSTRACT_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name) | |
84 | #define wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \ | |
85 | wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name) | |
86 | ||
87 | #define wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(name, basename) \ | |
88 | wxIMPLEMENT_PLUGGABLE_CLASS(name, basename) | |
89 | #define wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(name, basename1, basename2) \ | |
90 | wxIMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2) | |
91 | #define wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, basename) \ | |
92 | wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename) | |
93 | #define wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \ | |
94 | wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) | |
95 | ||
96 | #define wxCLASSINFO(name) (&name::ms_classInfo) | |
c801d85f | 97 | |
c0db9626 | 98 | #define wxIS_KIND_OF(obj, className) obj->IsKindOf(&className::ms_classInfo) |
3013b6f4 | 99 | |
b2edef6f | 100 | // Just seems a bit nicer-looking (pretend it's not a macro) |
c0db9626 | 101 | #define wxIsKindOf(obj, className) obj->IsKindOf(&className::ms_classInfo) |
c801d85f | 102 | |
73fbb031 VZ |
103 | // this cast does some more checks at compile time as it uses static_cast |
104 | // internally | |
105 | // | |
106 | // note that it still has different semantics from dynamic_cast<> and so can't | |
107 | // be replaced by it as long as there are any compilers not supporting it | |
34636400 | 108 | #define wxDynamicCast(obj, className) \ |
5232d996 | 109 | ((className *) wxCheckDynamicCast( \ |
5c33522f VZ |
110 | const_cast<wxObject *>(static_cast<const wxObject *>(\ |
111 | const_cast<className *>(static_cast<const className *>(obj)))), \ | |
5232d996 | 112 | &className::ms_classInfo)) |
0b9ab0bd | 113 | |
b2edef6f VZ |
114 | // The 'this' pointer is always true, so use this version |
115 | // to cast the this pointer and avoid compiler warnings. | |
f7637829 | 116 | #define wxDynamicCastThis(className) \ |
73fbb031 | 117 | (IsKindOf(&className::ms_classInfo) ? (className *)(this) : (className *)0) |
33ac7e6f | 118 | |
657a8a35 VZ |
119 | // FIXME-VC6: dummy argument needed because VC6 doesn't support explicitly |
120 | // choosing the template function to call | |
121 | template <class T> | |
122 | inline T *wxCheckCast(const void *ptr, T * = NULL) | |
0b9ab0bd | 123 | { |
657a8a35 VZ |
124 | wxASSERT_MSG( wxDynamicCast(ptr, T), "wxStaticCast() used incorrectly" ); |
125 | return const_cast<T *>(static_cast<const T *>(ptr)); | |
0b9ab0bd | 126 | } |
f6bcfd97 | 127 | |
657a8a35 | 128 | #define wxStaticCast(obj, className) wxCheckCast((obj), (className *)NULL) |
f6bcfd97 | 129 | |
b2edef6f VZ |
130 | // ---------------------------------------------------------------------------- |
131 | // set up memory debugging macros | |
132 | // ---------------------------------------------------------------------------- | |
133 | ||
134 | /* | |
135 | Which new/delete operator variants do we want? | |
136 | ||
137 | _WX_WANT_NEW_SIZET_WXCHAR_INT = void *operator new (size_t size, wxChar *fileName = 0, int lineNum = 0) | |
138 | _WX_WANT_DELETE_VOID = void operator delete (void * buf) | |
139 | _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET = void operator delete (void *buf, const char *_fname, size_t _line) | |
140 | _WX_WANT_DELETE_VOID_WXCHAR_INT = void operator delete(void *buf, wxChar*, int) | |
141 | _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT = void *operator new[] (size_t size, wxChar *fileName , int lineNum = 0) | |
142 | _WX_WANT_ARRAY_DELETE_VOID = void operator delete[] (void *buf) | |
143 | _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT = void operator delete[] (void* buf, wxChar*, int ) | |
144 | */ | |
145 | ||
657a8a35 | 146 | #if wxUSE_MEMORY_TRACING |
b2edef6f VZ |
147 | |
148 | // All compilers get this one | |
149 | #define _WX_WANT_NEW_SIZET_WXCHAR_INT | |
150 | ||
151 | // Everyone except Visage gets the next one | |
152 | #ifndef __VISAGECPP__ | |
153 | #define _WX_WANT_DELETE_VOID | |
c801d85f | 154 | #endif |
b2edef6f VZ |
155 | |
156 | // Only visage gets this one under the correct circumstances | |
157 | #if defined(__VISAGECPP__) && __DEBUG_ALLOC__ | |
158 | #define _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET | |
159 | #endif | |
160 | ||
4e124582 VZ |
161 | // Only VC++ 6 and CodeWarrior get overloaded delete that matches new |
162 | #if (defined(__VISUALC__) && (__VISUALC__ >= 1200)) || \ | |
163 | (defined(__MWERKS__) && (__MWERKS__ >= 0x2400)) | |
b2edef6f | 164 | #define _WX_WANT_DELETE_VOID_WXCHAR_INT |
fd85b064 | 165 | #endif |
c801d85f | 166 | |
b2edef6f VZ |
167 | // Now see who (if anyone) gets the array memory operators |
168 | #if wxUSE_ARRAY_MEMORY_OPERATORS | |
169 | ||
170 | // Everyone except Visual C++ (cause problems for VC++ - crashes) | |
171 | #if !defined(__VISUALC__) | |
172 | #define _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT | |
173 | #endif | |
174 | ||
175 | // Everyone except Visual C++ (cause problems for VC++ - crashes) | |
176 | #if !defined(__VISUALC__) | |
177 | #define _WX_WANT_ARRAY_DELETE_VOID | |
178 | #endif | |
179 | ||
180 | // Only CodeWarrior 6 or higher | |
181 | #if defined(__MWERKS__) && (__MWERKS__ >= 0x2400) | |
182 | #define _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT | |
183 | #endif | |
184 | ||
185 | #endif // wxUSE_ARRAY_MEMORY_OPERATORS | |
186 | ||
657a8a35 | 187 | #endif // wxUSE_MEMORY_TRACING |
b2edef6f | 188 | |
f8855e47 | 189 | // ---------------------------------------------------------------------------- |
6d37c1b7 | 190 | // wxRefCounter: ref counted data "manager" |
f8855e47 VZ |
191 | // ---------------------------------------------------------------------------- |
192 | ||
6d37c1b7 | 193 | class WXDLLIMPEXP_BASE wxRefCounter |
f8855e47 | 194 | { |
f8855e47 | 195 | public: |
6d37c1b7 | 196 | wxRefCounter() { m_count = 1; } |
f8855e47 VZ |
197 | |
198 | int GetRefCount() const { return m_count; } | |
199 | ||
4a11340a RR |
200 | void IncRef() { m_count++; } |
201 | void DecRef(); | |
202 | ||
203 | protected: | |
204 | // this object should never be destroyed directly but only as a | |
205 | // result of a DecRef() call: | |
6d37c1b7 | 206 | virtual ~wxRefCounter() { } |
4a11340a | 207 | |
f8855e47 | 208 | private: |
4a11340a | 209 | // our refcount: |
f8855e47 | 210 | int m_count; |
fd08ccd2 VZ |
211 | |
212 | // It doesn't make sense to copy the reference counted objects, a new ref | |
213 | // counter should be created for a new object instead and compilation | |
214 | // errors in the code using wxRefCounter due to the lack of copy ctor often | |
215 | // indicate a problem, e.g. a forgotten copy ctor implementation somewhere. | |
216 | wxDECLARE_NO_COPY_CLASS(wxRefCounter); | |
f8855e47 VZ |
217 | }; |
218 | ||
6d37c1b7 RR |
219 | // ---------------------------------------------------------------------------- |
220 | // wxObjectRefData: ref counted data meant to be stored in wxObject | |
221 | // ---------------------------------------------------------------------------- | |
222 | ||
223 | typedef wxRefCounter wxObjectRefData; | |
224 | ||
225 | ||
4a11340a RR |
226 | // ---------------------------------------------------------------------------- |
227 | // wxObjectDataPtr: helper class to avoid memleaks because of missing calls | |
228 | // to wxObjectRefData::DecRef | |
229 | // ---------------------------------------------------------------------------- | |
230 | ||
231 | template <class T> | |
232 | class wxObjectDataPtr | |
233 | { | |
234 | public: | |
235 | typedef T element_type; | |
236 | ||
237 | wxEXPLICIT wxObjectDataPtr(T *ptr = NULL) : m_ptr(ptr) {} | |
238 | ||
239 | // copy ctor | |
53a2db12 | 240 | wxObjectDataPtr(const wxObjectDataPtr<T> &tocopy) |
4a11340a | 241 | : m_ptr(tocopy.m_ptr) |
53a2db12 | 242 | { |
4a11340a | 243 | if (m_ptr) |
53a2db12 | 244 | m_ptr->IncRef(); |
4a11340a RR |
245 | } |
246 | ||
53a2db12 FM |
247 | ~wxObjectDataPtr() |
248 | { | |
249 | if (m_ptr) | |
250 | m_ptr->DecRef(); | |
4a11340a RR |
251 | } |
252 | ||
253 | T *get() const { return m_ptr; } | |
53a2db12 | 254 | |
a60b0ddc RR |
255 | // test for pointer validity: defining conversion to unspecified_bool_type |
256 | // and not more obvious bool to avoid implicit conversions to integer types | |
257 | typedef T *(wxObjectDataPtr<T>::*unspecified_bool_type)() const; | |
258 | operator unspecified_bool_type() const | |
259 | { | |
260 | return m_ptr ? &wxObjectDataPtr<T>::get : NULL; | |
261 | } | |
262 | ||
263 | T& operator*() const | |
53a2db12 FM |
264 | { |
265 | wxASSERT(m_ptr != NULL); | |
a60b0ddc RR |
266 | return *(m_ptr); |
267 | } | |
53a2db12 | 268 | |
e39d30c0 | 269 | T *operator->() const |
53a2db12 FM |
270 | { |
271 | wxASSERT(m_ptr != NULL); | |
272 | return get(); | |
e39d30c0 | 273 | } |
4a11340a RR |
274 | |
275 | void reset(T *ptr) | |
276 | { | |
277 | if (m_ptr) | |
278 | m_ptr->DecRef(); | |
279 | m_ptr = ptr; | |
280 | } | |
281 | ||
282 | wxObjectDataPtr& operator=(const wxObjectDataPtr &tocopy) | |
53a2db12 FM |
283 | { |
284 | if (m_ptr) | |
285 | m_ptr->DecRef(); | |
286 | m_ptr = tocopy.m_ptr; | |
4a11340a | 287 | if (m_ptr) |
53a2db12 | 288 | m_ptr->IncRef(); |
4a11340a RR |
289 | return *this; |
290 | } | |
291 | ||
292 | wxObjectDataPtr& operator=(T *ptr) | |
53a2db12 FM |
293 | { |
294 | if (m_ptr) | |
295 | m_ptr->DecRef(); | |
296 | m_ptr = ptr; | |
4a11340a RR |
297 | return *this; |
298 | } | |
299 | ||
300 | private: | |
301 | T *m_ptr; | |
302 | }; | |
303 | ||
0b9ab0bd | 304 | // ---------------------------------------------------------------------------- |
77ffb593 | 305 | // wxObject: the root class of wxWidgets object hierarchy |
0b9ab0bd RL |
306 | // ---------------------------------------------------------------------------- |
307 | ||
bddd7a8d | 308 | class WXDLLIMPEXP_BASE wxObject |
c801d85f | 309 | { |
b19b28c8 | 310 | wxDECLARE_ABSTRACT_CLASS(wxObject); |
c801d85f | 311 | |
0b9ab0bd | 312 | public: |
b2edef6f | 313 | wxObject() { m_refData = NULL; } |
0b9ab0bd | 314 | virtual ~wxObject() { UnRef(); } |
4393b50c | 315 | |
a6391d30 | 316 | wxObject(const wxObject& other) |
66e9a9f0 | 317 | { |
f8855e47 VZ |
318 | m_refData = other.m_refData; |
319 | if (m_refData) | |
6d37c1b7 | 320 | m_refData->IncRef(); |
66e9a9f0 | 321 | } |
4393b50c | 322 | |
a6391d30 GD |
323 | wxObject& operator=(const wxObject& other) |
324 | { | |
325 | if ( this != &other ) | |
326 | { | |
f8855e47 | 327 | Ref(other); |
a6391d30 GD |
328 | } |
329 | return *this; | |
330 | } | |
331 | ||
303c6f20 | 332 | bool IsKindOf(const wxClassInfo *info) const; |
c801d85f | 333 | |
0b9ab0bd | 334 | |
b2edef6f VZ |
335 | // Turn on the correct set of new and delete operators |
336 | ||
337 | #ifdef _WX_WANT_NEW_SIZET_WXCHAR_INT | |
cf760e4c | 338 | void *operator new ( size_t size, const wxChar *fileName = NULL, int lineNum = 0 ); |
0b9ab0bd | 339 | #endif |
27198be4 | 340 | |
b2edef6f VZ |
341 | #ifdef _WX_WANT_DELETE_VOID |
342 | void operator delete ( void * buf ); | |
343 | #endif | |
0b9ab0bd | 344 | |
b2edef6f VZ |
345 | #ifdef _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET |
346 | void operator delete ( void *buf, const char *_fname, size_t _line ); | |
0b9ab0bd | 347 | #endif |
76626af2 | 348 | |
b2edef6f | 349 | #ifdef _WX_WANT_DELETE_VOID_WXCHAR_INT |
cf760e4c | 350 | void operator delete ( void *buf, const wxChar*, int ); |
b2edef6f | 351 | #endif |
8cfc5426 | 352 | |
b2edef6f | 353 | #ifdef _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT |
cf760e4c | 354 | void *operator new[] ( size_t size, const wxChar *fileName = NULL, int lineNum = 0 ); |
0b9ab0bd RL |
355 | #endif |
356 | ||
b2edef6f VZ |
357 | #ifdef _WX_WANT_ARRAY_DELETE_VOID |
358 | void operator delete[] ( void *buf ); | |
0b9ab0bd | 359 | #endif |
27198be4 | 360 | |
b2edef6f | 361 | #ifdef _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT |
cf760e4c | 362 | void operator delete[] (void* buf, const wxChar*, int ); |
b2edef6f | 363 | #endif |
c801d85f | 364 | |
807d8487 VZ |
365 | // ref counted data handling methods |
366 | ||
367 | // get/set | |
368 | wxObjectRefData *GetRefData() const { return m_refData; } | |
369 | void SetRefData(wxObjectRefData *data) { m_refData = data; } | |
370 | ||
371 | // make a 'clone' of the object | |
0b9ab0bd | 372 | void Ref(const wxObject& clone); |
c801d85f | 373 | |
807d8487 | 374 | // destroy a reference |
0b9ab0bd | 375 | void UnRef(); |
c801d85f | 376 | |
93c5f755 PC |
377 | // Make sure this object has only one reference |
378 | void UnShare() { AllocExclusive(); } | |
379 | ||
a3ab1c18 VZ |
380 | // check if this object references the same data as the other one |
381 | bool IsSameAs(const wxObject& o) const { return m_refData == o.m_refData; } | |
55ccdb93 | 382 | |
c801d85f | 383 | protected: |
807d8487 VZ |
384 | // ensure that our data is not shared with anybody else: if we have no |
385 | // data, it is created using CreateRefData() below, if we have shared data | |
386 | // it is copied using CloneRefData(), otherwise nothing is done | |
387 | void AllocExclusive(); | |
388 | ||
4e124582 VZ |
389 | // both methods must be implemented if AllocExclusive() is used, not pure |
390 | // virtual only because of the backwards compatibility reasons | |
807d8487 VZ |
391 | |
392 | // create a new m_refData | |
393 | virtual wxObjectRefData *CreateRefData() const; | |
394 | ||
395 | // create a new m_refData initialized with the given one | |
b8027888 | 396 | virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; |
807d8487 | 397 | |
0b9ab0bd | 398 | wxObjectRefData *m_refData; |
c801d85f KB |
399 | }; |
400 | ||
ea1e6c4b RL |
401 | inline wxObject *wxCheckDynamicCast(wxObject *obj, wxClassInfo *classInfo) |
402 | { | |
b2edef6f | 403 | return obj && obj->GetClassInfo()->IsKindOf(classInfo) ? obj : NULL; |
ea1e6c4b RL |
404 | } |
405 | ||
2d51f067 SC |
406 | #if wxUSE_EXTENDED_RTTI |
407 | class WXDLLIMPEXP_BASE wxDynamicObject : public wxObject | |
408 | { | |
b5dbe15d | 409 | friend class WXDLLIMPEXP_FWD_BASE wxDynamicClassInfo ; |
2d51f067 SC |
410 | public: |
411 | // instantiates this object with an instance of its superclass | |
412 | wxDynamicObject(wxObject* superClassInstance, const wxDynamicClassInfo *info) ; | |
d3c7fc99 | 413 | virtual ~wxDynamicObject(); |
2d51f067 | 414 | |
8f2b1cfd SC |
415 | void SetProperty (const wxChar *propertyName, const wxxVariant &value); |
416 | wxxVariant GetProperty (const wxChar *propertyName) const ; | |
2d51f067 SC |
417 | |
418 | // get the runtime identity of this object | |
419 | wxClassInfo *GetClassInfo() const | |
420 | { | |
f525dc35 JS |
421 | #ifdef _MSC_VER |
422 | return (wxClassInfo*) m_classInfo; | |
423 | #else | |
5c33522f VZ |
424 | wxDynamicClassInfo *nonconst = const_cast<wxDynamicClassInfo *>(m_classInfo); |
425 | return static_cast<wxClassInfo *>(nonconst); | |
f525dc35 | 426 | #endif |
2d51f067 SC |
427 | } |
428 | ||
429 | wxObject* GetSuperClassInstance() const | |
430 | { | |
431 | return m_superClassInstance ; | |
432 | } | |
433 | private : | |
8f2b1cfd SC |
434 | // removes an existing runtime-property |
435 | void RemoveProperty( const wxChar *propertyName ) ; | |
436 | ||
437 | // renames an existing runtime-property | |
438 | void RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) ; | |
439 | ||
2d51f067 SC |
440 | wxObject *m_superClassInstance ; |
441 | const wxDynamicClassInfo *m_classInfo; | |
442 | struct wxDynamicObjectInternal; | |
443 | wxDynamicObjectInternal *m_data; | |
444 | }; | |
445 | #endif | |
446 | ||
b2edef6f VZ |
447 | // ---------------------------------------------------------------------------- |
448 | // more debugging macros | |
449 | // ---------------------------------------------------------------------------- | |
450 | ||
657a8a35 | 451 | #if wxUSE_DEBUG_NEW_ALWAYS |
70bf6180 VZ |
452 | #define WXDEBUG_NEW new(__TFILE__,__LINE__) |
453 | ||
657a8a35 VZ |
454 | #if wxUSE_GLOBAL_MEMORY_OPERATORS |
455 | #define new WXDEBUG_NEW | |
456 | #elif defined(__VISUALC__) | |
457 | // Including this file redefines new and allows leak reports to | |
458 | // contain line numbers | |
459 | #include "wx/msw/msvcrt.h" | |
460 | #endif | |
461 | #endif // wxUSE_DEBUG_NEW_ALWAYS | |
c801d85f | 462 | |
b19b28c8 FM |
463 | // ---------------------------------------------------------------------------- |
464 | // Compatibility macro aliases | |
465 | // ---------------------------------------------------------------------------- | |
466 | ||
467 | // deprecated variants _not_ requiring a semicolon after them and without wx prefix. | |
468 | // (note that also some wx-prefixed macro do _not_ require a semicolon because | |
469 | // it's not always possible to force the compire to require it) | |
470 | ||
471 | #define DECLARE_CLASS_INFO_ITERATORS() wxDECLARE_CLASS_INFO_ITERATORS(); | |
472 | #define DECLARE_ABSTRACT_CLASS(n) wxDECLARE_ABSTRACT_CLASS(n); | |
473 | #define DECLARE_DYNAMIC_CLASS_NO_ASSIGN(n) wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(n); | |
474 | #define DECLARE_DYNAMIC_CLASS_NO_COPY(n) wxDECLARE_DYNAMIC_CLASS_NO_COPY(n); | |
475 | #define DECLARE_DYNAMIC_CLASS(n) wxDECLARE_DYNAMIC_CLASS(n); | |
476 | #define DECLARE_CLASS(n) wxDECLARE_CLASS(n); | |
477 | ||
478 | #define IMPLEMENT_DYNAMIC_CLASS(n,b) wxIMPLEMENT_DYNAMIC_CLASS(n,b) | |
479 | #define IMPLEMENT_DYNAMIC_CLASS2(n,b1,b2) wxIMPLEMENT_DYNAMIC_CLASS2(n,b1,b2) | |
480 | #define IMPLEMENT_ABSTRACT_CLASS(n,b) wxIMPLEMENT_ABSTRACT_CLASS(n,b) | |
481 | #define IMPLEMENT_ABSTRACT_CLASS2(n,b1,b2) wxIMPLEMENT_ABSTRACT_CLASS2(n,b1,b2) | |
482 | #define IMPLEMENT_CLASS(n,b) wxIMPLEMENT_CLASS(n,b) | |
483 | #define IMPLEMENT_CLASS2(n,b1,b2) wxIMPLEMENT_CLASS2(n,b1,b2) | |
484 | ||
485 | #define DECLARE_PLUGGABLE_CLASS(n) wxDECLARE_PLUGGABLE_CLASS(n); | |
486 | #define DECLARE_ABSTRACT_PLUGGABLE_CLASS(n) wxDECLARE_ABSTRACT_PLUGGABLE_CLASS(n); | |
487 | #define DECLARE_USER_EXPORTED_PLUGGABLE_CLASS(n,u) wxDECLARE_USER_EXPORTED_PLUGGABLE_CLASS(n,u); | |
488 | #define DECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,u) wxDECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,u); | |
489 | ||
490 | #define IMPLEMENT_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_PLUGGABLE_CLASS(n,b) | |
491 | #define IMPLEMENT_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_PLUGGABLE_CLASS2(n,b,b2) | |
492 | #define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(n,b) | |
493 | #define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2) | |
494 | #define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(n,b) | |
495 | #define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(n,b,b2) | |
496 | #define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,b) | |
497 | #define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2) | |
498 | ||
499 | #define CLASSINFO(n) wxCLASSINFO(n) | |
500 | ||
c0089c96 | 501 | #endif // _WX_OBJECTH__ |