| Version: 3.0.1

- Main Page
- Related Pages
- Categories
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
wxRichTextSelection Class Reference
Rich Text

`#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.
| wxRichTextSelection (const wxRichTextRange &range, wxRichTextParagraphLayoutBox *container)
| Creates a selection from a range and a container.
| wxRichTextSelection ()
| Default constructor.
void | Reset ()
| Resets the selection.
void | Set (const wxRichTextRange &range, wxRichTextParagraphLayoutBox *container)
| Sets the selection.
void | Add (const wxRichTextRange &range)
| Adds a range to the selection.
void | Set (const wxRichTextRangeArray &ranges, wxRichTextParagraphLayoutBox *container)
| Sets the selections from an array of ranges and a container object.
void | Copy (const wxRichTextSelection &sel)
| Copies from sel.
void | operator= (const wxRichTextSelection &sel)
| Assignment operator.
bool | operator== (const wxRichTextSelection &sel) const
| Equality operator.
wxRichTextRange | operator[] (size_t i) const
| Index operator.
wxRichTextRangeArray & | GetRanges ()
| Returns the selection ranges.
const wxRichTextRangeArray & | GetRanges () const
| Returns the selection ranges.
void | SetRanges (const wxRichTextRangeArray &ranges)
| Sets the selection ranges.
size_t | GetCount () const
| Returns the number of ranges in the selection.
wxRichTextRange | GetRange (size_t i) const
| Returns the range at the given index.
wxRichTextRange | GetRange () const
| Returns the first range if there is one, otherwise wxRICHTEXT_NO_SELECTION.
void | SetRange (const wxRichTextRange &range)
| Sets a single range.
wxRichTextParagraphLayoutBox * | GetContainer () const
| Returns the container for which the selection is valid.
void | SetContainer (wxRichTextParagraphLayoutBox *container)
| Sets the container for which the selection is valid.
bool | IsValid () const
| Returns true if the selection is valid.
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.
bool | WithinSelection (long pos, wxRichTextObject *obj) const
| Returns true if the given position is within the selection.
bool | WithinSelection (long pos) const
| Returns true if the given position is within the selection.

## Static Public Member Functions

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

## Public Attributes

wxRichTextRangeArray | m_ranges
wxRichTextParagraphLayoutBox * | m_container

## Constructor & Destructor Documentation

wxRichTextSelection::wxRichTextSelection | ( | const wxRichTextSelection & | sel | ) |

inline

Copy constructor.

wxRichTextSelection::wxRichTextSelection | ( | const wxRichTextRange & | range,
|  | wxRichTextParagraphLayoutBox * | container
| ) |  |

inline

Creates a selection from a range and a container.

wxRichTextSelection::wxRichTextSelection | ( |  | ) |

inline

Default constructor.

## Member Function Documentation

void wxRichTextSelection::Add | ( | const wxRichTextRange & | range | ) |

inline

Adds a range to the selection.

void wxRichTextSelection::Copy | ( | const wxRichTextSelection & | sel | ) |

inline

Copies from sel.

wxRichTextParagraphLayoutBox* wxRichTextSelection::GetContainer | ( |  | ) | const

inline

Returns the container for which the selection is valid.

size_t wxRichTextSelection::GetCount | ( |  | ) | const

inline

Returns the number of ranges in the selection.

wxRichTextRange wxRichTextSelection::GetRange | ( | size_t | i | ) | const

inline

Returns the range at the given index.

wxRichTextRange wxRichTextSelection::GetRange | ( |  | ) | const

inline

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

wxRichTextRangeArray& wxRichTextSelection::GetRanges | ( |  | ) |

inline

Returns the selection ranges.

const wxRichTextRangeArray& wxRichTextSelection::GetRanges | ( |  | ) | const

inline

Returns the selection ranges.

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.

bool wxRichTextSelection::IsValid | ( |  | ) | const

inline

Returns true if the selection is valid.

void wxRichTextSelection::operator= | ( | const wxRichTextSelection & | sel | ) |

inline

Assignment operator.

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

Equality operator.

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

inline

Index operator.

void wxRichTextSelection::Reset | ( |  | ) |

inline

Resets the selection.

void wxRichTextSelection::Set | ( | const wxRichTextRange & | range,
|  | wxRichTextParagraphLayoutBox * | container
| ) |  |

inline

Sets the selection.

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

inline

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

void wxRichTextSelection::SetContainer | ( | wxRichTextParagraphLayoutBox * | container | ) |

inline

Sets the container for which the selection is valid.

void wxRichTextSelection::SetRange | ( | const wxRichTextRange & | range | ) |

inline

Sets a single range.

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

inline

Sets the selection ranges.

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

Returns true if the given position is within the selection.

bool wxRichTextSelection::WithinSelection | ( | long | pos | ) | const

inline

Returns true if the given position is within the selection.

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

static

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

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

static

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

## Member Data Documentation

wxRichTextParagraphLayoutBox* wxRichTextSelection::m_container

wxRichTextRangeArray wxRichTextSelection::m_ranges