.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2018 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.png" 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,83,207,112"/> <area shape="rect" id="node2" href="wx.Object.html" title="This is the root class of many of the wxWidgets classes." alt="" coords="62,5,150,35"/> </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, name, id, buffer, container, ctrl,
                      ignoreFirstTime=False)
       
   
   Implements a part of a command.



   .. method:: __init__(self, cmd, name, id, buffer, container, ctrl, ignoreFirstTime=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







   .. method:: ApplyParagraphs(self, fragment)

      Replaces the buffer paragraphs with the given fragment.                  


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







   .. method:: CalculateRefreshOptimizations(self, optimizationLineCharPositions, optimizationLineYPositions)

      Calculate arrays for refresh optimization.                  


      :param `optimizationLineCharPositions`: 
      :type `optimizationLineCharPositions`: list of integers
      :param `optimizationLineYPositions`: 
      :type `optimizationLineYPositions`: list of integers







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








   .. 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: `long`








   .. method:: GetRange(self)

      Returns the range for e.g.                  

      deletion.                  

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








   .. method:: MakeObject(self, obj)

      Makes an address from the given object.                  


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







   .. 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)`
      
      
      
      
      :param `address`: 
      :type `address`: wx.richtext.RichTextObjectAddress
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

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






   .. method:: SetIgnoreFirstTime(self, b)

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


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







   .. method:: SetObject(self, obj)

      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







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

      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







   .. method:: SetPosition(self, pos)

      Sets the position used for e.g.                  

      insertion.                  


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







   .. method:: SetRange(self, range)

      Sets the range for e.g.                  

      deletion.                  


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







   .. method:: StoreObject(self, obj)

      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






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








   .. method:: Undo(self)

      Undoes the action.                  

      :rtype: `bool`








   .. method:: UpdateAppearance(self, caretPosition, sendUpdateEvent=False, optimizationLineCharPositions=None, optimizationLineYPositions=None, isDoCmd=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 `optimizationLineCharPositions`: 
      :type `optimizationLineCharPositions`: list of integers
      :param `optimizationLineYPositions`: 
      :type `optimizationLineYPositions`: list of integers
      :param `isDoCmd`: 
      :type `isDoCmd`: bool







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