This is the base for drawable rich text objects.
wx.richtext.RichTextCompositeObject, wx.richtext.RichTextImage, wx.richtext.RichTextPlainText
Constructor, taking an optional parent pointer. |
|
Returns |
|
Adjusts the attributes for virtual attribute provision, collapsed borders, etc. |
|
Returns the rectangle which the child has available to it given restrictions specified in the child attribute, e.g. |
|
Calculates the range of the object. |
|
Returns |
|
Returns |
|
Returns |
|
Clones the object. |
|
Convert units in pixels to tenths of a millimetre. |
|
Converts units in tenths of a millimetre to device units. |
|
Copies the object. |
|
Deletes the given range. |
|
Reference-counting allows us to use the same object in multiple lists (not yet used). |
|
Do a split from pos, returning an object containing the second part, and setting the first part in ‘this’. |
|
Draw the item, within the given range. |
|
Draws a border. |
|
Draws the borders and background for the given rectangle and attributes. |
|
Edits the object’s properties via a GUI. |
|
Finds the absolute position and row height for the given character position. |
|
Returns the absolute object position, by traversing up the child/parent hierarchy. |
|
Returns the object’s attributes. |
|
Calculates the available content space in the given rectangle, given the margins, border and padding specified in the object’s attributes. |
|
Returns the best size, i.e. the ideal starting size for this object irrespective of available space. |
|
Returns the bottom margin of the object, in pixels. |
|
Returns the various rectangles of the box model in pixels. |
|
Returns the containing buffer. |
|
Gets the cached object size as calculated by Layout. |
|
Returns the top-level container of this object. |
|
Returns the stored descent value. |
|
Returns the floating direction. |
|
Returns the left margin of the object, in pixels. |
|
Gets the maximum object size as calculated by Layout. |
|
Gets the minimum object size as calculated by Layout. |
|
Returns the identifying name for this object from the properties, using the “name” key. |
|
Gets the ‘natural’ size for an object. |
|
Returns the object’s own range (valid if top-level). |
|
Returns the object’s own range only if a top-level object. |
|
Returns a pointer to the parent object. |
|
Returns the top-level container of this object. |
|
Returns the object position in pixels. |
|
Returns the object’s properties. |
|
Returns the label to be used for the properties context menu item. |
|
Returns the object’s range. |
|
Returns the object size for the given range. |
|
Returns the rectangle enclosing the object. |
|
Returns the right margin of the object, in pixels. |
|
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 top margin of the object, in pixels. |
|
Returns the total margin for the object in pixels, taking into account margin, padding and border size. |
|
Returns the |
|
Returns |
|
Hit-testing: returns a flag indicating hit test details, plus information about position. |
|
Imports this object from |
|
Invalidates the object at the given range. |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Lay the item out at the specified position with the given size constraint. |
|
Lays out the object first with a given amount of space, and then if no width was specified in attr, lays out the object again using the minimum size. |
|
Returns |
|
Moves the object recursively, by adding the offset from old to new. |
|
Reference-counting allows us to use the same object in multiple lists (not yet used). |
|
Sets the object’s attributes. |
|
Sets the cached object size as calculated by Layout. |
|
Sets the stored descent value. |
|
Set the margin around the object, in pixels. |
|
Sets the maximum object size as calculated by Layout. |
|
Sets the minimum object size as calculated by Layout. |
|
Sets the identifying name for this object as a property using the “name” key. |
|
Set the object’s own range, for a top-level object with its own position space. |
|
Sets the pointer to the parent object. |
|
Sets the object position in pixels. |
|
Sets the object’s properties. |
|
Sets the object’s range within its container. |
|
Call to show or hide this object. |
|
Returns the final object in the split objects if this object was split due to differences between sub-object virtual attributes. |
|
Returns |
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
Possible constructors:
RichTextObject(parent: Optional[RichTextObject]=None) -> None
This is the base for drawable rich text objects.
Constructor, taking an optional parent pointer.
parent (wx.richtext.RichTextObject)
None
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).
bool
Adjusts the attributes for virtual attribute provision, collapsed borders, etc.
attr (wx.richtext.RichTextAttr)
context (wx.richtext.RichTextDrawingContext)
bool
Returns the rectangle which the child has available to it given restrictions specified in the child attribute, e.g.
50% width of the parent, 400 pixels, x position 20% of the parent, etc. availableContainerSpace might be a parent that the cell has to compute its width relative to. E.g. a cell that’s 50% of its parent.
dc (wx.DC)
buffer (wx.richtext.RichTextBuffer)
parentAttr (wx.richtext.RichTextAttr)
childAttr (wx.richtext.RichTextAttr)
availableParentSpace (wx.Rect)
availableContainerSpace (wx.Rect)
Calculates the range of the object.
By default, guess that the object is 1 unit long.
start (long)
int
Returns True
if we can edit the object’s properties via a GUI.
bool
Returns True
if this object can merge itself with the given one.
object (wx.richtext.RichTextObject)
context (wx.richtext.RichTextDrawingContext)
bool
Returns True
if this object can potentially be split, by virtue of having different virtual attributes for individual sub-objects.
context (wx.richtext.RichTextDrawingContext)
bool
Clones the object.
Convert units in pixels to tenths of a millimetre.
ConvertPixelsToTenthsMM (self, dc : DC, pixels : int)
dc (wx.DC)
pixels (int)
int
ConvertPixelsToTenthsMM (ppi : int, pixels : int, scale: float=1.0)
ppi (int)
pixels (int)
scale (float)
int
Converts units in tenths of a millimetre to device units.
ConvertTenthsMMToPixels (self, dc : DC, units : int)
dc (wx.DC)
units (int)
int
ConvertTenthsMMToPixels (ppi : int, units : int, scale: float=1.0)
ppi (int)
units (int)
scale (float)
int
Copies the object.
None
Deletes the given range.
range (wx.richtext.RichTextRange)
bool
Reference-counting allows us to use the same object in multiple lists (not yet used).
None
Do a split from pos, returning an object containing the second part, and setting the first part in ‘this’.
pos (long)
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)
dc (wx.DC)
context (wx.richtext.RichTextDrawingContext)
range (wx.richtext.RichTextRange)
selection (wx.richtext.RichTextSelection)
rect (wx.Rect)
descent (int)
style (int)
bool
Draws a border.
dc (wx.DC)
buffer (wx.richtext.RichTextBuffer)
attr (wx.richtext.RichTextAttr)
borders (wx.richtext.TextAttrBorders)
rect (wx.Rect)
flags (int)
bool
Draws the borders and background for the given rectangle and attributes.
boxRect is taken to be the outer margin box, not the box around the content.
dc (wx.DC)
buffer (wx.richtext.RichTextBuffer)
attr (wx.richtext.RichTextAttr)
boxRect (wx.Rect)
flags (int)
bool
Edits the object’s properties via a GUI.
parent (wx.Window)
buffer (wx.richtext.RichTextBuffer)
bool
Finds the absolute position and row height for the given character position.
dc (wx.DC)
context (wx.richtext.RichTextDrawingContext)
index (long)
forceLineStart (bool)
le[bool, wx.Point, int]
Returns the absolute object position, by traversing up the child/parent hierarchy.
TODO
: may not be needed, if all object positions are in fact relative to the top of the coordinate space.
Point
Returns the object’s attributes.
Calculates the available content space in the given rectangle, given the margins, border and padding specified in the object’s attributes.
dc (wx.DC)
context (wx.richtext.RichTextDrawingContext)
outerRect (wx.Rect)
Returns the best size, i.e. the ideal starting size for this object irrespective of available space.
For a short text string, it will be the size that exactly encloses the text. For a longer string, it might use the parent width for example.
Size
Returns the bottom margin of the object, in pixels.
int
Returns the various rectangles of the box model in pixels.
You can either specify contentRect (inner) or marginRect (outer), and the other must be the default rectangle (no width or height). Note that the outline doesn’t affect the position of the rectangle, it’s drawn in whatever space is available.
dc (wx.DC)
buffer (wx.richtext.RichTextBuffer)
attr (wx.richtext.RichTextAttr)
le[bool, wx.Rect, wx.Rect, wx.Rect, wx.Rect, wx.Rect]
Returns the containing buffer.
Gets the cached object size as calculated by Layout.
Size
Returns the top-level container of this object.
May return itself if it’s a container; use GetParentContainer to return a different container.
Returns the stored descent value.
int
Returns the floating direction.
int
Returns the left margin of the object, in pixels.
int
Gets the maximum object size as calculated by Layout.
This allows us to fit an object to its contents or allocate extra space if required.
Size
Gets the minimum object size as calculated by Layout.
This allows us to constrain an object to its absolute minimum size if necessary.
Size
Returns the identifying name for this object from the properties, using the “name” key.
str
Gets the ‘natural’ size for an object.
For an image, it would be the image size.
Returns the object’s own range (valid if top-level).
Returns the object’s own range only if a top-level object.
Returns a pointer to the parent object.
Returns the top-level container of this object.
Returns a different container than itself, unless there’s no parent, in which case it will return None
.
Returns the object position in pixels.
Point
Returns the object’s properties.
Returns the label to be used for the properties context menu item.
str
Returns the object’s range.
Returns the object size for the given range.
Returns False
if the range is invalid for this object.
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)
bool
Returns the right margin of the object, in pixels.
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.
start (long)
end (long)
Returns any text in this object for the given range.
range (wx.richtext.RichTextRange)
str
Returns the top margin of the object, in pixels.
int
Returns the total margin for the object in pixels, taking into account margin, padding and border size.
dc (wx.DC)
buffer (wx.richtext.RichTextBuffer)
attr (wx.richtext.RichTextAttr)
Tuple[bool, int, int, int, int]
Returns the XML
node name of this object.
This must be overridden for XmlNode-base XML
export to work.
str
Returns True
if this object can handle the selections of its children, fOr example a table.
Required for composite selection handling to work.
bool
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).
dc (wx.DC)
context (wx.richtext.RichTextDrawingContext)
pt (wx.Point)
flags (int)
Tuple[int, int, RichTextObject, RichTextObject]
One of the wx.richtext.RichTextHitTestFlags values.
Imports this object from XML
.
buffer (wx.richtext.RichTextBuffer)
node (wx.xml.XmlNode)
handler (wx.richtext.RichTextXMLHandler)
recurse (bool)
bool
Invalidates the object at the given range.
With no argument, invalidates the whole object.
invalidRange (wx.richtext.RichTextRange)
None
Returns True
if no user editing can be done inside the object.
This returns True
for simple objects, False
for most composite objects, but True
for fields, which if composite, should not be user-edited.
bool
Returns True
if this object is composite.
bool
Returns True
if the object is empty.
bool
Returns True
if this class of object is floatable.
bool
Returns True
if this object is currently floating.
bool
Returns True
if the object will be shown, False
otherwise.
bool
Returns True
if this object is top-level, i.e. contains its own paragraphs, such as a text box.
bool
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).
dc (wx.DC)
context (wx.richtext.RichTextDrawingContext)
rect (wx.Rect)
parentRect (wx.Rect)
style (int)
bool
Lays out the object first with a given amount of space, and then if no width was specified in attr, lays out the object again using the minimum size.
availableParentSpace is the maximum space for the object, whereas availableContainerSpace is the container with which relative positions and sizes should be computed. For example, a text box whose space has already been constrained in a previous layout pass to availableParentSpace, but should have a width of 50% of availableContainerSpace. (If these two rects were the same, a 2nd pass could see the object getting too small.)
dc (wx.DC)
context (wx.richtext.RichTextDrawingContext)
buffer (wx.richtext.RichTextBuffer)
parentAttr (wx.richtext.RichTextAttr)
attr (wx.richtext.RichTextAttr)
availableParentSpace (wx.Rect)
availableContainerSpace (wx.Rect)
style (int)
bool
Returns True
if this object merged itself with the given one.
The calling code will then delete the given object.
object (wx.richtext.RichTextObject)
context (wx.richtext.RichTextDrawingContext)
bool
Moves the object recursively, by adding the offset from old to new.
pt (wx.Point)
None
Reference-counting allows us to use the same object in multiple lists (not yet used).
None
Sets the object’s attributes.
attr (wx.richtext.RichTextAttr)
None
Sets the cached object size as calculated by Layout.
sz (wx.Size)
None
Sets the stored descent value.
descent (int)
None
Set the margin around the object, in pixels.
SetMargins (self, margin : int)
margin (int)
None
SetMargins (self, leftMargin : int, rightMargin : int, topMargin : int, bottomMargin : int)
leftMargin (int)
rightMargin (int)
topMargin (int)
bottomMargin (int)
None
Sets the maximum object size as calculated by Layout.
This allows us to fit an object to its contents or allocate extra space if required.
sz (wx.Size)
None
Sets the minimum object size as calculated by Layout.
This allows us to constrain an object to its absolute minimum size if necessary.
sz (wx.Size)
None
Sets the identifying name for this object as a property using the “name” key.
name (string)
None
Set the object’s own range, for a top-level object with its own position space.
range (wx.richtext.RichTextRange)
None
Sets the pointer to the parent object.
parent (wx.richtext.RichTextObject)
None
Sets the object position in pixels.
pos (wx.Point)
None
Sets the object’s properties.
props (wx.richtext.RichTextProperties)
None
Sets the object’s range within its container.
range (wx.richtext.RichTextRange)
None
Call to show or hide this object.
This function does not cause the content to be laid out or redrawn.
show (bool)
None
Returns the final object in the split objects if this object was split due to differences between sub-object virtual attributes.
Returns itself if it was not split.
context (wx.richtext.RichTextDrawingContext)
Returns True
if this object takes note of paragraph attributes (text and image objects don’t).
bool
See GetAttributes
and SetAttributes
See GetBestSize
See GetBottomMargin
See GetCachedSize
and SetCachedSize
See GetContainer
See GetDescent
and SetDescent
See GetLeftMargin
See GetMaxSize
and SetMaxSize
See GetMinSize
and SetMinSize
See GetNaturalSize
See GetOwnRange
and SetOwnRange
See GetPosition
and SetPosition
See GetProperties
and SetProperties
See GetRightMargin
See GetTopMargin
See GetXMLNodeName