Skip to content
Newer
Older
100644 256 lines (222 sloc) 8.87 KB
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored Feb 2, 2009
1 /***********************************************************************
2 * FXRuby -- the Ruby language bindings for the FOX GUI toolkit.
b8219ec @lylejohnson Updated copyright notice for all SWIG interface files
lylejohnson authored Nov 9, 2009
3 * Copyright (c) 2001-2009 by Lyle Johnson. All Rights Reserved.
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored Feb 2, 2009
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * For further information please contact the author by e-mail
a934547 @lylejohnson Replaced e-mail address "lyle@users.sourceforge.net" with
lylejohnson authored Nov 9, 2009
20 * at "lyle@lylejohnson.name".
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored Feb 2, 2009
21 ***********************************************************************/
22
23 /// Default spacing
24 enum { DEFAULT_SPACING = 4 };
25
26 /**
27 * Packer is a layout manager which automatically places child windows
28 * inside its area against the left, right, top, or bottom side.
29 * Each time a child is placed, the remaining space is decreased by the
30 * amount of space taken by the child window.
31 * The side against which a child is placed is determined by the LAYOUT_SIDE_TOP,
32 * LAYOUT_SIDE_BOTTOM, LAYOUT_SIDE_LEFT, and LAYOUT_SIDE_RIGHT hints given by
33 * the child window. Other layout hints from the child are observed as far as
34 * sensible. So for example, a child placed against the right edge can still
35 * have LAYOUT_FILL_Y or LAYOUT_TOP, and so on.
36 * The last child may have both LAYOUT_FILL_X and LAYOUT_FILL_Y, in which
37 * case it will be placed to take all remaining space.
38 */
39 class FXPacker : public FXComposite {
40 protected:
41 FXColor baseColor; // Base color
42 FXColor hiliteColor; // Highlight color
43 FXColor shadowColor; // Shadow color
44 FXColor borderColor; // Border color
45 FXint padtop; // Top margin
46 FXint padbottom; // Bottom margin
47 FXint padleft; // Left margin
48 FXint padright; // Right margin
49 FXint hspacing; // Horizontal child spacing
50 FXint vspacing; // Vertical child spacing
51 FXint border; // Border width
52 protected:
53 FXPacker();
54 void drawBorderRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
55 void drawRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
56 void drawSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
57 void drawRidgeRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
58 void drawGrooveRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
59 void drawDoubleRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
60 void drawDoubleSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
61 void drawFocusRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
62 void drawFrame(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
63 public:
64 long onPaint(FXObject*,FXSelector,void* PTR_EVENT);
65 long onFocusUp(FXObject*,FXSelector,void* PTR_EVENT);
66 long onFocusDown(FXObject*,FXSelector,void* PTR_EVENT);
67 long onFocusLeft(FXObject*,FXSelector,void* PTR_EVENT);
68 long onFocusRight(FXObject*,FXSelector,void* PTR_EVENT);
69 public:
70 %extend {
71 /// Construct packer layout manager
72 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){
73 return new FXRbPacker(p,opts,x,y,w,h,pl,pr,pt,pb,hs,vs);
74 }
75 }
76
77 /// Change frame style
78 void setFrameStyle(FXuint style);
79
80 /// Get current frame style
81 FXuint getFrameStyle() const;
82
83 /// Change packing hints
84 void setPackingHints(FXuint ph);
85
86 /// Return packing hints
87 FXuint getPackingHints() const;
88
89 /// Get border width
90 FXint getBorderWidth() const;
91
92 /// Change top padding
93 void setPadTop(FXint pt);
94
95 /// Get top interior padding
96 FXint getPadTop() const;
97
98 /// Change bottom padding
99 void setPadBottom(FXint pb);
100
101 /// Get bottom interior padding
102 FXint getPadBottom() const;
103
104 /// Change left padding
105 void setPadLeft(FXint pl);
106
107 /// Get left interior padding
108 FXint getPadLeft() const;
109
110 /// Change right padding
111 void setPadRight(FXint pr);
112
113 /// Get right interior padding
114 FXint getPadRight() const;
115
116 /// Change highlight color
117 void setHiliteColor(FXColor clr);
118
119 /// Get highlight color
120 FXColor getHiliteColor() const;
121
122 /// Change shadow color
123 void setShadowColor(FXColor clr);
124
125 /// Get shadow color
126 FXColor getShadowColor() const;
127
128 /// Change border color
129 void setBorderColor(FXColor clr);
130
131 /// Get border color
132 FXColor getBorderColor() const;
133
134 /// Change base gui color
135 void setBaseColor(FXColor clr);
bea4cad @larskanis Strip all whitespaces on line endings
authored Feb 2, 2012
136
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored Feb 2, 2009
137 /// Get base gui color
138 FXColor getBaseColor() const;
bea4cad @larskanis Strip all whitespaces on line endings
authored Feb 2, 2012
139
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored Feb 2, 2009
140 /// Change horizontal inter-child spacing
141 void setHSpacing(FXint hs);
bea4cad @larskanis Strip all whitespaces on line endings
authored Feb 2, 2012
142
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored Feb 2, 2009
143 /// Return current horizontal inter-child spacing
144 FXint getHSpacing() const;
bea4cad @larskanis Strip all whitespaces on line endings
authored Feb 2, 2012
145
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored Feb 2, 2009
146 /// Change vertical inter-child spacing
147 void setVSpacing(FXint vs);
bea4cad @larskanis Strip all whitespaces on line endings
authored Feb 2, 2012
148
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored Feb 2, 2009
149 /// Return current vertical inter-child spacing
150 FXint getVSpacing() const;
bea4cad @larskanis Strip all whitespaces on line endings
authored Feb 2, 2012
151
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored Feb 2, 2009
152 /// Destructor
153 virtual ~FXPacker();
154 };
155
156
157 DECLARE_FXOBJECT_VIRTUALS(FXPacker)
158 DECLARE_FXID_VIRTUALS(FXPacker)
159 DECLARE_FXDRAWABLE_VIRTUALS(FXPacker)
160 DECLARE_FXWINDOW_VIRTUALS(FXPacker)
161
162 %{
163 static swig_type_info *FXPacker_dynamic_cast(void **ptr) {
164 FXPacker **ppPacker = reinterpret_cast<FXPacker **>(ptr);
165 FXColorSelector *pColorSelector=dynamic_cast<FXColorSelector*>(*ppPacker);
166 if(pColorSelector){
167 *ptr=reinterpret_cast<void*>(pColorSelector);
168 return SWIG_TypeQuery("FXColorSelector *");
169 }
170 FXComboBox *pComboBox=dynamic_cast<FXComboBox*>(*ppPacker);
171 if(pComboBox){
172 *ptr=reinterpret_cast<void*>(pComboBox);
173 return SWIG_TypeQuery("FXComboBox *");
174 }
175 FXDirSelector *pDirSelector=dynamic_cast<FXDirSelector*>(*ppPacker);
176 if(pDirSelector){
177 *ptr=reinterpret_cast<void*>(pDirSelector);
178 return SWIG_TypeQuery("FXDirSelector *");
179 }
180 FXDockBar *pDockBar=dynamic_cast<FXDockBar*>(*ppPacker);
181 if(pDockBar){
182 *ptr=reinterpret_cast<void*>(pDockBar);
183 return SWIG_TypeQuery("FXDockBar *");
184 }
185 FXDockSite *pDockSite=dynamic_cast<FXDockSite*>(*ppPacker);
186 if(pDockSite){
187 *ptr=reinterpret_cast<void*>(pDockSite);
188 return SWIG_TypeQuery("FXDockSite *");
189 }
190 FXFileSelector *pFileSelector=dynamic_cast<FXFileSelector*>(*ppPacker);
191 if(pFileSelector){
192 *ptr=reinterpret_cast<void*>(pFileSelector);
193 return SWIG_TypeQuery("FXFileSelector *");
194 }
195 FXFontSelector *pFontSelector=dynamic_cast<FXFontSelector*>(*ppPacker);
196 if(pFontSelector){
197 *ptr=reinterpret_cast<void*>(pFontSelector);
198 return SWIG_TypeQuery("FXFontSelector *");
199 }
200 FXGroupBox *pGroupBox=dynamic_cast<FXGroupBox*>(*ppPacker);
201 if(pGroupBox){
202 *ptr=reinterpret_cast<void*>(pGroupBox);
203 return SWIG_TypeQuery("FXGroupBox *");
204 }
205 FXHorizontalFrame *pHorizontalFrame=dynamic_cast<FXHorizontalFrame*>(*ppPacker);
206 if(pHorizontalFrame){
207 *ptr=reinterpret_cast<void*>(pHorizontalFrame);
208 return SWIG_TypeQuery("FXHorizontalFrame *");
209 }
210 FXListBox *pListBox=dynamic_cast<FXListBox*>(*ppPacker);
211 if(pListBox){
212 *ptr=reinterpret_cast<void*>(pListBox);
213 return SWIG_TypeQuery("FXListBox *");
214 }
215 FXMatrix *pMatrix=dynamic_cast<FXMatrix*>(*ppPacker);
216 if(pMatrix){
217 *ptr=reinterpret_cast<void*>(pMatrix);
218 return SWIG_TypeQuery("FXMatrix *");
219 }
220 FXRealSpinner *pRealSpinner=dynamic_cast<FXRealSpinner*>(*ppPacker);
221 if(pRealSpinner){
222 *ptr=reinterpret_cast<void*>(pRealSpinner);
223 return SWIG_TypeQuery("FXRealSpinner *");
224 }
225 FXSpinner *pSpinner=dynamic_cast<FXSpinner*>(*ppPacker);
226 if(pSpinner){
227 *ptr=reinterpret_cast<void*>(pSpinner);
228 return SWIG_TypeQuery("FXSpinner *");
229 }
230 FXSwitcher *pSwitcher=dynamic_cast<FXSwitcher*>(*ppPacker);
231 if(pSwitcher){
232 *ptr=reinterpret_cast<void*>(pSwitcher);
233 return SWIG_TypeQuery("FXSwitcher *");
234 }
235 FXTabBar *pTabBar=dynamic_cast<FXTabBar*>(*ppPacker);
236 if(pTabBar){
237 *ptr=reinterpret_cast<void*>(pTabBar);
238 return SWIG_TypeQuery("FXTabBar *");
239 }
240 FXTreeListBox *pTreeListBox=dynamic_cast<FXTreeListBox*>(*ppPacker);
241 if(pTreeListBox){
242 *ptr=reinterpret_cast<void*>(pTreeListBox);
243 return SWIG_TypeQuery("FXTreeListBox *");
244 }
245 FXVerticalFrame *pVerticalFrame=dynamic_cast<FXVerticalFrame*>(*ppPacker);
246 if(pVerticalFrame){
247 *ptr=reinterpret_cast<void*>(pVerticalFrame);
248 return SWIG_TypeQuery("FXVerticalFrame *");
249 }
250 return 0;
251 }
252 %}
253
254 DYNAMIC_CAST(SWIGTYPE_p_FXPacker, FXPacker_dynamic_cast);
255
Something went wrong with that request. Please try again.