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.

See also

wx.richtext.RichTextBuffer, wx.richtext.RichTextCtrl


class_hierarchy Class Hierarchy

Inheritance diagram for class RichTextSelection:

method_summary Methods Summary

__init__

Copy constructor.

Add

Adds a range to the selection.

Copy

Copies from sel.

GetContainer

Returns the container for which the selection is valid.

GetCount

Returns the number of ranges in the selection.

GetRange

Returns the range at the given index.

GetRanges

Returns the selection ranges.

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.

IsValid

Returns True if the selection is valid.

Reset

Resets the selection.

Set

Sets the selection.

SetContainer

Sets the container for which the selection is valid.

SetRange

Sets a single range.

SetRanges

Sets the selection ranges.

WithinSelection

Returns True if the given position is within the selection.

__bool__

__nonzero__

__eq__

Equality operator.


property_summary Properties Summary

Container

See GetContainer and SetContainer

Count

See GetCount

Range

See GetRange and SetRange

Ranges

See GetRanges and SetRanges

m_container

A public C++ attribute of type RichTextParagraphLayoutBox .

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.


Methods

__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self, sel : RichTextSelection)

Copy constructor.

Parameters:

sel (wx.richtext.RichTextSelection) –

Return type:

None



__init__ (self, range : RichTextRange, container : RichTextParagraphLayoutBox)

Creates a selection from a range and a container.

Parameters:
Return type:

None



__init__ (self)

Default constructor.

Return type:

None





Add(self, range : RichTextRange)

Adds a range to the selection.

Parameters:

range (wx.richtext.RichTextRange) –

Return type:

None



Copy(self, sel : RichTextSelection)

Copies from sel.

Parameters:

sel (wx.richtext.RichTextSelection) –

Return type:

None



GetContainer(self)

Returns the container for which the selection is valid.

Return type:

wx.richtext.RichTextParagraphLayoutBox



GetCount(self)

Returns the number of ranges in the selection.

Return type:

int



GetRange(self, *args, **kw)

overload Overloaded Implementations:



GetRange (self, i : int)

Returns the range at the given index.

Parameters:

i (int) –

Return type:

wx.richtext.RichTextRange



GetRange (self)

Returns the first range if there is one, otherwise wx.richtext.RICHTEXT_NO_SELECTION.

Return type:

wx.richtext.RichTextRange





GetRanges(self)

Returns the selection ranges.

Return type:

RichTextRangeArray



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.

Parameters:

obj (wx.richtext.RichTextObject) –

Return type:

RichTextRangeArray



IsValid(self)

Returns True if the selection is valid.

Return type:

bool



Reset(self)

Resets the selection.

Return type:

None



Set(self, *args, **kw)

overload Overloaded Implementations:



Set (self, range : RichTextRange, container : RichTextParagraphLayoutBox)

Sets the selection.

Parameters:
Return type:

None



Set (self, ranges : RichTextRangeArray, container : RichTextParagraphLayoutBox)

Sets the selections from an array of ranges and a container object.

Parameters:
Return type:

None





SetContainer(self, container : RichTextParagraphLayoutBox)

Sets the container for which the selection is valid.

Parameters:

container (wx.richtext.RichTextParagraphLayoutBox) –

Return type:

None



SetRange(self, range : RichTextRange)

Sets a single range.

Parameters:

range (wx.richtext.RichTextRange) –

Return type:

None



SetRanges(self, ranges : RichTextRangeArray)

Sets the selection ranges.

Parameters:

ranges (RichTextRangeArray) –

Return type:

None



WithinSelection(self, *args, **kw)

overload Overloaded Implementations:



WithinSelection (self, pos : int, obj : RichTextObject)

Returns True if the given position is within the selection.

Parameters:
Return type:

bool



WithinSelection (self, pos : int)

Returns True if the given position is within the selection.

Parameters:

pos (long) –

Return type:

bool



WithinSelection (pos : int, ranges : RichTextRangeArray)

Returns True if the given position is within the selection range.

Parameters:
  • pos (long) –

  • ranges (RichTextRangeArray) –

Return type:

bool



WithinSelection (range : RichTextRange, ranges : RichTextRangeArray)

Returns True if the given range is within the selection range.

Parameters:
Return type:

bool





__bool__(self)
Return type:

int



__nonzero__(self)
Return type:

int



__eq__(self)

Equality operator.

Parameters:

sel (wx.richtext.RichTextSelection) –


Properties

Container

See GetContainer and SetContainer



Count

See GetCount



Range

See GetRange and SetRange



Ranges

See GetRanges and SetRanges



m_container

A public C++ attribute of type RichTextParagraphLayoutBox .



m_ranges

A public C++ attribute of type RichTextRangeArray.