diff options
author | Sebastian Geerken <devnull@localhost> | 2014-06-02 00:27:52 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2014-06-02 00:27:52 +0200 |
commit | d7e3919ec130ef3684a5fc1344cbc047f63b61f3 (patch) | |
tree | 3c7a6ffbc648147d9812c9d75884a54bc4f620a9 /dw/widget.cc | |
parent | 0b8eaee1a82718d9fe7faab78aa57ab43c29a7be (diff) |
Reorganisation again.
Diffstat (limited to 'dw/widget.cc')
-rw-r--r-- | dw/widget.cc | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/dw/widget.cc b/dw/widget.cc index 8dab44ad..235e99b9 100644 --- a/dw/widget.cc +++ b/dw/widget.cc @@ -960,9 +960,34 @@ int Widget::getAvailWidthOfChild (Widget *child) int Widget::getAvailHeightOfChild (Widget *child) { - // Must be implemented for possible containers. - misc::assertNotReached (); - return 0; + // Again, a suitable implementation for all widgets (perhaps). + + // TODO Correct by extremes? + + DBG_OBJ_MSGF ("resize", 0, "<b>getAvailHeightOfChild</b> (%p)", child); + DBG_OBJ_MSG_START (); + + int height; + + if (core::style::isAbsLength (child->getStyle()->height)) + // TODO What does "height" exactly stand for? (Content or all?) + height = core::style::absLengthVal (child->getStyle()->height); + else { + int containerHeight = getAvailHeight () - boxDiffHeight (); + if (core::style::isPerLength (child->getStyle()->height)) + height = + core::style::multiplyWithPerLength (containerHeight, + child->getStyle()->height); + else + // Although no widget will probably use the whole height, we + // have to return some value here. + height = containerHeight; + } + + DBG_OBJ_MSGF ("resize", 1, "=> %d", height); + DBG_OBJ_MSG_END (); + + return height; } void Widget::correctRequisitionOfChild (Widget *child, Requisition *requisition, |