aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/dw-miscellaneous.doc25
-rw-r--r--dw/oofawarewidget.cc22
-rw-r--r--dw/oofawarewidget.hh21
-rw-r--r--dw/oofposrelmgr.cc29
-rw-r--r--dw/oofposrelmgr.hh3
5 files changed, 41 insertions, 59 deletions
diff --git a/doc/dw-miscellaneous.doc b/doc/dw-miscellaneous.doc
index e6dcf4c0..a94ca504 100644
--- a/doc/dw-miscellaneous.doc
+++ b/doc/dw-miscellaneous.doc
@@ -136,15 +136,24 @@ Positioned elements outside of the container
Relative positions
------------------
-Relatively positioned elements are currently not supported. Some notes
-for an implementation:
-
-- It is important to find a suitable parent widget. Ideas described in
- \ref dw-pos-elements-outside-container may be useful.
- At the original position, a space as large as the positioned element
- should be left. This may be implemented by assigning a size to the
- widget *reference*. Also, handling changes of the size of the
- positioned element may become tricky.
+ is left. This is implemented by assigning a size to the widget
+ *reference*. For this there are two new methods:
+ dw::oof::OutOfFlowMgr::calcWidgetRefSize and
+ dw::oof::OOFAwareWidget::widgetRefSizeChanged.
+
+- **Bug:** Since the size of a relatively positioned element should be
+ calculated as if it was in flow, the available width should be
+ delegated to the *generator*; however, since
+ dw::oof::OOFPosRelMgr::dealingWithSizeOfChild returns *false* in all
+ cases, it is delegated to the *container*. **Idea for fix:**
+ dw::oof::OOFPosRelMgr::dealingWithSizeOfChild should return *false*
+ if and only if the generator of the child is the container (to
+ prevent an endless recursion). In other cases,
+ dw::oof::OOFPosRelMgr::getAvailWidthOfChild and
+ dw::oof::OOFPosRelMgr::getAvailHeightOfChild should directly call
+ the respective methods of the *generator*, which must be made public
+ then.
Fixed positions
---------------
diff --git a/dw/oofawarewidget.cc b/dw/oofawarewidget.cc
index 3e51600f..885bd790 100644
--- a/dw/oofawarewidget.cc
+++ b/dw/oofawarewidget.cc
@@ -512,28 +512,6 @@ Widget *OOFAwareWidget::getWidgetOOFAtPoint (int x, int y,
return widgetAtPoint;
}
-int OOFAwareWidget::getAvailWidthOfChild (Widget *child, bool forceValue)
-{
- if (isWidgetOOF(child)) {
- assert (getWidgetOutOfFlowMgr(child) &&
- getWidgetOutOfFlowMgr(child)->dealingWithSizeOfChild (child));
- return getWidgetOutOfFlowMgr(child)->getAvailWidthOfChild (child,
- forceValue);
- } else
- return Widget::getAvailWidthOfChild (child, forceValue);
-}
-
-int OOFAwareWidget::getAvailHeightOfChild (Widget *child, bool forceValue)
-{
- if (isWidgetOOF(child)) {
- assert (getWidgetOutOfFlowMgr(child) &&
- getWidgetOutOfFlowMgr(child)->dealingWithSizeOfChild (child));
- return getWidgetOutOfFlowMgr(child)->getAvailHeightOfChild (child,
- forceValue);
- } else
- return Widget::getAvailWidthOfChild (child, forceValue);
-}
-
void OOFAwareWidget::removeChild (Widget *child)
{
// Sub classes should implement this method (and Textblock and
diff --git a/dw/oofawarewidget.hh b/dw/oofawarewidget.hh
index 9ac83eee..8b7c1fde 100644
--- a/dw/oofawarewidget.hh
+++ b/dw/oofawarewidget.hh
@@ -38,9 +38,19 @@ namespace oof {
*
* - Implementations of dw::core::Widget::getAvailWidthOfChild and
* dw::core::Widget::getAvailHeightOfChild have to distinguish
- * between widgets in flow and out of flow; see implementations of
- * dw::oof::OOFAwareWidget. (Open issue: What about
- * dw::core::Widget::correctRequisitionOfChild and
+ * between widgets in flow and out of flow; general pattern:
+ *
+ * \code
+ * if (isWidgetOOF (child) && getWidgetOutOfFlowMgr(child) &&
+ * getWidgetOutOfFlowMgr(child)->dealingWithSizeOfChild (child))
+ * width =
+ * getWidgetOutOfFlowMgr(child)->getAvailWidthOfChild (child,forceValue);
+ * else {
+ * // ... specific implementation ...
+ * \endcode
+ *
+ * See also implementations of dw::Textblock and dw::Table. (Open
+ * issue: What about dw::core::Widget::correctRequisitionOfChild and
* dw::core::Widget::correctExtremesOfChild? Currently, all widgets
* are used the default implementation.)
*
@@ -228,11 +238,6 @@ public:
static inline bool testWidgetOutOfFlow (Widget *widget)
{ return testStyleOutOfFlow (widget->getStyle ()); }
- // These two methods (which are protected in Widget) are made public
- // for OOFPosRelMgr.
- int getAvailWidthOfChild (Widget *child, bool forceValue);
- int getAvailHeightOfChild (Widget *child, bool forceValue);
-
bool doesWidgetOOFInterruptDrawing (Widget *widget);
void draw (core::View *view, core::Rectangle *area,
diff --git a/dw/oofposrelmgr.cc b/dw/oofposrelmgr.cc
index 5f70c2c3..f1bae6d8 100644
--- a/dw/oofposrelmgr.cc
+++ b/dw/oofposrelmgr.cc
@@ -167,32 +167,21 @@ int OOFPosRelMgr::getChildPosDim (style::Length posCssValue,
return refPos + diff;
}
-int OOFPosRelMgr::getAvailWidthOfChild (Widget *child, bool forceValue)
+bool OOFPosRelMgr::dealingWithSizeOfChild (Widget *child)
{
- DBG_OBJ_ENTER ("resize.oofm", 0, "getAvailWidthOfChild", "%p, %s",
- child, boolToStr (forceValue));
-
- TypedPointer<Widget> key (child);
- Child *tshild = childrenByWidget->get (&key);
- assert (tshild);
- int width = tshild->generator->getAvailWidthOfChild (child, forceValue);
+ return false;
+}
- DBG_OBJ_LEAVE_VAL ("%d", width);
- return width;
+int OOFPosRelMgr::getAvailWidthOfChild (Widget *child, bool forceValue)
+{
+ assertNotReached ();
+ return 0;
}
int OOFPosRelMgr::getAvailHeightOfChild (Widget *child, bool forceValue)
{
- DBG_OBJ_ENTER ("resize.oofm", 0, "getAvailWidthOfChild", "%p, %s",
- child, boolToStr (forceValue));
-
- TypedPointer<Widget> key (child);
- Child *tshild = childrenByWidget->get (&key);
- assert (tshild);
- int height = tshild->generator->getAvailHeightOfChild (child, forceValue);
-
- DBG_OBJ_LEAVE_VAL ("%d", height);
- return height;
+ assertNotReached ();
+ return 0;
}
bool OOFPosRelMgr::isReference (Widget *widget)
diff --git a/dw/oofposrelmgr.hh b/dw/oofposrelmgr.hh
index fa58add3..bd70ddeb 100644
--- a/dw/oofposrelmgr.hh
+++ b/dw/oofposrelmgr.hh
@@ -46,7 +46,8 @@ public:
int *oofHeight);
void getExtremes (core::Extremes *containerExtr, int *oofMinWidth,
int *oofMaxWidth);
-
+
+ bool dealingWithSizeOfChild (core::Widget *child);
int getAvailWidthOfChild (core::Widget *child, bool forceValue);
int getAvailHeightOfChild (core::Widget *child, bool forceValue);
};