Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 243 lines (213 sloc) 9.382 kB
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
1 /***********************************************************************
2 * FXRuby -- the Ruby language bindings for the FOX GUI toolkit.
b8219ec @lylejohnson Updated copyright notice for all SWIG interface files
lylejohnson authored
3 * Copyright (c) 2001-2009 by Lyle Johnson. All Rights Reserved.
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
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
20 * at "lyle@lylejohnson.name".
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
21 ***********************************************************************/
22
23 class FXMDIClient;
24 class FXMenuButton;
25 class FXButton;
26 class FXFont;
27
28
29
30 /// MDI Child Window styles
31 enum {
32 MDI_NORMAL = 0, /// Normal display mode
33 MDI_MAXIMIZED = 0x00001000, /// Window appears maximized
34 MDI_MINIMIZED = 0x00002000, /// Window is iconified or minimized
35 MDI_TRACKING = 0x00004000 /// Track continuously during dragging
36 };
37
38
39 /**
40 * The MDI child window contains the application work area in a Multiple Document
41 * Interface application. GUI Controls are connected to the MDI child via delegation
42 * through the MDI client, which forwards messages it receives to the active MDI child.
43 * The MDI child itself tries to further delegate messages to its single content window,
44 * and if not handled there, to its target object.
45 * When the MDI child is maximized, it sends a SEL_MAXIMIZE message; when the MDI
46 * child is minimized, it sends a SEL_MINIMIZE message. When it is restored, it
47 * sends a SEL_RESTORE message to its target. The MDI child also notifies its
48 * target when it becomes the active MDI child, via the SEL_SELECTED message.
49 * The void* in the SEL_SELECTED message refers to the previously active MDI child,
50 * if any. When an MDI child ceases to be the active one, a SEL_DESELECTED message
51 * is sent. The void* in the SEL_DESELECTED message refers to the newly activated
52 * MDI child, if any. Thus, interception of SEL_SELECTED and SEL_DESELECTED allows
53 * the target object to determine whether the user switched between MDI windows of
54 * the same document (target) or between MDI windows belonging to the same document.
55 * When the MDI child is closed, it sends a SEL_CLOSE message to its target.
56 * The target has an opportunity to object to the closing; if the MDI child should
57 * not be closed, it should return 1 (objection). If the MDI child should be closed,
58 * the target can either just return 0 or simply not handle the SEL_CLOSE message.
59 * The SEL_UPDATE message can be used to modify the MDI child's title (via
60 * ID_SETSTRINGVALUE), and window icon (via ID_SETICONVALUE).
61 */
62 class FXMDIChild : public FXComposite {
63 protected:
64 FXString title; // Window title
65 FXMenuButton *windowbtn; // Window button
66 FXButton *minimizebtn; // Minimize button
67 FXButton *restorebtn; // Restore button
68 FXButton *maximizebtn; // Maximize buton
69 FXButton *deletebtn; // Close button
70 FXFont *font; // Title font
71 FXColor baseColor; // Colors
72 FXColor hiliteColor;
73 FXColor shadowColor;
74 FXColor borderColor;
75 FXColor titleColor;
76 FXColor titleBackColor;
77 FXint iconPosX; // Saved icon position
78 FXint iconPosY;
79 FXint iconWidth;
80 FXint iconHeight;
81 FXint normalPosX; // Saved normal position
82 FXint normalPosY;
83 FXint normalWidth;
84 FXint normalHeight;
85 FXint spotx; // Grab-spot of mouse on window
86 FXint spoty;
87 FXint xoff; // Mouse offset to add
88 FXint newx; // New location of window
89 FXint newy;
90 FXint neww;
91 FXint newh;
92 FXuchar mode; // Dragging mode
93 protected:
94 FXMDIChild();
95 void drawRubberBox(FXint x,FXint y,FXint w,FXint h);
96 void animateRectangles(FXint ox,FXint oy,FXint ow,FXint oh,FXint nx,FXint ny,FXint nw,FXint nh);
97 FXuchar where(FXint x,FXint y);
98 void changeCursor(FXint x,FXint y);
99 void revertCursor();
100 protected:
101 enum {
102 DRAG_NONE = 0,
103 DRAG_TOP = 1,
104 DRAG_BOTTOM = 2,
105 DRAG_LEFT = 4,
106 DRAG_RIGHT = 8,
107 DRAG_TOPLEFT = (DRAG_TOP|DRAG_LEFT),
108 DRAG_TOPRIGHT = (DRAG_TOP|DRAG_RIGHT),
109 DRAG_BOTTOMLEFT = (DRAG_BOTTOM|DRAG_LEFT),
110 DRAG_BOTTOMRIGHT = (DRAG_BOTTOM|DRAG_RIGHT),
111 DRAG_INVERTED = 16,
112 DRAG_TITLE = 32
113 };
114 public:
115 long onPaint(FXObject*,FXSelector,void* PTR_EVENT);
116 long onFocusSelf(FXObject*,FXSelector,void* PTR_EVENT);
117 long onFocusIn(FXObject*,FXSelector,void* PTR_EVENT);
118 long onFocusOut(FXObject*,FXSelector,void* PTR_EVENT);
119 long onRightBtnPress(FXObject*,FXSelector,void* PTR_EVENT);
120 long onRightBtnRelease(FXObject*,FXSelector,void* PTR_EVENT);
121 long onLeftBtnPress(FXObject*,FXSelector,void* PTR_EVENT);
122 long onLeftBtnRelease(FXObject*,FXSelector,void* PTR_EVENT);
123 long onMiddleBtnPress(FXObject*,FXSelector,void* PTR_EVENT);
124 long onMiddleBtnRelease(FXObject*,FXSelector,void* PTR_EVENT);
125 long onMotion(FXObject*,FXSelector,void* PTR_EVENT);
126 long onSelected(FXObject*,FXSelector,void* PTR_MDICHILD);
127 long onDeselected(FXObject*,FXSelector,void* PTR_MDICHILD);
128 long onCmdClose(FXObject*,FXSelector,void* PTR_IGNORE);
129 long onUpdClose(FXObject*,FXSelector,void* PTR_IGNORE);
130 long onCmdRestore(FXObject*,FXSelector,void* PTR_IGNORE);
131 long onUpdRestore(FXObject*,FXSelector,void* PTR_IGNORE);
132 long onUpdMaximize(FXObject*,FXSelector,void* PTR_IGNORE);
133 long onUpdMinimize(FXObject*,FXSelector,void* PTR_IGNORE);
134 long onCmdMaximize(FXObject*,FXSelector,void* PTR_IGNORE);
135 long onCmdMinimize(FXObject*,FXSelector,void* PTR_IGNORE);
136 long onUpdWindow(FXObject*,FXSelector,void* PTR_IGNORE);
137 long onUpdMenuRestore(FXObject*,FXSelector,void* PTR_IGNORE);
138 long onUpdMenuMinimize(FXObject*,FXSelector,void* PTR_IGNORE);
139 long onUpdMenuClose(FXObject*,FXSelector,void* PTR_IGNORE);
140 long onUpdMenuWindow(FXObject*,FXSelector,void* PTR_IGNORE);
141 long onCmdSetStringValue(FXObject*,FXSelector,void* PTR_STRING);
142 long onCmdGetStringValue(FXObject*,FXSelector,void* PTR_STRING); // FIXME
143 long onCmdSetIconValue(FXObject*,FXSelector,void* PTR_STRING); // FIXME
144 long onCmdGetIconValue(FXObject*,FXSelector,void* PTR_STRING); // FIXME
145 public:
146 %extend {
147 /// Construct MDI Child window with given name and icon
148 FXMDIChild(FXMDIClient* p,const FXString& name,FXIcon* ic=NULL,FXPopup* pup=NULL,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0){
149 return new FXRbMDIChild(p,name,ic,pup,opts,x,y,w,h);
150 }
151 }
152
153 /// Change normal (restored) position
154 void setNormalX(FXint x);
155 void setNormalY(FXint y);
156 void setNormalWidth(FXint w);
157 void setNormalHeight(FXint h);
bea4cad @larskanis Strip all whitespaces on line endings
authored
158
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
159 /// Return normal (restored) position
160 FXint getNormalX() const;
161 FXint getNormalY() const;
162 FXint getNormalWidth() const;
163 FXint getNormalHeight() const;
164
165 /// Change iconified position
166 void setIconX(FXint x);
167 void setIconY(FXint y);
168 void setIconWidth(FXint w);
169 void setIconHeight(FXint h);
bea4cad @larskanis Strip all whitespaces on line endings
authored
170
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
171 /// Return iconified position
172 FXint getIconX() const;
173 FXint getIconY() const;
174 FXint getIconWidth() const;
175 FXint getIconHeight() const;
bea4cad @larskanis Strip all whitespaces on line endings
authored
176
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
177 /// Return content window
178 FXWindow *contentWindow() const;
bea4cad @larskanis Strip all whitespaces on line endings
authored
179
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
180 /// Change MDI Child's title
181 void setTitle(const FXString& name);
bea4cad @larskanis Strip all whitespaces on line endings
authored
182
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
183 /// Get current title
184 FXString getTitle() const;
185
186 /// Get colors
187 FXColor getHiliteColor() const;
188 FXColor getShadowColor() const;
189 FXColor getBaseColor() const;
190 FXColor getBorderColor() const;
191 FXColor getTitleColor () const;
192 FXColor getTitleBackColor() const;
193
194 /// Change colors
195 void setHiliteColor(FXColor clr);
196 void setShadowColor(FXColor clr);
197 void setBaseColor(FXColor clr);
198 void setBorderColor(FXColor clr);
199 void setTitleColor(FXColor clr);
200 void setTitleBackColor(FXColor clr);
bea4cad @larskanis Strip all whitespaces on line endings
authored
201
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
202 /// Return TRUE if maximized
203 FXbool isMaximized() const;
204
205 /// Return TRUE if minimized
206 FXbool isMinimized() const;
bea4cad @larskanis Strip all whitespaces on line endings
authored
207
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
208 /// Get window icon
209 FXIcon *getIcon() const;
bea4cad @larskanis Strip all whitespaces on line endings
authored
210
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
211 /// Set window icon
212 void setIcon(FXIcon* icon);
bea4cad @larskanis Strip all whitespaces on line endings
authored
213
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
214 /// Get window menu
215 FXPopup* getMenu() const;
bea4cad @larskanis Strip all whitespaces on line endings
authored
216
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
217 /// Set window menu
218 void setMenu(FXPopup* menu);
bea4cad @larskanis Strip all whitespaces on line endings
authored
219
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
220 /// Set tracking instead of just outline
221 void setTracking(FXbool tracking=TRUE);
222
223 /// Return true if tracking
224 FXbool getTracking() const;
225
226 /// Set title font
227 void setFont(FXFont *fnt);
bea4cad @larskanis Strip all whitespaces on line endings
authored
228
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
229 /// Get title font
230 FXFont* getFont() const;
231
232 /// Destroy
233 virtual ~FXMDIChild();
234 };
235
236
237 DECLARE_FXOBJECT_VIRTUALS(FXMDIChild)
238 DECLARE_FXID_VIRTUALS(FXMDIChild)
239 DECLARE_FXDRAWABLE_VIRTUALS(FXMDIChild)
240 DECLARE_FXWINDOW_VIRTUALS(FXMDIChild)
241 DECLARE_FXMDICHILD_VIRTUALS(FXMDIChild)
242
Something went wrong with that request. Please try again.