Update docs to mention wxRefCounter class
[wxWidgets.git] / interface / wx / object.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: object.h
3 // Purpose: interface of wxRefCounter
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /** @class wxObjectRefData
10
11 This class is just a typedef to wxRefCounter and is used by wxObject.
12
13 Derive classes from this to store your own data. When retrieving information
14 from a wxObject's reference data, you will need to cast to your own derived class.
15
16 @section objectrefdata_example Example
17
18 @code
19 // include file
20 // ------------
21
22 class MyCar : public wxObject
23 {
24 public:
25 MyCar() { }
26 MyCar( int price );
27
28 bool IsOk() const { return m_refData != NULL; }
29
30 bool operator == ( const MyCar& car ) const;
31 bool operator != (const MyCar& car) const { return !(*this == car); }
32
33 void SetPrice( int price );
34 int GetPrice() const;
35
36 protected:
37 virtual wxObjectRefData *CreateRefData() const;
38 virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
39
40 DECLARE_DYNAMIC_CLASS(MyCar)
41 };
42
43
44 // implementation
45 // --------------
46
47 // the reference data class is typically a private class only visible in the
48 // implementation source file of the refcounted class.
49 class MyCarRefData : public wxObjectRefData
50 {
51 public:
52 MyCarRefData()
53 {
54 m_price = 0;
55 }
56
57 MyCarRefData( const MyCarRefData& data )
58 : wxObjectRefData()
59 {
60 // copy refcounted data; this is usually a time- and memory-consuming operation
61 // and is only done when two (or more) MyCar instances need to unshare a
62 // common instance of MyCarRefData
63 m_price = data.m_price;
64 }
65
66 bool operator == (const MyCarRefData& data) const
67 {
68 return m_price == data.m_price;
69 }
70
71 private:
72 // in real world, reference counting is usually used only when
73 // the wxObjectRefData-derived class holds data very memory-consuming;
74 // in this example the various MyCar instances may share a MyCarRefData
75 // instance which however only takes 4 bytes for this integer!
76 int m_price;
77 };
78
79
80 #define M_CARDATA ((MyCarRefData *)m_refData)
81 IMPLEMENT_DYNAMIC_CLASS(MyCar,wxObject)
82
83 MyCar::MyCar( int price )
84 {
85 // here we init the MyCar internal data:
86 m_refData = new MyCarRefData();
87 M_CARDATA->m_price = price;
88 }
89
90 wxObjectRefData *MyCar::CreateRefData() const
91 {
92 return new MyCarRefData;
93 }
94
95 wxObjectRefData *MyCar::CloneRefData(const wxObjectRefData *data) const
96 {
97 return new MyCarRefData(*(MyCarRefData *)data);
98 }
99
100 bool MyCar::operator == ( const MyCar& car ) const
101 {
102 if (m_refData == car.m_refData)
103 return true;
104 if (!m_refData || !car.m_refData)
105 return false;
106
107 // here we use the MyCarRefData::operator==() function.
108 // Note however that this comparison may be very slow if the
109 // reference data contains a lot of data to be compared.
110 return ( *(MyCarRefData*)m_refData == *(MyCarRefData*)car.m_refData );
111 }
112
113 void MyCar::SetPrice( int price )
114 {
115 // since this function modifies one of the MyCar internal property,
116 // we need to be sure that the other MyCar instances which share the
117 // same MyCarRefData instance are not affected by this call.
118 // I.e. it's very important to call UnShare() in all setters of
119 // refcounted classes!
120 UnShare();
121
122 M_CARDATA->m_price = price;
123 }
124
125 int MyCar::GetPrice() const
126 {
127 wxCHECK_MSG( IsOk(), -1, "invalid car" );
128
129 return M_CARDATA->m_price;
130 }
131 @endcode
132
133
134 @library{wxbase}
135 @category{rtti}
136
137 @see wxObject, wxObjectDataPtr<T>, @ref overview_refcount
138 */
139 typedef wxRefCounter wxObjectRefData;
140
141
142 /**
143 @class wxRefCounter
144
145 This class is used to manage reference-counting.
146
147 @library{wxbase}
148 @category{rtti}
149
150 @see wxObject, wxObjectRefData, wxObjectDataPtr<T>, @ref overview_refcount
151 */
152 class wxRefCounter
153 {
154 protected:
155 /**
156 Destructor.
157
158 It's declared @c protected so that wxRefCounter instances
159 will never be destroyed directly but only as result of a DecRef() call.
160 */
161 virtual ~wxRefCounter();
162
163 public:
164 /**
165 Default constructor. Initialises the internal reference count to 1.
166 */
167 wxRefCounter();
168
169 /**
170 Decrements the reference count associated with this shared data and, if
171 it reaches zero, destroys this instance of wxRefCounter releasing its
172 memory.
173
174 Please note that after calling this function, the caller should
175 absolutely avoid to use the pointer to this instance since it may not be
176 valid anymore.
177 */
178 void DecRef();
179
180 /**
181 Returns the reference count associated with this shared data.
182
183 When this goes to zero during a DecRef() call, the object will auto-free itself.
184 */
185 int GetRefCount() const;
186
187 /**
188 Increments the reference count associated with this shared data.
189 */
190 void IncRef();
191 };
192
193
194
195 /**
196 @class wxObject
197
198 This is the root class of many of the wxWidgets classes.
199
200 It declares a virtual destructor which ensures that destructors get called
201 for all derived class objects where necessary.
202
203 wxObject is the hub of a dynamic object creation scheme, enabling a program
204 to create instances of a class only knowing its string class name, and to
205 query the class hierarchy.
206
207 The class contains optional debugging versions of @b new and @b delete, which
208 can help trace memory allocation and deallocation problems.
209
210 wxObject can be used to implement @ref overview_refcount "reference counted"
211 objects, such as wxPen, wxBitmap and others
212 (see @ref overview_refcount_list "this list").
213 See wxRefCounter and @ref overview_refcount for more info about
214 reference counting.
215
216 @library{wxbase}
217 @category{rtti}
218
219 @see wxClassInfo, @ref overview_debugging, @ref overview_refcount,
220 wxObjectDataRef, wxObjectDataPtr<T>
221 */
222 class wxObject
223 {
224 public:
225
226 /**
227 Default ctor; initializes to @NULL the internal reference data.
228 */
229 wxObject();
230
231 /**
232 Copy ctor.
233
234 Sets the internal wxObject::m_refData pointer to point to the same
235 instance of the wxObjectRefData-derived class pointed by @c other and
236 increments the refcount of wxObject::m_refData.
237 */
238 wxObject(const wxObject& other);
239
240 /**
241 Destructor.
242
243 Performs dereferencing, for those objects that use reference counting.
244 */
245 virtual ~wxObject();
246
247 /**
248 This virtual function is redefined for every class that requires run-time
249 type information, when using the ::DECLARE_CLASS macro (or similar).
250 */
251 virtual wxClassInfo* GetClassInfo() const;
252
253 /**
254 Returns the wxObject::m_refData pointer, i.e. the data referenced by this object.
255
256 @see Ref(), UnRef(), wxObject::m_refData, SetRefData(), wxObjectRefData
257 */
258 wxObjectRefData* GetRefData() const;
259
260 /**
261 Determines whether this class is a subclass of (or the same class as)
262 the given class.
263
264 Example:
265
266 @code
267 bool tmp = obj->IsKindOf(CLASSINFO(wxFrame));
268 @endcode
269
270 @param info
271 A pointer to a class information object, which may be obtained
272 by using the ::CLASSINFO macro.
273
274 @return @true if the class represented by info is the same class as this
275 one or is derived from it.
276 */
277 bool IsKindOf(const wxClassInfo* info) const;
278
279 /**
280 Returns @true if this object has the same data pointer as @a obj.
281
282 Notice that @true is returned if the data pointers are @NULL in both objects.
283
284 This function only does a @e shallow comparison, i.e. it doesn't compare
285 the objects pointed to by the data pointers of these objects.
286
287 @see @ref overview_refcount
288 */
289 bool IsSameAs(const wxObject& obj) const;
290
291 /**
292 Makes this object refer to the data in @a clone.
293
294 @param clone
295 The object to 'clone'.
296
297 @remarks First this function calls UnRef() on itself to decrement
298 (and perhaps free) the data it is currently referring to.
299 It then sets its own wxObject::m_refData to point to that of @a clone,
300 and increments the reference count inside the data.
301
302 @see UnRef(), SetRefData(), GetRefData(), wxObjectRefData
303 */
304 void Ref(const wxObject& clone);
305
306 /**
307 Sets the wxObject::m_refData pointer.
308
309 @see Ref(), UnRef(), GetRefData(), wxObjectRefData
310 */
311 void SetRefData(wxObjectRefData* data);
312
313 /**
314 Decrements the reference count in the associated data, and if it is zero,
315 deletes the data.
316
317 The wxObject::m_refData member is set to @NULL.
318
319 @see Ref(), SetRefData(), GetRefData(), wxObjectRefData
320 */
321 void UnRef();
322
323 /**
324 This is the same of AllocExclusive() but this method is public.
325 */
326 void UnShare();
327
328 /**
329 The @e delete operator is defined for debugging versions of the library only,
330 when the identifier @c __WXDEBUG__ is defined.
331
332 It takes over memory deallocation, allowing wxDebugContext operations.
333 */
334 void operator delete(void *buf);
335
336 /**
337 The @e new operator is defined for debugging versions of the library only, when
338 the identifier @c __WXDEBUG__ is defined.
339
340 It takes over memory allocation, allowing wxDebugContext operations.
341 */
342 void* operator new(size_t size, const wxString& filename = NULL, int lineNum = 0);
343
344 protected:
345 /**
346 Ensure that this object's data is not shared with any other object.
347
348 If we have no data, it is created using CreateRefData();
349 if we have shared data (i.e. data with a reference count greater than 1),
350 it is copied using CloneRefData(); otherwise nothing is done (the data
351 is already present and is not shared by other object instances).
352
353 If you use this function you should make sure that you override the
354 CreateRefData() and CloneRefData() functions in your class otherwise
355 an assertion will fail at runtime.
356 */
357 void AllocExclusive();
358
359 /**
360 Creates a new instance of the wxObjectRefData-derived class specific to
361 this object and returns it.
362
363 This is usually implemented as a one-line call:
364 @code
365 wxObjectRefData *MyObject::CreateRefData() const
366 {
367 return new MyObjectRefData;
368 }
369 @endcode
370 */
371 virtual wxObjectRefData *CreateRefData() const;
372
373 /**
374 Creates a new instance of the wxObjectRefData-derived class specific to
375 this object and initializes it copying @a data.
376
377 This is usually implemented as a one-line call:
378 @code
379 wxObjectRefData *MyObject::CloneRefData(const wxObjectRefData *data) const
380 {
381 // rely on the MyObjectRefData copy ctor:
382 return new MyObjectRefData(*(MyObjectRefData *)data);
383 }
384 @endcode
385 */
386 virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
387
388 /**
389 Pointer to an object which is the object's reference-counted data.
390
391 @see Ref(), UnRef(), SetRefData(), GetRefData(), wxObjectRefData
392 */
393 wxObjectRefData* m_refData;
394 };
395
396
397
398 /**
399 @class wxClassInfo
400
401 This class stores meta-information about classes.
402
403 Instances of this class are not generally defined directly by an application,
404 but indirectly through use of macros such as ::DECLARE_DYNAMIC_CLASS and
405 ::IMPLEMENT_DYNAMIC_CLASS.
406
407 @library{wxbase}
408 @category{rtti}
409
410 @see @ref overview_rtti_classinfo, wxObject
411 */
412 class wxClassInfo
413 {
414 public:
415 /**
416 Constructs a wxClassInfo object.
417
418 The supplied macros implicitly construct objects of this class, so there is no
419 need to create such objects explicitly in an application.
420 */
421 wxClassInfo(const wxChar* className,
422 const wxClassInfo* baseClass1,
423 const wxClassInfo* baseClass2,
424 int size, wxObjectConstructorFn fn);
425
426 /**
427 Creates an object of the appropriate kind.
428
429 @return @NULL if the class has not been declared dynamically creatable
430 (typically, this happens for abstract classes).
431 */
432 wxObject* CreateObject() const;
433
434 /**
435 Finds the wxClassInfo object for a class with the given @a name.
436 */
437 static wxClassInfo* FindClass(const wxString& className);
438
439 /**
440 Returns the name of the first base class (@NULL if none).
441 */
442 const wxChar* GetBaseClassName1() const;
443
444 /**
445 Returns the name of the second base class (@NULL if none).
446 */
447 const wxChar* GetBaseClassName2() const;
448
449 /**
450 Returns the string form of the class name.
451 */
452 const wxChar* GetClassName() const;
453
454 /**
455 Returns the size of the class.
456 */
457 int GetSize() const;
458
459 /**
460 Returns @true if this class info can create objects of the associated class.
461 */
462 bool IsDynamic() const;
463
464 /**
465 Returns @true if this class is a kind of (inherits from) the given class.
466 */
467 bool IsKindOf(const wxClassInfo* info) const;
468 };
469
470
471
472 /**
473
474 This is an helper template class primarily written to avoid memory leaks because of
475 missing calls to wxObjectRefData::DecRef().
476
477 Despite the name this template can actually be used as a smart pointer for any
478 class implementing the reference counting interface which only consists of the two
479 methods @b T::IncRef() and @b T::DecRef().
480
481 The difference to wxSharedPtr<T> is that wxObjectDataPtr<T> relies on the reference
482 counting to be in the class pointed to, where instead wxSharedPtr<T> implements the
483 reference counting itself.
484
485 @section objectdataptr_example Example
486
487 @code
488 class MyCarRefData: public wxObjectRefData
489 {
490 public:
491 MyCarRefData() { m_price = 0; }
492
493 MyCarRefData( const MyCarRefData& data )
494 : wxObjectRefData()
495 {
496 m_price = data.m_price;
497 }
498
499 void SetPrice( int price ) { m_price = price; }
500 int GetPrice() const { return m_price; }
501
502 bool operator == ( const MyCarRefData& other ) const
503 {
504 return m_price == other.m_price;
505 }
506
507 protected:
508 int m_price;
509 };
510
511 class MyCar
512 {
513 public:
514 // initializes this MyCar assigning to the
515 // internal data pointer a new instance of MyCarRefData
516 MyCar( int price ) : m_data( new MyCarRefData )
517 {
518 m_data->SetPrice( price );
519 }
520
521 MyCar& operator =( const MyCar& tocopy )
522 {
523 // shallow copy: this is just a fast copy of pointers; the real
524 // memory-consuming data which typically is stored inside
525 // MyCarRefData is not copied here!
526 m_data = tocopy.m_data;
527 return *this;
528 }
529
530 bool operator == ( const MyCar& other ) const
531 {
532 if (m_data.get() == other.m_data.get())
533 return true; // this instance and the 'other' one share the
534 // same MyCarRefData data...
535
536 // rely on the MyCarRefData::operator==()
537 return (*m_data.get()) == (*other.m_data.get());
538 }
539
540 void SetPrice( int price )
541 {
542 // make sure changes to this class do not affect other instances
543 // currently sharing our same refcounted data:
544 UnShare();
545
546 m_data->SetPrice( price );
547 }
548
549 int GetPrice() const
550 {
551 return m_data->GetPrice();
552 }
553
554 wxObjectDataPtr<MyCarRefData> m_data;
555
556 protected:
557 void UnShare()
558 {
559 if (m_data->GetRefCount() == 1)
560 return;
561
562 m_data.reset( new MyCarRefData( *m_data ) );
563 }
564 };
565 @endcode
566
567
568 @library{wxbase}
569 @category{rtti,smartpointers}
570
571 @see wxObject, wxObjectRefData, @ref overview_refcount, wxSharedPtr<T>,
572 wxScopedPtr<T>, wxWeakRef<T>
573 */
574 template <class T>
575 class wxObjectDataPtr<T>
576 {
577 public:
578 /**
579 Constructor.
580
581 @a ptr is a pointer to the reference counted object to which this class points.
582 If @a ptr is not NULL @b T::IncRef() will be called on the object.
583 */
584 wxObjectDataPtr<T>(T* ptr = NULL);
585
586 /**
587 This copy constructor increases the count of the reference counted object to
588 which @a tocopy points and then this class will point to, as well.
589 */
590 wxObjectDataPtr<T>(const wxObjectDataPtr<T>& tocopy);
591
592
593 /**
594 Decreases the reference count of the object to which this class points.
595 */
596 ~wxObjectDataPtr<T>();
597
598 /**
599 Gets a pointer to the reference counted object to which this class points.
600 */
601 T* get() const;
602
603 /**
604 Reset this class to ptr which points to a reference counted object and
605 calls T::DecRef() on the previously owned object.
606 */
607 void reset(T *ptr);
608
609 /**
610 Conversion to a boolean expression (in a variant which is not
611 convertable to anything but a boolean expression).
612
613 If this class contains a valid pointer it will return @true, if it contains
614 a @NULL pointer it will return @false.
615 */
616 operator unspecified_bool_type() const;
617
618 /**
619 Returns a reference to the object.
620
621 If the internal pointer is @NULL this method will cause an assert in debug mode.
622 */
623 T& operator*() const;
624
625 /**
626 Returns a pointer to the reference counted object to which this class points.
627
628 If this the internal pointer is @NULL, this method will assert in debug mode.
629 */
630 T* operator->() const;
631
632 //@{
633 /**
634 Assignment operator.
635 */
636 wxObjectDataPtr<T>& operator=(const wxObjectDataPtr<T>& tocopy);
637 wxObjectDataPtr<T>& operator=(T* ptr);
638 //@}
639 };
640
641
642
643 // ============================================================================
644 // Global functions/macros
645 // ============================================================================
646
647 /** @addtogroup group_funcmacro_rtti */
648 //@{
649
650 /**
651 Returns a pointer to the wxClassInfo object associated with this class.
652
653 @header{wx/object.h}
654 */
655 #define CLASSINFO( className )
656
657 /**
658 Used inside a class declaration to declare that the class should be made
659 known to the class hierarchy, but objects of this class cannot be created
660 dynamically. The same as DECLARE_ABSTRACT_CLASS().
661
662 @header{wx/object.h}
663 */
664 #define DECLARE_CLASS( className )
665
666 /**
667 Used inside a class declaration to declare that the class should be
668 made known to the class hierarchy, but objects of this class cannot be created
669 dynamically. The same as DECLARE_CLASS().
670
671 @header{wx/object.h}
672
673 Example:
674
675 @code
676 class wxCommand: public wxObject
677 {
678 DECLARE_ABSTRACT_CLASS(wxCommand)
679
680 private:
681 ...
682 public:
683 ...
684 };
685 @endcode
686 */
687 #define DECLARE_ABSTRACT_CLASS( className )
688
689 /**
690 Used inside a class declaration to make the class known to wxWidgets RTTI
691 system and also declare that the objects of this class should be
692 dynamically creatable from run-time type information. Notice that this
693 implies that the class should have a default constructor, if this is not
694 the case consider using DECLARE_CLASS().
695
696 @header{wx/object.h}
697
698 Example:
699
700 @code
701 class wxFrame: public wxWindow
702 {
703 DECLARE_DYNAMIC_CLASS(wxFrame)
704
705 private:
706 const wxString& frameTitle;
707 public:
708 ...
709 };
710 @endcode
711 */
712 #define DECLARE_DYNAMIC_CLASS( className )
713
714 /**
715 Used in a C++ implementation file to complete the declaration of a class
716 that has run-time type information. The same as IMPLEMENT_ABSTRACT_CLASS().
717
718 @header{wx/object.h}
719 */
720 #define IMPLEMENT_CLASS( className, baseClassName )
721
722 /**
723 Used in a C++ implementation file to complete the declaration of a class
724 that has run-time type information and two base classes. The same as
725 IMPLEMENT_ABSTRACT_CLASS2().
726
727 @header{wx/object.h}
728 */
729 #define IMPLEMENT_CLASS2( className, baseClassName1, baseClassName2 )
730
731 /**
732 Used in a C++ implementation file to complete the declaration of a class
733 that has run-time type information. The same as IMPLEMENT_CLASS().
734
735 @header{wx/object.h}
736
737 Example:
738
739 @code
740 IMPLEMENT_ABSTRACT_CLASS(wxCommand, wxObject)
741
742 wxCommand::wxCommand(void)
743 {
744 ...
745 }
746 @endcode
747 */
748 #define IMPLEMENT_ABSTRACT_CLASS( className, baseClassName )
749
750 /**
751 Used in a C++ implementation file to complete the declaration of a class
752 that has run-time type information and two base classes. The same as
753 IMPLEMENT_CLASS2().
754
755 @header{wx/object.h}
756 */
757 #define IMPLEMENT_ABSTRACT_CLASS2( className, baseClassName1, baseClassName2 )
758
759 /**
760 Used in a C++ implementation file to complete the declaration of a class
761 that has run-time type information, and whose instances can be created
762 dynamically.
763
764 @header{wx/object.h}
765
766 Example:
767
768 @code
769 IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
770
771 wxFrame::wxFrame(void)
772 {
773 ...
774 }
775 @endcode
776 */
777 #define IMPLEMENT_DYNAMIC_CLASS( className, baseClassName )
778
779 /**
780 Used in a C++ implementation file to complete the declaration of a class
781 that has run-time type information, and whose instances can be created
782 dynamically. Use this for classes derived from two base classes.
783
784 @header{wx/object.h}
785 */
786 #define IMPLEMENT_DYNAMIC_CLASS2( className, baseClassName1, baseClassName2 )
787
788 /**
789 Same as @c const_cast<T>(x) if the compiler supports const cast or @c (T)x for
790 old compilers. Unlike wxConstCast(), the cast it to the type @c T and not to
791 <tt>T *</tt> and also the order of arguments is the same as for the standard cast.
792
793 @header{wx/defs.h}
794
795 @see wx_reinterpret_cast(), wx_static_cast()
796 */
797 #define wx_const_cast(T, x)
798
799 /**
800 Same as @c reinterpret_cast<T>(x) if the compiler supports reinterpret cast or
801 @c (T)x for old compilers.
802
803 @header{wx/defs.h}
804
805 @see wx_const_cast(), wx_static_cast()
806 */
807 #define wx_reinterpret_cast(T, x)
808
809 /**
810 Same as @c static_cast<T>(x) if the compiler supports static cast or @c (T)x for
811 old compilers. Unlike wxStaticCast(), there are no checks being done and
812 the meaning of the macro arguments is exactly the same as for the standard
813 static cast, i.e. @a T is the full type name and star is not appended to it.
814
815 @header{wx/defs.h}
816
817 @see wx_const_cast(), wx_reinterpret_cast(), wx_truncate_cast()
818 */
819 #define wx_static_cast(T, x)
820
821 /**
822 This case doesn’t correspond to any standard cast but exists solely to make
823 casts which possibly result in a truncation of an integer value more
824 readable.
825
826 @header{wx/defs.h}
827 */
828 #define wx_truncate_cast(T, x)
829
830 /**
831 This macro expands into <tt>const_cast<classname *>(ptr)</tt> if the compiler
832 supports const_cast or into an old, C-style cast, otherwise.
833
834 @header{wx/defs.h}
835
836 @see wx_const_cast(), wxDynamicCast(), wxStaticCast()
837 */
838 #define wxConstCast( ptr, classname )
839
840 /**
841 This macro returns the pointer @e ptr cast to the type @e classname * if
842 the pointer is of this type (the check is done during the run-time) or
843 @NULL otherwise. Usage of this macro is preferred over obsoleted
844 wxObject::IsKindOf() function.
845
846 The @e ptr argument may be @NULL, in which case @NULL will be returned.
847
848 @header{wx/object.h}
849
850 Example:
851
852 @code
853 wxWindow *win = wxWindow::FindFocus();
854 wxTextCtrl *text = wxDynamicCast(win, wxTextCtrl);
855 if ( text )
856 {
857 // a text control has the focus...
858 }
859 else
860 {
861 // no window has the focus or it is not a text control
862 }
863 @endcode
864
865 @see @ref overview_rtti, wxDynamicCastThis(), wxConstCast(), wxStaticCast()
866 */
867 #define wxDynamicCast( ptr, classname )
868
869 /**
870 This macro is equivalent to <tt>wxDynamicCast(this, classname)</tt> but the latter provokes
871 spurious compilation warnings from some compilers (because it tests whether
872 @c this pointer is non-@NULL which is always true), so this macro should be
873 used to avoid them.
874
875 @header{wx/object.h}
876
877 @see wxDynamicCast()
878 */
879 #define wxDynamicCastThis( classname )
880
881 /**
882 This macro checks that the cast is valid in debug mode (an assert failure
883 will result if wxDynamicCast(ptr, classname) == @NULL) and then returns the
884 result of executing an equivalent of <tt>static_cast<classname *>(ptr)</tt>.
885
886 @header{wx/object.h}
887
888 @see wx_static_cast(), wxDynamicCast(), wxConstCast()
889 */
890 #define wxStaticCast( ptr, classname )
891
892 /**
893 Creates and returns an object of the given class, if the class has been
894 registered with the dynamic class system using DECLARE... and IMPLEMENT...
895 macros.
896
897 @header{wx/object.h}
898 */
899 wxObject *wxCreateDynamicObject(const wxString& className);
900
901 //@}
902
903 /** @addtogroup group_funcmacro_debug */
904 //@{
905
906 /**
907 This is defined in debug mode to be call the redefined new operator
908 with filename and line number arguments. The definition is:
909
910 @code
911 #define WXDEBUG_NEW new(__FILE__,__LINE__)
912 @endcode
913
914 In non-debug mode, this is defined as the normal new operator.
915
916 @header{wx/object.h}
917 */
918 #define WXDEBUG_NEW( arg )
919
920 //@}
921