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.
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. |
__nonzero__ |
|
__eq__ |
Equality operator. |
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. |
Class API¶wx.richtext.RichTextSelection(object)¶Possible constructors:
RichTextSelection(sel)
RichTextSelection(range, container)
RichTextSelection()
Stores selection information.
__init__(self, *args, **kw)¶__init__ (self, sel)
Copy constructor.
| Parameters: | sel (wx.richtext.RichTextSelection) – |
|---|
__init__ (self, range, container)
Creates a selection from a range and a container.
| Parameters: |
|
|---|
__init__ (self)
Default constructor.
Add(self, range)¶Adds a range to the selection.
| Parameters: | range (wx.richtext.RichTextRange) – |
|---|
Copy(self, sel)¶Copies from sel.
| Parameters: | sel (wx.richtext.RichTextSelection) – |
|---|
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)¶GetRange (self, i)
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)¶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.
Set(self, *args, **kw)¶Set (self, range, container)
Sets the selection.
| Parameters: |
|
|---|
Set (self, ranges, container)
Sets the selections from an array of ranges and a container object.
| Parameters: |
|
|---|
SetContainer(self, container)¶Sets the container for which the selection is valid.
| Parameters: | container (wx.richtext.RichTextParagraphLayoutBox) – |
|---|
SetRange(self, range)¶Sets a single range.
| Parameters: | range (wx.richtext.RichTextRange) – |
|---|
SetRanges(self, ranges)¶Sets the selection ranges.
| Parameters: | ranges (RichTextRangeArray) – |
|---|
WithinSelection(self, *args, **kw)¶WithinSelection (self, pos, obj)
Returns True if the given position is within the selection.
| Parameters: |
|
|---|---|
| Return type: | bool |
WithinSelection (self, pos)
Returns True if the given position is within the selection.
| Parameters: | pos (long) – |
|---|---|
| Return type: | bool |
WithinSelection (pos, ranges)
Returns True if the given position is within the selection range.
| Parameters: |
|
|---|---|
| Return type: | bool |
WithinSelection (range, ranges)
Returns True if the given range is within the selection range.
| Parameters: |
|
|---|---|
| Return type: | bool |
__nonzero__(self)¶| Return type: | int |
|---|
__eq__(self)¶Equality operator.
| Parameters: | sel (wx.richtext.RichTextSelection) – |
|---|
Container¶See GetContainer and SetContainer
m_container¶A public C++ attribute of type RichTextParagraphLayoutBox .
m_ranges¶A public C++ attribute of type RichTextRangeArray.