Version: 3.0.5
Loading...
Searching...
No Matches
object.h File Reference

Classes

class  wxRefCounter
 This class is used to manage reference-counting providing a simple interface and a counter. More...
 
class  wxObject
 This is the root class of many of the wxWidgets classes. More...
 
class  wxClassInfo
 This class stores meta-information about classes. More...
 
class  wxObjectDataPtr< T >
 This is an helper template class primarily written to avoid memory leaks because of missing calls to wxRefCounter::DecRef() and wxObjectRefData::DecRef(). More...
 

Macros

#define wxCLASSINFO(className)
 Returns a pointer to the wxClassInfo object associated with this class.
 
#define wxDECLARE_ABSTRACT_CLASS(className)
 Used inside a class declaration to declare that the class should be made known to the class hierarchy, but objects of this class cannot be created dynamically.
 
#define wxDECLARE_DYNAMIC_CLASS(className)
 Used inside a class declaration to make the class known to wxWidgets RTTI system and also declare that the objects of this class should be dynamically creatable from run-time type information.
 
#define wxDECLARE_CLASS(className)
 Used inside a class declaration to declare that the class should be made known to the class hierarchy, but objects of this class cannot be created dynamically.
 
#define wxIMPLEMENT_ABSTRACT_CLASS(className, baseClassName)
 Used in a C++ implementation file to complete the declaration of a class that has run-time type information.
 
#define wxIMPLEMENT_ABSTRACT_CLASS2(className, baseClassName1, baseClassName2)
 Used in a C++ implementation file to complete the declaration of a class that has run-time type information and two base classes.
 
#define wxIMPLEMENT_DYNAMIC_CLASS(className, baseClassName)
 Used in a C++ implementation file to complete the declaration of a class that has run-time type information, and whose instances can be created dynamically.
 
#define wxIMPLEMENT_DYNAMIC_CLASS2(className, baseClassName1, baseClassName2)
 Used in a C++ implementation file to complete the declaration of a class that has run-time type information, and whose instances can be created dynamically.
 
#define wxIMPLEMENT_CLASS(className, baseClassName)
 Synonym for wxIMPLEMENT_ABSTRACT_CLASS().
 
#define wxIMPLEMENT_CLASS2(className, baseClassName1, baseClassName2)
 Synonym for wxIMPLEMENT_ABSTRACT_CLASS2().
 
#define wx_const_cast(T, x)
 Same as const_cast<T>(x) if the compiler supports const cast or (T)x for old compilers.
 
#define wx_reinterpret_cast(T, x)
 Same as reinterpret_cast<T>(x) if the compiler supports reinterpret cast or (T)x for old compilers.
 
#define wx_static_cast(T, x)
 Same as static_cast<T>(x) if the compiler supports static cast or (T)x for old compilers.
 
#define wx_truncate_cast(T, x)
 This case doesn’t correspond to any standard cast but exists solely to make casts which possibly result in a truncation of an integer value more readable.
 
#define wxConstCast(ptr, classname)
 This macro expands into const_cast<classname *>(ptr) if the compiler supports const_cast or into an old, C-style cast, otherwise.
 
#define wxDynamicCast(ptr, classname)
 This macro returns the pointer ptr cast to the type classname * if the pointer is of this type (the check is done during the run-time) or NULL otherwise.
 
#define wxDynamicCastThis(classname)
 This macro is equivalent to wxDynamicCast(this, classname) but the latter provokes spurious compilation warnings from some compilers (because it tests whether this pointer is non-NULL which is always true), so this macro should be used to avoid them.
 
#define wxStaticCast(ptr, classname)
 This macro checks that the cast is valid in debug mode (an assert failure will result if wxDynamicCast(ptr, classname) == NULL) and then returns the result of executing an equivalent of static_cast<classname *>(ptr).
 
#define WXDEBUG_NEW(arg)
 This is defined in debug mode to be call the redefined new operator with filename and line number arguments.
 

Typedefs

typedef wxRefCounter wxObjectRefData
 

Functions

wxObjectwxCreateDynamicObject (const wxString &className)
 Creates and returns an object of the given class, if the class has been registered with the dynamic class system using DECLARE... and IMPLEMENT... macros.
 

Macro Definition Documentation

◆ wx_const_cast

#define wx_const_cast (   T,
 
)

Same as const_cast<T>(x) if the compiler supports const cast or (T)x for old compilers.

Unlike wxConstCast(), the cast it to the type T and not to T * and also the order of arguments is the same as for the standard cast.

Include file:

#include <wx/defs.h> 
See also
wx_reinterpret_cast(), wx_static_cast()

◆ wx_reinterpret_cast

#define wx_reinterpret_cast (   T,
 
)

Same as reinterpret_cast<T>(x) if the compiler supports reinterpret cast or (T)x for old compilers.

Include file:

#include <wx/defs.h> 
See also
wx_const_cast(), wx_static_cast()

◆ wx_static_cast

#define wx_static_cast (   T,
 
)

Same as static_cast<T>(x) if the compiler supports static cast or (T)x for old compilers.

Unlike wxStaticCast(), there are no checks being done and the meaning of the macro arguments is exactly the same as for the standard static cast, i.e. T is the full type name and star is not appended to it.

Include file:

#include <wx/defs.h> 
See also
wx_const_cast(), wx_reinterpret_cast(), wx_truncate_cast()

◆ wx_truncate_cast

#define wx_truncate_cast (   T,
 
)

This case doesn’t correspond to any standard cast but exists solely to make casts which possibly result in a truncation of an integer value more readable.

Include file:

#include <wx/defs.h> 

◆ wxCLASSINFO

#define wxCLASSINFO (   className)

Returns a pointer to the wxClassInfo object associated with this class.

Include file:

#include <wx/object.h> 

◆ wxConstCast

#define wxConstCast (   ptr,
  classname 
)

This macro expands into const_cast<classname *>(ptr) if the compiler supports const_cast or into an old, C-style cast, otherwise.

Include file:

#include <wx/defs.h> 
See also
wx_const_cast(), wxDynamicCast(), wxStaticCast()

◆ WXDEBUG_NEW

#define WXDEBUG_NEW (   arg)

This is defined in debug mode to be call the redefined new operator with filename and line number arguments.

The definition is:

#define WXDEBUG_NEW new(__FILE__,__LINE__)

In non-debug mode, this is defined as the normal new operator.

Include file:

#include <wx/object.h> 

◆ wxDECLARE_ABSTRACT_CLASS

#define wxDECLARE_ABSTRACT_CLASS (   className)

Used inside a class declaration to declare that the class should be made known to the class hierarchy, but objects of this class cannot be created dynamically.

Include file:

#include <wx/object.h> 

Example:

class wxCommand: public wxObject
{
private:
...
public:
...
};
wxCommand is a base class for modelling an application command, which is an action usually performed ...
Definition cmdproc.h:22
This is the root class of many of the wxWidgets classes.
Definition object.h:233
#define wxDECLARE_ABSTRACT_CLASS(className)
Used inside a class declaration to declare that the class should be made known to the class hierarchy...
Definition object.h:680

◆ wxDECLARE_CLASS

#define wxDECLARE_CLASS (   className)

Used inside a class declaration to declare that the class should be made known to the class hierarchy, but objects of this class cannot be created dynamically.

The same as wxDECLARE_ABSTRACT_CLASS().

Include file:

#include <wx/object.h> 

◆ wxDECLARE_DYNAMIC_CLASS

#define wxDECLARE_DYNAMIC_CLASS (   className)

Used inside a class declaration to make the class known to wxWidgets RTTI system and also declare that the objects of this class should be dynamically creatable from run-time type information.

Notice that this implies that the class should have a default constructor, if this is not the case consider using wxDECLARE_ABSTRACT_CLASS().

Include file:

#include <wx/object.h> 

Example:

class wxFrame: public wxWindow
{
private:
const wxString& frameTitle;
public:
...
};
A frame is a window whose size and position can (usually) be changed by the user.
Definition frame.h:153
String class for passing textual data to or receiving it from wxWidgets.
Definition string.h:314
wxWindow is the base class for all windows and represents any visible object on screen.
Definition window.h:287
#define wxDECLARE_DYNAMIC_CLASS(className)
Used inside a class declaration to make the class known to wxWidgets RTTI system and also declare tha...
Definition object.h:705

◆ wxDynamicCast

#define wxDynamicCast (   ptr,
  classname 
)

This macro returns the pointer ptr cast to the type classname * if the pointer is of this type (the check is done during the run-time) or NULL otherwise.

Usage of this macro is preferred over obsoleted wxObject::IsKindOf() function.

The ptr argument may be NULL, in which case NULL will be returned.

Include file:

#include <wx/object.h> 

Example:

wxTextCtrl *text = wxDynamicCast(win, wxTextCtrl);
if ( text )
{
// a text control has the focus...
}
else
{
// no window has the focus or it is not a text control
}
static wxWindow * FindFocus()
Finds the window or control which currently has the keyboard focus.
#define wxDynamicCast(ptr, classname)
This macro returns the pointer ptr cast to the type classname * if the pointer is of this type (the c...
Definition object.h:873
See also
Runtime Type Information (RTTI), wxDynamicCastThis(), wxConstCast(), wxStaticCast()

◆ wxDynamicCastThis

#define wxDynamicCastThis (   classname)

This macro is equivalent to wxDynamicCast(this, classname) but the latter provokes spurious compilation warnings from some compilers (because it tests whether this pointer is non-NULL which is always true), so this macro should be used to avoid them.

Include file:

#include <wx/object.h> 
See also
wxDynamicCast()

◆ wxIMPLEMENT_ABSTRACT_CLASS

#define wxIMPLEMENT_ABSTRACT_CLASS (   className,
  baseClassName 
)

Used in a C++ implementation file to complete the declaration of a class that has run-time type information.

Include file:

#include <wx/object.h> 

Example:

{
...
}
wxCommand(bool canUndo=false, const wxString &name=wxEmptyString)
Constructor.
#define wxIMPLEMENT_ABSTRACT_CLASS(className, baseClassName)
Used in a C++ implementation file to complete the declaration of a class that has run-time type infor...
Definition object.h:735

◆ wxIMPLEMENT_ABSTRACT_CLASS2

#define wxIMPLEMENT_ABSTRACT_CLASS2 (   className,
  baseClassName1,
  baseClassName2 
)

Used in a C++ implementation file to complete the declaration of a class that has run-time type information and two base classes.

Include file:

#include <wx/object.h> 

◆ wxIMPLEMENT_CLASS

#define wxIMPLEMENT_CLASS (   className,
  baseClassName 
)

Synonym for wxIMPLEMENT_ABSTRACT_CLASS().

Please prefer to use the more clear, if longer, wxIMPLEMENT_ABSTRACT_CLASS in the new code.

Include file:

#include <wx/object.h> 

◆ wxIMPLEMENT_CLASS2

#define wxIMPLEMENT_CLASS2 (   className,
  baseClassName1,
  baseClassName2 
)

Synonym for wxIMPLEMENT_ABSTRACT_CLASS2().

Please prefer to use the more clear, if longer, wxIMPLEMENT_ABSTRACT_CLASS2 in the new code.

Include file:

#include <wx/object.h> 

◆ wxIMPLEMENT_DYNAMIC_CLASS

#define wxIMPLEMENT_DYNAMIC_CLASS (   className,
  baseClassName 
)

Used in a C++ implementation file to complete the declaration of a class that has run-time type information, and whose instances can be created dynamically.

Include file:

#include <wx/object.h> 

Example:

{
...
}
wxFrame()
Default constructor.
#define wxIMPLEMENT_DYNAMIC_CLASS(className, baseClassName)
Used in a C++ implementation file to complete the declaration of a class that has run-time type infor...
Definition object.h:763

◆ wxIMPLEMENT_DYNAMIC_CLASS2

#define wxIMPLEMENT_DYNAMIC_CLASS2 (   className,
  baseClassName1,
  baseClassName2 
)

Used in a C++ implementation file to complete the declaration of a class that has run-time type information, and whose instances can be created dynamically.

Use this for classes derived from two base classes.

Include file:

#include <wx/object.h> 

◆ wxStaticCast

#define wxStaticCast (   ptr,
  classname 
)

This macro checks that the cast is valid in debug mode (an assert failure will result if wxDynamicCast(ptr, classname) == NULL) and then returns the result of executing an equivalent of static_cast<classname *>(ptr).

Include file:

#include <wx/object.h> 
See also
wx_static_cast(), wxDynamicCast(), wxConstCast()

Typedef Documentation

◆ wxObjectRefData

Function Documentation

◆ wxCreateDynamicObject()

wxObject * wxCreateDynamicObject ( const wxString className)

Creates and returns an object of the given class, if the class has been registered with the dynamic class system using DECLARE... and IMPLEMENT... macros.

Include file:

#include <wx/object.h>