.. 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.RichTextFieldType:
==========================================================================================================================================
|phoenix_title| **wx.richtext.RichTextFieldType**
==========================================================================================================================================
The base class for custom field types.
Each type definition handles one field type. Override functions to provide drawing, layout, updating and property editing functionality for a field.
Register field types on application initialisation with the static function :meth:`wx.richtext.RichTextBuffer.AddFieldType` . They will be deleted automatically on application exit.
.. seealso:: :ref:`wx.richtext.RichTextFieldTypeStandard`, :ref:`wx.richtext.RichTextField`, :ref:`wx.richtext.RichTextCtrl`
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html

Inheritance diagram for class
RichTextFieldType:
|
|sub_classes| Known Subclasses
==============================
:ref:`wx.richtext.RichTextFieldTypeStandard`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.richtext.RichTextFieldType.__init__` Creates a field type definition.
:meth:`~wx.richtext.RichTextFieldType.CanEditProperties` Returns ``True`` if we can edit the object's properties via a GUI.
:meth:`~wx.richtext.RichTextFieldType.Copy`
:meth:`~wx.richtext.RichTextFieldType.Draw` Draw the item, within the given range.
:meth:`~wx.richtext.RichTextFieldType.EditProperties` Edits the object's properties via a GUI.
:meth:`~wx.richtext.RichTextFieldType.GetName` Returns the field type name.
:meth:`~wx.richtext.RichTextFieldType.GetPropertiesMenuLabel` Returns the label to be used for the properties context menu item.
:meth:`~wx.richtext.RichTextFieldType.GetRangeSize` Returns the object size for the given range.
:meth:`~wx.richtext.RichTextFieldType.IsTopLevel` Returns ``True`` if this object is top-level, i.e. contains its own paragraphs, such as a text box.
:meth:`~wx.richtext.RichTextFieldType.Layout` Lay the item out at the specified position with the given size constraint.
:meth:`~wx.richtext.RichTextFieldType.SetName` Sets the field type name.
:meth:`~wx.richtext.RichTextFieldType.UpdateField` Update the field.
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.richtext.RichTextFieldType.Name` See :meth:`~wx.richtext.RichTextFieldType.GetName` and :meth:`~wx.richtext.RichTextFieldType.SetName`
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.richtext.RichTextFieldType(Object)
**Possible constructors**::
RichTextFieldType(name: str='') -> None
RichTextFieldType(fieldType : RichTextFieldType) -> None
The base class for custom field types.
.. method:: __init__(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**__init__** `(self, name: str='')`
Creates a field type definition.
:param `name`:
:type `name`: string
:rtype: `None`
:html:`
`
**__init__** `(self, fieldType : RichTextFieldType)`
Copy constructor.
:param `fieldType`:
:type `fieldType`: wx.richtext.RichTextFieldType
:rtype: `None`
:html:`
`
.. method:: CanEditProperties(self, obj : RichTextField)
Returns ``True`` if we can edit the object's properties via a GUI.
:param `obj`:
:type `obj`: wx.richtext.RichTextField
:rtype: `bool`
.. method:: Copy(self, fieldType : RichTextFieldType)
:param `fieldType`:
:type `fieldType`: wx.richtext.RichTextFieldType
:rtype: `None`
.. method:: Draw(self, obj : RichTextField, 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 `obj`:
:type `obj`: wx.richtext.RichTextField
: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, obj : RichTextField, parent : Window, buffer : RichTextBuffer)
Edits the object's properties via a GUI.
:param `obj`:
:type `obj`: wx.richtext.RichTextField
:param `parent`:
:type `parent`: wx.Window
:param `buffer`:
:type `buffer`: wx.richtext.RichTextBuffer
:rtype: `bool`
.. method:: GetName(self)
Returns the field type name.
There should be a unique name per field type object.
:rtype: `str`
.. method:: GetPropertiesMenuLabel(self, obj : RichTextField)
Returns the label to be used for the properties context menu item.
:param `obj`:
:type `obj`: wx.richtext.RichTextField
:rtype: `str`
.. method:: GetRangeSize(self, obj : RichTextField, 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 `obj`:
:type `obj`: wx.richtext.RichTextField
: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:: IsTopLevel(self, obj : RichTextField)
Returns ``True`` if this object is top-level, i.e. contains its own paragraphs, such as a text box.
:param `obj`:
:type `obj`: wx.richtext.RichTextField
:rtype: `bool`
.. method:: Layout(self, obj : RichTextField, 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 `obj`:
:type `obj`: wx.richtext.RichTextField
: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:: SetName(self, name : str)
Sets the field type name.
There should be a unique name per field type object.
:param `name`:
:type `name`: string
:rtype: `None`
.. method:: UpdateField(self, buffer : RichTextBuffer, obj : RichTextField)
Update the field.
This would typically expand the field to its value, if this is a dynamically changing and/or composite field.
:param `buffer`:
:type `buffer`: wx.richtext.RichTextBuffer
:param `obj`:
:type `obj`: wx.richtext.RichTextField
:rtype: `bool`
.. attribute:: Name
See :meth:`~wx.richtext.RichTextFieldType.GetName` and :meth:`~wx.richtext.RichTextFieldType.SetName`