Dillo v3.1.1-91-g6d5b3ee3
Loading...
Searching...
No Matches
ooffloatsmgr.hh
Go to the documentation of this file.
1#ifndef __DW_OOFFLOATSMGR_HH__
2#define __DW_OOFFLOATSMGR_HH__
3
4#include "outofflowmgr.hh"
5
6namespace dw {
7
8namespace oof {
9
18{
19 friend class WidgetInfo;
20
21private:
22 enum Side { LEFT, RIGHT };
23
26
28
30 {
31 private:
34
35 protected:
37
38 public:
40
41 inline core::Widget *getWidget () { return widget; }
42 };
43
44 class Float: public WidgetInfo
45 {
46 public:
48 {
49 public:
50 int compare (Object *o1, Object *o2);
51 };
52
54 {
55 public:
56 int compare (Object *o1, Object *o2);
57 };
58
60 {
61 private:
63
64 public:
66 { this->oofm = oofm; }
67 int compare(Object *o1, Object *o2);
68 };
69
72 int index; // TODO Needed after SRDOP?
73 int yReq, yReal; // relative to container
76 bool dirty;
77
79 OOFAwareWidget *generatingBlock, int externalIndex);
80
82
83 bool covers (int y, int h);
84 };
85
99 {
100 private:
103
104 public:
106 bool ownerOfObjects) :
107 lout::container::typed::Vector<Float> (1, ownerOfObjects)
108 { this->oofm = oofm; this->side = side; }
109
110 int findFloatIndex (OOFAwareWidget *lastGB, int lastExtIndex);
111 int find (int y, int start, int end);
112 int findFirst (int y, int h, OOFAwareWidget *lastGB, int lastExtIndex,
113 int *lastReturn);
114 int findLastBeforeSideSpanningIndex (int sideSpanningIndex);
115 void put (Float *vloat);
116
119 inline int size ()
121 inline Float *get (int pos)
125 };
126
127 class TBInfo: public WidgetInfo
128 {
129 public:
131 {
132 private:
134
135 public:
136 inline ComparePosition (int oofmIndex) { this->oofmIndex = oofmIndex; }
137 int compare (Object *o1, Object *o2);
138 };
139
140 int index; // position within "tbInfos"
141 int y; // used for sorting
142
145
146 // These two lists store all floats of a generator, in the order
147 // in which they are defined. Used for optimization
149
152 ~TBInfo ();
153
156 };
157
159
162
166
169
171 int oldStartIndex, int diff);
173 void updateGenerators (Float *vloat);
174 int findTBInfo (int y);
175
176 void sizeAllocateFloats (Side side);
178 int calcFloatX (Float *vloat);
179
180 void drawFloats (SortedFloatsVector *list, core::View *view,
181 core::Rectangle *area, core::DrawingContext *context);
184 *context);
185
186 bool collidesV (Float *vloat, Float *other, int *yReal);
187 bool collidesH (Float *vloat, Float *other);
188
189 void getFloatsListsAndSide (Float *vloat, SortedFloatsVector **listSame,
190 SortedFloatsVector **listOpp, Side *side);
191
192 void getFloatsSize (core::Requisition *cbReq, Side side, int *width,
193 int *height);
194 void getFloatsExtremes (core::Extremes *cbExtr, Side side, int *minWidth,
195 int *maxWidth);
196
200 { return getOOFAwareWidgetWhenRegistered (widget) != NULL; }
201
202 int getBorder (Side side, int y, int h, OOFAwareWidget *lastGB,
203 int lastExtIndex);
204 bool hasFloat (Side side, int y, int h, OOFAwareWidget *lastGB,
205 int lastExtIndex);
206 int getFloatHeight (Side side, int y, int h, OOFAwareWidget *lastGB,
207 int lastExtIndex);
208
209 int getClearPosition (OOFAwareWidget *widget, Side side);
210
211 void ensureFloatSize (Float *vloat);
212
213 inline static int createSubRefLeftFloat (int index) { return index << 1; }
214 inline static int createSubRefRightFloat (int index)
215 { return (index << 1) | 1; }
216
217 inline static bool isSubRefLeftFloat (int ref)
218 { return ref != -1 && (ref & 1) == 0; }
219 inline static bool isSubRefRightFloat (int ref)
220 { return ref != -1 && (ref & 1) == 1; }
221
222 inline static int getFloatIndexFromSubRef (int ref)
223 { return ref == -1 ? ref : (ref >> 1); }
224
225public:
227 ~OOFFloatsMgr ();
228
229 void sizeAllocateStart (OOFAwareWidget *caller,
230 core::Allocation *allocation);
231 void sizeAllocateEnd (OOFAwareWidget *caller);
233 void draw (core::View *view, core::Rectangle *area,
234 core::DrawingContext *context);
235
236 void markSizeChange (int ref);
237 void markExtremesChange (int ref);
238 core::Widget *getWidgetAtPoint (int x, int y,
240
241 void addWidgetInFlow (OOFAwareWidget *textblock, OOFAwareWidget *parentBlock,
242 int externalIndex);
243 int addWidgetOOF (core::Widget *widget, OOFAwareWidget *generatingBlock,
244 int externalIndex);
246 void moveExternalIndices (OOFAwareWidget *generatingBlock, int oldStartIndex,
247 int diff);
248
249 void tellPosition1 (core::Widget *widget, int x, int y);
250 void tellPosition2 (core::Widget *widget, int x, int y);
251 void tellIncompletePosition1 (core::Widget *generator, core::Widget *widget,
252 int x, int y);
253 void tellIncompletePosition2 (core::Widget *generator, core::Widget *widget,
254 int x, int y);
255
256 void getSize (core::Requisition *cbReq, int *oofWidth, int *oofHeight);
258 void getExtremes (core::Extremes *cbExtr,
259 int *oofMinWidth, int *oofMaxWidth);
260
261 int getLeftBorder (int y, int h, OOFAwareWidget *lastGB, int lastExtIndex);
262 int getRightBorder (int y, int h, OOFAwareWidget *lastGB, int lastExtIndex);
263
264 bool hasFloatLeft (int y, int h, OOFAwareWidget *lastGB, int lastExtIndex);
265 bool hasFloatRight (int y, int h, OOFAwareWidget *lastGB, int lastExtIndex);
266
267 int getLeftFloatHeight (int y, int h, OOFAwareWidget *lastGB,
268 int lastExtIndex);
269 int getRightFloatHeight (int y, int h, OOFAwareWidget *lastGB,
270 int lastExtIndex);
271
272 bool affectsLeftBorder (core::Widget *widget);
273 bool affectsRightBorder (core::Widget *widget);
274 bool mayAffectBordersAtAll ();
275
276 int getClearPosition (OOFAwareWidget *textblock);
277
279 int getAvailWidthOfChild (core::Widget *child, bool forceValue);
280 int getAvailHeightOfChild (core::Widget *child, bool forceValue);
281
282 int getNumWidgets ();
283 core::Widget *getWidget (int i);
284};
285
286} // namespace oof
287
288} // namespace dw
289
290#endif // __DW_OOFFLOATSMGR_HH__
Set at the top when drawing.
Definition types.hh:295
Set at the top when getting the widget at the point.
Definition types.hh:313
dw::core::Shape implemtation for simple rectangles.
Definition types.hh:70
An interface to encapsulate platform dependent drawing.
Definition view.hh:17
The base class of all dillo widgets.
Definition widget.hh:44
Base class for widgets which can act as container and generator for widgets out of flow.
int compare(Object *o1, Object *o2)
Compare two objects o1 and o2.
int compare(Object *o1, Object *o2)
Compare two objects o1 and o2.
int compare(Object *o1, Object *o2)
Compare two objects o1 and o2.
void intoStringBuffer(lout::misc::StringBuffer *sb)
Store a textual representation of the object in a misc::StringBuffer.
bool covers(int y, int h)
y is given relative to the container.
int findFloatIndex(OOFAwareWidget *lastGB, int lastExtIndex)
SortedFloatsVector(OOFFloatsMgr *oofm, Side side, bool ownerOfObjects)
int findLastBeforeSideSpanningIndex(int sideSpanningIndex)
int find(int y, int start, int end)
y is given relative to the container.
lout::container::typed::Iterator< Float > iterator()
int findFirst(int y, int h, OOFAwareWidget *lastGB, int lastExtIndex, int *lastReturn)
int compare(Object *o1, Object *o2)
Compare two objects o1 and o2.
lout::container::typed::Vector< Float > * rightFloats
OOFAwareWidget * getOOFAwareWidget()
lout::container::typed::Vector< Float > * leftFloats
OutOfFlowMgr implementation dealing with floats.
void getFloatsListsAndSide(Float *vloat, SortedFloatsVector **listSame, SortedFloatsVector **listOpp, Side *side)
core::Widget * getWidgetAtPoint(int x, int y, core::GettingWidgetAtPointContext *context)
bool hasFloat(Side side, int y, int h, OOFAwareWidget *lastGB, int lastExtIndex)
void moveExternalIndices(lout::container::typed::Vector< Float > *list, int oldStartIndex, int diff)
bool dealingWithSizeOfChild(core::Widget *child)
bool collidesV(Float *vloat, Float *other, int *yReal)
int getAvailHeightOfChild(core::Widget *child, bool forceValue)
static int getFloatIndexFromSubRef(int ref)
void getFloatsSize(core::Requisition *cbReq, Side side, int *width, int *height)
int getAvailWidthOfChild(core::Widget *child, bool forceValue)
int findTBInfo(int y)
y is given relative to the container.
core::Widget * getFloatWidgetAtPoint(SortedFloatsVector *list, int x, int y, core::GettingWidgetAtPointContext *context)
void tellIncompletePosition2(core::Widget *generator, core::Widget *widget, int x, int y)
int getRightFloatHeight(int y, int h, OOFAwareWidget *lastGB, int lastExtIndex)
Assuming there is a float on the right side, return the rest height of it.
bool isOOFAwareWidgetRegistered(OOFAwareWidget *widget)
void ensureFloatSize(Float *vloat)
void updateGenerators(Float *vloat)
Update all generators which are affected by a given float.
int getLeftBorder(int y, int h, OOFAwareWidget *lastGB, int lastExtIndex)
Get the left border for the vertical position of y, for a height of h", based on floats; relative to ...
bool collidesH(Float *vloat, Float *other)
void containerSizeChangedForChildren()
int getBorder(Side side, int y, int h, OOFAwareWidget *lastGB, int lastExtIndex)
core::Allocation containerAllocation
TBInfo * getOOFAwareWidget(OOFAwareWidget *widget)
lout::container::typed::Vector< TBInfo > * tbInfos
void tellPosition1(core::Widget *widget, int x, int y)
Called before tellPosition2, see there for more.
core::Widget * getWidget(int i)
bool hasFloatRight(int y, int h, OOFAwareWidget *lastGB, int lastExtIndex)
Return whether there is a float on the right side.
int getGBWidthForAllocation(Float *vloat)
void getExtremes(core::Extremes *cbExtr, int *oofMinWidth, int *oofMaxWidth)
bool affectsLeftBorder(core::Widget *widget)
static int createSubRefLeftFloat(int index)
void getFloatsExtremes(core::Extremes *cbExtr, Side side, int *minWidth, int *maxWidth)
void sizeAllocateEnd(OOFAwareWidget *caller)
void addWidgetInFlow(OOFAwareWidget *textblock, OOFAwareWidget *parentBlock, int externalIndex)
void calcWidgetRefSize(core::Widget *widget, core::Requisition *size)
static bool isSubRefLeftFloat(int ref)
void tellPosition2(core::Widget *widget, int x, int y)
Called after tellPosition1.
void draw(core::View *view, core::Rectangle *area, core::DrawingContext *context)
OOFAwareWidget * container
static int createSubRefRightFloat(int index)
lout::container::typed::HashTable< lout::object::TypedPointer< OOFAwareWidget >, TBInfo > * tbInfosByOOFAwareWidget
bool affectsRightBorder(core::Widget *widget)
void markSizeChange(int ref)
int calcFloatX(Float *vloat)
Return position of a float relative to the container.
int getRightBorder(int y, int h, OOFAwareWidget *lastGB, int lastExtIndex)
Get the right border for the vertical position of y, for a height of h, based on floats; relative to ...
void sizeAllocateFloats(Side side)
int getLeftFloatHeight(int y, int h, OOFAwareWidget *lastGB, int lastExtIndex)
Assuming there is a float on the left side, return the rest height of it.
Float * findFloatByWidget(core::Widget *widget)
int getClearPosition(OOFAwareWidget *widget, Side side)
lout::container::typed::HashTable< lout::object::TypedPointer< dw::core::Widget >, Float > * floatsByWidget
static bool isSubRefRightFloat(int ref)
TBInfo * getOOFAwareWidgetWhenRegistered(OOFAwareWidget *widget)
bool hasFloatLeft(int y, int h, OOFAwareWidget *lastGB, int lastExtIndex)
Return whether there is a float on the left side.
void markExtremesChange(int ref)
void getSize(core::Requisition *cbReq, int *oofWidth, int *oofHeight)
int getFloatHeight(Side side, int y, int h, OOFAwareWidget *lastGB, int lastExtIndex)
void tellIncompletePosition1(core::Widget *generator, core::Widget *widget, int x, int y)
int addWidgetOOF(core::Widget *widget, OOFAwareWidget *generatingBlock, int externalIndex)
void drawFloats(SortedFloatsVector *list, core::View *view, core::Rectangle *area, core::DrawingContext *context)
void sizeAllocateStart(OOFAwareWidget *caller, core::Allocation *allocation)
SortedFloatsVector * rightFloats
SortedFloatsVector * leftFloats
Represents additional data for OOF containers.
Typed version of container::untyped::HashTable.
Definition container.hh:536
Typed version of container::untyped::Iterator.
Definition container.hh:395
Typed version of container::untyped::Vector.
Definition container.hh:447
Vector(int initSize, bool ownerOfObjects)
Definition container.hh:449
A class for fast concatenation of a large number of strings.
Definition misc.hh:570
Used for other orders as the one defined by Comparable.
Definition object.hh:67
This is the base class for many other classes, which defines very common virtual methods.
Definition object.hh:25
A typed version of object::Pointer.
Definition object.hh:116
Dw is in this namespace, or sub namespaces of this one.
Represents the allocation, i.e.
Definition types.hh:164