aboutsummaryrefslogtreecommitdiff
path: root/dw/oofpositionedmgr.hh
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2015-02-03 20:33:08 +0100
committerSebastian Geerken <devnull@localhost>2015-02-03 20:33:08 +0100
commitc02036f3e1065051ad62cf2101f95628a4d3d3f3 (patch)
treeb662625f5ab8d3c61bb1240984a73ad990a0e181 /dw/oofpositionedmgr.hh
parentfa6dd63e38408ee6b9d888a4a0b0aaa44700eb5e (diff)
Positioned elements: some refactoring.
Diffstat (limited to 'dw/oofpositionedmgr.hh')
-rw-r--r--dw/oofpositionedmgr.hh38
1 files changed, 37 insertions, 1 deletions
diff --git a/dw/oofpositionedmgr.hh b/dw/oofpositionedmgr.hh
index 380037b4..4edf11e8 100644
--- a/dw/oofpositionedmgr.hh
+++ b/dw/oofpositionedmgr.hh
@@ -1,7 +1,8 @@
-#ifndef __DW_OOFPOSITIONEDMGR_HH__
+ #ifndef __DW_OOFPOSITIONEDMGR_HH__
#define __DW_OOFPOSITIONEDMGR_HH__
#include "outofflowmgr.hh"
+#include "oofawarewidget.hh"
namespace dw {
@@ -24,6 +25,8 @@ protected:
OOFAwareWidget *container;
core::Allocation containerAllocation;
+ enum { NOT_ALLOCATED, IN_ALLOCATION, WAS_ALLOCATED }
+ containerAllocationState;
lout::container::typed::Vector<Child> *children;
lout::container::typed::HashTable<lout::object::TypedPointer
@@ -40,13 +43,46 @@ protected:
{ return getPosBorder (child->getStyle()->bottom, availHeight, result); }
bool getPosBorder (core::style::Length cssValue, int refLength, int *result);
+
bool allChildrenConsideredForSize ();
bool allChildrenConsideredForExtremes ();
+ bool doChildrenExceedContainer ();
+
+ virtual void sizeAllocateChildren () = 0;
+ virtual bool posXAbsolute (Child *child) = 0;
+ virtual bool posYAbsolute (Child *child) = 0;
+
+ inline bool generatorPosDefined (Child *child) {
+ return child->generator == container ||
+ (containerAllocationState != NOT_ALLOCATED
+ && child->generator->wasAllocated ());
+ }
+ inline int generatorPosX (Child *child) {
+ assert (generatorPosDefined (child));
+ return child->generator == container ? 0 :
+ child->generator->getAllocation()->x - containerAllocation.x;
+ }
+ inline int generatorPosY (Child *child) {
+ assert (generatorPosDefined (child));
+ return child->generator == container ? 0 :
+ child->generator->getAllocation()->y - containerAllocation.y;
+ }
+
+ inline bool posXDefined (Child *child)
+ { return posXAbsolute (child) || generatorPosDefined (child); }
+
+ inline bool posYDefined (Child *child)
+ { return posYAbsolute (child) || generatorPosDefined (child); }
+
public:
OOFPositionedMgr (OOFAwareWidget *container);
~OOFPositionedMgr ();
+ void sizeAllocateStart (OOFAwareWidget *caller,
+ core::Allocation *allocation);
+ void sizeAllocateEnd (OOFAwareWidget *caller);
+
void containerSizeChangedForChildren ();
void draw (core::View *view, core::Rectangle *area,
core::DrawingContext *context);