Dillo
stackingcontextmgr.hh
Go to the documentation of this file.
1 #ifndef __DW_STACKINGCONTEXTMGR_HH__
2 #define __DW_STACKINGCONTEXTMGR_HH__
3 
4 #ifndef __INCLUDED_FROM_DW_CORE_HH__
5 # error Do not include this file directly, use "core.hh" instead.
6 #endif
7 
8 #include "../lout/container.hh"
9 
10 #include <limits.h>
11 
12 namespace dw {
13 
14 namespace core {
15 
20 {
21 private:
25 
26  int findZIndex (int zIndex, bool mustExist);
27  void draw (View *view, Rectangle *area, int startZIndex, int endZIndex,
28  DrawingContext *context);
29  Widget *getWidgetAtPoint (int x, int y,
31  int startZIndex, int endZIndex);
32 
33 public:
34  StackingContextMgr (Widget *widget);
36 
37  inline static bool isEstablishingStackingContext (Widget *widget) {
38  return IMPL_POS &&
40  widget->getStyle()->zIndex != style::Z_INDEX_AUTO;
41  }
42 
43  inline static bool handledByStackingContextMgr (Widget *widget) {
44  // Each widget establishing a stacking context is child of another
45  // stacking context, so drawn by StackingContextMgr::drawTop or
46  // StackingContextMgr::drawBottom etc.
47  return widget->getParent () != NULL
49  }
50 
51  void addChildSCWidget (Widget *widget);
52 
53  inline int getNumZIndices () { return numZIndices; }
54  inline int getNumChildSCWidgets () { return childSCWidgets->size (); }
55 
56  inline void drawBottom (View *view, Rectangle *area, DrawingContext *context)
57  { draw (view, area, INT_MIN, -1, context); }
58  void drawTop (View *view, Rectangle *area, DrawingContext *context)
59  { draw (view, area, 0, INT_MAX, context); }
60 
61  inline Widget *getTopWidgetAtPoint (int x, int y,
63  *context)
64  { return getWidgetAtPoint (x, y, context, 0, INT_MAX); }
65 
66  inline Widget *getBottomWidgetAtPoint (int x, int y,
68  *context)
69  { return getWidgetAtPoint (x, y, context, INT_MIN, -1); }
70 };
71 
72 } // namespace core
73 
74 } // namespace dw
75 
76 #endif // __DW_STACKINGCONTEXTMGR_HH__
int getNumChildSCWidgets()
Definition: stackingcontextmgr.hh:54
Typed version of container::untyped::Vector.
Definition: container.hh:425
Set at the top when getting the widget at the point.
Definition: types.hh:312
dw::core::Shape implemtation for simple rectangles.
Definition: types.hh:69
Definition: style.hh:344
Widget * getParent()
Definition: widget.hh:552
static bool handledByStackingContextMgr(Widget *widget)
Definition: stackingcontextmgr.hh:43
int size()
Definition: container.hh:418
See Handling stacking contexts.
Definition: stackingcontextmgr.hh:19
Widget * getBottomWidgetAtPoint(int x, int y, core::GettingWidgetAtPointContext *context)
Definition: stackingcontextmgr.hh:66
Widget * getTopWidgetAtPoint(int x, int y, core::GettingWidgetAtPointContext *context)
Definition: stackingcontextmgr.hh:61
static bool isEstablishingStackingContext(Widget *widget)
Definition: stackingcontextmgr.hh:37
The base class of all dillo widgets.
Definition: widget.hh:23
Set at the top when drawing.
Definition: types.hh:294
Widget * widget
Definition: stackingcontextmgr.hh:22
void drawBottom(View *view, Rectangle *area, DrawingContext *context)
Definition: stackingcontextmgr.hh:56
StackingContextMgr(Widget *widget)
Definition: stackingcontextmgr.cc:31
'z-index' is stored as int; use this for the value 'auto'.
Definition: style.hh:387
void addChildSCWidget(Widget *widget)
Definition: stackingcontextmgr.cc:53
int findZIndex(int zIndex, bool mustExist)
Definition: stackingcontextmgr.cc:86
int * zIndices
Definition: stackingcontextmgr.hh:24
Widget * getWidgetAtPoint(int x, int y, core::GettingWidgetAtPointContext *context, int startZIndex, int endZIndex)
Definition: stackingcontextmgr.cc:156
int getNumZIndices()
Definition: stackingcontextmgr.hh:53
int zIndex
Definition: style.hh:569
Definition: core.hh:16
Dw is in this namespace, or sub namespaces of this one.
Definition: alignedtablecell.cc:28
An interface to encapsulate platform dependent drawing.
Definition: view.hh:16
int numZIndices
Definition: stackingcontextmgr.hh:24
lout::container::typed::Vector< Widget > * childSCWidgets
Definition: stackingcontextmgr.hh:23
void drawTop(View *view, Rectangle *area, DrawingContext *context)
Definition: stackingcontextmgr.hh:58
Position position
Definition: style.hh:552
~StackingContextMgr()
Definition: stackingcontextmgr.cc:45
void draw(View *view, Rectangle *area, int startZIndex, int endZIndex, DrawingContext *context)
Definition: stackingcontextmgr.cc:123
style::Style * getStyle()
Definition: widget.hh:448