# wxRichTextTable Class Reference

`#include <wx/richtext/richtextbuffer.h>`

Inheritance diagram for wxRichTextTable:
[legend]

## Detailed Description

wxRichTextTable represents a table with arbitrary columns and rows.

## Public Member Functions
| wxRichTextTable (wxRichTextObject *parent=NULL)
| Default constructor; optionally pass the parent object.
| wxRichTextTable (const wxRichTextTable &obj)
| Copy constructor.
virtual bool | Draw (wxDC &dc, const wxRichTextRange &range, const wxRichTextSelection &selection, const wxRect &rect, int descent, int style)
| Draw the item, within the given range.
virtual wxString | GetXMLNodeName () const
| Returns the XML node name of this object.
virtual bool | Layout (wxDC &dc, const wxRect &rect, int style)
| Lay the item out at the specified position with the given size constraint.
virtual bool | GetRangeSize (const wxRichTextRange &range, wxSize &size, int &descent, wxDC &dc, int flags, wxPoint position=wxPoint(0, 0), wxArrayInt *partialExtents=NULL) const
| Returns the object size for the given range.
virtual bool | DeleteRange (const wxRichTextRange &range)
virtual wxString | GetTextForRange (const wxRichTextRange &range) const
virtual bool | FindPosition (wxDC &dc, long index, wxPoint &pt, int *height, bool forceLineStart)
virtual void | CalculateRange (long start, long &end)
| Calculates the range of the object.
virtual bool | HandlesChildSelections () const
| Returns true if this object can handle the selections of its children, fOr example a table.
virtual wxRichTextSelection | GetSelection (long start, long end) const
| Returns a selection object specifying the selections between start and end character positions.
virtual bool | CanEditProperties () const
| Returns true if we can edit the object's properties via a GUI.
virtual bool | EditProperties (wxWindow *parent, wxRichTextBuffer *buffer)
virtual wxString | GetPropertiesMenuLabel () const
| Returns the label to be used for the properties context menu item.
virtual bool | AcceptsFocus () const
| Returns true if objects of this class can accept the focus, i.e.
const wxRichTextObjectPtrArrayArray & | GetCells () const
| Returns the cells array.
wxRichTextObjectPtrArrayArray & | GetCells ()
| Returns the cells array.
int | GetRowCount () const
| Returns the row count.
int | GetColumnCount () const
| Returns the column count.
virtual wxRichTextCell * | GetCell (int row, int col) const
| Returns the cell at the given row/column position.
virtual wxRichTextCell * | GetCell (long pos) const
| Returns the cell at the given character position (in the range of the table).
virtual bool | GetCellRowColumnPosition (long pos, int &row, int &col) const
| Returns the row/column for a given character position.
virtual void | ClearTable ()
| Clears the table.
virtual bool | CreateTable (int rows, int cols)
| Creates a table of the given dimensions.
virtual bool | SetCellStyle (const wxRichTextSelection &selection, const wxRichTextAttr &style, int flags=wxRICHTEXT_SETSTYLE_WITH_UNDO)
| Sets the attributes for the cells specified by the selection.
virtual bool | DeleteRows (int startRow, int noRows=1)
| Deletes rows from the given row position.
virtual bool | DeleteColumns (int startCol, int noCols=1)
| Deletes columns from the given column position.
virtual bool | AddRows (int startRow, int noRows=1, const wxRichTextAttr &attr=wxRichTextAttr())
| Adds rows from the given row position.
virtual bool | AddColumns (int startCol, int noCols=1, const wxRichTextAttr &attr=wxRichTextAttr())
| Adds columns from the given column position.
virtual wxRichTextObject * | Clone () const
| Clones the object.
void | Copy (const wxRichTextTable &obj)
## Protected Attributes
int | m_rowCount
int | m_colCount
wxRichTextObjectPtrArrayArray | m_cells

List of all members.

## Constructor & Destructor Documentation

wxRichTextTable::wxRichTextTable | ( | wxRichTextObject * | parent = `NULL` | ) |

Default constructor; optionally pass the parent object.

wxRichTextTable::wxRichTextTable | ( | const wxRichTextTable & | obj | ) | `[inline]`

Copy constructor.

## Member Function Documentation

virtual bool wxRichTextTable::AcceptsFocus | ( |  | ) | const`[inline, virtual]`

Returns true if objects of this class can accept the focus, i.e.

a call to SetFocusObject is possible. For example, containers supporting text, such as a text box object, can accept the focus, but a table can't (set the focus to individual cells instead).

Reimplemented from wxRichTextParagraphLayoutBox.

virtual bool wxRichTextTable::AddColumns | ( | int | startCol,
|  | int | noCols = `1`,
|  | const wxRichTextAttr & | attr = `wxRichTextAttr()` |
| ) |  |  | `[virtual]`

Adds columns from the given column position.

virtual bool wxRichTextTable::AddRows | ( | int | startRow,
|  | int | noRows = `1`,
|  | const wxRichTextAttr & | attr = `wxRichTextAttr()` |
| ) |  |  | `[virtual]`

Adds rows from the given row position.

virtual void wxRichTextTable::CalculateRange | ( | long | start,
|  | long & | end |
| ) |  |  | `[virtual]`

Calculates the range of the object.

By default, guess that the object is 1 unit long.

Reimplemented from wxRichTextCompositeObject.

virtual bool wxRichTextTable::CanEditProperties | ( |  | ) | const`[inline, virtual]`

Returns true if we can edit the object's properties via a GUI.

Reimplemented from wxRichTextBox.

virtual void wxRichTextTable::ClearTable | ( |  | ) | `[virtual]`

Clears the table.

virtual wxRichTextObject* wxRichTextTable::Clone | ( |  | ) | const`[inline, virtual]`

Clones the object.

Reimplemented from wxRichTextBox.

void wxRichTextTable::Copy | ( | const wxRichTextTable & | obj | ) |

virtual bool wxRichTextTable::CreateTable | ( | int | rows,
|  | int | cols |
| ) |  |  | `[virtual]`

Creates a table of the given dimensions.

virtual bool wxRichTextTable::DeleteColumns | ( | int | startCol,
|  | int | noCols = `1` |
| ) |  |  | `[virtual]`

Deletes columns from the given column position.

virtual bool wxRichTextTable::DeleteRange | ( | const wxRichTextRange & | range | ) | `[virtual]`

Reimplemented from wxRichTextParagraphLayoutBox.

virtual bool wxRichTextTable::DeleteRows | ( | int | startRow,
|  | int | noRows = `1` |
| ) |  |  | `[virtual]`

Deletes rows from the given row position.

virtual bool wxRichTextTable::Draw | ( | wxDC & | dc,
|  | const wxRichTextRange & | range,
|  | const wxRichTextSelection & | selection,
|  | const wxRect & | rect,
|  | int | descent,
|  | int | style |
| ) |  |  | `[virtual]`

Draw the item, within the given range.

Some objects may ignore the range (for example paragraphs) while others must obey it (lines, to implement wrapping)

Reimplemented from wxRichTextBox.

virtual bool wxRichTextTable::EditProperties | ( | wxWindow * | parent,
|  | wxRichTextBuffer * | buffer |
| ) |  |  | `[virtual]`

Reimplemented from wxRichTextBox.

virtual bool wxRichTextTable::FindPosition | ( | wxDC & | dc,
|  | long | index,
|  | wxPoint & | pt,
|  | int * | height,
|  | bool | forceLineStart |
| ) |  |  | `[virtual]`

Reimplemented from wxRichTextCompositeObject.

virtual wxRichTextCell* wxRichTextTable::GetCell | ( | long | pos | ) | const`[virtual]`

Returns the cell at the given character position (in the range of the table).

virtual wxRichTextCell* wxRichTextTable::GetCell | ( | int | row,
|  | int | col |
| ) |  |  | const`[virtual]`

Returns the cell at the given row/column position.

virtual bool wxRichTextTable::GetCellRowColumnPosition | ( | long | pos,
|  | int & | row,
|  | int & | col |
| ) |  |  | const`[virtual]`

Returns the row/column for a given character position.

wxRichTextObjectPtrArrayArray& wxRichTextTable::GetCells | ( |  | ) | `[inline]`

Returns the cells array.

const wxRichTextObjectPtrArrayArray& wxRichTextTable::GetCells | ( |  | ) | const`[inline]`

Returns the cells array.

int wxRichTextTable::GetColumnCount | ( |  | ) | const`[inline]`

Returns the column count.

virtual wxString wxRichTextTable::GetPropertiesMenuLabel | ( |  | ) | const`[inline, virtual]`

Returns the label to be used for the properties context menu item.

Reimplemented from wxRichTextBox.

virtual bool wxRichTextTable::GetRangeSize | ( | const wxRichTextRange & | range,
|  | wxSize & | size,
|  | int & | descent,
|  | wxDC & | dc,
|  | int | flags,
|  | wxPoint | position = `wxPoint(0, 0)`,
|  | wxArrayInt * | partialExtents = `NULL` |
| ) |  |  | const`[virtual]`

Returns the object size for the given range.

Returns false if the range is invalid for this object.

Reimplemented from wxRichTextParagraphLayoutBox.

int wxRichTextTable::GetRowCount | ( |  | ) | const`[inline]`

Returns the row count.

virtual wxRichTextSelection wxRichTextTable::GetSelection | ( | long | start,
|  | long | end |
| ) |  |  | const`[virtual]`

Returns a selection object specifying the selections between start and end character positions.

For example, a table would deduce what cells (of range length 1) are selected when dragging across the table.

virtual wxString wxRichTextTable::GetTextForRange | ( | const wxRichTextRange & | range | ) | const`[virtual]`

Reimplemented from wxRichTextParagraphLayoutBox.

virtual wxString wxRichTextTable::GetXMLNodeName | ( |  | ) | const`[inline, virtual]`

Returns the XML node name of this object.

This must be overridden for wxXmlNode-base XML export to work.

Reimplemented from wxRichTextBox.

virtual bool wxRichTextTable::HandlesChildSelections | ( |  | ) | const`[inline, virtual]`

Returns true if this object can handle the selections of its children, fOr example a table.

Required for composite selection handling to work.

Reimplemented from wxRichTextObject.

virtual bool wxRichTextTable::Layout | ( | wxDC & | dc,
|  | const wxRect & | rect,
|  | int | style |
| ) |  |  | `[virtual]`

Lay the item out at the specified position with the given size constraint.

Layout must set the cached size.

Reimplemented from wxRichTextParagraphLayoutBox.

virtual bool wxRichTextTable::SetCellStyle | ( | const wxRichTextSelection & | selection,
|  | const wxRichTextAttr & | style,
|  | int | flags = `wxRICHTEXT_SETSTYLE_WITH_UNDO` |
| ) |  |  | `[virtual]`

Sets the attributes for the cells specified by the selection.

## Member Data Documentation

wxRichTextObjectPtrArrayArray wxRichTextTable::m_cells`[protected]`

int wxRichTextTable::m_colCount`[protected]`

int wxRichTextTable::m_rowCount`[protected]`

|  | [ top ]