aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dw/textblock.cc31
-rw-r--r--dw/textblock.hh1
-rw-r--r--dw/widget.cc31
3 files changed, 28 insertions, 35 deletions
diff --git a/dw/textblock.cc b/dw/textblock.cc
index 84e58f86..594e74fe 100644
--- a/dw/textblock.cc
+++ b/dw/textblock.cc
@@ -774,37 +774,6 @@ int Textblock::getAvailWidthOfChild (Widget *child)
return width;
}
-int Textblock::getAvailHeightOfChild (Widget *child)
-{
- // TODO Implement also for ListItem (subtract space for bullet).
- // 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 a textblock will not 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;
-}
-
bool Textblock::buttonPressImpl (core::EventButton *event)
{
return sendSelectionEvent (core::SelectionState::BUTTON_PRESS, event);
diff --git a/dw/textblock.hh b/dw/textblock.hh
index 96fbc7dc..2f35acb5 100644
--- a/dw/textblock.hh
+++ b/dw/textblock.hh
@@ -750,7 +750,6 @@ protected:
void markExtremesChange (int ref);
int getAvailWidthOfChild (Widget *child);
- int getAvailHeightOfChild (Widget *child);
void notifySetAsTopLevel();
void notifySetParent();
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,