wx.richtext.RichTextTable¶
wx.richtext.RichTextTable represents a table with arbitrary columns and rows.
Class Hierarchy¶
Methods Summary¶
Default constructor; optionally pass the parent object. |
|
Returns |
|
Adds columns from the given column position. |
|
Adds rows from the given row position. |
|
Calculates the range of the object. |
|
Returns |
|
Clears the table. |
|
Clones the object. |
|
Creates a table of the given dimensions. |
|
Deletes columns from the given column position. |
|
Deletes the given range. |
|
Deletes rows from the given row position. |
|
Draw the item, within the given range. |
|
Edits the object’s properties via a GUI. |
|
Finds the absolute position and row height for the given character position. |
|
Returns the cell at the given row/column position. |
|
Returns the row/column for a given character position. |
|
Returns the cells array. |
|
Returns the column count. |
|
Returns the coordinates of the cell with keyboard focus, or (-1,-1) if none. |
|
Returns the label to be used for the properties context menu item. |
|
Returns the object size for the given range. |
|
Returns the row count. |
|
Returns a selection object specifying the selections between start and end character positions. |
|
Returns any text in this object for the given range. |
|
Returns the |
|
Returns |
|
Hit-testing: returns a flag indicating hit test details, plus information about position. |
|
Imports this object from |
|
Lay the item out at the specified position with the given size constraint. |
|
Sets the attributes for the cells specified by the selection. |
Properties Summary¶
See |
|
See |
|
See |
|
See |
|
See |
Class API¶
- class wx.richtext.RichTextTable(RichTextBox)¶
Possible constructors:
RichTextTable(parent=None) -> None RichTextTable(obj) -> None
RichTextTable represents a table with arbitrary columns and rows.
Methods¶
- __init__(self, *args, **kw)¶
-
__init__ (self, parent=None)
Default constructor; optionally pass the parent object.
- Parameters:
parent (wx.richtext.RichTextObject)
- Return type:
None
__init__ (self, obj)
Copy constructor.
- Parameters:
- Return type:
None
- 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).
- Return type:
bool
- AddColumns(self, startCol, noCols=1, attr=RichTextAttr())¶
Adds columns from the given column position.
- Parameters:
startCol (int)
noCols (int)
attr (wx.richtext.RichTextAttr)
- Return type:
bool
- AddRows(self, startRow, noRows=1, attr=RichTextAttr())¶
Adds rows from the given row position.
- Parameters:
startRow (int)
noRows (int)
attr (wx.richtext.RichTextAttr)
- Return type:
bool
- CalculateRange(self, start)¶
Calculates the range of the object.
By default, guess that the object is 1 unit long.
- Parameters:
start (long)
- Return type:
int
- CanEditProperties(self)¶
Returns
True
if we can edit the object’s properties via a GUI.- Return type:
bool
- ClearTable(self)¶
Clears the table.
- Return type:
None
- Clone(self)¶
Clones the object.
- Return type:
- Copy(self, obj)¶
- Parameters:
- Return type:
None
- CreateTable(self, rows, cols)¶
Creates a table of the given dimensions.
- Parameters:
rows (int)
cols (int)
- Return type:
bool
- DeleteColumns(self, startCol, noCols=1)¶
Deletes columns from the given column position.
- Parameters:
startCol (int)
noCols (int)
- Return type:
bool
- DeleteRange(self, range)¶
Deletes the given range.
- Parameters:
range (wx.richtext.RichTextRange)
- Return type:
bool
- DeleteRows(self, startRow, noRows=1)¶
Deletes rows from the given row position.
- Parameters:
startRow (int)
noRows (int)
- Return type:
bool
- Draw(self, dc, context, range, selection, rect, descent, style)¶
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)
- Parameters:
dc (wx.DC)
context (wx.richtext.RichTextDrawingContext)
range (wx.richtext.RichTextRange)
selection (wx.richtext.RichTextSelection)
rect (wx.Rect)
descent (int)
style (int)
- Return type:
bool
- EditProperties(self, parent, buffer)¶
Edits the object’s properties via a GUI.
- Parameters:
parent (wx.Window)
buffer (wx.richtext.RichTextBuffer)
- Return type:
bool
- FindPosition(self, dc, context, index, forceLineStart)¶
Finds the absolute position and row height for the given character position.
- Parameters:
dc (wx.DC)
context (wx.richtext.RichTextDrawingContext)
index (long)
forceLineStart (bool)
- Return type:
le[bool, wx.Point, int]
- GetCell(self, *args, **kw)¶
-
GetCell (self, row, col)
Returns the cell at the given row/column position.
- Parameters:
row (int)
col (int)
- Return type:
GetCell (self, pos)
Returns the cell at the given character position (in the range of the table).
- Parameters:
pos (long)
- Return type:
- GetCellRowColumnPosition(self, pos, row, col)¶
Returns the row/column for a given character position.
- Parameters:
pos (long)
row (int)
col (int)
- Return type:
bool
- GetCells(self)¶
Returns the cells array.
- Return type:
RichTextObjectPtrArrayArray
- GetColumnCount(self)¶
Returns the column count.
- Return type:
int
- GetFocusedCell(self)¶
Returns the coordinates of the cell with keyboard focus, or (-1,-1) if none.
- Return type:
Position
- GetPropertiesMenuLabel(self)¶
Returns the label to be used for the properties context menu item.
- Return type:
str
- GetRangeSize(self, range, size, descent, dc, context, flags, position=Point(0, 0), parentSize=DefaultSize, partialExtents=None)¶
Returns the object size for the given range.
Returns
False
if the range is invalid for this object.- Parameters:
range (wx.richtext.RichTextRange)
size (wx.Size)
descent (int)
dc (wx.DC)
context (wx.richtext.RichTextDrawingContext)
flags (int)
position (wx.Point)
parentSize (wx.Size)
partialExtents (list of integers)
- Return type:
bool
- GetRowCount(self)¶
Returns the row count.
- Return type:
int
- GetSelection(self, start, end)¶
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.
- Parameters:
start (long)
end (long)
- Return type:
- GetTextForRange(self, range)¶
Returns any text in this object for the given range.
- Parameters:
range (wx.richtext.RichTextRange)
- Return type:
str
- GetXMLNodeName(self)¶
Returns the
XML
node name of this object.This must be overridden for XmlNode-base
XML
export to work.- Return type:
str
- 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.
- Return type:
bool
- HitTest(self, dc, context, pt, flags=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).
- Parameters:
dc (wx.DC)
context (wx.richtext.RichTextDrawingContext)
pt (wx.Point)
flags (int)
- Return type:
Tuple[int, int, RichTextObject, RichTextObject]
- Returns:
One of the wx.richtext.RichTextHitTestFlags values.
- ImportFromXML(self, buffer, node, handler, recurse)¶
Imports this object from
XML
.- Parameters:
buffer (wx.richtext.RichTextBuffer)
node (wx.xml.XmlNode)
handler (wx.richtext.RichTextXMLHandler)
recurse (bool)
- Return type:
bool
- Layout(self, dc, context, rect, parentRect, style)¶
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).
- Parameters:
dc (wx.DC)
context (wx.richtext.RichTextDrawingContext)
rect (wx.Rect)
parentRect (wx.Rect)
style (int)
- Return type:
bool
- SetCellStyle(self, selection, style, flags=RICHTEXT_SETSTYLE_WITH_UNDO)¶
Sets the attributes for the cells specified by the selection.
- Parameters:
selection (wx.richtext.RichTextSelection)
style (wx.richtext.RichTextAttr)
flags (int)
- Return type:
bool
Properties¶
- ColumnCount¶
See
GetColumnCount
- FocusedCell¶
See
GetFocusedCell
- PropertiesMenuLabel¶
- RowCount¶
See
GetRowCount
- XMLNodeName¶
See
GetXMLNodeName