Phoenix Logo

phoenix_title wx.richtext.RichTextFieldType

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.


class_hierarchy Class Hierarchy

Inheritance diagram for class RichTextFieldType:


method_summary Methods Summary

__init__ Creates a field type definition.
CanEditProperties Returns True if we can edit the object’s properties via a GUI.
Copy  
Draw Draw the item, within the given range.
EditProperties Edits the object’s properties via a GUI.
GetName Returns the field type name.
GetPropertiesMenuLabel Returns the label to be used for the properties context menu item.
GetRangeSize Returns the object size for the given range.
IsTopLevel Returns True if this object is top-level, i.e. contains its own paragraphs, such as a text box.
Layout Lay the item out at the specified position with the given size constraint.
SetName Sets the field type name.
UpdateField Update the field.

property_summary Properties Summary

Name See GetName and SetName

api Class API



class wx.richtext.RichTextFieldType(Object)

Possible constructors:

RichTextFieldType(name="")

RichTextFieldType(fieldType)

The base class for custom field types.


Methods



__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self, name=””)

Creates a field type definition.

Parameters:name (string) –



__init__ (self, fieldType)

Copy constructor.

Parameters:fieldType (wx.richtext.RichTextFieldType) –





CanEditProperties(self, obj)

Returns True if we can edit the object’s properties via a GUI.

Parameters:obj (wx.richtext.RichTextField) –
Return type:bool


Copy(self, fieldType)
Parameters: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)

Parameters:
Return type:

bool



EditProperties(self, obj, parent, buffer)

Edits the object’s properties via a GUI.

Parameters:
Return type:

bool



GetName(self)

Returns the field type name.

There should be a unique name per field type object.

Return type:string


GetPropertiesMenuLabel(self, obj)

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

Parameters:obj (wx.richtext.RichTextField) –
Return type: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.

Parameters:
Return type:

bool



IsTopLevel(self, obj)

Returns True if this object is top-level, i.e. contains its own paragraphs, such as a text box.

Parameters:obj (wx.richtext.RichTextField) –
Return type: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).

Parameters:
Return type:

bool



SetName(self, name)

Sets the field type name.

There should be a unique name per field type object.

Parameters: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.

Parameters:
Return type:

bool


Properties



Name

See GetName and SetName