Package wx :: Module richtext :: Class RichTextObject

[frames | no frames]

## Type RichTextObject

    object --+
             |
        Object --+
                 |
                RichTextObject

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
| `__init__(self)`
| `__del__(self)`
| `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)`
| `Dereference(self)`
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)`
| `Reference(self)`
| `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

### Attributes

GetAttributes(self) -> TextAttrEx

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

### CachedSize

GetCachedSize(self) -> Size

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

### Descent

GetDescent(self) -> int

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

### Dirty

GetDirty(self) -> bool

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

### Parent

GetParent(self) -> RichTextObject

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

### Position

GetPosition(self) -> Point

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

### Range

GetRange(self) -> RichTextRange

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

### Rect

GetRect(self) -> Rect

  Get Method:
    `GetRect`(self)

### thisown

The membership flag

  Get Method:
    unknown-38343936(...)
  Set Method:
    unknown-38344056(...)

Generated by Epydoc 2.1.20050511.rpd on Wed Sep 26 13:49:00 2007 | http://epydoc.sf.net