.. 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.RichTextSelection:
==========================================================================================================================================
|phoenix_title| **wx.richtext.RichTextSelection**
==========================================================================================================================================
Stores selection information.
The selection does not have to be contiguous, though currently non-contiguous selections are only supported for a range of table cells (a geometric block of cells can consist of a set of non-contiguous positions).
The selection consists of an array of ranges, and the container that is the context for the selection. It follows that a single selection object can only represent ranges with the same parent container.
.. seealso:: :ref:`wx.richtext.RichTextBuffer`, :ref:`wx.richtext.RichTextCtrl`
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html

Inheritance diagram for class
RichTextSelection:
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.richtext.RichTextSelection.__init__` Copy constructor.
:meth:`~wx.richtext.RichTextSelection.Add` Adds a range to the selection.
:meth:`~wx.richtext.RichTextSelection.Copy` Copies from `sel`.
:meth:`~wx.richtext.RichTextSelection.GetContainer` Returns the container for which the selection is valid.
:meth:`~wx.richtext.RichTextSelection.GetCount` Returns the number of ranges in the selection.
:meth:`~wx.richtext.RichTextSelection.GetRange` Returns the range at the given index.
:meth:`~wx.richtext.RichTextSelection.GetRanges` Returns the selection ranges.
:meth:`~wx.richtext.RichTextSelection.GetSelectionForObject` Returns the selection appropriate to the specified object, if any; returns an empty array if none at the level of the object's container.
:meth:`~wx.richtext.RichTextSelection.IsValid` Returns ``True`` if the selection is valid.
:meth:`~wx.richtext.RichTextSelection.Reset` Resets the selection.
:meth:`~wx.richtext.RichTextSelection.Set` Sets the selection.
:meth:`~wx.richtext.RichTextSelection.SetContainer` Sets the container for which the selection is valid.
:meth:`~wx.richtext.RichTextSelection.SetRange` Sets a single range.
:meth:`~wx.richtext.RichTextSelection.SetRanges` Sets the selection ranges.
:meth:`~wx.richtext.RichTextSelection.WithinSelection` Returns ``True`` if the given position is within the selection.
:meth:`~wx.richtext.RichTextSelection.__bool__`
:meth:`~wx.richtext.RichTextSelection.__nonzero__`
:meth:`~wx.richtext.RichTextSelection.__eq__` Equality operator.
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.richtext.RichTextSelection.Container` See :meth:`~wx.richtext.RichTextSelection.GetContainer` and :meth:`~wx.richtext.RichTextSelection.SetContainer`
:attr:`~wx.richtext.RichTextSelection.Count` See :meth:`~wx.richtext.RichTextSelection.GetCount`
:attr:`~wx.richtext.RichTextSelection.Range` See :meth:`~wx.richtext.RichTextSelection.GetRange` and :meth:`~wx.richtext.RichTextSelection.SetRange`
:attr:`~wx.richtext.RichTextSelection.Ranges` See :meth:`~wx.richtext.RichTextSelection.GetRanges` and :meth:`~wx.richtext.RichTextSelection.SetRanges`
:attr:`~wx.richtext.RichTextSelection.m_container` A public C++ attribute of type `~wx.richtext.RichTextParagraphLayoutBox` .
:attr:`~wx.richtext.RichTextSelection.m_ranges` A public C++ attribute of type ``RichTextRangeArray``.
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.richtext.RichTextSelection(object)
**Possible constructors**::
RichTextSelection(sel : RichTextSelection) -> None
RichTextSelection(range : RichTextRange, container :
RichTextParagraphLayoutBox) -> None
RichTextSelection() -> None
Stores selection information.
.. method:: __init__(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**__init__** `(self, sel : RichTextSelection)`
Copy constructor.
:param `sel`:
:type `sel`: wx.richtext.RichTextSelection
:rtype: `None`
:html:`
`
**__init__** `(self, range : RichTextRange, container : RichTextParagraphLayoutBox)`
Creates a selection from a range and a container.
:param `range`:
:type `range`: wx.richtext.RichTextRange
:param `container`:
:type `container`: wx.richtext.RichTextParagraphLayoutBox
:rtype: `None`
:html:`
`
**__init__** `(self)`
Default constructor.
:rtype: `None`
:html:`
`
.. method:: Add(self, range : RichTextRange)
Adds a range to the selection.
:param `range`:
:type `range`: wx.richtext.RichTextRange
:rtype: `None`
.. method:: Copy(self, sel : RichTextSelection)
Copies from `sel`.
:param `sel`:
:type `sel`: wx.richtext.RichTextSelection
:rtype: `None`
.. method:: GetContainer(self)
Returns the container for which the selection is valid.
:rtype: :ref:`wx.richtext.RichTextParagraphLayoutBox`
.. method:: GetCount(self)
Returns the number of ranges in the selection.
:rtype: `int`
.. method:: GetRange(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**GetRange** `(self, i : int)`
Returns the range at the given index.
:param `i`:
:type `i`: int
:rtype: :ref:`wx.richtext.RichTextRange`
:html:`
`
**GetRange** `(self)`
Returns the first range if there is one, otherwise ``wx.richtext.RICHTEXT_NO_SELECTION``.
:rtype: :ref:`wx.richtext.RichTextRange`
:html:`
`
.. method:: GetRanges(self)
Returns the selection ranges.
:rtype: `RichTextRangeArray`
.. method:: GetSelectionForObject(self, obj : RichTextObject)
Returns the selection appropriate to the specified object, if any; returns an empty array if none at the level of the object's container.
:param `obj`:
:type `obj`: wx.richtext.RichTextObject
:rtype: `RichTextRangeArray`
.. method:: IsValid(self)
Returns ``True`` if the selection is valid.
:rtype: `bool`
.. method:: Reset(self)
Resets the selection.
:rtype: `None`
.. method:: Set(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**Set** `(self, range : RichTextRange, container : RichTextParagraphLayoutBox)`
Sets the selection.
:param `range`:
:type `range`: wx.richtext.RichTextRange
:param `container`:
:type `container`: wx.richtext.RichTextParagraphLayoutBox
:rtype: `None`
:html:`
`
**Set** `(self, ranges : RichTextRangeArray, container : RichTextParagraphLayoutBox)`
Sets the selections from an array of ranges and a container object.
:param `ranges`:
:type `ranges`: RichTextRangeArray
:param `container`:
:type `container`: wx.richtext.RichTextParagraphLayoutBox
:rtype: `None`
:html:`
`
.. method:: SetContainer(self, container : RichTextParagraphLayoutBox)
Sets the container for which the selection is valid.
:param `container`:
:type `container`: wx.richtext.RichTextParagraphLayoutBox
:rtype: `None`
.. method:: SetRange(self, range : RichTextRange)
Sets a single range.
:param `range`:
:type `range`: wx.richtext.RichTextRange
:rtype: `None`
.. method:: SetRanges(self, ranges : RichTextRangeArray)
Sets the selection ranges.
:param `ranges`:
:type `ranges`: RichTextRangeArray
:rtype: `None`
.. method:: WithinSelection(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**WithinSelection** `(self, pos : int, obj : RichTextObject)`
Returns ``True`` if the given position is within the selection.
:param `pos`:
:type `pos`: long
:param `obj`:
:type `obj`: wx.richtext.RichTextObject
:rtype: `bool`
:html:`
`
**WithinSelection** `(self, pos : int)`
Returns ``True`` if the given position is within the selection.
:param `pos`:
:type `pos`: long
:rtype: `bool`
:html:`
`
**WithinSelection** `(pos : int, ranges : RichTextRangeArray)`
Returns ``True`` if the given position is within the selection range.
:param `pos`:
:type `pos`: long
:param `ranges`:
:type `ranges`: RichTextRangeArray
:rtype: `bool`
:html:`
`
**WithinSelection** `(range : RichTextRange, ranges : RichTextRangeArray)`
Returns ``True`` if the given range is within the selection range.
:param `range`:
:type `range`: wx.richtext.RichTextRange
:param `ranges`:
:type `ranges`: RichTextRangeArray
:rtype: `bool`
:html:`
`
.. method:: __bool__(self)
:rtype: `int`
.. method:: __nonzero__(self)
:rtype: `int`
.. method:: __eq__(self)
Equality operator.
:param `sel`:
:type `sel`: wx.richtext.RichTextSelection
.. attribute:: Container
See :meth:`~wx.richtext.RichTextSelection.GetContainer` and :meth:`~wx.richtext.RichTextSelection.SetContainer`
.. attribute:: Count
See :meth:`~wx.richtext.RichTextSelection.GetCount`
.. attribute:: Range
See :meth:`~wx.richtext.RichTextSelection.GetRange` and :meth:`~wx.richtext.RichTextSelection.SetRange`
.. attribute:: Ranges
See :meth:`~wx.richtext.RichTextSelection.GetRanges` and :meth:`~wx.richtext.RichTextSelection.SetRanges`
.. attribute:: m_container
A public C++ attribute of type `~wx.richtext.RichTextParagraphLayoutBox` .
.. attribute:: m_ranges
A public C++ attribute of type ``RichTextRangeArray``.