1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#ifndef __DW_STACKINGCONTEXTMGR_HH__
#define __DW_STACKINGCONTEXTMGR_HH__
#ifndef __INCLUDED_FROM_DW_CORE_HH__
# error Do not include this file directly, use "core.hh" instead.
#endif
#include "../lout/container.hh"
#include <limits.h>
namespace dw {
namespace core {
/**
* \brief See \ref dw-stacking-context.
*/
class StackingContextMgr
{
private:
Widget *widget;
lout::container::typed::Vector<Widget> *childSCWidgets;
int *zIndices, numZIndices;
int findZIndex (int zIndex, bool mustExist);
void draw (View *view, Rectangle *area, int startZIndex, int endZIndex,
DrawingContext *context);
Widget *getWidgetAtPoint (int x, int y, StackingIteratorStack *iteratorStack,
Widget **interruptedWidget, int *zIndexIndex,
int startZIndex, int endZIndex, int *index);
public:
StackingContextMgr (Widget *widget);
~StackingContextMgr ();
inline static bool isEstablishingStackingContext (Widget *widget) {
return widget->getStyle()->position != style::POSITION_STATIC &&
widget->getStyle()->zIndex != style::Z_INDEX_AUTO;
}
inline static bool handledByStackingContextMgr (Widget *widget) {
// Each widget establishing a stacking context is child of another
// stacking context, so drawn by StackingContextMgr::drawTop or
// StackingContextMgr::drawBottom etc.
return widget->getParent () != NULL
&& isEstablishingStackingContext (widget);
}
void addChildSCWidget (Widget *widget);
inline int getNumZIndices () { return numZIndices; }
inline int getNumChildSCWidgets () { return childSCWidgets->size (); }
inline void drawBottom (View *view, Rectangle *area, DrawingContext *context)
{ draw (view, area, INT_MIN, -1, context); }
void drawTop (View *view, Rectangle *area, DrawingContext *context)
{ draw (view, area, 0, INT_MAX, context); }
Widget *getTopWidgetAtPoint (int x, int y,
core::StackingIteratorStack *iteratorStack,
Widget **interruptedWidget,
int *zIndexIndex, int *index);
Widget *getBottomWidgetAtPoint (int x, int y,
core::StackingIteratorStack *iteratorStack,
Widget **interruptedWidget,
int *zIndexIndex, int *index);
};
} // namespace core
} // namespace dw
#endif // __DW_STACKINGCONTEXTMGR_HH__
|