aboutsummaryrefslogtreecommitdiff
path: root/dw/widget.cc
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2014-05-29 14:08:59 +0200
committerSebastian Geerken <devnull@localhost>2014-05-29 14:08:59 +0200
commit2f6d8aa3601505ad5490a212e75714abe3dcc77c (patch)
tree928a8558a1878e0a5267004f41f077757f4c5bc2 /dw/widget.cc
parent62fd27e851224c15bd41c1b70ad9710e2200c7bb (diff)
First step to an alternative to size hints.
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.