Package wx :: Module richtext :: Class RichTextObject
[frames | no frames]

Type RichTextObject

object --+    
    Object --+

Known Subclasses:
RichTextCompositeObject, RichTextImage, RichTextPlainText

This is the base class for all drawable objects in a RichTextCtrl.

The data displayed in a RichTextCtrl is handled by RichTextBuffer, and a RichTextCtrl always has one such buffer.

The content is represented by a hierarchy of objects, all derived from RichTextObject. An object might be an image, a fragment of text, a paragraph, or a whole buffer. Objects store a an attribute object containing style information; a paragraph object can contain both paragraph and character information, but content objects such as text can only store character information. The final style displayed in the control or in a printout is a combination of base style, paragraph style and content (character) style.

The top of the hierarchy is the buffer, a kind of RichTextParagraphLayoutBox. containing further RichTextParagraph objects, each of which can include text, images and potentially other types of objects.

Each object maintains a range (start and end position) measured from the start of the main parent object.

When Layout is called on an object, it is given a size which the object must limit itself to, or one or more flexible directions (vertical or horizontal). So, for example, a centred paragraph is given the page width to play with (minus any margins), but can extend indefinitely in the vertical direction. The implementation of Layout caches the calculated size and position.

When the buffer is modified, a range is invalidated (marked as requiring layout), so that only the minimum amount of layout is performed.

A paragraph of pure text with the same style contains just one further object, a RichTextPlainText object. When styling is applied to part of this object, the object is decomposed into separate objects, one object for each different character style. So each object within a paragraph always has just one attribute object to denote its character style. Of course, this can lead to fragmentation after a lot of edit operations, potentially leading to several objects with the same style where just one would do. So a Defragment function is called when updating the control's display, to ensure that the minimum number of objects is used.

To implement your own RichTextObjects in Python you must derive a class from PyRichTextObject, which has been instrumented to forward the virtual C++ method calls to the Python methods in the derived class. (This class hasn't been implemented yet!)

Method Summary
  CalculateRange(self, start, OUTPUT)
bool CanMerge(self, object)
RichTextObject Clone(self)
int ConvertTenthsMMToPixels(ppi, units)
(Static method)
int ConvertTenthsMMToPixelsDC(self, dc, units)
  Copy(self, obj)
bool DeleteRange(self, range)
RichTextObject DoSplit(self, pos)
bool Draw(self, dc, range, selectionRange, rect, descent, style)
String Dump(self)
bool FindPosition(self, dc, index, OUTPUT, OUTPUT, forceLineStart)
TextAttrEx GetAttributes(self)
Size GetBestSize(self)
int GetBottomMargin(self)
RichTextBuffer GetBuffer(self)
Size GetCachedSize(self)
int GetDescent(self)
bool GetDirty(self)
int GetLeftMargin(self)
RichTextObject GetParent(self)
Point GetPosition(self)
RichTextRange GetRange(self)
bool GetRangeSize(self, range, OUTPUT, OUTPUT, dc, flags, position, 0))
Rect GetRect(self)
int GetRightMargin(self)
String GetTextForRange(self, range)
int GetTopMargin(self)
int HitTest(self, dc, pt, OUTPUT)
bool IsComposite(self)
bool IsEmpty(self)
bool Layout(self, dc, rect, style)
bool Merge(self, object)
  SetAttributes(self, attr)
  SetCachedSize(self, sz)
  SetDescent(self, descent)
  SetDirty(self, dirty)
  SetMargins(self, leftMargin, rightMargin, topMargin, bottomMargin)
  SetParent(self, parent)
  SetPosition(self, pos)
  SetRange(self, range)
  SetSameMargins(self, margin)

Property Summary
  Attributes: GetAttributes(self) -> TextAttrEx
  CachedSize: GetCachedSize(self) -> Size
  Descent: GetDescent(self) -> int
  Dirty: GetDirty(self) -> bool
  Parent: GetParent(self) -> RichTextObject
  Position: GetPosition(self) -> Point
  Range: GetRange(self) -> RichTextRange
  Rect: GetRect(self) -> Rect
  thisown: The membership flag

Property Details


GetAttributes(self) -> TextAttrEx

Get Method:
Set Method:
SetAttributes(self, attr)


GetCachedSize(self) -> Size

Get Method:
Set Method:
SetCachedSize(self, sz)


GetDescent(self) -> int

Get Method:
Set Method:
SetDescent(self, descent)


GetDirty(self) -> bool

Get Method:
Set Method:
SetDirty(self, dirty)


GetParent(self) -> RichTextObject

Get Method:
Set Method:
SetParent(self, parent)


GetPosition(self) -> Point

Get Method:
Set Method:
SetPosition(self, pos)


GetRange(self) -> RichTextRange

Get Method:
Set Method:
SetRange(self, range)


GetRect(self) -> Rect

Get Method:


The membership flag

Get Method:
Set Method:

Generated by Epydoc 2.1.20050511.rpd on Mon Feb 16 12:54:44 2009