Public Types |
enum | LAYOUTING_PHASES { PHASE_0 = 0,
PHASE_1 = 1
} |
Public Methods |
| csLayout (csComponent *iParent, csDialogFrameStyle iFrameStyle=csdfsNone) |
virtual csLayoutConstraint* | AddLayoutComponent (csComponent *comp) |
| A components is added to a layout by creating it and passing the layout component as its parent component. More...
|
virtual void | RemoveLayoutComponent (csComponent *comp) |
| remove a component from the layout.
|
virtual void | SuggestSize (int &sugw, int &sugh)=0 |
| return best size for this layout.
|
virtual void | LayoutContainer ()=0 |
| recalc positions and sizes of components.
|
virtual void | InvalidateLayout () |
| make sure next time the layout is drawn the components are layed out first.
|
virtual int | GetLayoutingPhase () |
| return current phase of layouting.
|
virtual void | SetLayoutingPhase (int phase) |
| set current phase of layouting.
|
virtual csPoint | GetPhase0Size () |
| save size of first phase for later reference.
|
virtual bool | TwoPhaseLayoutingEnabled () |
| is the two phase layouting enabled ?
|
virtual void | Insert (csComponent *child) |
| new impl. for csComponent.
|
virtual bool | HandleEvent (iEvent &Event) |
| Handle input events.
|
virtual void | Draw () |
| Draw the component (only dirty rectangle should be redrawn).
|
virtual bool | SetRect (int xmin, int ymin, int xmax, int ymax) |
| Do auto-placement work if enabled.
|
virtual void | FixSize (int &newWidth, int &newHeight) |
| Fix dialog size when resizing.
|
Public Attributes |
csRect | insets |
| preserve space at the 4 borders of a layout.
|
csLayoutConstraint | c |
| Here we have the constraint a components will be layout with. When a component is added a copy of this will be made and attached to the component.
|
Static Public Methods |
void | SetTwoPhaseLayoutingGlobally (bool on) |
| enable or disable 2 phase layouting.
|
Protected Attributes |
bool | bRecalcLayout |
| do we need to recalc the positions and sizes of placed components ?
|
csConstraintVector | vConstraints |
| collect all constraints here.
|
csLayoutConstraint* | lc |
| a pointer to the current constraint.
|
Static Protected Attributes |
bool | mUseTwoPhaseLayoutingGlobally |
| A shortcoming of the original java layouts is that components are asked for its preferred size without knowing at what size its parent component will be layout in the end. More...
|
int | mCurrentLayoutingPhase |
Usually one designs dialogs, forms etc. by placing components like listcontrols, inputlines, treecontrols and so on at absolute locations inside the dialog. While this is fine for a fixed size of your dialog it turns out to be pretty ugly if you want allow resizing of dialogs, forms etc. A comparable ugly effect you achive by running an application in different window sizes.
Layouts will help you to overcome this drawback. They will allow you to relatively place a control and to resize components when necessary.
Layouts are themselfs csComponents and have a transparent canvas. Thus you will not note them. One important issue about layouts is that they will transfer all Events of type csevCommand to its parent control. This will allow you overwrite just one HandleEvent to receive all commands from the components embedded in the layouts no matter how deeply nested they are.