.. 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

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>RichTextFieldType</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.richtext.RichTextFieldType_inheritance.png" alt="Inheritance diagram of RichTextFieldType" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.richtext.RichTextFieldType.html" title="wx.richtext.RichTextFieldType" alt="" coords="5,83,220,112"/> <area shape="rect" id="node2" href="wx.Object.html" title="wx.Object" alt="" coords="69,5,156,35"/> </map> 
   </p>
   </div>

|


|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="")
       
       RichTextFieldType(fieldType)
       
   
   The base class for custom field types.



   .. method:: __init__(self, *args, **kw)



      |overload| Overloaded Implementations:

      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, name=EmptyString)`
      
      Creates a field type definition.                  
      
      
      :param `name`: 
      :type `name`: string
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, fieldType)`
      
      Copy constructor.                  
      
      
      :param `fieldType`: 
      :type `fieldType`: wx.richtext.RichTextFieldType
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: CanEditProperties(self, obj)

      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)




      :param `fieldType`: 
      :type `fieldType`: wx.richtext.RichTextFieldType







   .. method:: Draw(self, obj, dc, context, range, selection, rect, descent, style)

      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, parent, buffer)

      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: `string`








   .. method:: GetPropertiesMenuLabel(self, obj)

      Returns the label to be used for the properties context menu item.                  


      :param `obj`: 
      :type `obj`: wx.richtext.RichTextField




      :rtype: `string`








   .. method:: GetRangeSize(self, obj, range, size, descent, dc, context, flags, position=Point(0,0), parentSize=DefaultSize, partialExtents=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)

      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, dc, context, rect, parentRect, style)

      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)

      Sets the field type name.                  

      There should be a unique name per field type object.                  


      :param `name`: 
      :type `name`: string







   .. method:: UpdateField(self, buffer, obj)

      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`

