.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. _wx.richtext.RichTextImage:
==========================================================================================================================================
|phoenix_title| **wx.richtext.RichTextImage**
==========================================================================================================================================
This class implements a graphic object.
.. seealso:: :ref:`wx.richtext.RichTextBuffer`, :ref:`wx.richtext.RichTextCtrl`, :ref:`wx.richtext.RichTextImageBlock`
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html

Inheritance diagram for class
RichTextImage:
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.richtext.RichTextImage.__init__` Default constructor.
:meth:`~wx.richtext.RichTextImage.CanEditProperties` Returns ``True`` if we can edit the object's properties via a GUI.
:meth:`~wx.richtext.RichTextImage.Clone` Clones the image object.
:meth:`~wx.richtext.RichTextImage.Copy` Copies the image object.
:meth:`~wx.richtext.RichTextImage.Draw` Draw the item, within the given range.
:meth:`~wx.richtext.RichTextImage.EditProperties` Edits the object's properties via a GUI.
:meth:`~wx.richtext.RichTextImage.GetImageBlock` Returns the image block containing the raw data.
:meth:`~wx.richtext.RichTextImage.GetImageCache` Returns the image cache (a scaled bitmap).
:meth:`~wx.richtext.RichTextImage.GetImageState` Gets the image state.
:meth:`~wx.richtext.RichTextImage.GetNaturalSize` Returns the 'natural' size for this object - the image size.
:meth:`~wx.richtext.RichTextImage.GetOriginalImageSize` Gets the original image size.
:meth:`~wx.richtext.RichTextImage.GetPropertiesMenuLabel` Returns the label to be used for the properties context menu item.
:meth:`~wx.richtext.RichTextImage.GetRangeSize` Returns the object size for the given range.
:meth:`~wx.richtext.RichTextImage.GetXMLNodeName` Returns the ``XML`` node name of this object.
:meth:`~wx.richtext.RichTextImage.ImportFromXML` Imports this object from ``XML``.
:meth:`~wx.richtext.RichTextImage.IsEmpty` Returns ``True`` if the object is empty.
:meth:`~wx.richtext.RichTextImage.IsFloatable` Returns ``True`` if this class of object is floatable.
:meth:`~wx.richtext.RichTextImage.Layout` Lay the item out at the specified position with the given size constraint.
:meth:`~wx.richtext.RichTextImage.LoadAndScaleImageCache` Do the loading and scaling.
:meth:`~wx.richtext.RichTextImage.LoadImageCache` Creates a cached image at the required size.
:meth:`~wx.richtext.RichTextImage.ResetImageCache` Resets the image cache.
:meth:`~wx.richtext.RichTextImage.SetImageCache` Sets the image cache.
:meth:`~wx.richtext.RichTextImage.SetImageState` Sets the image state.
:meth:`~wx.richtext.RichTextImage.SetOriginalImageSize` Sets the original image size.
:meth:`~wx.richtext.RichTextImage.UsesParagraphAttributes` Returns ``True`` if this object takes note of paragraph attributes (text and image objects don't).
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.richtext.RichTextImage.ImageBlock` See :meth:`~wx.richtext.RichTextImage.GetImageBlock`
:attr:`~wx.richtext.RichTextImage.ImageCache` See :meth:`~wx.richtext.RichTextImage.GetImageCache` and :meth:`~wx.richtext.RichTextImage.SetImageCache`
:attr:`~wx.richtext.RichTextImage.ImageState` See :meth:`~wx.richtext.RichTextImage.GetImageState` and :meth:`~wx.richtext.RichTextImage.SetImageState`
:attr:`~wx.richtext.RichTextImage.NaturalSize` See :meth:`~wx.richtext.RichTextImage.GetNaturalSize`
:attr:`~wx.richtext.RichTextImage.OriginalImageSize` See :meth:`~wx.richtext.RichTextImage.GetOriginalImageSize` and :meth:`~wx.richtext.RichTextImage.SetOriginalImageSize`
:attr:`~wx.richtext.RichTextImage.PropertiesMenuLabel` See :meth:`~wx.richtext.RichTextImage.GetPropertiesMenuLabel`
:attr:`~wx.richtext.RichTextImage.XMLNodeName` See :meth:`~wx.richtext.RichTextImage.GetXMLNodeName`
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.richtext.RichTextImage(RichTextObject)
**Possible constructors**::
RichTextImage(parent: Optional[RichTextObject]=None) -> None
RichTextImage(image : Image, parent: Optional[RichTextObject]=None,
charStyle: Optional[RichTextAttr]=None) -> None
RichTextImage(imageBlock : RichTextImageBlock, parent:
Optional[RichTextObject]=None, charStyle: Optional[RichTextAttr]=None)
-> None
RichTextImage(obj : RichTextImage) -> None
This class implements a graphic object.
.. method:: __init__(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**__init__** `(self, parent: Optional[RichTextObject]=None)`
Default constructor.
:param `parent`:
:type `parent`: wx.richtext.RichTextObject
:rtype: `None`
:html:`
`
**__init__** `(self, image : Image, parent: Optional[RichTextObject]=None, charStyle: Optional[RichTextAttr]=None)`
Creates a :ref:`wx.richtext.RichTextImage` from a :ref:`wx.Image`.
:param `image`:
:type `image`: wx.Image
:param `parent`:
:type `parent`: wx.richtext.RichTextObject
:param `charStyle`:
:type `charStyle`: wx.richtext.RichTextAttr
:rtype: `None`
:html:`
`
**__init__** `(self, imageBlock : RichTextImageBlock, parent: Optional[RichTextObject]=None, charStyle: Optional[RichTextAttr]=None)`
Creates a :ref:`wx.richtext.RichTextImage` from an image block.
:param `imageBlock`:
:type `imageBlock`: wx.richtext.RichTextImageBlock
:param `parent`:
:type `parent`: wx.richtext.RichTextObject
:param `charStyle`:
:type `charStyle`: wx.richtext.RichTextAttr
:rtype: `None`
:html:`
`
**__init__** `(self, obj : RichTextImage)`
Copy constructor.
:param `obj`:
:type `obj`: wx.richtext.RichTextImage
:rtype: `None`
:html:`
`
.. method:: CanEditProperties(self)
Returns ``True`` if we can edit the object's properties via a GUI.
:rtype: `bool`
.. method:: Clone(self)
Clones the image object.
:rtype: :ref:`wx.richtext.RichTextObject`
.. method:: Copy(self, obj : RichTextImage)
Copies the image object.
:param `obj`:
:type `obj`: wx.richtext.RichTextImage
:rtype: `None`
.. method:: Draw(self, dc : DC, context : RichTextDrawingContext, range : RichTextRange, selection : RichTextSelection, rect : Rect, descent : int, style : int)
Draw the item, within the given range.
Some objects may ignore the range (for example paragraphs) while others must obey it (lines, to implement wrapping)
:param `dc`:
:type `dc`: wx.DC
:param `context`:
:type `context`: wx.richtext.RichTextDrawingContext
:param `range`:
:type `range`: wx.richtext.RichTextRange
:param `selection`:
:type `selection`: wx.richtext.RichTextSelection
:param `rect`:
:type `rect`: wx.Rect
:param `descent`:
:type `descent`: int
:param `style`:
:type `style`: int
:rtype: `bool`
.. method:: EditProperties(self, parent : Window, buffer : RichTextBuffer)
Edits the object's properties via a GUI.
:param `parent`:
:type `parent`: wx.Window
:param `buffer`:
:type `buffer`: wx.richtext.RichTextBuffer
:rtype: `bool`
.. method:: GetImageBlock(self)
Returns the image block containing the raw data.
:rtype: :ref:`wx.richtext.RichTextImageBlock`
.. method:: GetImageCache(self)
Returns the image cache (a scaled bitmap).
:rtype: `Bitmap`
.. method:: GetImageState(self)
Gets the image state.
:rtype: `int`
.. method:: GetNaturalSize(self)
Returns the 'natural' size for this object - the image size.
:rtype: :ref:`wx.richtext.TextAttrSize`
.. method:: GetOriginalImageSize(self)
Gets the original image size.
:rtype: `Size`
.. method:: GetPropertiesMenuLabel(self)
Returns the label to be used for the properties context menu item.
:rtype: `str`
.. method:: GetRangeSize(self, range : RichTextRange, size : Size, descent : int, dc : DC, context : RichTextDrawingContext, flags : int, position: Point=Point(0,0), parentSize: Size=DefaultSize, partialExtents: Optional[List[int]]=None)
Returns the object size for the given range.
Returns ``False`` if the range is invalid for this object.
:param `range`:
:type `range`: wx.richtext.RichTextRange
:param `size`:
:type `size`: wx.Size
:param `descent`:
:type `descent`: int
:param `dc`:
:type `dc`: wx.DC
:param `context`:
:type `context`: wx.richtext.RichTextDrawingContext
:param `flags`:
:type `flags`: int
:param `position`:
:type `position`: wx.Point
:param `parentSize`:
:type `parentSize`: wx.Size
:param `partialExtents`:
:type `partialExtents`: list of integers
:rtype: `bool`
.. method:: GetXMLNodeName(self)
Returns the ``XML`` node name of this object.
This must be overridden for XmlNode-base ``XML`` export to work.
:rtype: `str`
.. method:: ImportFromXML(self, buffer : RichTextBuffer, node : XmlNode, handler : RichTextXMLHandler, recurse : bool)
Imports this object from ``XML``.
:param `buffer`:
:type `buffer`: wx.richtext.RichTextBuffer
:param `node`:
:type `node`: wx.xml.XmlNode
:param `handler`:
:type `handler`: wx.richtext.RichTextXMLHandler
:param `recurse`:
:type `recurse`: bool
:rtype: `bool`
.. method:: IsEmpty(self)
Returns ``True`` if the object is empty.
:rtype: `bool`
.. method:: IsFloatable(self)
Returns ``True`` if this class of object is floatable.
:rtype: `bool`
.. method:: Layout(self, dc : DC, context : RichTextDrawingContext, rect : Rect, parentRect : Rect, style : int)
Lay the item out at the specified position with the given size constraint.
Layout must set the cached size. `rect` is the available space for the object, and `parentRect` is the container that is used to determine a relative size or position (for example if a text box must be 50% of the parent text box).
:param `dc`:
:type `dc`: wx.DC
:param `context`:
:type `context`: wx.richtext.RichTextDrawingContext
:param `rect`:
:type `rect`: wx.Rect
:param `parentRect`:
:type `parentRect`: wx.Rect
:param `style`:
:type `style`: int
:rtype: `bool`
.. method:: LoadAndScaleImageCache(self, image : Image, sz : Size, context : RichTextDrawingContext, changed : bool)
Do the loading and scaling.
:param `image`:
:type `image`: wx.Image
:param `sz`:
:type `sz`: wx.Size
:param `context`:
:type `context`: wx.richtext.RichTextDrawingContext
:param `changed`:
:type `changed`: bool
:rtype: :ref:`Tuple[bool, bool]`
.. method:: LoadImageCache(self, dc : DC, context : RichTextDrawingContext, retImageSize : Size, resetCache: bool=False, parentSize: Size=DefaultSize)
Creates a cached image at the required size.
:param `dc`:
:type `dc`: wx.DC
:param `context`:
:type `context`: wx.richtext.RichTextDrawingContext
:param `retImageSize`:
:type `retImageSize`: wx.Size
:param `resetCache`:
:type `resetCache`: bool
:param `parentSize`:
:type `parentSize`: wx.Size
:rtype: `bool`
.. method:: ResetImageCache(self)
Resets the image cache.
:rtype: `None`
.. method:: SetImageCache(self, bitmap : Bitmap)
Sets the image cache.
:param `bitmap`:
:type `bitmap`: wx.Bitmap
:rtype: `None`
.. method:: SetImageState(self, state : int)
Sets the image state.
:param `state`:
:type `state`: int
:rtype: `None`
.. method:: SetOriginalImageSize(self, sz : Size)
Sets the original image size.
:param `sz`:
:type `sz`: wx.Size
:rtype: `None`
.. method:: UsesParagraphAttributes(self)
Returns ``True`` if this object takes note of paragraph attributes (text and image objects don't).
:rtype: `bool`
.. attribute:: ImageBlock
See :meth:`~wx.richtext.RichTextImage.GetImageBlock`
.. attribute:: ImageCache
See :meth:`~wx.richtext.RichTextImage.GetImageCache` and :meth:`~wx.richtext.RichTextImage.SetImageCache`
.. attribute:: ImageState
See :meth:`~wx.richtext.RichTextImage.GetImageState` and :meth:`~wx.richtext.RichTextImage.SetImageState`
.. attribute:: NaturalSize
See :meth:`~wx.richtext.RichTextImage.GetNaturalSize`
.. attribute:: OriginalImageSize
See :meth:`~wx.richtext.RichTextImage.GetOriginalImageSize` and :meth:`~wx.richtext.RichTextImage.SetOriginalImageSize`
.. attribute:: PropertiesMenuLabel
See :meth:`~wx.richtext.RichTextImage.GetPropertiesMenuLabel`
.. attribute:: XMLNodeName
See :meth:`~wx.richtext.RichTextImage.GetXMLNodeName`