Dillo v3.1.1-119-g140d9ebd
Loading...
Searching...
No Matches
oofawarewidget.hh
Go to the documentation of this file.
1#ifndef __DW_OOFAWAREWIDGET_HH__
2#define __DW_OOFAWAREWIDGET_HH__
3
4#include "core.hh"
5#include "outofflowmgr.hh"
6
7namespace dw {
8
9namespace oof {
10
78{
79protected:
81 static const char *OOFM_NAME[NUM_OOFM];
84
86 {
87 private:
88 enum { NUM_SECTIONS = NUM_OOFM + 1 };
89 int sectionIndex; // 0 means in flow, otherwise OOFM index + 1
90 int index;
91
92 int numParts (int sectionIndex, int numContentsInFlow = -1);
94
95 protected:
96 virtual int numContentsInFlow () = 0;
97 virtual void getContentInFlow (int index, core::Content *content) = 0;
98
99 void setValues (int sectionIndex, int index);
101 { other->setValues (sectionIndex, index); }
102
103 inline bool inFlow () { return sectionIndex == 0; }
104 inline int getInFlowIndex () { assert (inFlow ()); return index; }
105 void highlightOOF (int start, int end, core::HighlightLayer layer);
106 void unhighlightOOF (int direction, core::HighlightLayer layer);
107 void getAllocationOOF (int start, int end, core::Allocation *allocation);
108
109 public:
111 bool atEnd, int numContentsInFlow);
112
115
116 bool next ();
117 bool prev ();
118 };
119
120 inline bool isParentRefOOF (int parentRef)
121 { return parentRef != -1 && (parentRef & PARENT_REF_OOFM_MASK); }
122
123 inline int makeParentRefInFlow (int inFlowSubRef)
124 { return (inFlowSubRef << PARENT_REF_OOFM_BITS); }
126 { assert (!isParentRefOOF (parentRef));
128
129 inline int makeParentRefOOF (int oofmIndex, int oofmSubRef)
130 { return (oofmSubRef << PARENT_REF_OOFM_BITS) | (oofmIndex + 1); }
132 { assert (isParentRefOOF (parentRef));
135 { assert (isParentRefOOF (parentRef));
136 return (parentRef & PARENT_REF_OOFM_MASK) - 1; }
139
140 inline bool isWidgetOOF (Widget *widget)
141 { return isParentRefOOF (widget->parentRef); }
142
143 inline int getWidgetInFlowSubRef (Widget *widget)
144 { return getParentRefInFlowSubRef (widget->parentRef); }
145
146 inline int getWidgetOOFSubRef (Widget *widget)
147 { return getParentRefOOFSubRef (widget->parentRef); }
148 inline int getWidgetOOFIndex (Widget *widget)
149 { return getParentRefOOFIndex (widget->parentRef); }
151 { return getParentRefOutOfFlowMgr (widget->parentRef); }
152
156
157 inline OutOfFlowMgr *searchOutOfFlowMgr (int oofmIndex)
158 { return oofContainer[oofmIndex] ?
159 oofContainer[oofmIndex]->outOfFlowMgr[oofmIndex] : NULL; }
160
161 static int getOOFMIndex (Widget *widget);
162
163 void initOutOfFlowMgrs ();
165 void (*splitHeightFun) (int, int*, int*));
168 void sizeAllocateEnd ();
170
171 virtual void drawLevel (core::View *view, core::Rectangle *area, int level,
172 core::DrawingContext *context);
173 void drawOOF (core::View *view, core::Rectangle *area,
174 core::DrawingContext *context);
175
176 Widget *getWidgetAtPoint (int x, int y,
178 virtual Widget *getWidgetAtPointLevel (int x, int y, int level,
180 *context);
181 Widget *getWidgetOOFAtPoint (int x, int y,
183
184 static bool isOOFContainer (Widget *widget, int oofmIndex);
185
186 void notifySetAsTopLevel();
187 void notifySetParent();
188
189 void removeChild (Widget *child);
190
192
193public:
194 enum {
197
198 static int CLASS_ID;
199
202
203 static const char *stackingLevelText (int level);
204
207
214
219
221 { // Second part is equivalent to testStylePositioned(), but we still keep
222 // the two seperately.
226
227 static inline bool testWidgetFloat (Widget *widget)
228 { return testStyleFloat (widget->getStyle ()); }
229
230 static inline bool testWidgetAbsolutelyPositioned (Widget *widget)
231 { return testStyleAbsolutelyPositioned (widget->getStyle ()); }
232 static inline bool testWidgetFixedlyPositioned (Widget *widget)
233 { return testStyleFixedlyPositioned (widget->getStyle ()); }
234 static inline bool testWidgetRelativelyPositioned (Widget *widget)
235 { return testStyleRelativelyPositioned (widget->getStyle ()); }
236
237 static inline bool testWidgetPositioned (Widget *widget)
238 { return testStylePositioned (widget->getStyle ()); }
239
240 static inline bool testWidgetOutOfFlow (Widget *widget)
241 { return testStyleOutOfFlow (widget->getStyle ()); }
242
245
247
248 void draw (core::View *view, core::Rectangle *area,
249 core::DrawingContext *context);
250
255 virtual void updateReference (int ref);
256
263 virtual void widgetRefSizeChanged (int externalIndex);
264
269 virtual void oofSizeChanged (bool extremesChanged);
270
275 virtual int getGeneratorX (int oofmIndex);
276
281 virtual int getGeneratorY (int oofmIndex);
282
287 virtual int getGeneratorWidth ();
288
289 virtual int getMaxGeneratorWidth ();
290
291 virtual bool usesMaxGeneratorWidth ();
292
293 virtual bool isPossibleOOFContainer (int oofmIndex);
294
295 virtual bool isPossibleOOFContainerParent (int oofmIndex);
296};
297
298} // namespace oof
299
300} // namespace dw
301
302#endif // __DW_OOFAWAREWIDGET_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
Iterators are used to iterate through the contents of a widget.
Definition iterator.hh:20
Content::Type mask
Definition iterator.hh:30
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
Extremes extremes
Analogue to dw::core::Widget::requisition.
Definition widget.hh:166
Allocation allocation
The current allocation: size and position, always relative to the canvas.
Definition widget.hh:204
int parentRef
This value is defined by the parent widget, and used for incremential resizing.
Definition widget.hh:195
Requisition requisition
Size_request() stores the result of the last call of size_request_impl().
Definition widget.hh:160
bool extremesChanged()
Definition widget.hh:474
style::Style * style
Definition widget.hh:150
virtual void getContentInFlow(int index, core::Content *content)=0
void getPart(int sectionIndex, int index, core::Content *content)
int numParts(int sectionIndex, int numContentsInFlow=-1)
void cloneValues(OOFAwareWidgetIterator *other)
int compareTo(lout::object::Comparable *other)
Compare two objects, this and other.
void unhighlightOOF(int direction, core::HighlightLayer layer)
bool next()
Move iterator forward and store content it.
void getAllocationOOF(int start, int end, core::Allocation *allocation)
void highlightOOF(int start, int end, core::HighlightLayer layer)
void intoStringBuffer(lout::misc::StringBuffer *sb)
Store a textual representation of the object in a misc::StringBuffer.
bool prev()
Move iterator backward and store content it.
Base class for widgets which can act as container and generator for widgets out of flow.
void notifySetAsTopLevel()
This method is called after a widget has been set as the top of a widget tree.
static bool testStyleRelativelyPositioned(core::style::Style *style)
static bool testWidgetFixedlyPositioned(Widget *widget)
Widget * getWidgetOOFAtPoint(int x, int y, core::GettingWidgetAtPointContext *context)
virtual int getMaxGeneratorWidth()
OutOfFlowMgr * outOfFlowMgr[NUM_OOFM]
virtual Widget * getWidgetAtPointLevel(int x, int y, int level, core::GettingWidgetAtPointContext *context)
virtual int getGeneratorX(int oofmIndex)
Return position relative to container, not regarding margin/border/padding, Called by OOFFloatsMgr to...
int getParentRefInFlowSubRef(int parentRef)
virtual void drawLevel(core::View *view, core::Rectangle *area, int level, core::DrawingContext *context)
virtual void updateReference(int ref)
Update content in flow, down from ref.
void draw(core::View *view, core::Rectangle *area, core::DrawingContext *context)
Area is given in widget coordinates.
void sizeAllocateStart(core::Allocation *allocation)
OutOfFlowMgr * searchOutOfFlowMgr(int oofmIndex)
virtual int getGeneratorWidth()
Return width including margin/border/padding Called by OOFFloatsMgr to position floats.
Widget * getWidgetAtPoint(int x, int y, core::GettingWidgetAtPointContext *context)
bool isWidgetOOF(Widget *widget)
bool doesWidgetOOFInterruptDrawing(Widget *widget)
virtual void oofSizeChanged(bool extremesChanged)
Called by an implementation of dw::oof::OutOfFlowMgr when the size of the container has changed,...
static bool testWidgetAbsolutelyPositioned(Widget *widget)
bool isParentRefOOF(int parentRef)
static const char * stackingLevelText(int level)
oof::OutOfFlowMgr * getWidgetOutOfFlowMgr(Widget *widget)
OOFAwareWidget * oofContainer[NUM_OOFM]
virtual bool adjustExtraSpaceWhenCorrectingRequisitionByOOF()
static bool isOOFContainer(Widget *widget, int oofmIndex)
static bool testStylePositioned(core::style::Style *style)
void correctRequisitionByOOF(core::Requisition *requisition, void(*splitHeightFun)(int, int *, int *))
void removeChild(Widget *child)
int getParentRefOOFSubRef(int parentRef)
virtual bool isPossibleOOFContainer(int oofmIndex)
void notifySetParent()
This method is called after a widget has been added to a parent.
int getParentRefOOFIndex(int parentRef)
virtual void widgetRefSizeChanged(int externalIndex)
Called by an implementation of dw::oof::OutOfFlowMgr (actually only OOFPosRelMgr) for the generator o...
int makeParentRefOOF(int oofmIndex, int oofmSubRef)
void correctExtremesByOOF(core::Extremes *extremes)
static const char * OOFM_NAME[NUM_OOFM]
static int getOOFMIndex(Widget *widget)
int getWidgetOOFSubRef(Widget *widget)
oof::OutOfFlowMgr * getParentRefOutOfFlowMgr(int parentRef)
core::Requisition requisitionWithoutOOF
static bool testWidgetFloat(Widget *widget)
static bool testStyleFloat(core::style::Style *style)
static bool testStyleFixedlyPositioned(core::style::Style *style)
static bool testStyleOutOfFlow(core::style::Style *style)
virtual bool usesMaxGeneratorWidth()
static bool testWidgetPositioned(Widget *widget)
static bool testWidgetOutOfFlow(Widget *widget)
int makeParentRefInFlow(int inFlowSubRef)
int getWidgetInFlowSubRef(Widget *widget)
core::Requisition * getRequisitionWithoutOOF()
void drawOOF(core::View *view, core::Rectangle *area, core::DrawingContext *context)
int getWidgetOOFIndex(Widget *widget)
virtual int getGeneratorY(int oofmIndex)
Return position relative to container, not regarding margin/border/padding, Called by OOFFloatsMgr to...
static bool testStyleAbsolutelyPositioned(core::style::Style *style)
virtual bool isPossibleOOFContainerParent(int oofmIndex)
static bool testWidgetRelativelyPositioned(Widget *widget)
Represents additional data for OOF containers.
A class for fast concatenation of a large number of strings.
Definition misc.hh:570
Instances of a sub class of may be compared (less, greater).
Definition object.hh:42
HighlightLayer
Definition types.hh:43
Dw is in this namespace, or sub namespaces of this one.
@ IMPL_POS
Definition core.hh:16
Represents the allocation, i.e.
Definition types.hh:164