aboutsummaryrefslogtreecommitdiff
path: root/dw/outofflowmgr.hh
blob: 67b18f5003ea50836f977f30c5c7c2671895c55a (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#ifndef __DW_OUTOFFLOWMGR_HH__
#define __DW_OUTOFFLOWMGR_HH__

#include "core.hh"

namespace dw {

/**
 *  \brief Out Of Flow. See \ref dw-out-of-flow.
 */
namespace oof {

class OOFAwareWidget;

/**
 * \brief Represents additional data for OOF containers.
 */
class OutOfFlowMgr
{
public:
   OutOfFlowMgr ();
   virtual ~OutOfFlowMgr ();

   virtual void sizeAllocateStart (OOFAwareWidget *caller,
                                   core::Allocation *allocation) = 0;
   virtual void sizeAllocateEnd (OOFAwareWidget *caller) = 0;
   virtual void containerSizeChangedForChildren () = 0;
   virtual void draw (core::View *view, core::Rectangle *area,
                      core::DrawingContext *context) = 0;

   virtual void markSizeChange (int ref) = 0;
   virtual void markExtremesChange (int ref) = 0;
   virtual core::Widget *getWidgetAtPoint (int x, int y,
                                           core::GettingWidgetAtPointContext
                                           *context) = 0;

   virtual void addWidgetInFlow (OOFAwareWidget *widget,
                                 OOFAwareWidget *parent, int externalIndex) = 0;
   virtual int addWidgetOOF (core::Widget *widget, OOFAwareWidget *generator,
                             int externalIndex) = 0;
   virtual void calcWidgetRefSize (core::Widget *widget,
                                   core::Requisition *size) = 0;
   virtual void moveExternalIndices (OOFAwareWidget *generator,
                                     int oldStartIndex, int diff) = 0;
   
   /**
    * \brief Called before tellPosition2, see there for more.
    */
   virtual void tellPosition1 (core::Widget *widget, int x, int y) = 0;

   /**
    * \brief Called after tellPosition1.
    *
    * An implementation should only implement either tellPosition1 or
    * tellPosition2. Coordinates are relative to the allocation of the
    * generator.
    */
   virtual void tellPosition2 (core::Widget *widget, int x, int y) = 0;
   
   virtual void getSize (core::Requisition *containerReq, int *oofWidth,
                         int *oofHeight) = 0;
   virtual bool containerMustAdjustExtraSpace ()= 0;
   virtual void getExtremes (core::Extremes *containerExtr, int *oofMinWidth,
                             int *oofMaxWidth) = 0;

   /**
    * Get the left border for the vertical position of *y*, for a height
    * of *h", based on floats; relative to the allocation of the calling
    * textblock.
    *
    * The border includes marging/border/padding of the calling textblock
    * but is 0 if there is no float, so a caller should also consider
    * other borders.
    */
   virtual int getLeftBorder (OOFAwareWidget *widget, int y, int h,
                              OOFAwareWidget *lastGen, int lastExtIndex) = 0;

   /**
    * Get the right border for the vertical position of *y*, for a height
    * of *h*, based on floats.
    *
    * See also getLeftBorder().
    */
   virtual int getRightBorder (OOFAwareWidget *widget, int y, int h,
                               OOFAwareWidget *lastGen, int lastExtIndex) = 0;

   /**
    * Return whether there is a float on the left side.
    *
    * See also getLeftBorder().
    */
   virtual bool hasFloatLeft (OOFAwareWidget *widget, int y, int h,
                              OOFAwareWidget *lastGen, int lastExtIndex) = 0;

   /**
    * Return whether there is a float on the right side.
    *
    * See also hasFloatLeft(), getLeftBorder();
    */
   virtual bool hasFloatRight (OOFAwareWidget *widget, int y, int h,
                               OOFAwareWidget *lastGen, int lastExtIndex) = 0;

   /**
    * Assuming there is a float on the left side, return the rest
    * height of it.
    *
    * See also getLeftBorder().
    */
   virtual int getLeftFloatHeight (OOFAwareWidget *widget, int y, int h,
                                   OOFAwareWidget *lastGen, int lastExtIndex)
      = 0;

   /**
    * Assuming there is a float on the right side, return the rest
    * height of it.
    *
    * See also getLeftFloatHeight(), getLeftBorder().
    */
   virtual int getRightFloatHeight (OOFAwareWidget *widget, int y, int h,
                                    OOFAwareWidget *lastGen, int lastExtIndex)
      = 0;
   
   virtual bool affectsLeftBorder (core::Widget *widget) = 0;
   virtual bool affectsRightBorder (core::Widget *widget) = 0;
   virtual bool mayAffectBordersAtAll () = 0;

   virtual int getClearPosition (OOFAwareWidget *widget) = 0;

   virtual bool dealingWithSizeOfChild (core::Widget *child) = 0;
   virtual int getAvailWidthOfChild (core::Widget *child, bool forceValue) = 0;
   virtual int getAvailHeightOfChild (core::Widget *child, bool forceValue) = 0;
   
   // for iterators
   virtual int getNumWidgets () = 0;
   virtual core::Widget *getWidget (int i) = 0;
};

} // namespace oof

} // namespace dw

#endif // __DW_OUTOFFLOWMGR_HH__