# wxRichTextObject Class Reference
[Rich Text]

`#include </home/work/projects/wx/2.9/wx/interface/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=NULL)
| Constructor, taking an optional parent pointer.
virtual | ~wxRichTextObject ()
virtual bool | Draw (wxDC &dc, const wxRichTextRange &range, const wxRichTextSelection &selection, const wxRect &rect, int descent, int style)=0
| Draw the item, within the given range.
virtual bool | Layout (wxDC &dc, const wxRect &rect, int style)=0
| Lay the item out at the specified position with the given size constraint.
virtual int | HitTest (wxDC &dc, 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.
virtual bool | FindPosition (wxDC &WXUNUSED(dc), long WXUNUSED(index), wxPoint &WXUNUSED(pt), int *WXUNUSED(height), bool WXUNUSED(forceLineStart))
| Finds the absolute position and row height for the given character position.
virtual wxSize | GetBestSize () const
| Returns the best size, i.e.
virtual bool | GetRangeSize (const wxRichTextRange &range, wxSize &size, int &descent, wxDC &dc, int flags, wxPoint position=wxPoint(0, 0), wxArrayInt *partialExtents=NULL) const =0
| Returns the object size for the given range.
virtual wxRichTextObject * | DoSplit (long WXUNUSED(pos))
| Do a split from pos, returning an object containing the second part, and setting the first part in 'this'.
virtual void | CalculateRange (long start, long &end)
| Calculates the range of the object.
virtual bool | DeleteRange (const wxRichTextRange &WXUNUSED(range))
| Deletes the given range.
virtual bool | IsEmpty () const
| Returns true if the object is empty.
virtual bool | IsFloatable () const
| Returns true if this class of object is floatable.
virtual bool | IsFloating () const
| Returns true if this object is currently floating.
virtual int | GetFloatDirection () const
| Returns the floating direction.
virtual wxString | GetTextForRange (const wxRichTextRange &WXUNUSED(range)) const
| Returns any text in this object for the given range.
virtual bool | CanMerge (wxRichTextObject *WXUNUSED(object)) const
| Returns true if this object can merge itself with the given one.
virtual bool | Merge (wxRichTextObject *WXUNUSED(object))
| Returns true if this object merged itself with the given one.
virtual void | Dump (wxTextOutputStream &stream)
| Dump object data to the given output stream for debugging.
virtual bool | CanEditProperties () const
| Returns true if we can edit the object's properties via a GUI.
virtual bool | EditProperties (wxWindow *WXUNUSED(parent), wxRichTextBuffer *WXUNUSED(buffer))
| Edits the object's properties via a GUI.
virtual wxString | GetPropertiesMenuLabel () const
| Returns the label to be used for the properties context menu item.
virtual bool | AcceptsFocus () const
| Returns true if objects of this class can accept the focus, i.e.
virtual bool | UsesParagraphAttributes () const
| Returns true if this object takes note of paragraph attributes (text and image objects don't).
virtual wxString | GetXMLNodeName () const
| Returns the XML node name of this object.
virtual void | Invalidate (const wxRichTextRange &invalidRange=wxRICHTEXT_ALL)
| Invalidates the object at the given range.
virtual bool | HandlesChildSelections () const
| Returns true if this object can handle the selections of its children, fOr example a table.
virtual wxRichTextSelection | GetSelection (long WXUNUSED(start), long WXUNUSED(end)) const
| Returns a selection object specifying the selections between start and end character positions.
virtual wxSize | GetCachedSize () const
| Gets the cached object size as calculated by Layout.
virtual void | SetCachedSize (const wxSize &sz)
| Sets the cached object size as calculated by Layout.
virtual wxSize | GetMaxSize () const
| Gets the maximum object size as calculated by Layout.
virtual void | SetMaxSize (const wxSize &sz)
| Sets the maximum object size as calculated by Layout.
virtual wxSize | GetMinSize () const
| Gets the minimum object size as calculated by Layout.
virtual void | SetMinSize (const wxSize &sz)
| Sets the minimum object size as calculated by Layout.
virtual wxTextAttrSize | GetNaturalSize () const
| Gets the 'natural' size for an object.
virtual wxPoint | GetPosition () const
| Returns the object position in pixels.
virtual void | SetPosition (const wxPoint &pos)
| Sets the object position in pixels.
virtual wxPoint | GetAbsolutePosition () const
| Returns the absolute object position, by traversing up the child/parent hierarchy.
virtual wxRect | GetRect () const
| Returns the rectangle enclosing the object.
void | SetRange (const wxRichTextRange &range)
| Sets the object's range within its container.
const wxRichTextRange & | GetRange () const
| Returns the object's range.
wxRichTextRange & | GetRange ()
| Returns the object's range.
void | SetOwnRange (const wxRichTextRange &range)
| Set the object's own range, for a top-level object with its own position space.
const wxRichTextRange & | GetOwnRange () const
| Returns the object's own range (valid if top-level).
wxRichTextRange & | GetOwnRange ()
| Returns the object's own range (valid if top-level).
wxRichTextRange | GetOwnRangeIfTopLevel () const
| Returns the object's own range only if a top-level object.
virtual bool | IsComposite () const
| Returns true if this object this composite.
virtual wxRichTextObject * | GetParent () const
| Returns a pointer to the parent object.
virtual void | SetParent (wxRichTextObject *parent)
| Sets the pointer to the parent object.
virtual wxRichTextParagraphLayoutBox * | GetContainer () const
| Returns the top-level container of this object.
virtual wxRichTextParagraphLayoutBox * | GetParentContainer () const
| Returns the top-level container of this object.
virtual void | SetMargins (int margin)
| Set the margin around the object, in pixels.
virtual void | SetMargins (int leftMargin, int rightMargin, int topMargin, int bottomMargin)
| Set the margin around the object, in pixels.
virtual int | GetLeftMargin () const
| Returns the left margin of the object, in pixels.
virtual int | GetRightMargin () const
| Returns the right margin of the object, in pixels.
virtual int | GetTopMargin () const
| Returns the top margin of the object, in pixels.
virtual int | GetBottomMargin () const
| Returns the bottom margin of the object, in pixels.
virtual wxRect | GetAvailableContentArea (wxDC &dc, 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.
virtual bool | LayoutToBestSize (wxDC &dc, wxRichTextBuffer *buffer, const wxRichTextAttr &parentAttr, const wxRichTextAttr &attr, const wxRect &availableParentSpace, 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.
void | SetAttributes (const wxRichTextAttr &attr)
| Sets the object's attributes.
const wxRichTextAttr & | GetAttributes () const
| Returns the object's attributes.
wxRichTextAttr & | GetAttributes ()
| Returns the object's attributes.
wxRichTextProperties & | GetProperties ()
| Sets the object's properties.
const wxRichTextProperties & | GetProperties () const
| Returns the object's properties.
void | SetProperties (const wxRichTextProperties &props)
| Returns the object's properties.
void | SetDescent (int descent)
| Sets the stored descent value.
int | GetDescent () const
| Returns the stored descent value.
wxRichTextBuffer * | GetBuffer () const
| Returns the containing buffer.
void | SetName (const wxString &name)
| Sets the identifying name for this object as a property using the "name" key.
wxString | GetName () const
| Returns the identifying name for this object from the properties, using the "name" key.
virtual bool | IsTopLevel () const
| Returns true if this object is top-level, i.e.
bool | IsShown () const
| Returns true if the object will be shown, false otherwise.
virtual void | Show (bool show)
| Call to show or hide this object.
virtual wxRichTextObject * | Clone () const
| Clones the object.
void | Copy (const wxRichTextObject &obj)
| Copies the object.
void | Reference ()
| Reference-counting allows us to use the same object in multiple lists (not yet used).
void | Dereference ()
| Reference-counting allows us to use the same object in multiple lists (not yet used).
virtual void | Move (const wxPoint &pt)
| Moves the object recursively, by adding the offset from old to new.
int | ConvertTenthsMMToPixels (wxDC &dc, int units) const
| Converts units in tenths of a millimetre to device units.
int | ConvertPixelsToTenthsMM (wxDC &dc, int pixels) const
| Convert units in pixels to tenths of a millimetre.

## 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.
static int | ConvertPixelsToTenthsMM (int ppi, int pixels, double scale=1.0)
| Convert units in pixels to tenths of a millimetre.
static bool | DrawBoxAttributes (wxDC &dc, wxRichTextBuffer *buffer, const wxRichTextAttr &attr, const wxRect &boxRect, int flags=0)
| Draws the borders and background for the given rectangle and attributes.
static bool | DrawBorder (wxDC &dc, wxRichTextBuffer *buffer, const wxTextAttrBorders &attr, const wxRect &rect, int flags=0)
| Draws a border.
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.
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.
static wxRect | AdjustAvailableSpace (wxDC &dc, wxRichTextBuffer *buffer, const wxRichTextAttr &parentAttr, const wxRichTextAttr &childAttr, const wxRect &availableParentSpace)
| Returns the rectangle which the child has available to it given restrictions specified in the child attribute, e.g.

## 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

List of all members.

## Constructor & Destructor Documentation

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

Constructor, taking an optional parent pointer.

virtual wxRichTextObject::~wxRichTextObject | ( |  | ) | `[virtual]`

## Member Function Documentation

virtual bool wxRichTextObject::AcceptsFocus | ( |  | ) | const`[inline, 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 wxRichTextParagraphLayoutBox, and wxRichTextTable.

static wxRect wxRichTextObject::AdjustAvailableSpace | ( | wxDC & | dc,
|  | wxRichTextBuffer * | buffer,
|  | const wxRichTextAttr & | parentAttr,
|  | const wxRichTextAttr & | childAttr,
|  | const wxRect & | availableParentSpace |
| ) |  |  | `[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.

virtual void wxRichTextObject::CalculateRange | ( | long | start,
|  | long & | end |
| ) |  |  | `[inline, virtual]`

Calculates the range of the object.

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

Reimplemented in wxRichTextCompositeObject, wxRichTextParagraph, wxRichTextPlainText, and wxRichTextTable.

virtual bool wxRichTextObject::CanEditProperties | ( |  | ) | const`[inline, virtual]`

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

Reimplemented in wxRichTextBox, wxRichTextImage, wxRichTextCell, and wxRichTextTable.

virtual bool wxRichTextObject::CanMerge | ( | wxRichTextObject * | WXUNUSEDobject | ) | const`[inline, virtual]`

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

virtual wxRichTextObject* wxRichTextObject::Clone | ( |  | ) | const`[inline, virtual]`

Clones the object.

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

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

Convert units in pixels to tenths of a millimetre.

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

Convert units in pixels to tenths of a millimetre.

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

Converts units in tenths of a millimetre to device units.

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

Converts units in tenths of a millimetre to device units.

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

Copies the object.

virtual bool wxRichTextObject::DeleteRange | ( | const wxRichTextRange & | WXUNUSEDrange | ) | `[inline, virtual]`

Deletes the given range.

void wxRichTextObject::Dereference | ( |  | ) |

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

virtual wxRichTextObject* wxRichTextObject::DoSplit | ( | long | WXUNUSEDpos | ) | `[inline, virtual]`

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

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

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

Draws a border.

static bool wxRichTextObject::DrawBoxAttributes | ( | wxDC & | dc,
|  | wxRichTextBuffer * | buffer,
|  | const wxRichTextAttr & | attr,
|  | const wxRect & | boxRect,
|  | int | flags = `0` |
| ) |  |  | `[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.

virtual void wxRichTextObject::Dump | ( | wxTextOutputStream & | stream | ) | `[virtual]`

Dump object data to the given output stream for debugging.

Reimplemented in wxRichTextCompositeObject, wxRichTextPlainText, and wxRichTextBuffer.

virtual bool wxRichTextObject::EditProperties | ( | wxWindow * | WXUNUSEDparent,
|  | wxRichTextBuffer * | WXUNUSEDbuffer |
| ) |  |  | `[inline, virtual]`

Edits the object's properties via a GUI.

virtual bool wxRichTextObject::FindPosition | ( | wxDC & | WXUNUSEDdc,
|  | long | WXUNUSEDindex,
|  | wxPoint & | WXUNUSEDpt,
|  | int * | WXUNUSEDheight,
|  | bool | WXUNUSEDforceLineStart |
| ) |  |  | `[inline, virtual]`

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

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.

const wxRichTextAttr& wxRichTextObject::GetAttributes | ( |  | ) | const`[inline]`

Returns the object's attributes.

wxRichTextAttr& wxRichTextObject::GetAttributes | ( |  | ) | `[inline]`

Returns the object's attributes.

virtual wxRect wxRichTextObject::GetAvailableContentArea | ( | wxDC & | dc,
|  | 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.

virtual wxSize wxRichTextObject::GetBestSize | ( |  | ) | const`[inline, 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.

virtual int wxRichTextObject::GetBottomMargin | ( |  | ) | const`[virtual]`

Returns the bottom margin of the object, in pixels.

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.

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

Returns the containing buffer.

virtual wxSize wxRichTextObject::GetCachedSize | ( |  | ) | const`[inline, virtual]`

Gets the cached object size as calculated by Layout.

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.

int wxRichTextObject::GetDescent | ( |  | ) | const`[inline]`

Returns the stored descent value.

virtual int wxRichTextObject::GetFloatDirection | ( |  | ) | const`[inline, virtual]`

Returns the floating direction.

virtual int wxRichTextObject::GetLeftMargin | ( |  | ) | const`[virtual]`

Returns the left margin of the object, in pixels.

virtual wxSize wxRichTextObject::GetMaxSize | ( |  | ) | const`[inline, 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.

virtual wxSize wxRichTextObject::GetMinSize | ( |  | ) | const`[inline, virtual]`

Gets the minimum object size as calculated by Layout.

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

wxString wxRichTextObject::GetName | ( |  | ) | const`[inline]`

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

virtual wxTextAttrSize wxRichTextObject::GetNaturalSize | ( |  | ) | const`[inline, virtual]`

Gets the 'natural' size for an object.

For an image, it would be the image size.

Reimplemented in wxRichTextImage.

const wxRichTextRange& wxRichTextObject::GetOwnRange | ( |  | ) | const`[inline]`

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

wxRichTextRange& wxRichTextObject::GetOwnRange | ( |  | ) | `[inline]`

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

wxRichTextRange wxRichTextObject::GetOwnRangeIfTopLevel | ( |  | ) | const`[inline]`

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

virtual wxRichTextObject* wxRichTextObject::GetParent | ( |  | ) | const`[inline, virtual]`

Returns a pointer to the parent object.

virtual wxRichTextParagraphLayoutBox* wxRichTextObject::GetParentContainer | ( |  | ) | const`[inline, 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 NULL.

virtual wxPoint wxRichTextObject::GetPosition | ( |  | ) | const`[inline, virtual]`

Returns the object position in pixels.

wxRichTextProperties& wxRichTextObject::GetProperties | ( |  | ) | `[inline]`

Sets the object's properties.

const wxRichTextProperties& wxRichTextObject::GetProperties | ( |  | ) | const`[inline]`

Returns the object's properties.

virtual wxString wxRichTextObject::GetPropertiesMenuLabel | ( |  | ) | const`[inline, virtual]`

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

Reimplemented in wxRichTextBox, wxRichTextImage, wxRichTextCell, and wxRichTextTable.

const wxRichTextRange& wxRichTextObject::GetRange | ( |  | ) | const`[inline]`

Returns the object's range.

wxRichTextRange& wxRichTextObject::GetRange | ( |  | ) | `[inline]`

Returns the object's range.

virtual bool wxRichTextObject::GetRangeSize | ( | const wxRichTextRange & | range,
|  | wxSize & | size,
|  | int & | descent,
|  | wxDC & | dc,
|  | int | flags,
|  | wxPoint | position = `wxPoint(0, 0)`,
|  | 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 wxRichTextCompositeObject, wxRichTextParagraphLayoutBox, wxRichTextParagraph, wxRichTextPlainText, wxRichTextImage, and wxRichTextTable.

virtual wxRect wxRichTextObject::GetRect | ( |  | ) | const`[inline, virtual]`

Returns the rectangle enclosing the object.

virtual int wxRichTextObject::GetRightMargin | ( |  | ) | const`[virtual]`

Returns the right margin of the object, in pixels.

virtual wxRichTextSelection wxRichTextObject::GetSelection | ( | long | WXUNUSEDstart,
|  | long | WXUNUSEDend |
| ) |  |  | const`[inline, 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.

virtual wxString wxRichTextObject::GetTextForRange | ( | const wxRichTextRange & | WXUNUSEDrange | ) | const`[inline, virtual]`

Returns any text in this object for the given range.

virtual int wxRichTextObject::GetTopMargin | ( |  | ) | const`[virtual]`

Returns the top margin of the object, in pixels.

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.

virtual wxString wxRichTextObject::GetXMLNodeName | ( |  | ) | const`[inline, virtual]`

Returns the XML node name of this object.

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

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

virtual bool wxRichTextObject::HandlesChildSelections | ( |  | ) | const`[inline, 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.

virtual int wxRichTextObject::HitTest | ( | wxDC & | dc,
|  | 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 wxRichTextCompositeObject, wxRichTextParagraphLayoutBox, wxRichTextParagraph, and wxRichTextBuffer.

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 wxRichTextCompositeObject, and wxRichTextParagraphLayoutBox.

virtual bool wxRichTextObject::IsComposite | ( |  | ) | const`[inline, virtual]`

Returns true if this object this composite.

Reimplemented in wxRichTextCompositeObject.

virtual bool wxRichTextObject::IsEmpty | ( |  | ) | const`[inline, virtual]`

Returns true if the object is empty.

Reimplemented in wxRichTextCompositeObject, wxRichTextPlainText, and wxRichTextImage.

virtual bool wxRichTextObject::IsFloatable | ( |  | ) | const`[inline, virtual]`

Returns true if this class of object is floatable.

Reimplemented in wxRichTextImage.

virtual bool wxRichTextObject::IsFloating | ( |  | ) | const`[inline, virtual]`

Returns true if this object is currently floating.

bool wxRichTextObject::IsShown | ( |  | ) | const`[inline]`

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

virtual bool wxRichTextObject::IsTopLevel | ( |  | ) | const`[inline, virtual]`

Returns true if this object is top-level, i.e.

contains its own paragraphs, such as a text box.

Reimplemented in wxRichTextParagraphLayoutBox.

virtual bool wxRichTextObject::Layout | ( | wxDC & | dc,
|  | const wxRect & | rect,
|  | int | style |
| ) |  |  | `[pure virtual]`

Lay the item out at the specified position with the given size constraint.

Layout must set the cached size.

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

virtual bool wxRichTextObject::LayoutToBestSize | ( | wxDC & | dc,
|  | wxRichTextBuffer * | buffer,
|  | const wxRichTextAttr & | parentAttr,
|  | const wxRichTextAttr & | attr,
|  | const wxRect & | availableParentSpace,
|  | 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.

virtual bool wxRichTextObject::Merge | ( | wxRichTextObject * | WXUNUSEDobject | ) | `[inline, virtual]`

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

The calling code will then delete the given object.

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

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

Reimplemented in wxRichTextCompositeObject.

void wxRichTextObject::Reference | ( |  | ) | `[inline]`

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

void wxRichTextObject::SetAttributes | ( | const wxRichTextAttr & | attr | ) | `[inline]`

Sets the object's attributes.

virtual void wxRichTextObject::SetCachedSize | ( | const wxSize & | sz | ) | `[inline, virtual]`

Sets the cached object size as calculated by Layout.

void wxRichTextObject::SetDescent | ( | int | descent | ) | `[inline]`

Sets the stored descent value.

virtual void wxRichTextObject::SetMargins | ( | int | margin | ) | `[virtual]`

Set the margin around the object, in pixels.

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

Set the margin around the object, in pixels.

virtual void wxRichTextObject::SetMaxSize | ( | const wxSize & | sz | ) | `[inline, 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.

virtual void wxRichTextObject::SetMinSize | ( | const wxSize & | sz | ) | `[inline, virtual]`

Sets the minimum object size as calculated by Layout.

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

void wxRichTextObject::SetName | ( | const wxString & | name | ) | `[inline]`

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

void wxRichTextObject::SetOwnRange | ( | const wxRichTextRange & | range | ) | `[inline]`

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

virtual void wxRichTextObject::SetParent | ( | wxRichTextObject * | parent | ) | `[inline, virtual]`

Sets the pointer to the parent object.

virtual void wxRichTextObject::SetPosition | ( | const wxPoint & | pos | ) | `[inline, virtual]`

Sets the object position in pixels.

void wxRichTextObject::SetProperties | ( | const wxRichTextProperties & | props | ) | `[inline]`

Returns the object's properties.

void wxRichTextObject::SetRange | ( | const wxRichTextRange & | range | ) | `[inline]`

Sets the object's range within its container.

virtual void wxRichTextObject::Show | ( | bool | show | ) | `[inline, virtual]`

Call to show or hide this object.

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

virtual bool wxRichTextObject::UsesParagraphAttributes | ( |  | ) | const`[inline, virtual]`

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

Reimplemented in wxRichTextPlainText, and wxRichTextImage.

## Member Data Documentation

wxRichTextAttr wxRichTextObject::m_attributes`[protected]`

int wxRichTextObject::m_descent`[protected]`

wxSize wxRichTextObject::m_maxSize`[protected]`

wxSize wxRichTextObject::m_minSize`[protected]`

wxRichTextRange wxRichTextObject::m_ownRange`[protected]`

wxRichTextObject* wxRichTextObject::m_parent`[protected]`

wxPoint wxRichTextObject::m_pos`[protected]`

wxRichTextProperties wxRichTextObject::m_properties`[protected]`

wxRichTextRange wxRichTextObject::m_range`[protected]`

int wxRichTextObject::m_refCount`[protected]`

bool wxRichTextObject::m_show`[protected]`

wxSize wxRichTextObject::m_size`[protected]`

|  | [ top ]