Version: 3.1.0
wxRichTextFieldTypeStandard Class Reference

#include <wx/richtext/richtextbuffer.h>

+ Inheritance diagram for wxRichTextFieldTypeStandard:

Detailed Description

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.

Styles

This class supports the following styles:

  • wxRICHTEXT_FIELD_STYLE_COMPOSITE:
    Creates a composite field; you will probably need to derive a new class to implement UpdateField.
  • wxRICHTEXT_FIELD_STYLE_RECTANGLE:
    Shows a rounded rectangle background.
  • wxRICHTEXT_FIELD_STYLE_NO_BORDER:
    Suppresses the background and border; mostly used with a bitmap label.
  • wxRICHTEXT_FIELD_STYLE_START_TAG:
    Shows a start tag background, with the pointy end facing right.
  • wxRICHTEXT_FIELD_STYLE_END_TAG:
    Shows an end tag background, with the pointy end facing left.

Library:  wxRichText
Category:  Rich Text
See Also
wxRichTextFieldType, wxRichTextField, wxRichTextBuffer, wxRichTextCtrl

Public Types

enum  {
  wxRICHTEXT_FIELD_STYLE_COMPOSITE = 0x01,
  wxRICHTEXT_FIELD_STYLE_RECTANGLE = 0x02,
  wxRICHTEXT_FIELD_STYLE_NO_BORDER = 0x04,
  wxRICHTEXT_FIELD_STYLE_START_TAG = 0x08,
  wxRICHTEXT_FIELD_STYLE_END_TAG = 0x10
}
 

Public Member Functions

 wxRichTextFieldTypeStandard (const wxString &name, const wxString &label, int displayStyle=wxRICHTEXT_FIELD_STYLE_RECTANGLE)
 Constructor, creating a field type definition with a text label.
 
 wxRichTextFieldTypeStandard (const wxString &name, const wxBitmap &bitmap, int displayStyle=wxRICHTEXT_FIELD_STYLE_NO_BORDER)
 Constructor, creating a field type definition with a bitmap label.
 
 wxRichTextFieldTypeStandard ()
 The default constructor.
 
 wxRichTextFieldTypeStandard (const wxRichTextFieldTypeStandard &field)
 The copy constructor.
 
void Init ()
 Initialises the object.
 
void Copy (const wxRichTextFieldTypeStandard &field)
 Copies the object.
 
void operator= (const wxRichTextFieldTypeStandard &field)
 The assignment operator.
 
virtual bool Draw (wxRichTextField *obj, wxDC &dc, wxRichTextDrawingContext &context, const wxRichTextRange &range, const wxRichTextSelection &selection, const wxRect &rect, int descent, int style)
 Draw the item, within the given range.
 
virtual bool Layout (wxRichTextField *obj, wxDC &dc, wxRichTextDrawingContext &context, const wxRect &rect, const wxRect &parentRect, int style)
 Lay the item out at the specified position with the given size constraint.
 
virtual bool GetRangeSize (wxRichTextField *obj, const wxRichTextRange &range, wxSize &size, int &descent, wxDC &dc, wxRichTextDrawingContext &context, int flags, const wxPoint &position=wxPoint(0, 0), const wxSize &parentSize=wxDefaultSize, wxArrayInt *partialExtents=NULL) const
 Returns the object size for the given range.
 
wxSize GetSize (wxRichTextField *obj, wxDC &dc, wxRichTextDrawingContext &context, int style) const
 Get the size of the field, given the label, font size, and so on.
 
virtual bool IsTopLevel (wxRichTextField *obj) const
 Returns true if the display type is wxRICHTEXT_FIELD_STYLE_COMPOSITE, false otherwise.
 
void SetLabel (const wxString &label)
 Sets the text label for fields of this type.
 
const wxStringGetLabel () const
 Returns the text label for fields of this type.
 
void SetBitmap (const wxBitmap &bitmap)
 Sets the bitmap label for fields of this type.
 
const wxBitmapGetBitmap () const
 Gets the bitmap label for fields of this type.
 
int GetDisplayStyle () const
 Gets the display style for fields of this type.
 
void SetDisplayStyle (int displayStyle)
 Sets the display style for fields of this type.
 
const wxFontGetFont () const
 Gets the font used for drawing the text label.
 
void SetFont (const wxFont &font)
 Sets the font used for drawing the text label.
 
const wxColourGetTextColour () const
 Gets the colour used for drawing the text label.
 
void SetTextColour (const wxColour &colour)
 Sets the colour used for drawing the text label.
 
const wxColourGetBorderColour () const
 Gets the colour used for drawing the field border.
 
void SetBorderColour (const wxColour &colour)
 Sets the colour used for drawing the field border.
 
const wxColourGetBackgroundColour () const
 Gets the colour used for drawing the field background.
 
void SetBackgroundColour (const wxColour &colour)
 Sets the colour used for drawing the field background.
 
void SetVerticalPadding (int padding)
 Sets the vertical padding (the distance between the border and the text).
 
int GetVerticalPadding () const
 Gets the vertical padding (the distance between the border and the text).
 
void SetHorizontalPadding (int padding)
 Sets the horizontal padding (the distance between the border and the text).
 
int GetHorizontalPadding () const
 Sets the horizontal padding (the distance between the border and the text).
 
void SetHorizontalMargin (int margin)
 Sets the horizontal margin surrounding the field object.
 
int GetHorizontalMargin () const
 Gets the horizontal margin surrounding the field object.
 
void SetVerticalMargin (int margin)
 Sets the vertical margin surrounding the field object.
 
int GetVerticalMargin () const
 Gets the vertical margin surrounding the field object.
 
- Public Member Functions inherited from wxRichTextFieldType
 wxRichTextFieldType (const wxString &name=wxEmptyString)
 Creates a field type definition.
 
 wxRichTextFieldType (const wxRichTextFieldType &fieldType)
 Copy constructor.
 
void Copy (const wxRichTextFieldType &fieldType)
 
virtual bool CanEditProperties (wxRichTextField *obj) const
 Returns true if we can edit the object's properties via a GUI.
 
virtual bool EditProperties (wxRichTextField *obj, wxWindow *parent, wxRichTextBuffer *buffer)
 Edits the object's properties via a GUI.
 
virtual wxString GetPropertiesMenuLabel (wxRichTextField *obj) const
 Returns the label to be used for the properties context menu item.
 
virtual bool UpdateField (wxRichTextBuffer *buffer, wxRichTextField *obj)
 Update the field.
 
void SetName (const wxString &name)
 Sets the field type name.
 
wxString GetName () const
 Returns the field type name.
 
- Public Member Functions inherited from wxObject
 wxObject ()
 Default ctor; initializes to NULL the internal reference data.
 
 wxObject (const wxObject &other)
 Copy ctor.
 
virtual ~wxObject ()
 Destructor.
 
virtual wxClassInfoGetClassInfo () const
 This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar).
 
wxObjectRefDataGetRefData () const
 Returns the wxObject::m_refData pointer, i.e. the data referenced by this object.
 
bool IsKindOf (const wxClassInfo *info) const
 Determines whether this class is a subclass of (or the same class as) the given class.
 
bool IsSameAs (const wxObject &obj) const
 Returns true if this object has the same data pointer as obj.
 
void Ref (const wxObject &clone)
 Makes this object refer to the data in clone.
 
void SetRefData (wxObjectRefData *data)
 Sets the wxObject::m_refData pointer.
 
void UnRef ()
 Decrements the reference count in the associated data, and if it is zero, deletes the data.
 
void UnShare ()
 This is the same of AllocExclusive() but this method is public.
 
void operator delete (void *buf)
 The delete operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined.
 
void * operator new (size_t size, const wxString &filename=NULL, int lineNum=0)
 The new operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined.
 

Protected Attributes

wxString m_label
 
int m_displayStyle
 
wxFont m_font
 
wxColour m_textColour
 
wxColour m_borderColour
 
wxColour m_backgroundColour
 
int m_verticalPadding
 
int m_horizontalPadding
 
int m_horizontalMargin
 
int m_verticalMargin
 
wxBitmap m_bitmap
 
- Protected Attributes inherited from wxRichTextFieldType
wxString m_name
 
- Protected Attributes inherited from wxObject
wxObjectRefDatam_refData
 Pointer to an object which is the object's reference-counted data.
 

Additional Inherited Members

- Protected Member Functions inherited from wxObject
void AllocExclusive ()
 Ensure that this object's data is not shared with any other object.
 
virtual wxObjectRefDataCreateRefData () const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it.
 
virtual wxObjectRefDataCloneRefData (const wxObjectRefData *data) const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data.
 

Member Enumeration Documentation

anonymous enum
Enumerator:
wxRICHTEXT_FIELD_STYLE_COMPOSITE 
wxRICHTEXT_FIELD_STYLE_RECTANGLE 
wxRICHTEXT_FIELD_STYLE_NO_BORDER 
wxRICHTEXT_FIELD_STYLE_START_TAG 
wxRICHTEXT_FIELD_STYLE_END_TAG 

Constructor & Destructor Documentation

wxRichTextFieldTypeStandard::wxRichTextFieldTypeStandard ( const wxString name,
const wxString label,
int  displayStyle = wxRICHTEXT_FIELD_STYLE_RECTANGLE 
)

Constructor, creating a field type definition with a text label.

Parameters
nameThe name of the type definition. This must be unique, and is the type name used when adding a field to a control.
labelThe text label to be shown on the field.
displayStyleThe display style: one of wxRICHTEXT_FIELD_STYLE_RECTANGLE, wxRICHTEXT_FIELD_STYLE_NO_BORDER, wxRICHTEXT_FIELD_STYLE_START_TAG, wxRICHTEXT_FIELD_STYLE_END_TAG.
wxRichTextFieldTypeStandard::wxRichTextFieldTypeStandard ( const wxString name,
const wxBitmap bitmap,
int  displayStyle = wxRICHTEXT_FIELD_STYLE_NO_BORDER 
)

Constructor, creating a field type definition with a bitmap label.

Parameters
nameThe name of the type definition. This must be unique, and is the type name used when adding a field to a control.
bitmapThe bitmap label to be shown on the field.
displayStyleThe display style: one of wxRICHTEXT_FIELD_STYLE_RECTANGLE, wxRICHTEXT_FIELD_STYLE_NO_BORDER, wxRICHTEXT_FIELD_STYLE_START_TAG, wxRICHTEXT_FIELD_STYLE_END_TAG.
wxRichTextFieldTypeStandard::wxRichTextFieldTypeStandard ( )
inline

The default constructor.

wxRichTextFieldTypeStandard::wxRichTextFieldTypeStandard ( const wxRichTextFieldTypeStandard field)
inline

The copy constructor.

Member Function Documentation

void wxRichTextFieldTypeStandard::Copy ( const wxRichTextFieldTypeStandard field)

Copies the object.

virtual bool wxRichTextFieldTypeStandard::Draw ( wxRichTextField obj,
wxDC dc,
wxRichTextDrawingContext context,
const wxRichTextRange range,
const wxRichTextSelection selection,
const wxRect rect,
int  descent,
int  style 
)
virtual

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)

Implements wxRichTextFieldType.

const wxColour& wxRichTextFieldTypeStandard::GetBackgroundColour ( ) const
inline

Gets the colour used for drawing the field background.

const wxBitmap& wxRichTextFieldTypeStandard::GetBitmap ( ) const
inline

Gets the bitmap label for fields of this type.

const wxColour& wxRichTextFieldTypeStandard::GetBorderColour ( ) const
inline

Gets the colour used for drawing the field border.

int wxRichTextFieldTypeStandard::GetDisplayStyle ( ) const
inline

Gets the display style for fields of this type.

const wxFont& wxRichTextFieldTypeStandard::GetFont ( ) const
inline

Gets the font used for drawing the text label.

int wxRichTextFieldTypeStandard::GetHorizontalMargin ( ) const
inline

Gets the horizontal margin surrounding the field object.

int wxRichTextFieldTypeStandard::GetHorizontalPadding ( ) const
inline

Sets the horizontal padding (the distance between the border and the text).

const wxString& wxRichTextFieldTypeStandard::GetLabel ( ) const
inline

Returns the text label for fields of this type.

virtual bool wxRichTextFieldTypeStandard::GetRangeSize ( wxRichTextField obj,
const wxRichTextRange range,
wxSize size,
int &  descent,
wxDC dc,
wxRichTextDrawingContext context,
int  flags,
const wxPoint position = wxPoint(0, 0),
const wxSize parentSize = wxDefaultSize,
wxArrayInt partialExtents = NULL 
) const
virtual

Returns the object size for the given range.

Returns false if the range is invalid for this object.

Implements wxRichTextFieldType.

wxSize wxRichTextFieldTypeStandard::GetSize ( wxRichTextField obj,
wxDC dc,
wxRichTextDrawingContext context,
int  style 
) const

Get the size of the field, given the label, font size, and so on.

const wxColour& wxRichTextFieldTypeStandard::GetTextColour ( ) const
inline

Gets the colour used for drawing the text label.

int wxRichTextFieldTypeStandard::GetVerticalMargin ( ) const
inline

Gets the vertical margin surrounding the field object.

int wxRichTextFieldTypeStandard::GetVerticalPadding ( ) const
inline

Gets the vertical padding (the distance between the border and the text).

void wxRichTextFieldTypeStandard::Init ( )

Initialises the object.

virtual bool wxRichTextFieldTypeStandard::IsTopLevel ( wxRichTextField obj) const
inlinevirtual

Returns true if the display type is wxRICHTEXT_FIELD_STYLE_COMPOSITE, false otherwise.

Reimplemented from wxRichTextFieldType.

virtual bool wxRichTextFieldTypeStandard::Layout ( wxRichTextField obj,
wxDC dc,
wxRichTextDrawingContext context,
const wxRect rect,
const wxRect parentRect,
int  style 
)
virtual

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).

Implements wxRichTextFieldType.

void wxRichTextFieldTypeStandard::operator= ( const wxRichTextFieldTypeStandard field)
inline

The assignment operator.

void wxRichTextFieldTypeStandard::SetBackgroundColour ( const wxColour colour)
inline

Sets the colour used for drawing the field background.

void wxRichTextFieldTypeStandard::SetBitmap ( const wxBitmap bitmap)
inline

Sets the bitmap label for fields of this type.

void wxRichTextFieldTypeStandard::SetBorderColour ( const wxColour colour)
inline

Sets the colour used for drawing the field border.

void wxRichTextFieldTypeStandard::SetDisplayStyle ( int  displayStyle)
inline

Sets the display style for fields of this type.

void wxRichTextFieldTypeStandard::SetFont ( const wxFont font)
inline

Sets the font used for drawing the text label.

void wxRichTextFieldTypeStandard::SetHorizontalMargin ( int  margin)
inline

Sets the horizontal margin surrounding the field object.

void wxRichTextFieldTypeStandard::SetHorizontalPadding ( int  padding)
inline

Sets the horizontal padding (the distance between the border and the text).

void wxRichTextFieldTypeStandard::SetLabel ( const wxString label)
inline

Sets the text label for fields of this type.

void wxRichTextFieldTypeStandard::SetTextColour ( const wxColour colour)
inline

Sets the colour used for drawing the text label.

void wxRichTextFieldTypeStandard::SetVerticalMargin ( int  margin)
inline

Sets the vertical margin surrounding the field object.

void wxRichTextFieldTypeStandard::SetVerticalPadding ( int  padding)
inline

Sets the vertical padding (the distance between the border and the text).

Member Data Documentation

wxColour wxRichTextFieldTypeStandard::m_backgroundColour
protected
wxBitmap wxRichTextFieldTypeStandard::m_bitmap
protected
wxColour wxRichTextFieldTypeStandard::m_borderColour
protected
int wxRichTextFieldTypeStandard::m_displayStyle
protected
wxFont wxRichTextFieldTypeStandard::m_font
protected
int wxRichTextFieldTypeStandard::m_horizontalMargin
protected
int wxRichTextFieldTypeStandard::m_horizontalPadding
protected
wxString wxRichTextFieldTypeStandard::m_label
protected
wxColour wxRichTextFieldTypeStandard::m_textColour
protected
int wxRichTextFieldTypeStandard::m_verticalMargin
protected
int wxRichTextFieldTypeStandard::m_verticalPadding
protected