]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/richtext/readme
Use the data scheme to load resources in the WebKitGTK+ implementation, rather than...
[wxWidgets.git] / src / richtext / readme
... / ...
CommitLineData
1Implement detail of floating layout
2
31. Data Structure
4
5Mainly, we maintain two floating list data for a wxRichTextBuffer.
6'struct FloatRectMap' is used to represent a floating object's region,
7and 'class wxFloatCollector' is a container of all 'struct FloatRectMap'.
8It maintains all the information of the positions of all the floating
9objects with two list of 'struct FloatRectMap', one for objects floated
10to left and the other for right.
11
12wxRichTextAnchoredObject is introduced to represent a kind of objects
13that can be floated. wxRichTextImage is made to be a child class of
14this one. In future, we may introduce some other floating object type
15like wxRichTextTable. And we also introduce a twin object of this one,
16it is wxRichTextPlaceHoldingObject. When the object is set to be a
17floating one, we will place a 'placing holding' object in its origin
18position, this makes us to record the position of the object correctly
19even if the containing paragraph change its content.
20
21Also, along with wxRichTextAnchoredObject, we also introduce a
22wxRichTextAnchoredObjectAttr class, which contains the attributes of
23floating direction, floating offset and etc. wxRichTextImageAttr is made
24to be a subclass of this one.
25
26Finally, wxRichTextImageDlg is a image control dialog, in which users can
27set the alignment, floating direction, size, offset of the image, in addition,
28users can also move the image between paragraph with this dialog.
29
302. Layout Algorithm
31
32With floating objects, when we layout a paragraph, wxFloatCollector will
33firstly collect all the floating objects of the paragraphs before this
34one. And then, layout the floating objects of this paragraph, then layout
35the normal objects using the available rect info according the floating
36objects' state.
37
38Generally, the basic paragraph layout algorithm:
391. All paragraphs before this one is layout well, so use wxFloatCollector
40 to collect the floating objects state;
412. Collect all the 'place holding objects' of the paragraph, layout the
42 floating objects with the space available for it;
433. For other objects left, make line break as:
44 GetAvailableWidth with a <y, h> pair, where y is the vertical position
45 of the line and h is the minimum height of the line.
46 After we get the width, do line break and normal layout.
47
483. Some Note
49
50If we use floating attributes with list style, it may cause some problems.
51Something like image/text overlap may happen. Since, list style is applied
52to the paragraph after its normal layout, in which phrase, floating layout
53is done, list style will change the position of the paragraph and so may
54cause some overlap.