Home | Trees | Index | Help |
|
---|
Package wx :: Module richtext :: Class RichTextObject |
|
object
--+ |Object
--+ | RichTextObject
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!)
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 |
---|
AttributesGetAttributes(self) -> TextAttrEx
|
CachedSizeGetCachedSize(self) -> Size
|
DescentGetDescent(self) -> int
|
DirtyGetDirty(self) -> bool |
ParentGetParent(self) -> RichTextObject |
PositionGetPosition(self) -> Point
|
RangeGetRange(self) -> RichTextRange |
RectGetRect(self) -> Rect
|
thisownThe membership flag
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1.20050511.rpd on Mon Feb 16 12:54:44 2009 | http://epydoc.sf.net |