.. include:: headings.inc .. _Object: ========================================================================================================================================== |phoenix_title| **Object** ========================================================================================================================================== This is the root class of many of the wxWidgets classes. It declares a virtual destructor which ensures that destructors get called for all derived class objects where necessary. :ref:`Object` is the hub of a dynamic object creation scheme, enabling a program to create instances of a class only knowing its string class name, and to query the class hierarchy. The class contains optional debugging versions of **new** and **delete**, which can help trace memory allocation and deallocation problems. :ref:`Object` can be used to implement :ref:`reference counted ` objects, such as :ref:`Pen`, :ref:`Bitmap` and others (see :ref:`this list `). See :ref:`RefCounter` and :ref:`Reference Counting ` for more info about reference counting. .. seealso:: `ClassInfo`, :ref:`Reference Counting `, ObjectDataRef, `ObjectDataPtr` | |class_hierarchy| Inheritance Diagram ===================================== Inheritance diagram for class **Object** .. raw:: html

Inheritance diagram of Object

| |sub_classes| Known Subclasses ============================== :ref:`AcceleratorTable`, `Accessible`, `ArchiveClassFactory`, `ArchiveEntry`, :ref:`ArtProvider`, `AutomationObject`, `BitmapHandler`, `Client`, :ref:`Clipboard`, :ref:`Colour`, :ref:`ColourData`, `Command`, `CommandProcessor`, :ref:`ConfigBase`, `Connection`, `ConnectionBase`, :ref:`ContextHelp`, `DataViewIconText`, :ref:`dataview.DataViewRenderer`, :ref:`DC`, `DDEClient`, `DocTemplate`, :ref:`DragImage`, `EncodingConverter`, :ref:`Event`, :ref:`EvtHandler`, `FileHistory`, :ref:`FileSystem`, :ref:`FileSystemHandler`, `FilterClassFactory`, :ref:`FindReplaceData`, `FontData`, :ref:`FSFile`, :ref:`GDIObject`, `GLContext`, :ref:`GraphicsObject`, :ref:`GraphicsRenderer`, `GridTableBase`, `HashTable`, :ref:`HelpControllerBase`, `HtmlCell`, `HtmlDCRenderer`, `HtmlEasyPrinting`, `HtmlFilter`, `HtmlHelpData`, `HtmlLinkInfo`, `HtmlTagHandler`, :ref:`Image`, :ref:`ImageHandler`, :ref:`ImageList`, :ref:`IndividualLayoutConstraint`, :ref:`adv.Joystick`, `LayoutAlgorithm`, :ref:`LayoutConstraints`, :ref:`ListItem`, :ref:`Mask`, :ref:`MenuItem`, `Metafile`, `Module`, :ref:`PageSetupDialog`, :ref:`PageSetupDialogData`, `PGCell`, `PGEditor`, `PGProperty`, :ref:`PrintData`, :ref:`PrintDialog`, :ref:`PrintDialogData`, :ref:`Printer`, :ref:`Printout`, :ref:`PrintPreview`, `Quantize`, :ref:`RegionIterator`, `RichTextAction`, `RichTextDrawingContext`, `RichTextDrawingHandler`, `RichTextFieldType`, `RichTextFileHandler`, `RichTextFontTable`, `RichTextFormattingDialogFactory`, `RichTextHeaderFooterData`, `RichTextImageBlock`, `RichTextObject`, `RichTextPrinting`, `RichTextProperties`, `RichTextRenderer`, `RichTextStyleDefinition`, `RichTextStyleSheet`, :ref:`Sizer`, :ref:`SizerItem`, `SockAddress`, `SocketBase`, :ref:`adv.Sound`, `StringTokenizer`, :ref:`SystemOptions`, :ref:`SystemSettings`, `TCPClient`, `TCPConnection`, `TCPServer`, :ref:`ToolBarToolBase`, :ref:`ToolTip`, `URI`, `Variant`, `XmlDocument`, `XmlResource`, `XmlResourceHandler` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~Object.__init__` Default constructor; initializes to ``None`` the internal reference data. :meth:`~Object.Destroy` Deletes the ``C++`` object this Python object is a proxy for. :meth:`~Object.GetClassName` Returns the class name of the ``C++`` class using ``RTTI``. :meth:`~Object.GetRefData` Returns the ``Object.m_refData`` pointer, i.e. :meth:`~Object.IsSameAs` Returns ``True`` if this object has the same data pointer as `obj`. :meth:`~Object.Ref` Makes this object refer to the data in `clone`. :meth:`~Object.SetRefData` Sets the ``Object.m_refData`` pointer. :meth:`~Object.UnRef` Decrements the reference count in the associated data, and if it is zero, deletes the data. :meth:`~Object.UnShare` This is the same of :meth:`AllocExclusive` but this method is public. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~Object.ClassName` See :meth:`~Object.GetClassName` :attr:`~Object.RefData` See :meth:`~Object.GetRefData` and :meth:`~Object.SetRefData` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: Object(object) This is the root class of many of the wxWidgets classes. **Possible constructors**:: Object() Object(other) .. method:: __init__(self, *args, **kw) |overload| **Overloaded Implementations**: **~~~** **__init__** `(self)` Default constructor; initializes to ``None`` the internal reference data. **~~~** **__init__** `(self, other)` Copy constructor. Sets the internal ``Object.m_refData`` pointer to point to the same instance of the ObjectRefData-derived class pointed by ``other`` and increments the refcount of ``Object.m_refData``. :param `other`: :type `other`: Object **~~~** .. method:: Destroy(self) Deletes the ``C++`` object this Python object is a proxy for. .. method:: GetClassName(self) Returns the class name of the ``C++`` class using ``RTTI``. :rtype: `string` .. method:: GetRefData(self) Returns the ``Object.m_refData`` pointer, i.e. the data referenced by this object. :rtype: `ObjectRefData` .. seealso:: :meth:`Ref` , :meth:`UnRef` , ``Object.m_refData``, :meth:`SetRefData` , `ObjectRefData` .. method:: IsSameAs(self, obj) Returns ``True`` if this object has the same data pointer as `obj`. Notice that ``True`` is returned if the data pointers are ``None`` in both objects. This function only does a `shallow` comparison, i.e. it doesn't compare the objects pointed to by the data pointers of these objects. :param `obj`: :type `obj`: Object :rtype: `bool` .. seealso:: :ref:`Reference Counting ` .. method:: Ref(self, clone) Makes this object refer to the data in `clone`. :param `clone`: The object to 'clone'. :type `clone`: Object .. note:: First this function calls :meth:`UnRef` on itself to decrement (and perhaps free) the data it is currently referring to. It then sets its own ``Object.m_refData`` to point to that of `clone`, and increments the reference count inside the data. .. seealso:: :meth:`UnRef` , :meth:`SetRefData` , :meth:`GetRefData` , `ObjectRefData` .. method:: SetRefData(self, data) Sets the ``Object.m_refData`` pointer. :param `data`: :type `data`: ObjectRefData .. seealso:: :meth:`Ref` , :meth:`UnRef` , :meth:`GetRefData` , `ObjectRefData` .. method:: UnRef(self) Decrements the reference count in the associated data, and if it is zero, deletes the data. The ``Object.m_refData`` member is set to ``None``. .. seealso:: :meth:`Ref` , :meth:`SetRefData` , :meth:`GetRefData` , `ObjectRefData` .. method:: UnShare(self) This is the same of :meth:`AllocExclusive` but this method is public. .. attribute:: ClassName See :meth:`~Object.GetClassName` .. attribute:: RefData See :meth:`~Object.GetRefData` and :meth:`~Object.SetRefData`