aboutsummaryrefslogtreecommitdiff
path: root/dw/oofposrelmgr.hh
blob: dd9a8144c2e797180536c0e2feefc24ee5f0adbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef __DW_OOFPOSRELMGR_HH__
#define __DW_OOFPOSRELMGR_HH__

#include "oofpositionedmgr.hh"
#include "oofawarewidget.hh"

namespace dw {

namespace oof {

class OOFPosRelMgr: public OOFPositionedMgr
{
protected:
   int getChildPosDim (core::style::Length posCssValue,
                       core::style::Length negCssValue, int refPos,
                       int refLength);

   inline int getChildPosX (Child *child, int refWidth)
   { return getChildPosDim
         (child->widget->getStyle()->left, child->widget->getStyle()->right,
          child->x, refWidth - child->widget->getStyle()->boxDiffWidth ()); }
   inline int getChildPosX (Child *child) 
   { return getChildPosX (child, container->getAvailWidth (true)); }

   inline int getChildPosY (Child *child, int refHeight)
   { return getChildPosDim
         (child->widget->getStyle()->top, child->widget->getStyle()->bottom,
          child->y, refHeight - child->widget->getStyle()->boxDiffHeight ()); }
   inline int getChildPosY (Child *child) 
   { return getChildPosY (child, container->getAvailHeight (true)); }

public:
   OOFPosRelMgr (OOFAwareWidget *container);
   ~OOFPosRelMgr ();

   void markSizeChange (int ref);
   void markExtremesChange (int ref);
   void calcWidgetRefSize (core::Widget *widget, core::Requisition *size);

   void sizeAllocateStart (OOFAwareWidget *caller,
                           core::Allocation *allocation);
   void sizeAllocateEnd (OOFAwareWidget *caller);
   void getSize (core::Requisition *containerReq, int *oofWidth,
                 int *oofHeight);
   void getExtremes (core::Extremes *containerExtr, int *oofMinWidth,
                     int *oofMaxWidth);

   bool dealingWithSizeOfChild (core::Widget *child);
   int getAvailWidthOfChild (core::Widget *child, bool forceValue);
   int getAvailHeightOfChild (core::Widget *child, bool forceValue);
};

} // namespace oof

} // namespace dw

#endif // __DW_OOFPOSRELMGR_HH__