diff options
Diffstat (limited to 'dw')
-rw-r--r-- | dw/alignedtablecell.cc | 33 | ||||
-rw-r--r-- | dw/alignedtablecell.hh | 5 | ||||
-rw-r--r-- | dw/simpletablecell.cc | 31 | ||||
-rw-r--r-- | dw/simpletablecell.hh | 5 | ||||
-rw-r--r-- | dw/tablecell.cc | 29 | ||||
-rw-r--r-- | dw/tablecell.hh | 8 |
6 files changed, 111 insertions, 0 deletions
diff --git a/dw/alignedtablecell.cc b/dw/alignedtablecell.cc index 5e4b9e24..394b89df 100644 --- a/dw/alignedtablecell.cc +++ b/dw/alignedtablecell.cc @@ -84,6 +84,39 @@ int AlignedTableCell::getAvailHeightOfChild (Widget *child, bool forceValue) return height; } +void AlignedTableCell::correctRequisitionOfChild (Widget *child, + core::Requisition + *requisition, + void (*splitHeightFun) (int, + int*, + int*)) +{ + DBG_OBJ_ENTER ("resize", 0, "AlignedTableCell/correctRequisitionOfChild", + "%p, %d * (%d + %d), ...", child, requisition->width, + requisition->ascent, requisition->descent); + + AlignedTextblock::correctRequisitionOfChild (child, requisition, + splitHeightFun); + tablecell::correctCorrectedRequisitionOfChild (this, child, requisition, + splitHeightFun); + + DBG_OBJ_LEAVE (); +} + +void AlignedTableCell::correctExtremesOfChild (Widget *child, + core::Extremes *extremes) +{ + DBG_OBJ_ENTER ("resize", 0, "AlignedTableCell/correctExtremesOfChild", + "%p, %d (%d) / %d (%d)", + child, extremes->minWidth, extremes->minWidthIntrinsic, + extremes->maxWidth, extremes->maxWidthIntrinsic); + + AlignedTextblock::correctExtremesOfChild (child, extremes); + tablecell::correctCorrectedExtremesOfChild (this, child, extremes); + + DBG_OBJ_LEAVE (); +} + int AlignedTableCell::applyPerWidth (int containerWidth, core::style::Length perWidth) { diff --git a/dw/alignedtablecell.hh b/dw/alignedtablecell.hh index b49660ba..5ea606d7 100644 --- a/dw/alignedtablecell.hh +++ b/dw/alignedtablecell.hh @@ -15,6 +15,11 @@ protected: int getAvailWidthOfChild (Widget *child, bool forceValue); int getAvailHeightOfChild (Widget *child, bool forceValue); + void correctRequisitionOfChild (Widget *child, + core::Requisition *requisition, + void (*splitHeightFun) (int, int*, int*)); + void correctExtremesOfChild (Widget *child, core::Extremes *extremes); + bool getAdjustMinWidth (); int wordWrap (int wordIndex, bool wrapAll); diff --git a/dw/simpletablecell.cc b/dw/simpletablecell.cc index 2621c348..02f92db6 100644 --- a/dw/simpletablecell.cc +++ b/dw/simpletablecell.cc @@ -76,6 +76,37 @@ int SimpleTableCell::getAvailHeightOfChild (Widget *child, bool forceValue) return height; } +void SimpleTableCell::correctRequisitionOfChild (Widget *child, + core::Requisition *requisition, + void (*splitHeightFun) (int, + int*, + int*)) +{ + DBG_OBJ_ENTER ("resize", 0, "SimpleTableCell/correctRequisitionOfChild", + "%p, %d * (%d + %d), ...", child, requisition->width, + requisition->ascent, requisition->descent); + + Textblock::correctRequisitionOfChild (child, requisition, splitHeightFun); + tablecell::correctCorrectedRequisitionOfChild (this, child, requisition, + splitHeightFun); + + DBG_OBJ_LEAVE (); +} + +void SimpleTableCell::correctExtremesOfChild (Widget *child, + core::Extremes *extremes) +{ + DBG_OBJ_ENTER ("resize", 0, "SimpleTableCell/correctExtremesOfChild", + "%p, %d (%d) / %d (%d)", + child, extremes->minWidth, extremes->minWidthIntrinsic, + extremes->maxWidth, extremes->maxWidthIntrinsic); + + Textblock::correctExtremesOfChild (child, extremes); + tablecell::correctCorrectedExtremesOfChild (this, child, extremes); + + DBG_OBJ_LEAVE (); +} + int SimpleTableCell::applyPerWidth (int containerWidth, core::style::Length perWidth) { diff --git a/dw/simpletablecell.hh b/dw/simpletablecell.hh index f731ec9b..4c18b454 100644 --- a/dw/simpletablecell.hh +++ b/dw/simpletablecell.hh @@ -11,6 +11,11 @@ protected: int getAvailWidthOfChild (Widget *child, bool forceValue); int getAvailHeightOfChild (Widget *child, bool forceValue); + void correctRequisitionOfChild (Widget *child, + core::Requisition *requisition, + void (*splitHeightFun) (int, int*, int*)); + void correctExtremesOfChild (Widget *child, core::Extremes *extremes); + bool getAdjustMinWidth (); public: diff --git a/dw/tablecell.cc b/dw/tablecell.cc index 1c8e0d0d..5c34c781 100644 --- a/dw/tablecell.cc +++ b/dw/tablecell.cc @@ -74,6 +74,35 @@ int correctAvailHeightOfChild (core::Widget *widget, core::Widget *child, return height; } +void correctCorrectedRequisitionOfChild (core::Widget *widget, + core::Widget *child, + core::Requisition *requisition, + void (*splitHeightFun) (int, int*, + int*)) +{ + DBG_OBJ_ENTER_O ("resize", 0, widget, "tablecell/correctRequisitionOfChild", + "%p, %d * (%d + %d), ...", child, requisition->width, + requisition->ascent, requisition->descent); + + // Make sure that this width does not exceed the width of the table + // cell (minus margin/border/padding). + + int thisWidth = widget->getAvailWidth (true); + DBG_OBJ_MSGF_O ("resize", 1, widget, "thisWidth = %d", thisWidth); + requisition->width = + lout::misc::max (lout::misc::min (requisition->width, + thisWidth - widget->boxDiffWidth ()), + 0); + + DBG_OBJ_LEAVE_O (widget); +} + +void correctCorrectedExtremesOfChild (core::Widget *widget, core::Widget *child, + core::Extremes *extremes) +{ + // Something to do? +} + int applyPerWidth (core::Widget *widget, int containerWidth, core::style::Length perWidth) { diff --git a/dw/tablecell.hh b/dw/tablecell.hh index 0b3b324f..2e26c8e8 100644 --- a/dw/tablecell.hh +++ b/dw/tablecell.hh @@ -15,6 +15,14 @@ int correctAvailWidthOfChild (core::Widget *widget, core::Widget *child, int correctAvailHeightOfChild (core::Widget *widget, core::Widget *child, int height, bool forceValue); +void correctCorrectedRequisitionOfChild (core::Widget *widget, + core::Widget *child, + core::Requisition *requisition, + void (*splitHeightFun) (int, int*, + int*)); +void correctCorrectedExtremesOfChild (core::Widget *widget, core::Widget *child, + core::Extremes *extremes); + int applyPerWidth (core::Widget *widget, int containerWidth, core::style::Length perWidth); int applyPerHeight (core::Widget *widget, int containerHeight, |