aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2015-01-23 21:28:59 +0100
committerSebastian Geerken <devnull@localhost>2015-01-23 21:28:59 +0100
commite497d315b87a42184dce3f9b90e495b3a3806b14 (patch)
tree7709c3680197e471fdbcbcb6437c6ad64fbde676
parent9d17539aa2d7c7b00ae08cdd0615ff6ea84493fc (diff)
StackingProcessingContext, GettingWidgetAtPointContext.
-rw-r--r--dw/ooffloatsmgr.cc2
-rw-r--r--dw/oofpositionedmgr.cc2
-rw-r--r--dw/types.hh55
-rw-r--r--dw/widget.cc2
4 files changed, 44 insertions, 17 deletions
diff --git a/dw/ooffloatsmgr.cc b/dw/ooffloatsmgr.cc
index f9e7b0d0..5f0d9eff 100644
--- a/dw/ooffloatsmgr.cc
+++ b/dw/ooffloatsmgr.cc
@@ -1315,7 +1315,7 @@ void OOFFloatsMgr::drawFloats (SortedFloatsVector *list, View *view,
Widget *childWidget = vloat->getWidget ();
Rectangle childArea;
- if (!context->hasWidgetBeenDrawnAsInterruption (childWidget) &&
+ if (!context->hasWidgetBeenProcessedAsInterruption (childWidget) &&
!StackingContextMgr::handledByStackingContextMgr (childWidget) &&
childWidget->intersects (container, area, &childArea))
childWidget->draw (view, &childArea, context);
diff --git a/dw/oofpositionedmgr.cc b/dw/oofpositionedmgr.cc
index 28d5aac7..10c48b1e 100644
--- a/dw/oofpositionedmgr.cc
+++ b/dw/oofpositionedmgr.cc
@@ -225,7 +225,7 @@ void OOFPositionedMgr::draw (View *view, Rectangle *area,
Child *child = children->get(i);
Rectangle childArea;
- if (!context->hasWidgetBeenDrawnAsInterruption (child->widget) &&
+ if (!context->hasWidgetBeenProcessedAsInterruption (child->widget) &&
!StackingContextMgr::handledByStackingContextMgr (child->widget) &&
child->widget->intersects (container, area, &childArea))
child->widget->draw (view, &childArea, context);
diff --git a/dw/types.hh b/dw/types.hh
index c68ad781..481f4804 100644
--- a/dw/types.hh
+++ b/dw/types.hh
@@ -238,37 +238,64 @@ struct Content
};
/**
- * Set at the top when drawing. See \ref dw-interrupted-drawing for details.
+ * \brief Base class for dw::core::DrawingContext and
+ * dw::core::GettingWidgetAtPointContext.
+ *
+ * Not to be confused with the *stacking context* as defined by CSS.
*/
-class DrawingContext
+class StackingProcessingContext
{
private:
- Rectangle toplevelArea;
lout::container::typed::HashSet<lout::object::TypedPointer<Widget> >
- *widgetsDrawnAsInterruption;
+ *widgetsProcessedAsInterruption;
public:
- inline DrawingContext (Rectangle *toplevelArea) {
- this->toplevelArea = *toplevelArea;
- widgetsDrawnAsInterruption =
+ inline StackingProcessingContext () {
+ widgetsProcessedAsInterruption =
new lout::container::typed::HashSet<lout::object::
TypedPointer<Widget> > (true);
}
- inline ~DrawingContext () { delete widgetsDrawnAsInterruption; }
+ inline ~StackingProcessingContext ()
+ { delete widgetsProcessedAsInterruption; }
- inline Rectangle *getToplevelArea () { return &toplevelArea; }
-
- inline bool hasWidgetBeenDrawnAsInterruption (Widget *widget) {
+ inline bool hasWidgetBeenProcessedAsInterruption (Widget *widget) {
lout::object::TypedPointer<Widget> key (widget);
- return widgetsDrawnAsInterruption->contains (&key);
+ return widgetsProcessedAsInterruption->contains (&key);
}
- inline void addWidgetDrawnAsInterruption (Widget *widget) {
+ inline void addWidgetProcessedAsInterruption (Widget *widget) {
lout::object::TypedPointer<Widget> *key =
new lout::object::TypedPointer<Widget> (widget);
- return widgetsDrawnAsInterruption->put (key);
+ return widgetsProcessedAsInterruption->put (key);
+ }
+};
+
+/**
+ * \brief Set at the top when drawing.
+ *
+ * See \ref dw-interrupted-drawing for details.
+ */
+class DrawingContext: public StackingProcessingContext
+{
+private:
+ Rectangle toplevelArea;
+
+public:
+ inline DrawingContext (Rectangle *toplevelArea) {
+ this->toplevelArea = *toplevelArea;
}
+
+ inline Rectangle *getToplevelArea () { return &toplevelArea; }
+};
+
+/**
+ * \brief Set at the top when getting the widget at the point.
+ *
+ * Similar to dw::core::DrawingContext.
+ */
+class GettingWidgetAtPointContext: public StackingProcessingContext
+{
};
} // namespace core
diff --git a/dw/widget.cc b/dw/widget.cc
index 9188f997..00ce8d97 100644
--- a/dw/widget.cc
+++ b/dw/widget.cc
@@ -200,7 +200,7 @@ void Widget::drawInterruption (View *view, Rectangle *area,
if (intersects (layout->topLevel, context->getToplevelArea (), &thisArea))
draw (view, &thisArea, context);
- context->addWidgetDrawnAsInterruption (this);
+ context->addWidgetProcessedAsInterruption (this);
}
Widget *Widget::getWidgetAtPoint (int x, int y,