wx.richtext.RichTextFieldTypeStandard¶
A field type that can handle fields with text or bitmap labels, with a small range of styles for implementing rectangular fields and fields that can be used for start and end tags.
The border, text and background colours can be customised; the default is white text on a black background.
The following display styles can be used.
Window Styles¶
This class supports the following styles:
RICHTEXT_FIELD_STYLE_COMPOSITE
: Creates a composite field; you will probably need to derive a new class to implement UpdateField.RICHTEXT_FIELD_STYLE_RECTANGLE
: Shows a rounded rectangle background.RICHTEXT_FIELD_STYLE_NO_BORDER
: Suppresses the background and border; mostly used with a bitmap label.RICHTEXT_FIELD_STYLE_START_TAG
: Shows a start tag background, with the pointy end facing right.RICHTEXT_FIELD_STYLE_END_TAG
: Shows an end tag background, with the pointy end facing left.
See also
wx.richtext.RichTextFieldType, wx.richtext.RichTextField, wx.richtext.RichTextBuffer, wx.richtext.RichTextCtrl
Class Hierarchy¶
Methods Summary¶
Constructor, creating a field type definition with a text label. |
|
Copies the object. |
|
Draw the item, within the given range. |
|
Gets the colour used for drawing the field background. |
|
Gets the bitmap label for fields of this type. |
|
Gets the colour used for drawing the field border. |
|
Gets the display style for fields of this type. |
|
Gets the font used for drawing the text label. |
|
Gets the horizontal margin surrounding the field object. |
|
Sets the horizontal padding (the distance between the border and the text). |
|
Returns the text label for fields of this type. |
|
Returns the object size for the given range. |
|
Get the size of the field, given the label, font size, and so on. |
|
Gets the colour used for drawing the text label. |
|
Gets the vertical margin surrounding the field object. |
|
Gets the vertical padding (the distance between the border and the text). |
|
Initialises the object. |
|
Returns |
|
Lay the item out at the specified position with the given size constraint. |
|
Sets the colour used for drawing the field background. |
|
Sets the bitmap label for fields of this type. |
|
Sets the colour used for drawing the field border. |
|
Sets the display style for fields of this type. |
|
Sets the font used for drawing the text label. |
|
Sets the horizontal margin surrounding the field object. |
|
Sets the horizontal padding (the distance between the border and the text). |
|
Sets the text label for fields of this type. |
|
Sets the colour used for drawing the text label. |
|
Sets the vertical margin surrounding the field object. |
|
Sets the vertical padding (the distance between the border and the text). |
Properties Summary¶
See |
|
See |
|
See |
|
See |
|
See |
Class API¶
- class wx.richtext.RichTextFieldTypeStandard(RichTextFieldType)¶
Possible constructors:
RichTextFieldTypeStandard(name, label, displayStyle=RICHTEXT_FIELD_STYLE_RECTANGLE) -> None RichTextFieldTypeStandard(name, bitmap, displayStyle=RICHTEXT_FIELD_STYLE_NO_BORDER) -> None RichTextFieldTypeStandard() -> None RichTextFieldTypeStandard(field) -> None
A field type that can handle fields with text or bitmap labels, with a small range of styles for implementing rectangular fields and fields that can be used for start and end tags.
Methods¶
- __init__(self, *args, **kw)¶
-
__init__ (self, name, label, displayStyle=RICHTEXT_FIELD_STYLE_RECTANGLE)
Constructor, creating a field type definition with a text label.
- Parameters:
name (string) – The name of the type definition. This must be unique, and is the type name used when adding a field to a control.
label (string) – The text label to be shown on the field.
displayStyle (int) – The display style: one of
RICHTEXT_FIELD_STYLE_RECTANGLE
,RICHTEXT_FIELD_STYLE_NO_BORDER
,RICHTEXT_FIELD_STYLE_START_TAG
,RICHTEXT_FIELD_STYLE_END_TAG
.
- Return type:
None
__init__ (self, name, bitmap, displayStyle=RICHTEXT_FIELD_STYLE_NO_BORDER)
Constructor, creating a field type definition with a bitmap label.
- Parameters:
name (string) – The name of the type definition. This must be unique, and is the type name used when adding a field to a control.
bitmap (wx.Bitmap) – The bitmap label to be shown on the field.
displayStyle (int) – The display style: one of
RICHTEXT_FIELD_STYLE_RECTANGLE
,RICHTEXT_FIELD_STYLE_NO_BORDER
,RICHTEXT_FIELD_STYLE_START_TAG
,RICHTEXT_FIELD_STYLE_END_TAG
.
- Return type:
None
__init__ (self)
The default constructor.
- Return type:
None
__init__ (self, field)
The copy constructor.
- Parameters:
- Return type:
None
- Copy(self, field)¶
Copies the object.
- Parameters:
- Return type:
None
- 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:
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
- GetBackgroundColour(self)¶
Gets the colour used for drawing the field background.
- Return type:
Colour
- GetBorderColour(self)¶
Gets the colour used for drawing the field border.
- Return type:
Colour
- GetDisplayStyle(self)¶
Gets the display style for fields of this type.
- Return type:
int
- GetHorizontalMargin(self)¶
Gets the horizontal margin surrounding the field object.
- Return type:
int
- GetHorizontalPadding(self)¶
Sets the horizontal padding (the distance between the border and the text).
- Return type:
int
- GetLabel(self)¶
Returns the text label for fields of this type.
- Return type:
str
- 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:
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
- GetSize(self, obj, dc, context, style)¶
Get the size of the field, given the label, font size, and so on.
- Parameters:
dc (wx.DC)
context (wx.richtext.RichTextDrawingContext)
style (int)
- Return type:
Size
- GetTextColour(self)¶
Gets the colour used for drawing the text label.
- Return type:
Colour
- GetVerticalMargin(self)¶
Gets the vertical margin surrounding the field object.
- Return type:
int
- GetVerticalPadding(self)¶
Gets the vertical padding (the distance between the border and the text).
- Return type:
int
- Init(self)¶
Initialises the object.
- Return type:
None
- IsTopLevel(self, obj)¶
Returns
True
if the display type isRICHTEXT_FIELD_STYLE_COMPOSITE
,False
otherwise.- Parameters:
- 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:
dc (wx.DC)
context (wx.richtext.RichTextDrawingContext)
rect (wx.Rect)
parentRect (wx.Rect)
style (int)
- Return type:
bool
- SetBackgroundColour(self, colour)¶
Sets the colour used for drawing the field background.
- Parameters:
colour (wx.Colour)
- Return type:
None
- SetBitmap(self, bitmap)¶
Sets the bitmap label for fields of this type.
- Parameters:
bitmap (wx.Bitmap)
- Return type:
None
- SetBorderColour(self, colour)¶
Sets the colour used for drawing the field border.
- Parameters:
colour (wx.Colour)
- Return type:
None
- SetDisplayStyle(self, displayStyle)¶
Sets the display style for fields of this type.
- Parameters:
displayStyle (int)
- Return type:
None
- SetFont(self, font)¶
Sets the font used for drawing the text label.
- Parameters:
font (wx.Font)
- Return type:
None
- SetHorizontalMargin(self, margin)¶
Sets the horizontal margin surrounding the field object.
- Parameters:
margin (int)
- Return type:
None
- SetHorizontalPadding(self, padding)¶
Sets the horizontal padding (the distance between the border and the text).
- Parameters:
padding (int)
- Return type:
None
- SetLabel(self, label)¶
Sets the text label for fields of this type.
- Parameters:
label (string)
- Return type:
None
- SetTextColour(self, colour)¶
Sets the colour used for drawing the text label.
- Parameters:
colour (wx.Colour)
- Return type:
None
- SetVerticalMargin(self, margin)¶
Sets the vertical margin surrounding the field object.
- Parameters:
margin (int)
- Return type:
None
- SetVerticalPadding(self, padding)¶
Sets the vertical padding (the distance between the border and the text).
- Parameters:
padding (int)
- Return type:
None
Properties¶
- BackgroundColour¶
- BorderColour¶
See
GetBorderColour
andSetBorderColour
- DisplayStyle¶
See
GetDisplayStyle
andSetDisplayStyle
- HorizontalMargin¶
- HorizontalPadding¶
- TextColour¶
See
GetTextColour
andSetTextColour
- VerticalMargin¶
See
GetVerticalMargin
andSetVerticalMargin
- VerticalPadding¶
See
GetVerticalPadding
andSetVerticalPadding