Version: 3.1.0
wxRichTextFieldType Class Referenceabstract

#include <wx/richtext/richtextbuffer.h>

+ Inheritance diagram for wxRichTextFieldType:

Detailed Description

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 wxRichTextBuffer::AddFieldType. They will be deleted automatically on application exit.

Library:  wxRichText
Category:  Rich Text
See also
wxRichTextFieldTypeStandard, wxRichTextField, wxRichTextCtrl

Public Member Functions

 wxRichTextFieldType (const wxString &name=wxEmptyString)
 Creates a field type definition. More...
 
 wxRichTextFieldType (const wxRichTextFieldType &fieldType)
 Copy constructor. More...
 
void Copy (const wxRichTextFieldType &fieldType)
 
virtual bool Draw (wxRichTextField *obj, wxDC &dc, wxRichTextDrawingContext &context, const wxRichTextRange &range, const wxRichTextSelection &selection, const wxRect &rect, int descent, int style)=0
 Draw the item, within the given range. More...
 
virtual bool Layout (wxRichTextField *obj, wxDC &dc, wxRichTextDrawingContext &context, const wxRect &rect, const wxRect &parentRect, int style)=0
 Lay the item out at the specified position with the given size constraint. More...
 
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 =0
 Returns the object size for the given range. More...
 
virtual bool CanEditProperties (wxRichTextField *obj) const
 Returns true if we can edit the object's properties via a GUI. More...
 
virtual bool EditProperties (wxRichTextField *obj, wxWindow *parent, wxRichTextBuffer *buffer)
 Edits the object's properties via a GUI. More...
 
virtual wxString GetPropertiesMenuLabel (wxRichTextField *obj) const
 Returns the label to be used for the properties context menu item. More...
 
virtual bool UpdateField (wxRichTextBuffer *buffer, wxRichTextField *obj)
 Update the field. More...
 
virtual bool IsTopLevel (wxRichTextField *obj) const
 Returns true if this object is top-level, i.e. contains its own paragraphs, such as a text box. More...
 
void SetName (const wxString &name)
 Sets the field type name. More...
 
wxString GetName () const
 Returns the field type name. More...
 
- Public Member Functions inherited from wxObject
 wxObject ()
 Default ctor; initializes to NULL the internal reference data. More...
 
 wxObject (const wxObject &other)
 Copy ctor. More...
 
virtual ~wxObject ()
 Destructor. More...
 
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). More...
 
wxObjectRefDataGetRefData () const
 Returns the wxObject::m_refData pointer, i.e. the data referenced by this object. More...
 
bool IsKindOf (const wxClassInfo *info) const
 Determines whether this class is a subclass of (or the same class as) the given class. More...
 
bool IsSameAs (const wxObject &obj) const
 Returns true if this object has the same data pointer as obj. More...
 
void Ref (const wxObject &clone)
 Makes this object refer to the data in clone. More...
 
void SetRefData (wxObjectRefData *data)
 Sets the wxObject::m_refData pointer. More...
 
void UnRef ()
 Decrements the reference count in the associated data, and if it is zero, deletes the data. More...
 
void UnShare ()
 This is the same of AllocExclusive() but this method is public. More...
 
void operator delete (void *buf)
 The delete operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined. More...
 
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. More...
 

Protected Attributes

wxString m_name
 
- Protected Attributes inherited from wxObject
wxObjectRefDatam_refData
 Pointer to an object which is the object's reference-counted data. More...
 

Additional Inherited Members

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

Constructor & Destructor Documentation

wxRichTextFieldType::wxRichTextFieldType ( const wxString name = wxEmptyString)
inline

Creates a field type definition.

wxRichTextFieldType::wxRichTextFieldType ( const wxRichTextFieldType fieldType)
inline

Copy constructor.

Member Function Documentation

virtual bool wxRichTextFieldType::CanEditProperties ( wxRichTextField obj) const
inlinevirtual

Returns true if we can edit the object's properties via a GUI.

void wxRichTextFieldType::Copy ( const wxRichTextFieldType fieldType)
inline
virtual bool wxRichTextFieldType::Draw ( wxRichTextField obj,
wxDC dc,
wxRichTextDrawingContext context,
const wxRichTextRange range,
const wxRichTextSelection selection,
const wxRect rect,
int  descent,
int  style 
)
pure 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)

Implemented in wxRichTextFieldTypeStandard.

virtual bool wxRichTextFieldType::EditProperties ( wxRichTextField obj,
wxWindow parent,
wxRichTextBuffer buffer 
)
inlinevirtual

Edits the object's properties via a GUI.

wxString wxRichTextFieldType::GetName ( ) const
inline

Returns the field type name.

There should be a unique name per field type object.

virtual wxString wxRichTextFieldType::GetPropertiesMenuLabel ( wxRichTextField obj) const
inlinevirtual

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

virtual bool wxRichTextFieldType::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
pure virtual

Returns the object size for the given range.

Returns false if the range is invalid for this object.

Implemented in wxRichTextFieldTypeStandard.

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

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

Reimplemented in wxRichTextFieldTypeStandard.

virtual bool wxRichTextFieldType::Layout ( wxRichTextField obj,
wxDC dc,
wxRichTextDrawingContext context,
const wxRect rect,
const wxRect parentRect,
int  style 
)
pure 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).

Implemented in wxRichTextFieldTypeStandard.

void wxRichTextFieldType::SetName ( const wxString name)
inline

Sets the field type name.

There should be a unique name per field type object.

virtual bool wxRichTextFieldType::UpdateField ( wxRichTextBuffer buffer,
wxRichTextField obj 
)
inlinevirtual

Update the field.

This would typically expand the field to its value, if this is a dynamically changing and/or composite field.

Member Data Documentation

wxString wxRichTextFieldType::m_name
protected