Version: 3.2.5
wxRichTextSelection Class Reference

#include <wx/richtext/richtextbuffer.h>

Detailed Description

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.

Library:  wxRichText
Category:  Rich Text
See also
wxRichTextBuffer, wxRichTextCtrl

Public Member Functions

 wxRichTextSelection (const wxRichTextSelection &sel)
 Copy constructor. More...
 
 wxRichTextSelection (const wxRichTextRange &range, wxRichTextParagraphLayoutBox *container)
 Creates a selection from a range and a container. More...
 
 wxRichTextSelection ()
 Default constructor. More...
 
void Reset ()
 Resets the selection. More...
 
void Set (const wxRichTextRange &range, wxRichTextParagraphLayoutBox *container)
 Sets the selection. More...
 
void Add (const wxRichTextRange &range)
 Adds a range to the selection. More...
 
void Set (const wxRichTextRangeArray &ranges, wxRichTextParagraphLayoutBox *container)
 Sets the selections from an array of ranges and a container object. More...
 
void Copy (const wxRichTextSelection &sel)
 Copies from sel. More...
 
void operator= (const wxRichTextSelection &sel)
 Assignment operator. More...
 
bool operator== (const wxRichTextSelection &sel) const
 Equality operator. More...
 
wxRichTextRange operator[] (size_t i) const
 Index operator. More...
 
wxRichTextRangeArray & GetRanges ()
 Returns the selection ranges. More...
 
const wxRichTextRangeArray & GetRanges () const
 Returns the selection ranges. More...
 
void SetRanges (const wxRichTextRangeArray &ranges)
 Sets the selection ranges. More...
 
size_t GetCount () const
 Returns the number of ranges in the selection. More...
 
wxRichTextRange GetRange (size_t i) const
 Returns the range at the given index. More...
 
wxRichTextRange GetRange () const
 Returns the first range if there is one, otherwise wxRICHTEXT_NO_SELECTION. More...
 
void SetRange (const wxRichTextRange &range)
 Sets a single range. More...
 
wxRichTextParagraphLayoutBoxGetContainer () const
 Returns the container for which the selection is valid. More...
 
void SetContainer (wxRichTextParagraphLayoutBox *container)
 Sets the container for which the selection is valid. More...
 
bool IsValid () const
 Returns true if the selection is valid. More...
 
wxRichTextRangeArray GetSelectionForObject (wxRichTextObject *obj) const
 Returns the selection appropriate to the specified object, if any; returns an empty array if none at the level of the object's container. More...
 
bool WithinSelection (long pos, wxRichTextObject *obj) const
 Returns true if the given position is within the selection. More...
 
bool WithinSelection (long pos) const
 Returns true if the given position is within the selection. More...
 

Static Public Member Functions

static bool WithinSelection (long pos, const wxRichTextRangeArray &ranges)
 Returns true if the given position is within the selection range. More...
 
static bool WithinSelection (const wxRichTextRange &range, const wxRichTextRangeArray &ranges)
 Returns true if the given range is within the selection range. More...
 

Public Attributes

wxRichTextRangeArray m_ranges
 
wxRichTextParagraphLayoutBoxm_container
 

Constructor & Destructor Documentation

◆ wxRichTextSelection() [1/3]

wxRichTextSelection::wxRichTextSelection ( const wxRichTextSelection sel)
inline

Copy constructor.

◆ wxRichTextSelection() [2/3]

wxRichTextSelection::wxRichTextSelection ( const wxRichTextRange range,
wxRichTextParagraphLayoutBox container 
)
inline

Creates a selection from a range and a container.

◆ wxRichTextSelection() [3/3]

wxRichTextSelection::wxRichTextSelection ( )
inline

Default constructor.

Member Function Documentation

◆ Add()

void wxRichTextSelection::Add ( const wxRichTextRange range)
inline

Adds a range to the selection.

◆ Copy()

void wxRichTextSelection::Copy ( const wxRichTextSelection sel)
inline

Copies from sel.

◆ GetContainer()

wxRichTextParagraphLayoutBox* wxRichTextSelection::GetContainer ( ) const
inline

Returns the container for which the selection is valid.

◆ GetCount()

size_t wxRichTextSelection::GetCount ( ) const
inline

Returns the number of ranges in the selection.

◆ GetRange() [1/2]

wxRichTextRange wxRichTextSelection::GetRange ( ) const
inline

Returns the first range if there is one, otherwise wxRICHTEXT_NO_SELECTION.

◆ GetRange() [2/2]

wxRichTextRange wxRichTextSelection::GetRange ( size_t  i) const
inline

Returns the range at the given index.

◆ GetRanges() [1/2]

wxRichTextRangeArray& wxRichTextSelection::GetRanges ( )
inline

Returns the selection ranges.

◆ GetRanges() [2/2]

const wxRichTextRangeArray& wxRichTextSelection::GetRanges ( ) const
inline

Returns the selection ranges.

◆ GetSelectionForObject()

wxRichTextRangeArray wxRichTextSelection::GetSelectionForObject ( wxRichTextObject obj) const

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()

bool wxRichTextSelection::IsValid ( ) const
inline

Returns true if the selection is valid.

◆ operator=()

void wxRichTextSelection::operator= ( const wxRichTextSelection sel)
inline

Assignment operator.

◆ operator==()

bool wxRichTextSelection::operator== ( const wxRichTextSelection sel) const

Equality operator.

◆ operator[]()

wxRichTextRange wxRichTextSelection::operator[] ( size_t  i) const
inline

Index operator.

◆ Reset()

void wxRichTextSelection::Reset ( )
inline

Resets the selection.

◆ Set() [1/2]

void wxRichTextSelection::Set ( const wxRichTextRange range,
wxRichTextParagraphLayoutBox container 
)
inline

Sets the selection.

◆ Set() [2/2]

void wxRichTextSelection::Set ( const wxRichTextRangeArray &  ranges,
wxRichTextParagraphLayoutBox container 
)
inline

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

◆ SetContainer()

void wxRichTextSelection::SetContainer ( wxRichTextParagraphLayoutBox container)
inline

Sets the container for which the selection is valid.

◆ SetRange()

void wxRichTextSelection::SetRange ( const wxRichTextRange range)
inline

Sets a single range.

◆ SetRanges()

void wxRichTextSelection::SetRanges ( const wxRichTextRangeArray &  ranges)
inline

Sets the selection ranges.

◆ WithinSelection() [1/4]

static bool wxRichTextSelection::WithinSelection ( const wxRichTextRange range,
const wxRichTextRangeArray &  ranges 
)
static

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

◆ WithinSelection() [2/4]

bool wxRichTextSelection::WithinSelection ( long  pos) const
inline

Returns true if the given position is within the selection.

◆ WithinSelection() [3/4]

static bool wxRichTextSelection::WithinSelection ( long  pos,
const wxRichTextRangeArray &  ranges 
)
static

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

◆ WithinSelection() [4/4]

bool wxRichTextSelection::WithinSelection ( long  pos,
wxRichTextObject obj 
) const

Returns true if the given position is within the selection.

Member Data Documentation

◆ m_container

wxRichTextParagraphLayoutBox* wxRichTextSelection::m_container

◆ m_ranges

wxRichTextRangeArray wxRichTextSelection::m_ranges