The base class for custom field types.
Each type definition handles one field type. Override functions to provide drawing, layout, updating and property editing functionality for a field.
Register field types on application initialisation with the static function wx.richtext.RichTextBuffer.AddFieldType
. They will be deleted automatically on application exit.
See also
wx.richtext.RichTextFieldTypeStandard, wx.richtext.RichTextField, wx.richtext.RichTextCtrl
wx.richtext.RichTextFieldTypeStandard
Creates a field type definition. |
|
Returns |
|
Draw the item, within the given range. |
|
Edits the object’s properties via a GUI. |
|
Returns the field type name. |
|
Returns the label to be used for the properties context menu item. |
|
Returns the object size for the given range. |
|
Returns |
|
Lay the item out at the specified position with the given size constraint. |
|
Sets the field type name. |
|
Update the field. |
wx.richtext.
RichTextFieldType
(Object)¶Possible constructors:
RichTextFieldType(name="")
RichTextFieldType(fieldType)
The base class for custom field types.
__init__
(self, *args, **kw)¶__init__ (self, name=””)
Creates a field type definition.
name (string) –
__init__ (self, fieldType)
Copy constructor.
fieldType (wx.richtext.RichTextFieldType) –
CanEditProperties
(self, obj)¶Returns True
if we can edit the object’s properties via a GUI.
obj (wx.richtext.RichTextField) –
bool
Copy
(self, fieldType)¶fieldType (wx.richtext.RichTextFieldType) –
Draw
(self, obj, 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)
obj (wx.richtext.RichTextField) –
dc (wx.DC) –
context (wx.richtext.RichTextDrawingContext) –
range (wx.richtext.RichTextRange) –
selection (wx.richtext.RichTextSelection) –
rect (wx.Rect) –
descent (int) –
style (int) –
bool
EditProperties
(self, obj, parent, buffer)¶Edits the object’s properties via a GUI.
obj (wx.richtext.RichTextField) –
parent (wx.Window) –
buffer (wx.richtext.RichTextBuffer) –
bool
GetName
(self)¶Returns the field type name.
There should be a unique name per field type object.
string
GetPropertiesMenuLabel
(self, obj)¶Returns the label to be used for the properties context menu item.
obj (wx.richtext.RichTextField) –
string
GetRangeSize
(self, obj, 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.
obj (wx.richtext.RichTextField) –
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
IsTopLevel
(self, obj)¶Returns True
if this object is top-level, i.e. contains its own paragraphs, such as a text box.
obj (wx.richtext.RichTextField) –
bool
Layout
(self, obj, 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).
obj (wx.richtext.RichTextField) –
dc (wx.DC) –
context (wx.richtext.RichTextDrawingContext) –
rect (wx.Rect) –
parentRect (wx.Rect) –
style (int) –
bool
SetName
(self, name)¶Sets the field type name.
There should be a unique name per field type object.
name (string) –
UpdateField
(self, buffer, obj)¶Update the field.
This would typically expand the field to its value, if this is a dynamically changing and/or composite field.
buffer (wx.richtext.RichTextBuffer) –
obj (wx.richtext.RichTextField) –
bool