.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. _wx.richtext.RichTextTable:
==========================================================================================================================================
|phoenix_title| **wx.richtext.RichTextTable**
==========================================================================================================================================
:ref:`wx.richtext.RichTextTable` represents a table with arbitrary columns and rows.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html

Inheritance diagram for class
RichTextTable:
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.richtext.RichTextTable.__init__` Default constructor; optionally pass the parent object.
:meth:`~wx.richtext.RichTextTable.AcceptsFocus` Returns ``True`` if objects of this class can accept the focus, i.e. a call to SetFocusObject is possible.
:meth:`~wx.richtext.RichTextTable.AddColumns` Adds columns from the given column position.
:meth:`~wx.richtext.RichTextTable.AddRows` Adds rows from the given row position.
:meth:`~wx.richtext.RichTextTable.CalculateRange` Calculates the range of the object.
:meth:`~wx.richtext.RichTextTable.CanEditProperties` Returns ``True`` if we can edit the object's properties via a GUI.
:meth:`~wx.richtext.RichTextTable.ClearTable` Clears the table.
:meth:`~wx.richtext.RichTextTable.Clone` Clones the object.
:meth:`~wx.richtext.RichTextTable.Copy`
:meth:`~wx.richtext.RichTextTable.CreateTable` Creates a table of the given dimensions.
:meth:`~wx.richtext.RichTextTable.DeleteColumns` Deletes columns from the given column position.
:meth:`~wx.richtext.RichTextTable.DeleteRange` Deletes the given range.
:meth:`~wx.richtext.RichTextTable.DeleteRows` Deletes rows from the given row position.
:meth:`~wx.richtext.RichTextTable.Draw` Draw the item, within the given range.
:meth:`~wx.richtext.RichTextTable.EditProperties` Edits the object's properties via a GUI.
:meth:`~wx.richtext.RichTextTable.FindPosition` Finds the absolute position and row height for the given character position.
:meth:`~wx.richtext.RichTextTable.GetCell` Returns the cell at the given row/column position.
:meth:`~wx.richtext.RichTextTable.GetCellRowColumnPosition` Returns the row/column for a given character position.
:meth:`~wx.richtext.RichTextTable.GetCells` Returns the cells array.
:meth:`~wx.richtext.RichTextTable.GetColumnCount` Returns the column count.
:meth:`~wx.richtext.RichTextTable.GetFocusedCell` Returns the coordinates of the cell with keyboard focus, or (-1,-1) if none.
:meth:`~wx.richtext.RichTextTable.GetPropertiesMenuLabel` Returns the label to be used for the properties context menu item.
:meth:`~wx.richtext.RichTextTable.GetRangeSize` Returns the object size for the given range.
:meth:`~wx.richtext.RichTextTable.GetRowCount` Returns the row count.
:meth:`~wx.richtext.RichTextTable.GetSelection` Returns a selection object specifying the selections between start and end character positions.
:meth:`~wx.richtext.RichTextTable.GetTextForRange` Returns any text in this object for the given range.
:meth:`~wx.richtext.RichTextTable.GetXMLNodeName` Returns the ``XML`` node name of this object.
:meth:`~wx.richtext.RichTextTable.HandlesChildSelections` Returns ``True`` if this object can handle the selections of its children, fOr example a table.
:meth:`~wx.richtext.RichTextTable.HitTest` Hit-testing: returns a flag indicating hit test details, plus information about position.
:meth:`~wx.richtext.RichTextTable.ImportFromXML` Imports this object from ``XML``.
:meth:`~wx.richtext.RichTextTable.Layout` Lay the item out at the specified position with the given size constraint.
:meth:`~wx.richtext.RichTextTable.SetCellStyle` Sets the attributes for the cells specified by the selection.
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.richtext.RichTextTable.Cells` See :meth:`~wx.richtext.RichTextTable.GetCells`
:attr:`~wx.richtext.RichTextTable.ColumnCount` See :meth:`~wx.richtext.RichTextTable.GetColumnCount`
:attr:`~wx.richtext.RichTextTable.FocusedCell` See :meth:`~wx.richtext.RichTextTable.GetFocusedCell`
:attr:`~wx.richtext.RichTextTable.PropertiesMenuLabel` See :meth:`~wx.richtext.RichTextTable.GetPropertiesMenuLabel`
:attr:`~wx.richtext.RichTextTable.RowCount` See :meth:`~wx.richtext.RichTextTable.GetRowCount`
:attr:`~wx.richtext.RichTextTable.XMLNodeName` See :meth:`~wx.richtext.RichTextTable.GetXMLNodeName`
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.richtext.RichTextTable(RichTextBox)
**Possible constructors**::
RichTextTable(parent: Optional[RichTextObject]=None) -> None
RichTextTable(obj : RichTextTable) -> None
RichTextTable represents a table with arbitrary columns and rows.
.. method:: __init__(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**__init__** `(self, parent: Optional[RichTextObject]=None)`
Default constructor; optionally pass the parent object.
:param `parent`:
:type `parent`: wx.richtext.RichTextObject
:rtype: `None`
:html:`
`
**__init__** `(self, obj : RichTextTable)`
Copy constructor.
:param `obj`:
:type `obj`: wx.richtext.RichTextTable
:rtype: `None`
:html:`
`
.. method:: AcceptsFocus(self)
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).
:rtype: `bool`
.. method:: AddColumns(self, startCol : int, noCols: int=1, attr: RichTextAttr=RichTextAttr())
Adds columns from the given column position.
:param `startCol`:
:type `startCol`: int
:param `noCols`:
:type `noCols`: int
:param `attr`:
:type `attr`: wx.richtext.RichTextAttr
:rtype: `bool`
.. method:: AddRows(self, startRow : int, noRows: int=1, attr: RichTextAttr=RichTextAttr())
Adds rows from the given row position.
:param `startRow`:
:type `startRow`: int
:param `noRows`:
:type `noRows`: int
:param `attr`:
:type `attr`: wx.richtext.RichTextAttr
:rtype: `bool`
.. method:: CalculateRange(self, start : int)
Calculates the range of the object.
By default, guess that the object is 1 unit long.
:param `start`:
:type `start`: long
:rtype: `int`
.. method:: CanEditProperties(self)
Returns ``True`` if we can edit the object's properties via a GUI.
:rtype: `bool`
.. method:: ClearTable(self)
Clears the table.
:rtype: `None`
.. method:: Clone(self)
Clones the object.
:rtype: :ref:`wx.richtext.RichTextObject`
.. method:: Copy(self, obj : RichTextTable)
:param `obj`:
:type `obj`: wx.richtext.RichTextTable
:rtype: `None`
.. method:: CreateTable(self, rows : int, cols : int)
Creates a table of the given dimensions.
:param `rows`:
:type `rows`: int
:param `cols`:
:type `cols`: int
:rtype: `bool`
.. method:: DeleteColumns(self, startCol : int, noCols: int=1)
Deletes columns from the given column position.
:param `startCol`:
:type `startCol`: int
:param `noCols`:
:type `noCols`: int
:rtype: `bool`
.. method:: DeleteRange(self, range : RichTextRange)
Deletes the given range.
:param `range`:
:type `range`: wx.richtext.RichTextRange
:rtype: `bool`
.. method:: DeleteRows(self, startRow : int, noRows: int=1)
Deletes rows from the given row position.
:param `startRow`:
:type `startRow`: int
:param `noRows`:
:type `noRows`: int
:rtype: `bool`
.. method:: Draw(self, dc : DC, context : RichTextDrawingContext, range : RichTextRange, selection : RichTextSelection, rect : Rect, descent : int, style : int)
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)
:param `dc`:
:type `dc`: wx.DC
:param `context`:
:type `context`: wx.richtext.RichTextDrawingContext
:param `range`:
:type `range`: wx.richtext.RichTextRange
:param `selection`:
:type `selection`: wx.richtext.RichTextSelection
:param `rect`:
:type `rect`: wx.Rect
:param `descent`:
:type `descent`: int
:param `style`:
:type `style`: int
:rtype: `bool`
.. method:: EditProperties(self, parent : Window, buffer : RichTextBuffer)
Edits the object's properties via a GUI.
:param `parent`:
:type `parent`: wx.Window
:param `buffer`:
:type `buffer`: wx.richtext.RichTextBuffer
:rtype: `bool`
.. method:: FindPosition(self, dc : DC, context : RichTextDrawingContext, index : int, forceLineStart : bool)
Finds the absolute position and row height for the given character position.
:param `dc`:
:type `dc`: wx.DC
:param `context`:
:type `context`: wx.richtext.RichTextDrawingContext
:param `index`:
:type `index`: long
:param `forceLineStart`:
:type `forceLineStart`: bool
:rtype: :ref:`le[bool, wx.Point, int]`
.. method:: GetCell(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**GetCell** `(self, row : int, col : int)`
Returns the cell at the given row/column position.
:param `row`:
:type `row`: int
:param `col`:
:type `col`: int
:rtype: :ref:`wx.richtext.RichTextCell`
:html:`
`
**GetCell** `(self, pos : int)`
Returns the cell at the given character position (in the range of the table).
:param `pos`:
:type `pos`: long
:rtype: :ref:`wx.richtext.RichTextCell`
:html:`
`
.. method:: GetCellRowColumnPosition(self, pos : int, row : int, col : int)
Returns the row/column for a given character position.
:param `pos`:
:type `pos`: long
:param `row`:
:type `row`: int
:param `col`:
:type `col`: int
:rtype: `bool`
.. method:: GetCells(self)
Returns the cells array.
:rtype: `RichTextObjectPtrArrayArray`
.. method:: GetColumnCount(self)
Returns the column count.
:rtype: `int`
.. method:: GetFocusedCell(self)
Returns the coordinates of the cell with keyboard focus, or (-1,-1) if none.
:rtype: `Position`
.. method:: GetPropertiesMenuLabel(self)
Returns the label to be used for the properties context menu item.
:rtype: `str`
.. method:: GetRangeSize(self, range : RichTextRange, size : Size, descent : int, dc : DC, context : RichTextDrawingContext, flags : int, position: Point=Point(0,0), parentSize: Size=DefaultSize, partialExtents: Optional[List[int]]=None)
Returns the object size for the given range.
Returns ``False`` if the range is invalid for this object.
:param `range`:
:type `range`: wx.richtext.RichTextRange
:param `size`:
:type `size`: wx.Size
:param `descent`:
:type `descent`: int
:param `dc`:
:type `dc`: wx.DC
:param `context`:
:type `context`: wx.richtext.RichTextDrawingContext
:param `flags`:
:type `flags`: int
:param `position`:
:type `position`: wx.Point
:param `parentSize`:
:type `parentSize`: wx.Size
:param `partialExtents`:
:type `partialExtents`: list of integers
:rtype: `bool`
.. method:: GetRowCount(self)
Returns the row count.
:rtype: `int`
.. method:: GetSelection(self, start : int, end : int)
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.
:param `start`:
:type `start`: long
:param `end`:
:type `end`: long
:rtype: :ref:`wx.richtext.RichTextSelection`
.. method:: GetTextForRange(self, range : RichTextRange)
Returns any text in this object for the given range.
:param `range`:
:type `range`: wx.richtext.RichTextRange
:rtype: `str`
.. method:: GetXMLNodeName(self)
Returns the ``XML`` node name of this object.
This must be overridden for XmlNode-base ``XML`` export to work.
:rtype: `str`
.. method:: HandlesChildSelections(self)
Returns ``True`` if this object can handle the selections of its children, fOr example a table.
Required for composite selection handling to work.
:rtype: `bool`
.. method:: HitTest(self, dc : DC, context : RichTextDrawingContext, pt : Point, flags: int=0)
Hit-testing: returns a flag indicating hit test details, plus information about position.
`contextObj` is returned to specify what object position is relevant to, since otherwise there's an ambiguity. @ obj might not be a child of `contextObj`, since we may be referring to the container itself if we have no hit on a child - for example if we click outside an object.
The function puts the position in `textPosition` if one is found. `pt` is in logical units (a zero y position is at the beginning of the buffer).
:param `dc`:
:type `dc`: wx.DC
:param `context`:
:type `context`: wx.richtext.RichTextDrawingContext
:param `pt`:
:type `pt`: wx.Point
:param `flags`:
:type `flags`: int
:rtype: :ref:`Tuple[int, int, RichTextObject, RichTextObject]`
:returns:
One of the :ref:`wx.richtext.RichTextHitTestFlags` values.
.. method:: ImportFromXML(self, buffer : RichTextBuffer, node : XmlNode, handler : RichTextXMLHandler, recurse : bool)
Imports this object from ``XML``.
:param `buffer`:
:type `buffer`: wx.richtext.RichTextBuffer
:param `node`:
:type `node`: wx.xml.XmlNode
:param `handler`:
:type `handler`: wx.richtext.RichTextXMLHandler
:param `recurse`:
:type `recurse`: bool
:rtype: `bool`
.. method:: Layout(self, dc : DC, context : RichTextDrawingContext, rect : Rect, parentRect : Rect, style : int)
Lay the item out at the specified position with the given size constraint.
Layout must set the cached size. `rect` is the available space for the object, and `parentRect` is the container that is used to determine a relative size or position (for example if a text box must be 50% of the parent text box).
:param `dc`:
:type `dc`: wx.DC
:param `context`:
:type `context`: wx.richtext.RichTextDrawingContext
:param `rect`:
:type `rect`: wx.Rect
:param `parentRect`:
:type `parentRect`: wx.Rect
:param `style`:
:type `style`: int
:rtype: `bool`
.. method:: SetCellStyle(self, selection : RichTextSelection, style : RichTextAttr, flags: int=RICHTEXT_SETSTYLE_WITH_UNDO)
Sets the attributes for the cells specified by the selection.
:param `selection`:
:type `selection`: wx.richtext.RichTextSelection
:param `style`:
:type `style`: wx.richtext.RichTextAttr
:param `flags`:
:type `flags`: int
:rtype: `bool`
.. attribute:: Cells
See :meth:`~wx.richtext.RichTextTable.GetCells`
.. attribute:: ColumnCount
See :meth:`~wx.richtext.RichTextTable.GetColumnCount`
.. attribute:: FocusedCell
See :meth:`~wx.richtext.RichTextTable.GetFocusedCell`
.. attribute:: PropertiesMenuLabel
See :meth:`~wx.richtext.RichTextTable.GetPropertiesMenuLabel`
.. attribute:: RowCount
See :meth:`~wx.richtext.RichTextTable.GetRowCount`
.. attribute:: XMLNodeName
See :meth:`~wx.richtext.RichTextTable.GetXMLNodeName`