aboutsummaryrefslogtreecommitdiff
path: root/dw/widget.cc
diff options
context:
space:
mode:
Diffstat (limited to 'dw/widget.cc')
-rw-r--r--dw/widget.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/dw/widget.cc b/dw/widget.cc
index 5ff02e22..891ec08b 100644
--- a/dw/widget.cc
+++ b/dw/widget.cc
@@ -334,6 +334,24 @@ void Widget::sizeRequest (Requisition *requisition)
DBG_OBJ_MSG_END ();
}
+int Widget::getAvailWidth ()
+{
+ // TODO Correct by extremes?
+ // TODO Border, padding etc.? (Relevant here?)
+
+ if (container == NULL) {
+ // TODO Consider nested layouts (e. g. <button>).
+ if (style::isAbsLength (getStyle()->width))
+ return style::absLengthVal (getStyle()->width);
+ else if (style::isPerLength (getStyle()->width))
+ return style::multiplyWithPerLength (layout->viewportWidth,
+ getStyle()->width);
+ else
+ return layout->viewportWidth;
+ } else
+ return container->getAvailWidthOfChild (this);
+}
+
/**
* \brief Wrapper for Widget::getExtremesImpl().
*/
@@ -811,6 +829,13 @@ void Widget::markExtremesChange (int ref)
{
}
+int Widget::getAvailWidthOfChild (Widget *child)
+{
+ // Must be implemented for block-level widgets.
+ misc::assertNotReached ();
+ return 0;
+}
+
/**
* \brief This method is called after a widget has been set as the top of a
* widget tree.