aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dw/oofawarewidget.cc23
-rw-r--r--dw/oofawarewidget.hh21
-rw-r--r--dw/table.cc27
3 files changed, 58 insertions, 13 deletions
diff --git a/dw/oofawarewidget.cc b/dw/oofawarewidget.cc
index a71b3f0d..edecb12f 100644
--- a/dw/oofawarewidget.cc
+++ b/dw/oofawarewidget.cc
@@ -255,6 +255,29 @@ Widget *OOFAwareWidget::getWidgetOOFAtPoint (int x, int y, int level)
return NULL;
}
+
+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::borderChanged (int y, Widget *vloat)
{
assertNotReached ();
diff --git a/dw/oofawarewidget.hh b/dw/oofawarewidget.hh
index 9421bae0..32de4868 100644
--- a/dw/oofawarewidget.hh
+++ b/dw/oofawarewidget.hh
@@ -31,9 +31,19 @@ namespace oof {
* - dw::oof::OOFAwareWidget::getWidgetOOFAtPoint (from
* dw::core::Widget::getWidgetAtPoint)
*
- * See dw::Textblock on how this is done best. For both generators and
- * containers of floats (which is only implemented by dw::Textblock)
- * it gets a bit more complicated.
+ * See dw::Textblock on how this is done best.
+ *
+ * Furthermore, 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
+ * dw::core::Widget::correctExtremesOfChild? Currently, all widgets
+ * are used the default implementation.)
+ *
+ * For both generators
+ * and containers of floats (which is only implemented by
+ * dw::Textblock) it gets a bit more complicated.
*/
class OOFAwareWidget: public core::Widget
{
@@ -104,10 +114,13 @@ protected:
void drawOOF (core::View *view, core::Rectangle *area);
core::Widget *getWidgetOOFAtPoint (int x, int y, int level);
+ static bool isOOFContainer (Widget *widget, int oofmIndex);
+
void notifySetAsTopLevel();
void notifySetParent();
- static bool isOOFContainer (Widget *widget, int oofmIndex);
+ int getAvailWidthOfChild (Widget *child, bool forceValue);
+ int getAvailHeightOfChild (Widget *child, bool forceValue);
public:
static int CLASS_ID;
diff --git a/dw/table.cc b/dw/table.cc
index a59c0120..899bfe89 100644
--- a/dw/table.cc
+++ b/dw/table.cc
@@ -229,15 +229,22 @@ int Table::getAvailWidthOfChild (Widget *child, bool forceValue)
int width;
- // Unlike other containers, the table widget sometimes narrows
- // columns to a width less than specified by CSS (see
- // forceCalcCellSizes). For this reason, the column widths have to
- // be calculated in all cases.
- if (forceValue) {
- calcCellSizes (false);
- width = calcAvailWidthForDescendant (child);
- } else
- width = -1;
+ if (isWidgetOOF(child)) {
+ assert (getWidgetOutOfFlowMgr(child) &&
+ getWidgetOutOfFlowMgr(child)->dealingWithSizeOfChild (child));
+ width =
+ getWidgetOutOfFlowMgr(child)->getAvailWidthOfChild (child, forceValue);
+ } else {
+ // Unlike other containers, the table widget sometimes narrows
+ // columns to a width less than specified by CSS (see
+ // forceCalcCellSizes). For this reason, the column widths have to
+ // be calculated in all cases.
+ if (forceValue) {
+ calcCellSizes (false);
+ width = calcAvailWidthForDescendant (child);
+ } else
+ width = -1;
+ }
DBG_OBJ_MSGF ("resize", 1, "=> %d", width);
DBG_OBJ_LEAVE ();
@@ -479,6 +486,8 @@ void Table::addCell (Widget *widget, int colspan, int rowspan)
curCol += colspanEff;
+ widget->parentRef = makeParentRefInFlow (0);
+
widget->setParent (this);
if (rowStyle->get (curRow))
widget->setBgColor (rowStyle->get(curRow)->backgroundColor);