Newer
Older
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/********************************************************************************
* *
* P a c k e r C o n t a i n e r W i d g e t *
* *
*********************************************************************************
* Copyright (C) 1997,2003 by Jeroen van der Zijp. All Rights Reserved. *
*********************************************************************************
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*********************************************************************************
* $Id: FXPacker.h 1536 2003-05-14 21:41:00Z lyle $ *
********************************************************************************/
#ifndef FXPACKER_H
#define FXPACKER_H
#ifndef FXCOMPOSITE_H
#include "FXComposite.h"
#endif
namespace FX {
/// Default spacing
enum { DEFAULT_SPACING = 4 };
/**
* Packer is a layout manager which automatically places child windows
* inside its area against the left, right, top, or bottom side.
* Each time a child is placed, the remaining space is decreased by the
* amount of space taken by the child window.
* The side against which a child is placed is determined by the LAYOUT_SIDE_TOP,
* LAYOUT_SIDE_BOTTOM, LAYOUT_SIDE_LEFT, and LAYOUT_SIDE_RIGHT hints given by
* the child window. Other layout hints from the child are observed as far as
* sensible. So for example, a child placed against the right edge can still
* have LAYOUT_FILL_Y or LAYOUT_TOP, and so on.
* The last child may have both LAYOUT_FILL_X and LAYOUT_FILL_Y, in which
* case it will be placed to take all remaining space.
*/
class FXAPI FXPacker : public FXComposite {
FXDECLARE(FXPacker)
protected:
FXColor baseColor; // Base color
FXColor hiliteColor; // Highlight color
FXColor shadowColor; // Shadow color
FXColor borderColor; // Border color
FXint padtop; // Top margin
FXint padbottom; // Bottom margin
FXint padleft; // Left margin
FXint padright; // Right margin
FXint hspacing; // Horizontal child spacing
FXint vspacing; // Vertical child spacing
FXint border; // Border width
protected:
FXPacker();
void drawBorderRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
void drawRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
void drawSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
void drawRidgeRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
void drawGrooveRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
void drawDoubleRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
void drawDoubleSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
void drawFocusRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
void drawFrame(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
private:
FXPacker(const FXPacker&);
FXPacker &operator=(const FXPacker&);
public:
long onPaint(FXObject*,FXSelector,void*);
long onFocusUp(FXObject*,FXSelector,void*);
long onFocusDown(FXObject*,FXSelector,void*);
long onFocusLeft(FXObject*,FXSelector,void*);
long onFocusRight(FXObject*,FXSelector,void*);
public:
/// Construct packer layout manager
FXPacker(FXComposite *p,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_SPACING,FXint pr=DEFAULT_SPACING,FXint pt=DEFAULT_SPACING,FXint pb=DEFAULT_SPACING,FXint hs=DEFAULT_SPACING,FXint vs=DEFAULT_SPACING);
/// Return default width
virtual FXint getDefaultWidth();
/// Return default height
virtual FXint getDefaultHeight();
/// Perform layout
virtual void layout();
/// Change frame style
void setFrameStyle(FXuint style);
/// Get current frame style
FXuint getFrameStyle() const;
/// Change packing hints
void setPackingHints(FXuint ph);
/// Return packing hints
FXuint getPackingHints() const;
/// Get border width
FXint getBorderWidth() const { return border; }
/// Change top padding
void setPadTop(FXint pt);
/// Get top interior padding
FXint getPadTop() const { return padtop; }
/// Change bottom padding
void setPadBottom(FXint pb);
/// Get bottom interior padding
FXint getPadBottom() const { return padbottom; }
/// Change left padding
void setPadLeft(FXint pl);
/// Get left interior padding
FXint getPadLeft() const { return padleft; }
/// Change right padding
void setPadRight(FXint pr);
/// Get right interior padding
FXint getPadRight() const { return padright; }
/// Change highlight color
void setHiliteColor(FXColor clr);
/// Get highlight color
FXColor getHiliteColor() const { return hiliteColor; }
/// Change shadow color
void setShadowColor(FXColor clr);
/// Get shadow color
FXColor getShadowColor() const { return shadowColor; }
/// Change border color
void setBorderColor(FXColor clr);
/// Get border color
FXColor getBorderColor() const { return borderColor; }
/// Change base gui color
void setBaseColor(FXColor clr);
/// Get base gui color
FXColor getBaseColor() const { return baseColor; }
/// Change horizontal inter-child spacing
void setHSpacing(FXint hs);
/// Return current horizontal inter-child spacing
FXint getHSpacing() const { return hspacing; }
/// Change vertical inter-child spacing
void setVSpacing(FXint vs);
/// Return current vertical inter-child spacing
FXint getVSpacing() const { return vspacing; }
/// Save to stream
virtual void save(FXStream& store) const;
/// Load from stream
virtual void load(FXStream& store);
};
}
#endif