diff options
author | Sebastian Geerken <devnull@localhost> | 2015-02-03 20:33:08 +0100 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2015-02-03 20:33:08 +0100 |
commit | c02036f3e1065051ad62cf2101f95628a4d3d3f3 (patch) | |
tree | b662625f5ab8d3c61bb1240984a73ad990a0e181 /dw/oofposrelmgr.cc | |
parent | fa6dd63e38408ee6b9d888a4a0b0aaa44700eb5e (diff) |
Positioned elements: some refactoring.
Diffstat (limited to 'dw/oofposrelmgr.cc')
-rw-r--r-- | dw/oofposrelmgr.cc | 108 |
1 files changed, 59 insertions, 49 deletions
diff --git a/dw/oofposrelmgr.cc b/dw/oofposrelmgr.cc index 4799e33c..8fb34cd9 100644 --- a/dw/oofposrelmgr.cc +++ b/dw/oofposrelmgr.cc @@ -75,41 +75,25 @@ void OOFPosRelMgr::calcWidgetRefSize (Widget *widget, Requisition *size) } -void OOFPosRelMgr::sizeAllocateStart (OOFAwareWidget *caller, - Allocation *allocation) +void OOFPosRelMgr::sizeAllocateChildren () { - DBG_OBJ_ENTER ("resize.oofm", 0, "sizeAllocateStart", - "%p, (%d, %d, %d * (%d + %d))", - caller, allocation->x, allocation->y, allocation->width, - allocation->ascent, allocation->descent); + DBG_OBJ_ENTER0 ("resize.oofm", 0, "sizeAllocateChildren"); - if (caller == container) - containerAllocation = *allocation; - - DBG_OBJ_LEAVE (); -} - -void OOFPosRelMgr::sizeAllocateEnd (OOFAwareWidget *caller) -{ - DBG_OBJ_ENTER ("resize.oofm", 0, "sizeAllocateEnd", "%p", caller); - - if (caller == container) { - for (int i = 0; i < children->size (); i++) { - Child *child = children->get(i); + for (int i = 0; i < children->size (); i++) { + Child *child = children->get(i); - Requisition childReq; - child->widget->sizeRequest (&childReq); + Requisition childReq; + child->widget->sizeRequest (&childReq); - Allocation *genAlloc = child->generator == container ? - &containerAllocation : child->generator->getAllocation (), - childAlloc; - childAlloc.x = genAlloc->x + getChildPosX (child); - childAlloc.y = genAlloc->y + getChildPosY (child); - childAlloc.width = childReq.width; - childAlloc.ascent = childReq.ascent; - childAlloc.descent = childReq.descent; - child->widget->sizeAllocate (&childAlloc); - } + Allocation *genAlloc = child->generator == container ? + &containerAllocation : child->generator->getAllocation (), + childAlloc; + childAlloc.x = genAlloc->x + getChildPosX (child); + childAlloc.y = genAlloc->y + getChildPosY (child); + childAlloc.width = childReq.width; + childAlloc.ascent = childReq.ascent; + childAlloc.descent = childReq.descent; + child->widget->sizeAllocate (&childAlloc); } DBG_OBJ_LEAVE (); @@ -122,12 +106,20 @@ void OOFPosRelMgr::getSize (Requisition *containerReq, int *oofWidth, for (int i = 0; i < children->size (); i++) { Child *child = children->get(i); - Requisition childReq; - child->widget->sizeRequest (&childReq); - *oofWidth = max (*oofWidth, getChildPosX (child) + childReq.width); - *oofHeight = max (*oofHeight, - getChildPosX (child) + childReq.ascent - + childReq.descent); + + // Children whose position cannot be determined will be + // considered later in sizeAllocateEnd. + if (posXDefined (child) && posYDefined (child)) { + Requisition childReq; + child->widget->sizeRequest (&childReq); + *oofWidth = max (*oofWidth, getChildPosX (child) + childReq.width); + *oofHeight = max (*oofHeight, + getChildPosX (child) + childReq.ascent + + childReq.descent); + + child->consideredForSize = true; + } else + child->consideredForSize = false; } } @@ -138,21 +130,39 @@ void OOFPosRelMgr::getExtremes (Extremes *containerExtr, int *oofMinWidth, for (int i = 0; i < children->size (); i++) { Child *child = children->get(i); - Extremes childExtr; - child->widget->getExtremes (&childExtr); - - // Put the extremes of the container in relation to the extremes - // of the child, as in OOFPosAbsLikeMgr::getExtremes (see - // comment there). - *oofMinWidth = max (*oofMinWidth, - getChildPosX (child, containerExtr->minWidth) - + childExtr.minWidth); - *oofMaxWidth = max (*oofMaxWidth, - getChildPosX (child, containerExtr->maxWidth) - + childExtr.maxWidth); + + // Children whose position cannot be determined will be + // considered later in sizeAllocateEnd. + if (posXDefined (child)) { + Extremes childExtr; + child->widget->getExtremes (&childExtr); + + // Put the extremes of the container in relation to the extremes + // of the child, as in OOFPosAbsLikeMgr::getExtremes (see + // comment there). + *oofMinWidth = max (*oofMinWidth, + getChildPosX (child, containerExtr->minWidth) + + childExtr.minWidth); + *oofMaxWidth = max (*oofMaxWidth, + getChildPosX (child, containerExtr->maxWidth) + + childExtr.maxWidth); + + child->consideredForExtremes = true; + } else + child->consideredForExtremes = false; } } +bool OOFPosRelMgr::posXAbsolute (Child *child) +{ + return false; +} + +bool OOFPosRelMgr::posYAbsolute (Child *child) +{ + return false; +} + int OOFPosRelMgr::getChildPosDim (style::Length posCssValue, style::Length negCssValue, int refPos, int refLength) |