Dillo
oofpositionedmgr.hh
Go to the documentation of this file.
1  #ifndef __DW_OOFPOSITIONEDMGR_HH__
2 #define __DW_OOFPOSITIONEDMGR_HH__
3 
4 #include "outofflowmgr.hh"
5 #include "oofawarewidget.hh"
6 
7 namespace dw {
8 
9 namespace oof {
10 
12 {
13 protected:
15  {
16  public:
19  int externalIndex, x, y;
21 
22  Child (core::Widget *widget, OOFAwareWidget *generator,
23  int externalIndex);
24  };
25 
30 
35 
36  inline bool getPosLeft (core::Widget *child, int availWidth, int *result)
37  { return getPosBorder (child->getStyle()->left, availWidth, result); }
38  inline bool getPosRight (core::Widget *child, int availWidth, int *result)
39  { return getPosBorder (child->getStyle()->right, availWidth, result); }
40  inline bool getPosTop (core::Widget *child, int availHeight, int *result)
41  { return getPosBorder (child->getStyle()->top, availHeight, result); }
42  inline bool getPosBottom (core::Widget *child, int availHeight, int *result)
43  { return getPosBorder (child->getStyle()->bottom, availHeight, result); }
44 
45  bool getPosBorder (core::style::Length cssValue, int refLength, int *result);
46 
49 
51 
52  virtual void sizeAllocateChildren () = 0;
53  virtual bool posXAbsolute (Child *child) = 0;
54  virtual bool posYAbsolute (Child *child) = 0;
55 
56  inline bool generatorPosDefined (Child *child) {
57  return child->generator == container ||
59  && child->generator->wasAllocated ());
60  }
61  inline int generatorPosX (Child *child) {
62  assert (generatorPosDefined (child));
63  return child->generator == container ? 0 :
64  child->generator->getAllocation()->x - containerAllocation.x;
65  }
66  inline int generatorPosY (Child *child) {
67  assert (generatorPosDefined (child));
68  return child->generator == container ? 0 :
69  child->generator->getAllocation()->y - containerAllocation.y;
70  }
71 
72  inline bool posXDefined (Child *child)
73  { return posXAbsolute (child) || generatorPosDefined (child); }
74 
75  inline bool posYDefined (Child *child)
76  { return posYAbsolute (child) || generatorPosDefined (child); }
77 
78 public:
79  OOFPositionedMgr (OOFAwareWidget *container);
81 
82  void sizeAllocateStart (OOFAwareWidget *caller,
83  core::Allocation *allocation);
84  void sizeAllocateEnd (OOFAwareWidget *caller);
85 
87  void draw (core::View *view, core::Rectangle *area,
88  core::DrawingContext *context);
89 
90  void markSizeChange (int ref);
91  void markExtremesChange (int ref);
92  core::Widget *getWidgetAtPoint (int x, int y,
94 
95  void addWidgetInFlow (OOFAwareWidget *widget, OOFAwareWidget *parent,
96  int externalIndex);
97  int addWidgetOOF (core::Widget *widget, OOFAwareWidget *generator,
98  int externalIndex);
99  void moveExternalIndices (OOFAwareWidget *generator, int oldStartIndex,
100  int diff);
101 
102  void tellPosition1 (core::Widget *widget, int x, int y);
103  void tellPosition2 (core::Widget *widget, int x, int y);
104  void tellIncompletePosition1 (core::Widget *generator, core::Widget *widget,
105  int x, int y);
106  void tellIncompletePosition2 (core::Widget *generator, core::Widget *widget,
107  int x, int y);
108 
109 
111 
112  int getLeftBorder (int y, int h, OOFAwareWidget *lastGen, int lastExtIndex);
113  int getRightBorder (int y, int h, OOFAwareWidget *lastGen, int lastExtIndex);
114 
115  bool hasFloatLeft (int y, int h, OOFAwareWidget *lastGen, int lastExtIndex);
116  bool hasFloatRight (int y, int h, OOFAwareWidget *lastGen, int lastExtIndex);
117 
118  int getLeftFloatHeight (int y, int h, OOFAwareWidget *lastGen,
119  int lastExtIndex);
120  int getRightFloatHeight (int y, int h, OOFAwareWidget *lastGen,
121  int lastExtIndex);
122 
123  int getClearPosition (OOFAwareWidget *widget);
124 
125  bool affectsLeftBorder (core::Widget *widget);
126  bool affectsRightBorder (core::Widget *widget);
127  bool mayAffectBordersAtAll ();
128 
129  bool dealingWithSizeOfChild (core::Widget *child);
130 
131  int getNumWidgets ();
132  core::Widget *getWidget (int i);
133 };
134 
135 } // namespace oof
136 
137 } // namespace dw
138 
139 #endif // __DW_OOFPOSITIONEDMGR_HH__
Definition: oofpositionedmgr.hh:28
lout::container::typed::HashTable< lout::object::TypedPointer< dw::core::Widget >, Child > * childrenByWidget
Definition: oofpositionedmgr.hh:34
int x
Definition: types.hh:165
bool generatorPosDefined(Child *child)
Definition: oofpositionedmgr.hh:56
virtual bool posYAbsolute(Child *child)=0
bool getPosLeft(core::Widget *child, int availWidth, int *result)
Definition: oofpositionedmgr.hh:36
Typed version of container::untyped::Vector.
Definition: container.hh:425
Length right
Definition: style.hh:553
bool affectsRightBorder(core::Widget *widget)
Definition: oofpositionedmgr.cc:338
core::Widget * getWidget(int i)
Definition: oofpositionedmgr.cc:358
Set at the top when getting the widget at the point.
Definition: types.hh:312
int y
Definition: oofpositionedmgr.hh:19
void tellIncompletePosition2(core::Widget *generator, core::Widget *widget, int x, int y)
Definition: oofpositionedmgr.cc:279
Typed version of container::untyped::HashTable.
Definition: container.hh:514
dw::core::Shape implemtation for simple rectangles.
Definition: types.hh:69
int getClearPosition(OOFAwareWidget *widget)
Definition: oofpositionedmgr.cc:328
Length left
Definition: style.hh:553
virtual void sizeAllocateChildren()=0
bool posYDefined(Child *child)
Definition: oofpositionedmgr.hh:75
bool allChildrenConsideredForSize()
Definition: oofpositionedmgr.cc:377
This is the base class for many other classes, which defines very common virtual methods.
Definition: object.hh:24
Allocation * getAllocation()
Definition: widget.hh:450
void tellPosition2(core::Widget *widget, int x, int y)
Called after tellPosition1.
Definition: oofpositionedmgr.cc:255
OOFAwareWidget * generator
Definition: oofpositionedmgr.hh:18
bool doChildrenExceedContainer()
Definition: oofpositionedmgr.cc:105
int generatorPosX(Child *child)
Definition: oofpositionedmgr.hh:61
bool mayAffectBordersAtAll()
Definition: oofpositionedmgr.cc:343
Child(core::Widget *widget, OOFAwareWidget *generator, int externalIndex)
Definition: oofpositionedmgr.cc:33
void moveExternalIndices(OOFAwareWidget *generator, int oldStartIndex, int diff)
Definition: oofpositionedmgr.cc:208
bool posXDefined(Child *child)
Definition: oofpositionedmgr.hh:72
int getRightFloatHeight(int y, int h, OOFAwareWidget *lastGen, int lastExtIndex)
Definition: oofpositionedmgr.cc:321
int getNumWidgets()
Definition: oofpositionedmgr.cc:353
int externalIndex
Definition: oofpositionedmgr.hh:19
virtual bool posXAbsolute(Child *child)=0
bool wasAllocated()
Definition: widget.hh:441
Definition: oofpositionedmgr.hh:28
bool consideredForExtremes
Definition: oofpositionedmgr.hh:20
core::Allocation containerAllocation
Definition: oofpositionedmgr.hh:27
Represents the allocation, i.e. actual position and size of a dw::core::Widget.
Definition: types.hh:163
int getLeftFloatHeight(int y, int h, OOFAwareWidget *lastGen, int lastExtIndex)
Definition: oofpositionedmgr.cc:315
bool allChildrenConsideredForExtremes()
Definition: oofpositionedmgr.cc:385
void containerSizeChangedForChildren()
Definition: oofpositionedmgr.cc:151
Length bottom
Definition: style.hh:553
The base class of all dillo widgets.
Definition: widget.hh:23
Set at the top when drawing.
Definition: types.hh:294
void sizeAllocateEnd(OOFAwareWidget *caller)
Definition: oofpositionedmgr.cc:87
OOFPositionedMgr(OOFAwareWidget *container)
Definition: oofpositionedmgr.cc:48
bool consideredForSize
Definition: oofpositionedmgr.hh:20
Represents additional data for OOF containers.
Definition: outofflowmgr.hh:18
core::Widget * widget
Definition: oofpositionedmgr.hh:17
core::Widget * getWidgetAtPoint(int x, int y, core::GettingWidgetAtPointContext *context)
Definition: oofpositionedmgr.cc:230
OOFAwareWidget * container
Definition: oofpositionedmgr.hh:26
Base class for widgets which can act as container and generator for widgets out of flow...
Definition: oofawarewidget.hh:77
bool getPosTop(core::Widget *child, int availHeight, int *result)
Definition: oofpositionedmgr.hh:40
int getLeftBorder(int y, int h, OOFAwareWidget *lastGen, int lastExtIndex)
Definition: oofpositionedmgr.cc:290
void addWidgetInFlow(OOFAwareWidget *widget, OOFAwareWidget *parent, int externalIndex)
Definition: oofpositionedmgr.cc:180
Definition: oofpositionedmgr.hh:14
bool containerMustAdjustExtraSpace()
Definition: oofpositionedmgr.cc:285
enum dw::oof::OOFPositionedMgr::@11 containerAllocationState
bool hasFloatLeft(int y, int h, OOFAwareWidget *lastGen, int lastExtIndex)
Definition: oofpositionedmgr.cc:302
bool getPosRight(core::Widget *child, int availWidth, int *result)
Definition: oofpositionedmgr.hh:38
int getRightBorder(int y, int h, OOFAwareWidget *lastGen, int lastExtIndex)
Definition: oofpositionedmgr.cc:296
int generatorPosY(Child *child)
Definition: oofpositionedmgr.hh:66
bool hasFloatRight(int y, int h, OOFAwareWidget *lastGen, int lastExtIndex)
Definition: oofpositionedmgr.cc:308
~OOFPositionedMgr()
Definition: oofpositionedmgr.cc:61
void tellPosition1(core::Widget *widget, int x, int y)
Called before tellPosition2, see there for more.
Definition: oofpositionedmgr.cc:251
bool getPosBottom(core::Widget *child, int availHeight, int *result)
Definition: oofpositionedmgr.hh:42
Dw is in this namespace, or sub namespaces of this one.
Definition: alignedtablecell.cc:28
An interface to encapsulate platform dependent drawing.
Definition: view.hh:16
bool getPosBorder(core::style::Length cssValue, int refLength, int *result)
Definition: oofpositionedmgr.cc:363
void markExtremesChange(int ref)
Definition: oofpositionedmgr.cc:226
bool affectsLeftBorder(core::Widget *widget)
Definition: oofpositionedmgr.cc:333
lout::container::typed::Vector< Child > * children
Definition: oofpositionedmgr.hh:31
void draw(core::View *view, core::Rectangle *area, core::DrawingContext *context)
Definition: oofpositionedmgr.cc:161
Definition: oofpositionedmgr.hh:28
int x
Definition: oofpositionedmgr.hh:19
void tellIncompletePosition1(core::Widget *generator, core::Widget *widget, int x, int y)
Definition: oofpositionedmgr.cc:273
Length top
Definition: style.hh:553
int Length
Type for representing all lengths within dw::core::style.
Definition: style.hh:428
void markSizeChange(int ref)
Definition: oofpositionedmgr.cc:221
style::Style * getStyle()
Definition: widget.hh:448
void sizeAllocateStart(OOFAwareWidget *caller, core::Allocation *allocation)
Definition: oofpositionedmgr.cc:69
A typed version of object::Pointer.
Definition: object.hh:115
int addWidgetOOF(core::Widget *widget, OOFAwareWidget *generator, int externalIndex)
Definition: oofpositionedmgr.cc:186
bool dealingWithSizeOfChild(core::Widget *child)
Definition: oofpositionedmgr.cc:348
Definition: oofpositionedmgr.hh:11
int y
Definition: types.hh:166