/
StackLayout.h
49 lines (40 loc) · 1.61 KB
/
StackLayout.h
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
//---------------------------------------------------------------------------
#ifndef StackLayoutH
#define StackLayoutH
#include "ALayout.h"
#include <vector>
/** Affiche un série de contrôles horizontalement ou verticalement,
* en ignorant les contrôles invisibles. */
class TStackLayout : public ALayout
{
public:
typedef std::vector<TControl*> CONTROL_LIST;
typedef enum {HORIZONTAL, VERTICAL } ORIENTATION;
typedef enum {TOP, BOTTOM, LEFT, RIGHT } ALIGNMENT;
TStackLayout(TWinControl* aParent);
CONTROL_LIST& Controls() {return controls; };
void SetAlignment(ALIGNMENT anAlignment) { alignment = anAlignment;}
ALIGNMENT GetAlignment() const { return alignment;}
void SetOrientation(ORIENTATION anOrientation) { orientation = anOrientation;}
ORIENTATION GetOrientation() const { return orientation;}
void SetMargin(size_t aMargin) { margin = aMargin; }
size_t GetMargin() const { return margin; }
static void AlignRight(TControl* left, TControl* right);
static void AlignRight(TControl* left, TControl* middle, TControl* right);
static void AlignRight(TControl* left, TControl* middle1, TControl* middle2, TControl* right);
static void AlignRight(TControl** controls, size_t count);
protected:
virtual void DoAlign();
CONTROL_LIST controls;
private:
ALIGNMENT alignment;
ORIENTATION orientation;
size_t margin;
void DoHAlignLeft();
void DoHAlignRight();
void DoVAlignTop();
void DoVAlignBottom();
bool mustDisplayControl(TControl* control) const;
};
//---------------------------------------------------------------------------
#endif