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