diff options
author | Sebastian Geerken <devnull@localhost> | 2016-04-23 12:36:04 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2016-04-23 12:36:04 +0200 |
commit | cd616fc93a5adb072d282f7afbdbe4b057f9d6fc (patch) | |
tree | 8073831411ce59ce6ca9dc430bb7506d0ba18467 /dw/tablecell.cc | |
parent | eb40226852118f6b24b594c307a6e12b369ceb04 (diff) |
GROWS: new options allowDecreaseWidth and allowDecreaseHeight for size correction.
Diffstat (limited to 'dw/tablecell.cc')
-rw-r--r-- | dw/tablecell.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/dw/tablecell.cc b/dw/tablecell.cc index a7b16776..e2588c0b 100644 --- a/dw/tablecell.cc +++ b/dw/tablecell.cc @@ -20,6 +20,8 @@ #include "tablecell.hh" #include "table.hh" +using namespace lout; + namespace dw { /** @@ -78,21 +80,27 @@ void correctCorrectedRequisitionOfChild (core::Widget *widget, core::Widget *child, core::Requisition *requisition, void (*splitHeightFun) (int, int*, - int*)) + int*), + bool allowDecreaseWidth, + bool allowDecreaseHeight) { DBG_OBJ_ENTER_O ("resize", 0, widget, "tablecell::correctRequisitionOfChild", - "%p, %d * (%d + %d), ...", child, requisition->width, - requisition->ascent, requisition->descent); + "%p, %d * (%d + %d), ..., %s, %s", + child, requisition->width, requisition->ascent, + requisition->descent, misc::boolToStr (allowDecreaseWidth), + misc::boolToStr (allowDecreaseHeight)); // 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 = + int newWidth = lout::misc::max (lout::misc::min (requisition->width, thisWidth - widget->boxDiffWidth ()), 0); + requisition->width = allowDecreaseWidth ? + newWidth : misc::max (requisition->width, newWidth); DBG_OBJ_LEAVE_O (widget); } |