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

==========================================================================================================================================
|phoenix_title|  **wx.richtext.RichTextAction**
==========================================================================================================================================

Implements a part of a command. 
         








         



.. seealso:: :ref:`wx.richtext.RichTextCommand`    







|

|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>RichTextAction</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.RichTextAction_inheritance.svg" alt="Inheritance diagram of RichTextAction" 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.RichTextAction.html" title="Implements a part of a command." alt="" coords="5,82,220,111"/> <area shape="rect" id="node2" href="wx.Object.html" title="This is the root class of many of the wxWidgets classes." alt="" coords="63,5,162,34"/> </map> 
   </p>
   </div>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.richtext.RichTextAction.__init__`                                     Constructor.
:meth:`~wx.richtext.RichTextAction.ApplyParagraphs`                              Replaces the buffer paragraphs with the given fragment.
:meth:`~wx.richtext.RichTextAction.CalculateRefreshOptimizations`                Calculate arrays for refresh optimization.
:meth:`~wx.richtext.RichTextAction.Do`                                           Performs the action.
:meth:`~wx.richtext.RichTextAction.GetAttributes`                                Returns the attributes, for single-object commands.
:meth:`~wx.richtext.RichTextAction.GetContainer`                                 Returns the container that this action refers to, using the container address and top-level buffer.
:meth:`~wx.richtext.RichTextAction.GetContainerAddress`                          Returns the address (nested position) of the container within the buffer being manipulated.
:meth:`~wx.richtext.RichTextAction.GetIgnoreFirstTime`                           Returns ``True`` if the first :meth:`~RichTextAction.Do`   command should be skipped as it's already been applied.
:meth:`~wx.richtext.RichTextAction.GetName`                                      Returns the action name.
:meth:`~wx.richtext.RichTextAction.GetNewParagraphs`                             Returns the new fragments.
:meth:`~wx.richtext.RichTextAction.GetObject`                                    Returns the object to replace the one at the position defined by the container address and the action's range start position.
:meth:`~wx.richtext.RichTextAction.GetOldParagraphs`                             Returns the old fragments.
:meth:`~wx.richtext.RichTextAction.GetPosition`                                  Returns the position used for e.g.
:meth:`~wx.richtext.RichTextAction.GetRange`                                     Returns the range for e.g.
:meth:`~wx.richtext.RichTextAction.MakeObject`                                   Makes an address from the given object.
:meth:`~wx.richtext.RichTextAction.SetContainerAddress`                          Sets the address (nested position) of the container within the buffer being manipulated.
:meth:`~wx.richtext.RichTextAction.SetIgnoreFirstTime`                           Instructs the first :meth:`~RichTextAction.Do`   command should be skipped as it's already been applied.
:meth:`~wx.richtext.RichTextAction.SetObject`                                    Sets the object to replace the one at the position defined by the container address and the action's range start position.
:meth:`~wx.richtext.RichTextAction.SetOldAndNewObjects`                          Sets the existing and new objects, for use with ``wx.richtext.RICHTEXT_CHANGE_OBJECT``.
:meth:`~wx.richtext.RichTextAction.SetPosition`                                  Sets the position used for e.g.
:meth:`~wx.richtext.RichTextAction.SetRange`                                     Sets the range for e.g.
:meth:`~wx.richtext.RichTextAction.StoreObject`                                  Stores the object to replace the one at the position defined by the container address without making an address for it.
:meth:`~wx.richtext.RichTextAction.Undo`                                         Undoes the action.
:meth:`~wx.richtext.RichTextAction.UpdateAppearance`                             Updates the control appearance, optimizing if possible given information from the call to Layout.
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.richtext.RichTextAction.Attributes`                                   See :meth:`~wx.richtext.RichTextAction.GetAttributes`
:attr:`~wx.richtext.RichTextAction.Container`                                    See :meth:`~wx.richtext.RichTextAction.GetContainer`
:attr:`~wx.richtext.RichTextAction.ContainerAddress`                             See :meth:`~wx.richtext.RichTextAction.GetContainerAddress` and :meth:`~wx.richtext.RichTextAction.SetContainerAddress`
:attr:`~wx.richtext.RichTextAction.IgnoreFirstTime`                              See :meth:`~wx.richtext.RichTextAction.GetIgnoreFirstTime` and :meth:`~wx.richtext.RichTextAction.SetIgnoreFirstTime`
:attr:`~wx.richtext.RichTextAction.Name`                                         See :meth:`~wx.richtext.RichTextAction.GetName`
:attr:`~wx.richtext.RichTextAction.NewParagraphs`                                See :meth:`~wx.richtext.RichTextAction.GetNewParagraphs`
:attr:`~wx.richtext.RichTextAction.Object`                                       See :meth:`~wx.richtext.RichTextAction.GetObject` and :meth:`~wx.richtext.RichTextAction.SetObject`
:attr:`~wx.richtext.RichTextAction.OldParagraphs`                                See :meth:`~wx.richtext.RichTextAction.GetOldParagraphs`
:attr:`~wx.richtext.RichTextAction.Position`                                     See :meth:`~wx.richtext.RichTextAction.GetPosition` and :meth:`~wx.richtext.RichTextAction.SetPosition`
:attr:`~wx.richtext.RichTextAction.Range`                                        See :meth:`~wx.richtext.RichTextAction.GetRange` and :meth:`~wx.richtext.RichTextAction.SetRange`
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.richtext.RichTextAction(Object)

   **Possible constructors**::

       RichTextAction(cmd : RichTextCommand, name : str, id :
                      RichTextCommandId, buffer : RichTextBuffer, container :
                      RichTextParagraphLayoutBox, ctrl : RichTextCtrl, ignoreFirstTime:
                      bool=False) -> None
       
   
   Implements a part of a command.



   .. method:: __init__(self, cmd : RichTextCommand, name : str, id : RichTextCommandId, buffer : RichTextBuffer, container : RichTextParagraphLayoutBox, ctrl : RichTextCtrl, ignoreFirstTime: bool=False)

      Constructor. 
                 

      `buffer`  is the top-level buffer, while `container`  is the object within which the action is taking place. In the simplest case, they are the same. 
                 


      :param `cmd`: 
      :type `cmd`: wx.richtext.RichTextCommand
      :param `name`: 
      :type `name`: string
      :param `id`: 
      :type `id`: wx.richtext.RichTextCommandId
      :param `buffer`: 
      :type `buffer`: wx.richtext.RichTextBuffer
      :param `container`: 
      :type `container`: wx.richtext.RichTextParagraphLayoutBox
      :param `ctrl`: 
      :type `ctrl`: wx.richtext.RichTextCtrl
      :param `ignoreFirstTime`: 
      :type `ignoreFirstTime`: bool




      :rtype: `None`     








   .. method:: ApplyParagraphs(self, fragment : RichTextParagraphLayoutBox)

      Replaces the buffer paragraphs with the given fragment. 
                 


      :param `fragment`: 
      :type `fragment`: wx.richtext.RichTextParagraphLayoutBox




      :rtype: `None`     








   .. method:: CalculateRefreshOptimizations(self, optimizationLineCharPositions : List[int], optimizationLineYPositions : List[int], oldFloatRect : Rect)

      Calculate arrays for refresh optimization. 
                 


      :param `optimizationLineCharPositions`: 
      :type `optimizationLineCharPositions`: list of integers
      :param `optimizationLineYPositions`: 
      :type `optimizationLineYPositions`: list of integers
      :param `oldFloatRect`: 
      :type `oldFloatRect`: wx.Rect




      :rtype: `None`     








   .. method:: Do(self)

      Performs the action. 
                 

      :rtype: `bool`








   .. method:: GetAttributes(self)

      Returns the attributes, for single-object commands. 
                 

      :rtype: :ref:`wx.richtext.RichTextAttr`








   .. method:: GetContainer(self)

      Returns the container that this action refers to, using the container address and top-level buffer. 
                 

      :rtype: :ref:`wx.richtext.RichTextParagraphLayoutBox`








   .. method:: GetContainerAddress(self)

      Returns the address (nested position) of the container within the buffer being manipulated. 
                 

      :rtype: :ref:`wx.richtext.RichTextObjectAddress`








   .. method:: GetIgnoreFirstTime(self)

      Returns ``True`` if the first :meth:`Do`   command should be skipped as it's already been applied. 
                 

      :rtype: `bool`








   .. method:: GetName(self)

      Returns the action name. 
                 

      :rtype: `str`








   .. method:: GetNewParagraphs(self)

      Returns the new fragments. 
                 

      :rtype: :ref:`wx.richtext.RichTextParagraphLayoutBox`








   .. method:: GetObject(self)

      Returns the object to replace the one at the position defined by the container address and the action's range start position. 
                 

      :rtype: :ref:`wx.richtext.RichTextObject`








   .. method:: GetOldParagraphs(self)

      Returns the old fragments. 
                 

      :rtype: :ref:`wx.richtext.RichTextParagraphLayoutBox`








   .. method:: GetPosition(self)

      Returns the position used for e.g. 
                 

      insertion. 
                 

      :rtype: `int`








   .. method:: GetRange(self)

      Returns the range for e.g. 
                 

      deletion. 
                 

      :rtype: :ref:`wx.richtext.RichTextRange`








   .. method:: MakeObject(self, obj : RichTextObject)

      Makes an address from the given object. 
                 


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




      :rtype: `None`     








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

      Sets the address (nested position) of the container within the buffer being manipulated. 
                  


      |overload| **Overloaded Implementations:**

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

      
      **SetContainerAddress** `(self, address : RichTextObjectAddress)`
      
      
      
      
      :param `address`: 
      :type `address`: wx.richtext.RichTextObjectAddress
      
      
      
      
      :rtype: `None`     
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **SetContainerAddress** `(self, container : RichTextParagraphLayoutBox, obj : RichTextObject)`
      
      
      
      
      :param `container`: 
      :type `container`: wx.richtext.RichTextParagraphLayoutBox
      :param `obj`: 
      :type `obj`: wx.richtext.RichTextObject
      
      
      
      
      :rtype: `None`     
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: SetIgnoreFirstTime(self, b : bool)

      Instructs the first :meth:`Do`   command should be skipped as it's already been applied. 
                 


      :param `b`: 
      :type `b`: bool




      :rtype: `None`     








   .. method:: SetObject(self, obj : RichTextObject)

      Sets the object to replace the one at the position defined by the container address and the action's range start position. 
                 


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




      :rtype: `None`     








   .. method:: SetOldAndNewObjects(self, oldObj : RichTextObject, newObj : RichTextObject)

      Sets the existing and new objects, for use with ``wx.richtext.RICHTEXT_CHANGE_OBJECT``. 
                 


      :param `oldObj`: 
      :type `oldObj`: wx.richtext.RichTextObject
      :param `newObj`: 
      :type `newObj`: wx.richtext.RichTextObject




      :rtype: `None`     








   .. method:: SetPosition(self, pos : int)

      Sets the position used for e.g. 
                 

      insertion. 
                 


      :param `pos`: 
      :type `pos`: long




      :rtype: `None`     








   .. method:: SetRange(self, range : RichTextRange)

      Sets the range for e.g. 
                 

      deletion. 
                 


      :param `range`: 
      :type `range`: wx.richtext.RichTextRange




      :rtype: `None`     








   .. method:: StoreObject(self, obj : RichTextObject)

      Stores the object to replace the one at the position defined by the container address without making an address for it. 
                 


                


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




      :rtype: `None`     







      .. seealso:: :meth:`SetObject` , :meth:`MakeObject` ).   








   .. method:: Undo(self)

      Undoes the action. 
                 

      :rtype: `bool`








   .. method:: UpdateAppearance(self, caretPosition : int, sendUpdateEvent: bool=False, oldFloatRect: Rect=Rect(), optimizationLineCharPositions: Optional[List[int]]=None, optimizationLineYPositions: Optional[List[int]]=None, isDoCmd: bool=True)

      Updates the control appearance, optimizing if possible given information from the call to Layout. 
                 


      :param `caretPosition`: 
      :type `caretPosition`: long
      :param `sendUpdateEvent`: 
      :type `sendUpdateEvent`: bool
      :param `oldFloatRect`: 
      :type `oldFloatRect`: wx.Rect
      :param `optimizationLineCharPositions`: 
      :type `optimizationLineCharPositions`: list of integers
      :param `optimizationLineYPositions`: 
      :type `optimizationLineYPositions`: list of integers
      :param `isDoCmd`: 
      :type `isDoCmd`: bool




      :rtype: `None`     








   .. attribute:: Attributes

      See :meth:`~wx.richtext.RichTextAction.GetAttributes`


   .. attribute:: Container

      See :meth:`~wx.richtext.RichTextAction.GetContainer`


   .. attribute:: ContainerAddress

      See :meth:`~wx.richtext.RichTextAction.GetContainerAddress` and :meth:`~wx.richtext.RichTextAction.SetContainerAddress`


   .. attribute:: IgnoreFirstTime

      See :meth:`~wx.richtext.RichTextAction.GetIgnoreFirstTime` and :meth:`~wx.richtext.RichTextAction.SetIgnoreFirstTime`


   .. attribute:: Name

      See :meth:`~wx.richtext.RichTextAction.GetName`


   .. attribute:: NewParagraphs

      See :meth:`~wx.richtext.RichTextAction.GetNewParagraphs`


   .. attribute:: Object

      See :meth:`~wx.richtext.RichTextAction.GetObject` and :meth:`~wx.richtext.RichTextAction.SetObject`


   .. attribute:: OldParagraphs

      See :meth:`~wx.richtext.RichTextAction.GetOldParagraphs`


   .. attribute:: Position

      See :meth:`~wx.richtext.RichTextAction.GetPosition` and :meth:`~wx.richtext.RichTextAction.SetPosition`


   .. attribute:: Range

      See :meth:`~wx.richtext.RichTextAction.GetRange` and :meth:`~wx.richtext.RichTextAction.SetRange`