| Version: 3.3.1

Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
wxRichTextObject Class Referenceabstract
Class List by Category » Rich Text

`#include <wx/richtext/richtextbuffer.h>`

Inheritance diagram for wxRichTextObject:
[legend]

## Detailed Description

This is the base for drawable rich text objects.

##

Library: wxRichText
Category: Rich Text

See also
  wxRichTextBuffer, wxRichTextCtrl

## Public Member Functions
| wxRichTextObject (wxRichTextObject *parent=nullptr)
| Constructor, taking an optional parent pointer. More...
virtual | ~wxRichTextObject ()
virtual bool | Draw (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 (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 int | HitTest (wxDC &dc, wxRichTextDrawingContext &context, const wxPoint &pt, long &textPosition, wxRichTextObject **obj, wxRichTextObject **contextObj, int flags=0)
| Hit-testing: returns a flag indicating hit test details, plus information about position. More...
virtual bool | FindPosition (wxDC &dc, wxRichTextDrawingContext &context, long index, wxPoint &pt, int *height, bool forceLineStart)
| Finds the absolute position and row height for the given character position. More...
virtual wxSize | GetBestSize () const
| Returns the best size, i.e. the ideal starting size for this object irrespective of available space. More...
virtual bool | GetRangeSize (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=nullptr) const =0
| Returns the object size for the given range. More...
virtual wxRichTextObject * | DoSplit (long pos)
| Do a split from pos, returning an object containing the second part, and setting the first part in 'this'. More...
virtual void | CalculateRange (long start, long &end)
| Calculates the range of the object. More...
virtual bool | DeleteRange (const wxRichTextRange &range)
| Deletes the given range. More...
virtual bool | IsEmpty () const
| Returns true if the object is empty. More...
virtual bool | IsFloatable () const
| Returns true if this class of object is floatable. More...
virtual bool | IsFloating () const
| Returns true if this object is currently floating. More...
virtual int | GetFloatDirection () const
| Returns the floating direction. More...
virtual wxString | GetTextForRange (const wxRichTextRange &range) const
| Returns any text in this object for the given range. More...
virtual bool | CanMerge (wxRichTextObject *object, wxRichTextDrawingContext &context) const
| Returns true if this object can merge itself with the given one. More...
virtual bool | Merge (wxRichTextObject *object, wxRichTextDrawingContext &context)
| Returns true if this object merged itself with the given one. More...
virtual bool | CanSplit (wxRichTextDrawingContext &context) const
| Returns true if this object can potentially be split, by virtue of having different virtual attributes for individual sub-objects. More...
virtual wxRichTextObject * | Split (wxRichTextDrawingContext &context)
| Returns the final object in the split objects if this object was split due to differences between sub-object virtual attributes. More...
virtual void | Dump (wxTextOutputStream &stream)
| Dump object data to the given output stream for debugging. More...
virtual bool | CanEditProperties () const
| Returns true if we can edit the object's properties via a GUI. More...
virtual bool | EditProperties (wxWindow *parent, wxRichTextBuffer *buffer)
| Edits the object's properties via a GUI. More...
virtual wxString | GetPropertiesMenuLabel () const
| Returns the label to be used for the properties context menu item. More...
virtual bool | AcceptsFocus () const
| Returns true if objects of this class can accept the focus, i.e. a call to SetFocusObject is possible. More...
virtual bool | ImportFromXML (wxRichTextBuffer *buffer, wxXmlNode *node, wxRichTextXMLHandler *handler, bool *recurse)
| Imports this object from XML. More...
virtual bool | UsesParagraphAttributes () const
| Returns true if this object takes note of paragraph attributes (text and image objects don't). More...
virtual wxString | GetXMLNodeName () const
| Returns the XML node name of this object. More...
virtual void | Invalidate (const wxRichTextRange &invalidRange=wxRICHTEXT_ALL)
| Invalidates the object at the given range. More...
virtual bool | HandlesChildSelections () const
| Returns true if this object can handle the selections of its children, fOr example a table. More...
virtual wxRichTextSelection | GetSelection (long start, long end) const
| Returns a selection object specifying the selections between start and end character positions. More...
virtual wxSize | GetCachedSize () const
| Gets the cached object size as calculated by Layout. More...
virtual void | SetCachedSize (const wxSize &sz)
| Sets the cached object size as calculated by Layout. More...
virtual wxSize | GetMaxSize () const
| Gets the maximum object size as calculated by Layout. More...
virtual void | SetMaxSize (const wxSize &sz)
| Sets the maximum object size as calculated by Layout. More...
virtual wxSize | GetMinSize () const
| Gets the minimum object size as calculated by Layout. More...
virtual void | SetMinSize (const wxSize &sz)
| Sets the minimum object size as calculated by Layout. More...
virtual wxTextAttrSize | GetNaturalSize () const
| Gets the 'natural' size for an object. More...
virtual wxPoint | GetPosition () const
| Returns the object position in pixels. More...
virtual void | SetPosition (const wxPoint &pos)
| Sets the object position in pixels. More...
virtual wxPoint | GetAbsolutePosition () const
| Returns the absolute object position, by traversing up the child/parent hierarchy. More...
virtual wxRect | GetRect () const
| Returns the rectangle enclosing the object. More...
void | SetRange (const wxRichTextRange &range)
| Sets the object's range within its container. More...
const wxRichTextRange & | GetRange () const
| Returns the object's range. More...
wxRichTextRange & | GetRange ()
| Returns the object's range. More...
void | SetOwnRange (const wxRichTextRange &range)
| Set the object's own range, for a top-level object with its own position space. More...
const wxRichTextRange & | GetOwnRange () const
| Returns the object's own range (valid if top-level). More...
wxRichTextRange & | GetOwnRange ()
| Returns the object's own range (valid if top-level). More...
wxRichTextRange | GetOwnRangeIfTopLevel () const
| Returns the object's own range only if a top-level object. More...
virtual bool | IsComposite () const
| Returns true if this object is composite. More...
virtual bool | IsAtomic () const
| Returns true if no user editing can be done inside the object. More...
virtual wxRichTextObject * | GetParent () const
| Returns a pointer to the parent object. More...
virtual void | SetParent (wxRichTextObject *parent)
| Sets the pointer to the parent object. More...
virtual wxRichTextParagraphLayoutBox * | GetContainer () const
| Returns the top-level container of this object. More...
virtual wxRichTextParagraphLayoutBox * | GetParentContainer () const
| Returns the top-level container of this object. More...
virtual void | SetMargins (int margin)
| Set the margin around the object, in pixels. More...
virtual void | SetMargins (int leftMargin, int rightMargin, int topMargin, int bottomMargin)
| Set the margin around the object, in pixels. More...
virtual int | GetLeftMargin () const
| Returns the left margin of the object, in pixels. More...
virtual int | GetRightMargin () const
| Returns the right margin of the object, in pixels. More...
virtual int | GetTopMargin () const
| Returns the top margin of the object, in pixels. More...
virtual int | GetBottomMargin () const
| Returns the bottom margin of the object, in pixels. More...
virtual wxRect | GetAvailableContentArea (wxDC &dc, wxRichTextDrawingContext &context, const wxRect &outerRect) const
| Calculates the available content space in the given rectangle, given the margins, border and padding specified in the object's attributes. More...
virtual bool | LayoutToBestSize (wxDC &dc, wxRichTextDrawingContext &context, wxRichTextBuffer *buffer, const wxRichTextAttr &parentAttr, const wxRichTextAttr &attr, const wxRect &availableParentSpace, const wxRect &availableContainerSpace, int style)
| Lays out the object first with a given amount of space, and then if no width was specified in attr, lays out the object again using the minimum size. More...
virtual bool | AdjustAttributes (wxRichTextAttr &attr, wxRichTextDrawingContext &context)
| Adjusts the attributes for virtual attribute provision, collapsed borders, etc. More...
void | SetAttributes (const wxRichTextAttr &attr)
| Sets the object's attributes. More...
const wxRichTextAttr & | GetAttributes () const
| Returns the object's attributes. More...
wxRichTextAttr & | GetAttributes ()
| Returns the object's attributes. More...
wxRichTextProperties & | GetProperties ()
| Returns the object's properties. More...
const wxRichTextProperties & | GetProperties () const
| Returns the object's properties. More...
void | SetProperties (const wxRichTextProperties &props)
| Sets the object's properties. More...
void | SetDescent (int descent)
| Sets the stored descent value. More...
int | GetDescent () const
| Returns the stored descent value. More...
wxRichTextBuffer * | GetBuffer () const
| Returns the containing buffer. More...
void | SetName (const wxString &name)
| Sets the identifying name for this object as a property using the "name" key. More...
wxString | GetName () const
| Returns the identifying name for this object from the properties, using the "name" key. More...
virtual bool | IsTopLevel () const
| Returns true if this object is top-level, i.e. contains its own paragraphs, such as a text box. More...
bool | IsShown () const
| Returns true if the object will be shown, false otherwise. More...
virtual void | Show (bool show)
| Call to show or hide this object. More...
virtual wxRichTextObject * | Clone () const
| Clones the object. More...
void | Copy (const wxRichTextObject &obj)
| Copies the object. More...
void | Reference ()
| Reference-counting allows us to use the same object in multiple lists (not yet used). More...
void | Dereference ()
| Reference-counting allows us to use the same object in multiple lists (not yet used). More...
virtual void | Move (const wxPoint &pt)
| Moves the object recursively, by adding the offset from old to new. More...
int | ConvertTenthsMMToPixels (wxDC &dc, int units) const
| Converts units in tenths of a millimetre to device units. More...
int | ConvertPixelsToTenthsMM (wxDC &dc, int pixels) const
| Convert units in pixels to tenths of a millimetre. More...
Public Member Functions inherited from wxObject
| wxObject ()
| Default ctor; initializes to nullptr the internal reference data. More...
| wxObject (const wxObject &other)
| Copy ctor. More...
virtual | ~wxObject ()
| Destructor. More...
virtual wxClassInfo * | GetClassInfo () const
| This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar). More...
wxObjectRefData * | GetRefData () 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=nullptr, int lineNum=0)
| The new operator is defined for debugging versions of the library only, when the identifier `__WXDEBUG__` is defined. More...

## Static Public Member Functions
static int | ConvertTenthsMMToPixels (int ppi, int units, double scale=1.0)
| Converts units in tenths of a millimetre to device units. More...
static int | ConvertPixelsToTenthsMM (int ppi, int pixels, double scale=1.0)
| Convert units in pixels to tenths of a millimetre. More...
static bool | DrawBoxAttributes (wxDC &dc, wxRichTextBuffer *buffer, const wxRichTextAttr &attr, const wxRect &boxRect, int flags=0, wxRichTextObject *obj=nullptr)
| Draws the borders and background for the given rectangle and attributes. More...
static bool | DrawBorder (wxDC &dc, wxRichTextBuffer *buffer, const wxRichTextAttr &attr, const wxTextAttrBorders &borders, const wxRect &rect, int flags=0)
| Draws a border. More...
static bool | GetBoxRects (wxDC &dc, wxRichTextBuffer *buffer, const wxRichTextAttr &attr, wxRect &marginRect, wxRect &borderRect, wxRect &contentRect, wxRect &paddingRect, wxRect &outlineRect)
| Returns the various rectangles of the box model in pixels. More...
static bool | GetTotalMargin (wxDC &dc, wxRichTextBuffer *buffer, const wxRichTextAttr &attr, int &leftMargin, int &rightMargin, int &topMargin, int &bottomMargin)
| Returns the total margin for the object in pixels, taking into account margin, padding and border size. More...
static wxRect | AdjustAvailableSpace (wxDC &dc, wxRichTextBuffer *buffer, const wxRichTextAttr &parentAttr, const wxRichTextAttr &childAttr, const wxRect &availableParentSpace, const wxRect &availableContainerSpace)
| Returns the rectangle which the child has available to it given restrictions specified in the child attribute, e.g. More...

## Protected Attributes
wxSize | m_size
wxSize | m_maxSize
wxSize | m_minSize
wxPoint | m_pos
int | m_descent
int | m_refCount
bool | m_show
wxRichTextObject * | m_parent
wxRichTextRange | m_range
wxRichTextRange | m_ownRange
wxRichTextAttr | m_attributes
wxRichTextProperties | m_properties
Protected Attributes inherited from wxObject
wxObjectRefData * | m_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 wxObjectRefData * | CreateRefData () const
| Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. More...
virtual wxObjectRefData * | CloneRefData (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

## ◆ wxRichTextObject()

wxRichTextObject::wxRichTextObject | ( | wxRichTextObject * | parent = `nullptr` | ) |

Constructor, taking an optional parent pointer.

## ◆ ~wxRichTextObject()

virtual wxRichTextObject::~wxRichTextObject | ( |  | ) |
| virtual

## Member Function Documentation

## ◆ AcceptsFocus()

virtual bool wxRichTextObject::AcceptsFocus | ( |  | ) | const
| virtual

Returns true if objects of this class can accept the focus, i.e. a call to SetFocusObject is possible.

For example, containers supporting text, such as a text box object, can accept the focus, but a table can't (set the focus to individual cells instead).

Reimplemented in wxRichTextTable, wxRichTextField, and wxRichTextParagraphLayoutBox.

## ◆ AdjustAttributes()

virtual bool wxRichTextObject::AdjustAttributes | ( | wxRichTextAttr & | attr,
|  | wxRichTextDrawingContext & | context
| ) |  |
| virtual

Adjusts the attributes for virtual attribute provision, collapsed borders, etc.

## ◆ AdjustAvailableSpace()

static wxRect wxRichTextObject::AdjustAvailableSpace | ( | wxDC & | dc,
|  | wxRichTextBuffer * | buffer,
|  | const wxRichTextAttr & | parentAttr,
|  | const wxRichTextAttr & | childAttr,
|  | const wxRect & | availableParentSpace,
|  | const wxRect & | availableContainerSpace
| ) |  |
| static

Returns the rectangle which the child has available to it given restrictions specified in the child attribute, e.g.

50% width of the parent, 400 pixels, x position 20% of the parent, etc. availableContainerSpace might be a parent that the cell has to compute its width relative to. E.g. a cell that's 50% of its parent.

## ◆ CalculateRange()

virtual void wxRichTextObject::CalculateRange | ( | long | start,
|  | long & | end
| ) |  |
| virtual

Calculates the range of the object.

By default, guess that the object is 1 unit long.

Reimplemented in wxRichTextTable, wxRichTextPlainText, wxRichTextParagraph, wxRichTextField, and wxRichTextCompositeObject.

## ◆ CanEditProperties()

virtual bool wxRichTextObject::CanEditProperties | ( |  | ) | const
| virtual

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

Reimplemented in wxRichTextTable, wxRichTextCell, wxRichTextImage, wxRichTextField, and wxRichTextBox.

## ◆ CanMerge()

virtual bool wxRichTextObject::CanMerge | ( | wxRichTextObject * | object,
|  | wxRichTextDrawingContext & | context
| ) |  | const
| virtual

Returns true if this object can merge itself with the given one.

Reimplemented in wxRichTextPlainText.

## ◆ CanSplit()

virtual bool wxRichTextObject::CanSplit | ( | wxRichTextDrawingContext & | context | ) | const
| virtual

Returns true if this object can potentially be split, by virtue of having different virtual attributes for individual sub-objects.

Reimplemented in wxRichTextPlainText.

## ◆ Clone()

virtual wxRichTextObject* wxRichTextObject::Clone | ( |  | ) | const
| virtual

Clones the object.

Reimplemented in wxRichTextTable, wxRichTextCell, wxRichTextBuffer, wxRichTextImage, wxRichTextPlainText, wxRichTextParagraph, wxRichTextField, wxRichTextBox, and wxRichTextParagraphLayoutBox.

## ◆ ConvertPixelsToTenthsMM() [1/2]

static int wxRichTextObject::ConvertPixelsToTenthsMM | ( | int | ppi,
|  | int | pixels,
|  | double | scale = `1.0`
| ) |  |
| static

Convert units in pixels to tenths of a millimetre.

## ◆ ConvertPixelsToTenthsMM() [2/2]

int wxRichTextObject::ConvertPixelsToTenthsMM | ( | wxDC & | dc,
|  | int | pixels
| ) |  | const

Convert units in pixels to tenths of a millimetre.

## ◆ ConvertTenthsMMToPixels() [1/2]

static int wxRichTextObject::ConvertTenthsMMToPixels | ( | int | ppi,
|  | int | units,
|  | double | scale = `1.0`
| ) |  |
| static

Converts units in tenths of a millimetre to device units.

## ◆ ConvertTenthsMMToPixels() [2/2]

int wxRichTextObject::ConvertTenthsMMToPixels | ( | wxDC & | dc,
|  | int | units
| ) |  | const

Converts units in tenths of a millimetre to device units.

## ◆ Copy()

void wxRichTextObject::Copy | ( | const wxRichTextObject & | obj | ) |

Copies the object.

## ◆ DeleteRange()

virtual bool wxRichTextObject::DeleteRange | ( | const wxRichTextRange & | range | ) |
| virtual

Deletes the given range.

Reimplemented in wxRichTextTable, wxRichTextPlainText, wxRichTextParagraphLayoutBox, and wxRichTextCompositeObject.

## ◆ Dereference()

void wxRichTextObject::Dereference | ( |  | ) |

Reference-counting allows us to use the same object in multiple lists (not yet used).

## ◆ DoSplit()

virtual wxRichTextObject* wxRichTextObject::DoSplit | ( | long | pos | ) |
| virtual

Do a split from pos, returning an object containing the second part, and setting the first part in 'this'.

Reimplemented in wxRichTextPlainText.

## ◆ Draw()

virtual bool wxRichTextObject::Draw | ( | 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 wxRichTextTable, wxRichTextCell, wxRichTextImage, wxRichTextPlainText, wxRichTextParagraph, wxRichTextField, wxRichTextBox, and wxRichTextParagraphLayoutBox.

## ◆ DrawBorder()

static bool wxRichTextObject::DrawBorder | ( | wxDC & | dc,
|  | wxRichTextBuffer * | buffer,
|  | const wxRichTextAttr & | attr,
|  | const wxTextAttrBorders & | borders,
|  | const wxRect & | rect,
|  | int | flags = `0`
| ) |  |
| static

Draws a border.

## ◆ DrawBoxAttributes()

static bool wxRichTextObject::DrawBoxAttributes | ( | wxDC & | dc,
|  | wxRichTextBuffer * | buffer,
|  | const wxRichTextAttr & | attr,
|  | const wxRect & | boxRect,
|  | int | flags = `0`,
|  | wxRichTextObject * | obj = `nullptr`
| ) |  |
| static

Draws the borders and background for the given rectangle and attributes.

boxRect is taken to be the outer margin box, not the box around the content.

## ◆ Dump()

virtual void wxRichTextObject::Dump | ( | wxTextOutputStream & | stream | ) |
| virtual

Dump object data to the given output stream for debugging.

Reimplemented in wxRichTextBuffer, wxRichTextPlainText, and wxRichTextCompositeObject.

## ◆ EditProperties()

virtual bool wxRichTextObject::EditProperties | ( | wxWindow * | parent,
|  | wxRichTextBuffer * | buffer
| ) |  |
| virtual

Edits the object's properties via a GUI.

Reimplemented in wxRichTextTable, wxRichTextCell, wxRichTextImage, wxRichTextField, and wxRichTextBox.

## ◆ FindPosition()

virtual bool wxRichTextObject::FindPosition | ( | wxDC & | dc,
|  | wxRichTextDrawingContext & | context,
|  | long | index,
|  | wxPoint & | pt,
|  | int * | height,
|  | bool | forceLineStart
| ) |  |
| virtual

Finds the absolute position and row height for the given character position.

Reimplemented in wxRichTextTable, wxRichTextParagraph, and wxRichTextCompositeObject.

## ◆ GetAbsolutePosition()

virtual wxPoint wxRichTextObject::GetAbsolutePosition | ( |  | ) | const
| virtual

Returns the absolute object position, by traversing up the child/parent hierarchy.

TODO: may not be needed, if all object positions are in fact relative to the top of the coordinate space.

## ◆ GetAttributes() [1/2]

wxRichTextAttr& wxRichTextObject::GetAttributes | ( |  | ) |

Returns the object's attributes.

## ◆ GetAttributes() [2/2]

const wxRichTextAttr& wxRichTextObject::GetAttributes | ( |  | ) | const

Returns the object's attributes.

## ◆ GetAvailableContentArea()

virtual wxRect wxRichTextObject::GetAvailableContentArea | ( | wxDC & | dc,
|  | wxRichTextDrawingContext & | context,
|  | const wxRect & | outerRect
| ) |  | const
| virtual

Calculates the available content space in the given rectangle, given the margins, border and padding specified in the object's attributes.

## ◆ GetBestSize()

virtual wxSize wxRichTextObject::GetBestSize | ( |  | ) | const
| virtual

Returns the best size, i.e. the ideal starting size for this object irrespective of available space.

For a short text string, it will be the size that exactly encloses the text. For a longer string, it might use the parent width for example.

## ◆ GetBottomMargin()

virtual int wxRichTextObject::GetBottomMargin | ( |  | ) | const
| virtual

Returns the bottom margin of the object, in pixels.

## ◆ GetBoxRects()

static bool wxRichTextObject::GetBoxRects | ( | wxDC & | dc,
|  | wxRichTextBuffer * | buffer,
|  | const wxRichTextAttr & | attr,
|  | wxRect & | marginRect,
|  | wxRect & | borderRect,
|  | wxRect & | contentRect,
|  | wxRect & | paddingRect,
|  | wxRect & | outlineRect
| ) |  |
| static

Returns the various rectangles of the box model in pixels.

You can either specify contentRect (inner) or marginRect (outer), and the other must be the default rectangle (no width or height). Note that the outline doesn't affect the position of the rectangle, it's drawn in whatever space is available.

## ◆ GetBuffer()

wxRichTextBuffer* wxRichTextObject::GetBuffer | ( |  | ) | const

Returns the containing buffer.

## ◆ GetCachedSize()

virtual wxSize wxRichTextObject::GetCachedSize | ( |  | ) | const
| virtual

Gets the cached object size as calculated by Layout.

## ◆ GetContainer()

virtual wxRichTextParagraphLayoutBox* wxRichTextObject::GetContainer | ( |  | ) | const
| virtual

Returns the top-level container of this object.

May return itself if it's a container; use GetParentContainer to return a different container.

## ◆ GetDescent()

int wxRichTextObject::GetDescent | ( |  | ) | const

Returns the stored descent value.

## ◆ GetFloatDirection()

virtual int wxRichTextObject::GetFloatDirection | ( |  | ) | const
| virtual

Returns the floating direction.

## ◆ GetLeftMargin()

virtual int wxRichTextObject::GetLeftMargin | ( |  | ) | const
| virtual

Returns the left margin of the object, in pixels.

## ◆ GetMaxSize()

virtual wxSize wxRichTextObject::GetMaxSize | ( |  | ) | const
| virtual

Gets the maximum object size as calculated by Layout.

This allows us to fit an object to its contents or allocate extra space if required.

## ◆ GetMinSize()

virtual wxSize wxRichTextObject::GetMinSize | ( |  | ) | const
| virtual

Gets the minimum object size as calculated by Layout.

This allows us to constrain an object to its absolute minimum size if necessary.

## ◆ GetName()

wxString wxRichTextObject::GetName | ( |  | ) | const

Returns the identifying name for this object from the properties, using the "name" key.

## ◆ GetNaturalSize()

virtual wxTextAttrSize wxRichTextObject::GetNaturalSize | ( |  | ) | const
| virtual

Gets the 'natural' size for an object.

For an image, it would be the image size.

Reimplemented in wxRichTextImage.

## ◆ GetOwnRange() [1/2]

wxRichTextRange& wxRichTextObject::GetOwnRange | ( |  | ) |

Returns the object's own range (valid if top-level).

## ◆ GetOwnRange() [2/2]

const wxRichTextRange& wxRichTextObject::GetOwnRange | ( |  | ) | const

Returns the object's own range (valid if top-level).

## ◆ GetOwnRangeIfTopLevel()

wxRichTextRange wxRichTextObject::GetOwnRangeIfTopLevel | ( |  | ) | const

Returns the object's own range only if a top-level object.

## ◆ GetParent()

virtual wxRichTextObject* wxRichTextObject::GetParent | ( |  | ) | const
| virtual

Returns a pointer to the parent object.

## ◆ GetParentContainer()

virtual wxRichTextParagraphLayoutBox* wxRichTextObject::GetParentContainer | ( |  | ) | const
| virtual

Returns the top-level container of this object.

Returns a different container than itself, unless there's no parent, in which case it will return nullptr.

## ◆ GetPosition()

virtual wxPoint wxRichTextObject::GetPosition | ( |  | ) | const
| virtual

Returns the object position in pixels.

## ◆ GetProperties() [1/2]

wxRichTextProperties& wxRichTextObject::GetProperties | ( |  | ) |

Returns the object's properties.

## ◆ GetProperties() [2/2]

const wxRichTextProperties& wxRichTextObject::GetProperties | ( |  | ) | const

Returns the object's properties.

## ◆ GetPropertiesMenuLabel()

virtual wxString wxRichTextObject::GetPropertiesMenuLabel | ( |  | ) | const
| virtual

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

Reimplemented in wxRichTextTable, wxRichTextCell, wxRichTextImage, wxRichTextField, and wxRichTextBox.

## ◆ GetRange() [1/2]

wxRichTextRange& wxRichTextObject::GetRange | ( |  | ) |

Returns the object's range.

## ◆ GetRange() [2/2]

const wxRichTextRange& wxRichTextObject::GetRange | ( |  | ) | const

Returns the object's range.

## ◆ GetRangeSize()

virtual bool wxRichTextObject::GetRangeSize | ( | 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 = `nullptr`
| ) |  | const
| pure virtual

Returns the object size for the given range.

Returns false if the range is invalid for this object.

Implemented in wxRichTextTable, wxRichTextImage, wxRichTextPlainText, wxRichTextParagraph, wxRichTextField, wxRichTextParagraphLayoutBox, and wxRichTextCompositeObject.

## ◆ GetRect()

virtual wxRect wxRichTextObject::GetRect | ( |  | ) | const
| virtual

Returns the rectangle enclosing the object.

## ◆ GetRightMargin()

virtual int wxRichTextObject::GetRightMargin | ( |  | ) | const
| virtual

Returns the right margin of the object, in pixels.

## ◆ GetSelection()

virtual wxRichTextSelection wxRichTextObject::GetSelection | ( | long | start,
|  | long | end
| ) |  | const
| virtual

Returns a selection object specifying the selections between start and end character positions.

For example, a table would deduce what cells (of range length 1) are selected when dragging across the table.

Reimplemented in wxRichTextTable.

## ◆ GetTextForRange()

virtual wxString wxRichTextObject::GetTextForRange | ( | const wxRichTextRange & | range | ) | const
| virtual

Returns any text in this object for the given range.

Reimplemented in wxRichTextTable, wxRichTextPlainText, wxRichTextParagraphLayoutBox, and wxRichTextCompositeObject.

## ◆ GetTopMargin()

virtual int wxRichTextObject::GetTopMargin | ( |  | ) | const
| virtual

Returns the top margin of the object, in pixels.

## ◆ GetTotalMargin()

static bool wxRichTextObject::GetTotalMargin | ( | wxDC & | dc,
|  | wxRichTextBuffer * | buffer,
|  | const wxRichTextAttr & | attr,
|  | int & | leftMargin,
|  | int & | rightMargin,
|  | int & | topMargin,
|  | int & | bottomMargin
| ) |  |
| static

Returns the total margin for the object in pixels, taking into account margin, padding and border size.

## ◆ GetXMLNodeName()

virtual wxString wxRichTextObject::GetXMLNodeName | ( |  | ) | const
| virtual

Returns the XML node name of this object.

This must be overridden for wxXmlNode-base XML export to work.

Reimplemented in wxRichTextTable, wxRichTextCell, wxRichTextImage, wxRichTextPlainText, wxRichTextParagraph, wxRichTextField, wxRichTextBox, and wxRichTextParagraphLayoutBox.

## ◆ HandlesChildSelections()

virtual bool wxRichTextObject::HandlesChildSelections | ( |  | ) | const
| virtual

Returns true if this object can handle the selections of its children, fOr example a table.

Required for composite selection handling to work.

Reimplemented in wxRichTextTable.

## ◆ HitTest()

virtual int wxRichTextObject::HitTest | ( | wxDC & | dc,
|  | wxRichTextDrawingContext & | context,
|  | const wxPoint & | pt,
|  | long & | textPosition,
|  | wxRichTextObject ** | obj,
|  | wxRichTextObject ** | contextObj,
|  | int | flags = `0`
| ) |  |
| virtual

Hit-testing: returns a flag indicating hit test details, plus information about position.

contextObj is returned to specify what object position is relevant to, since otherwise there's an ambiguity. @ obj might not be a child of contextObj, since we may be referring to the container itself if we have no hit on a child - for example if we click outside an object.

The function puts the position in textPosition if one is found. pt is in logical units (a zero y position is at the beginning of the buffer).

Returns
  One of the wxRichTextHitTestFlags values.

Reimplemented in wxRichTextTable, wxRichTextCell, wxRichTextBuffer, wxRichTextParagraph, wxRichTextParagraphLayoutBox, and wxRichTextCompositeObject.

## ◆ ImportFromXML()

virtual bool wxRichTextObject::ImportFromXML | ( | wxRichTextBuffer * | buffer,
|  | wxXmlNode * | node,
|  | wxRichTextXMLHandler * | handler,
|  | bool * | recurse
| ) |  |
| virtual

Imports this object from XML.

Reimplemented in wxRichTextTable, wxRichTextImage, wxRichTextPlainText, and wxRichTextParagraphLayoutBox.

## ◆ Invalidate()

virtual void wxRichTextObject::Invalidate | ( | const wxRichTextRange & | invalidRange = `wxRICHTEXT_ALL` | ) |
| virtual

Invalidates the object at the given range.

With no argument, invalidates the whole object.

Reimplemented in wxRichTextParagraphLayoutBox, and wxRichTextCompositeObject.

## ◆ IsAtomic()

virtual bool wxRichTextObject::IsAtomic | ( |  | ) | const
| virtual

Returns true if no user editing can be done inside the object.

This returns true for simple objects, false for most composite objects, but true for fields, which if composite, should not be user-edited.

Reimplemented in wxRichTextField, and wxRichTextCompositeObject.

## ◆ IsComposite()

virtual bool wxRichTextObject::IsComposite | ( |  | ) | const
| virtual

Returns true if this object is composite.

Reimplemented in wxRichTextCompositeObject.

## ◆ IsEmpty()

virtual bool wxRichTextObject::IsEmpty | ( |  | ) | const
| virtual

Returns true if the object is empty.

Reimplemented in wxRichTextImage, wxRichTextPlainText, wxRichTextField, and wxRichTextCompositeObject.

## ◆ IsFloatable()

virtual bool wxRichTextObject::IsFloatable | ( |  | ) | const
| virtual

Returns true if this class of object is floatable.

Reimplemented in wxRichTextImage.

## ◆ IsFloating()

virtual bool wxRichTextObject::IsFloating | ( |  | ) | const
| virtual

Returns true if this object is currently floating.

## ◆ IsShown()

bool wxRichTextObject::IsShown | ( |  | ) | const

Returns true if the object will be shown, false otherwise.

## ◆ IsTopLevel()

virtual bool wxRichTextObject::IsTopLevel | ( |  | ) | const
| virtual

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

Reimplemented in wxRichTextField, and wxRichTextParagraphLayoutBox.

## ◆ Layout()

virtual bool wxRichTextObject::Layout | ( | 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 wxRichTextTable, wxRichTextImage, wxRichTextPlainText, wxRichTextParagraph, wxRichTextField, and wxRichTextParagraphLayoutBox.

## ◆ LayoutToBestSize()

virtual bool wxRichTextObject::LayoutToBestSize | ( | wxDC & | dc,
|  | wxRichTextDrawingContext & | context,
|  | wxRichTextBuffer * | buffer,
|  | const wxRichTextAttr & | parentAttr,
|  | const wxRichTextAttr & | attr,
|  | const wxRect & | availableParentSpace,
|  | const wxRect & | availableContainerSpace,
|  | int | style
| ) |  |
| virtual

Lays out the object first with a given amount of space, and then if no width was specified in attr, lays out the object again using the minimum size.

availableParentSpace is the maximum space for the object, whereas availableContainerSpace is the container with which relative positions and sizes should be computed. For example, a text box whose space has already been constrained in a previous layout pass to availableParentSpace, but should have a width of 50% of availableContainerSpace. (If these two rects were the same, a 2nd pass could see the object getting too small.)

## ◆ Merge()

virtual bool wxRichTextObject::Merge | ( | wxRichTextObject * | object,
|  | wxRichTextDrawingContext & | context
| ) |  |
| virtual

Returns true if this object merged itself with the given one.

The calling code will then delete the given object.

Reimplemented in wxRichTextPlainText.

## ◆ Move()

virtual void wxRichTextObject::Move | ( | const wxPoint & | pt | ) |
| virtual

Moves the object recursively, by adding the offset from old to new.

Reimplemented in wxRichTextCompositeObject.

## ◆ Reference()

void wxRichTextObject::Reference | ( |  | ) |

Reference-counting allows us to use the same object in multiple lists (not yet used).

## ◆ SetAttributes()

void wxRichTextObject::SetAttributes | ( | const wxRichTextAttr & | attr | ) |

Sets the object's attributes.

## ◆ SetCachedSize()

virtual void wxRichTextObject::SetCachedSize | ( | const wxSize & | sz | ) |
| virtual

Sets the cached object size as calculated by Layout.

## ◆ SetDescent()

void wxRichTextObject::SetDescent | ( | int | descent | ) |

Sets the stored descent value.

## ◆ SetMargins() [1/2]

virtual void wxRichTextObject::SetMargins | ( | int | leftMargin,
|  | int | rightMargin,
|  | int | topMargin,
|  | int | bottomMargin
| ) |  |
| virtual

Set the margin around the object, in pixels.

## ◆ SetMargins() [2/2]

virtual void wxRichTextObject::SetMargins | ( | int | margin | ) |
| virtual

Set the margin around the object, in pixels.

## ◆ SetMaxSize()

virtual void wxRichTextObject::SetMaxSize | ( | const wxSize & | sz | ) |
| virtual

Sets the maximum object size as calculated by Layout.

This allows us to fit an object to its contents or allocate extra space if required.

## ◆ SetMinSize()

virtual void wxRichTextObject::SetMinSize | ( | const wxSize & | sz | ) |
| virtual

Sets the minimum object size as calculated by Layout.

This allows us to constrain an object to its absolute minimum size if necessary.

## ◆ SetName()

void wxRichTextObject::SetName | ( | const wxString & | name | ) |

Sets the identifying name for this object as a property using the "name" key.

## ◆ SetOwnRange()

void wxRichTextObject::SetOwnRange | ( | const wxRichTextRange & | range | ) |

Set the object's own range, for a top-level object with its own position space.

## ◆ SetParent()

virtual void wxRichTextObject::SetParent | ( | wxRichTextObject * | parent | ) |
| virtual

Sets the pointer to the parent object.

## ◆ SetPosition()

virtual void wxRichTextObject::SetPosition | ( | const wxPoint & | pos | ) |
| virtual

Sets the object position in pixels.

## ◆ SetProperties()

void wxRichTextObject::SetProperties | ( | const wxRichTextProperties & | props | ) |

Sets the object's properties.

## ◆ SetRange()

void wxRichTextObject::SetRange | ( | const wxRichTextRange & | range | ) |

Sets the object's range within its container.

## ◆ Show()

virtual void wxRichTextObject::Show | ( | bool | show | ) |
| virtual

Call to show or hide this object.

This function does not cause the content to be laid out or redrawn.

## ◆ Split()

virtual wxRichTextObject* wxRichTextObject::Split | ( | wxRichTextDrawingContext & | context | ) |
| virtual

Returns the final object in the split objects if this object was split due to differences between sub-object virtual attributes.

Returns itself if it was not split.

Reimplemented in wxRichTextPlainText.

## ◆ UsesParagraphAttributes()

virtual bool wxRichTextObject::UsesParagraphAttributes | ( |  | ) | const
| virtual

Returns true if this object takes note of paragraph attributes (text and image objects don't).

Reimplemented in wxRichTextImage, and wxRichTextPlainText.

## Member Data Documentation

## ◆ m_attributes

wxRichTextAttr wxRichTextObject::m_attributes
| protected

## ◆ m_descent

int wxRichTextObject::m_descent
| protected

## ◆ m_maxSize

wxSize wxRichTextObject::m_maxSize
| protected

## ◆ m_minSize

wxSize wxRichTextObject::m_minSize
| protected

## ◆ m_ownRange

wxRichTextRange wxRichTextObject::m_ownRange
| protected

## ◆ m_parent

wxRichTextObject* wxRichTextObject::m_parent
| protected

## ◆ m_pos

wxPoint wxRichTextObject::m_pos
| protected

## ◆ m_properties

wxRichTextProperties wxRichTextObject::m_properties
| protected

## ◆ m_range

wxRichTextRange wxRichTextObject::m_range
| protected

## ◆ m_refCount

int wxRichTextObject::m_refCount
| protected

## ◆ m_show

bool wxRichTextObject::m_show
| protected

## ◆ m_size

wxSize wxRichTextObject::m_size
| protected