Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXMDIChild.h
1 /********************************************************************************
2 * *
3 * M u l t i p l e D o c u m e n t C h i l d W i n d o w *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1998,2022 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXMDICHILD_H
22 #define FXMDICHILD_H
23 
24 #ifndef FXCOMPOSITE_H
25 #include "FXComposite.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 class FXMDIClient;
32 class FXMenuButton;
33 class FXButton;
34 class FXFont;
35 
36 
38 enum {
39  MDI_NORMAL = 0,
40  MDI_MAXIMIZED = 0x00001000,
41  MDI_MINIMIZED = 0x00002000,
42  MDI_TRACKING = 0x00004000
43  };
44 
45 
46 
78 class FXAPI FXMDIChild : public FXComposite {
79  FXDECLARE(FXMDIChild)
80 protected:
81  FXString title; // Window title
82  FXMenuButton *windowbtn; // Window button
83  FXButton *minimizebtn; // Minimize button
84  FXButton *restorebtn; // Restore button
85  FXButton *maximizebtn; // Maximize buton
86  FXButton *deletebtn; // Close button
87  FXFont *font; // Title font
88  FXColor baseColor; // Colors
89  FXColor hiliteColor;
90  FXColor shadowColor;
91  FXColor borderColor;
92  FXColor titleColor;
93  FXColor titleBackColor;
94  FXint iconPosX; // Saved icon position
95  FXint iconPosY;
96  FXint iconWidth;
97  FXint iconHeight;
98  FXint normalPosX; // Saved normal position
99  FXint normalPosY;
100  FXint normalWidth;
101  FXint normalHeight;
102  FXint spotx; // Grab-spot of mouse on window
103  FXint spoty;
104  FXint xoff; // Mouse offset to add
105  FXint yoff;
106  FXint newx; // New location of window
107  FXint newy;
108  FXint neww;
109  FXint newh;
110  FXuchar mode; // Dragging mode
111 protected:
112  FXMDIChild();
113  void drawRubberBox(FXint x,FXint y,FXint w,FXint h);
114  void animateRectangles(FXint ox,FXint oy,FXint ow,FXint oh,FXint nx,FXint ny,FXint nw,FXint nh);
115  FXuchar where(FXint x,FXint y) const;
116  void changeCursor(FXuchar which);
117 protected:
118  enum {
119  DRAG_NONE = 0,
120  DRAG_TOP = 1,
121  DRAG_BOTTOM = 2,
122  DRAG_LEFT = 4,
123  DRAG_RIGHT = 8,
124  DRAG_TOPLEFT = (DRAG_TOP|DRAG_LEFT),
125  DRAG_TOPRIGHT = (DRAG_TOP|DRAG_RIGHT),
126  DRAG_BOTTOMLEFT = (DRAG_BOTTOM|DRAG_LEFT),
127  DRAG_BOTTOMRIGHT = (DRAG_BOTTOM|DRAG_RIGHT),
128  DRAG_INVERTED = 16,
129  DRAG_TITLE = 32
130  };
131 private:
132  FXMDIChild(const FXMDIChild&);
133  FXMDIChild &operator=(const FXMDIChild&);
134 public:
135  long onPaint(FXObject*,FXSelector,void*);
136  long onEnter(FXObject*,FXSelector,void*);
137  long onLeave(FXObject*,FXSelector,void*);
138  long onFocusSelf(FXObject*,FXSelector,void*);
139  long onFocusIn(FXObject*,FXSelector,void*);
140  long onFocusOut(FXObject*,FXSelector,void*);
141  long onRightBtnPress(FXObject*,FXSelector,void*);
142  long onRightBtnRelease(FXObject*,FXSelector,void*);
143  long onLeftBtnPress(FXObject*,FXSelector,void*);
144  long onLeftBtnRelease(FXObject*,FXSelector,void*);
145  long onMiddleBtnPress(FXObject*,FXSelector,void*);
146  long onMiddleBtnRelease(FXObject*,FXSelector,void*);
147  long onMotion(FXObject*,FXSelector,void*);
148  long onSelected(FXObject*,FXSelector,void*);
149  long onDeselected(FXObject*,FXSelector,void*);
150  long onCmdClose(FXObject*,FXSelector,void*);
151  long onUpdClose(FXObject*,FXSelector,void*);
152  long onCmdRestore(FXObject*,FXSelector,void*);
153  long onUpdRestore(FXObject*,FXSelector,void*);
154  long onUpdMaximize(FXObject*,FXSelector,void*);
155  long onUpdMinimize(FXObject*,FXSelector,void*);
156  long onCmdMaximize(FXObject*,FXSelector,void*);
157  long onCmdMinimize(FXObject*,FXSelector,void*);
158  long onUpdWindow(FXObject*,FXSelector,void*);
159  long onUpdMenuRestore(FXObject*,FXSelector,void*);
160  long onUpdMenuMinimize(FXObject*,FXSelector,void*);
161  long onUpdMenuClose(FXObject*,FXSelector,void*);
162  long onUpdMenuWindow(FXObject*,FXSelector,void*);
163  long onCmdSetStringValue(FXObject*,FXSelector,void*);
164  long onCmdGetStringValue(FXObject*,FXSelector,void*);
165  long onCmdSetIconValue(FXObject*,FXSelector,void*);
166  long onCmdGetIconValue(FXObject*,FXSelector,void*);
167  virtual long onDefault(FXObject*,FXSelector,void*);
168 public:
169 
171  FXMDIChild(FXMDIClient* p,const FXString& name,FXIcon* ic=nullptr,FXPopup* pup=nullptr,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
172 
174  virtual void create();
175 
177  virtual void detach();
178 
180  virtual void layout();
181 
183  virtual FXint getDefaultWidth();
184 
186  virtual FXint getDefaultHeight();
187 
189  virtual void setFocus();
190 
192  virtual FXbool canFocus() const;
193 
195  virtual void move(FXint x,FXint y);
196 
198  virtual void resize(FXint w,FXint h);
199 
201  virtual void position(FXint x,FXint y,FXint w,FXint h);
202 
204  void setNormalX(FXint x){ normalPosX=x; }
205  void setNormalY(FXint y){ normalPosY=y; }
206  void setNormalWidth(FXint w){ normalWidth=w; }
207  void setNormalHeight(FXint h){ normalHeight=h; }
208 
210  FXint getNormalX() const { return normalPosX; }
211  FXint getNormalY() const { return normalPosY; }
212  FXint getNormalWidth() const { return normalWidth; }
213  FXint getNormalHeight() const { return normalHeight; }
214 
216  void setIconX(FXint x){ iconPosX=x; }
217  void setIconY(FXint y){ iconPosY=y; }
218  void setIconWidth(FXint w){ iconWidth=w; }
219  void setIconHeight(FXint h){ iconHeight=h; }
220 
222  FXint getIconX() const { return iconPosX; }
223  FXint getIconY() const { return iconPosY; }
224  FXint getIconWidth() const { return iconWidth; }
225  FXint getIconHeight() const { return iconHeight; }
226 
228  FXWindow *contentWindow() const;
229 
231  void setTitle(const FXString& name);
232 
234  FXString getTitle() const { return title; }
235 
237  FXColor getHiliteColor() const { return hiliteColor; }
238  FXColor getShadowColor() const { return shadowColor; }
239  FXColor getBaseColor() const { return baseColor; }
240  FXColor getBorderColor() const { return borderColor; }
241  FXColor getTitleColor () const { return titleColor; }
242  FXColor getTitleBackColor() const { return titleBackColor; }
243 
245  void setHiliteColor(FXColor clr);
246  void setShadowColor(FXColor clr);
247  void setBaseColor(FXColor clr);
248  void setBorderColor(FXColor clr);
249  void setTitleColor(FXColor clr);
250  void setTitleBackColor(FXColor clr);
251 
253  virtual FXbool restore(FXbool notify=false);
254 
256  virtual FXbool maximize(FXbool notify=false);
257 
259  virtual FXbool minimize(FXbool notify=false);
260 
262  virtual FXbool close(FXbool notify=false);
263 
265  FXbool isMaximized() const;
266 
268  FXbool isMinimized() const;
269 
271  FXIcon *getIcon() const;
272 
274  void setIcon(FXIcon* icon);
275 
277  FXPopup* getMenu() const;
278 
280  void setMenu(FXPopup* menu);
281 
283  void setTracking(FXbool tracking=true);
284 
286  FXbool getTracking() const;
287 
289  void setFont(FXFont *fnt);
290 
292  FXFont* getFont() const { return font; }
293 
295  virtual void save(FXStream& store) const;
296 
298  virtual void load(FXStream& store);
299 
301  virtual ~FXMDIChild();
302  };
303 
304 }
305 
306 #endif
A menu button posts a popup menu when clicked.
Definition: FXMenuButton.h:69
The MDI child window contains the application work area in a Multiple Document Interface application...
Definition: FXMDIChild.h:78
FXFont * getFont() const
Get title font.
Definition: FXMDIChild.h:292
FXString getTitle() const
Get current title.
Definition: FXMDIChild.h:234
Popup window is used as a container for transitional controls such as menu panes and other ephemeral ...
Definition: FXPopup.h:51
A button provides a push button, with optional icon and/or text label.
Definition: FXButton.h:70
FXint getNormalX() const
Return normal (restored) position.
Definition: FXMDIChild.h:210
Base composite.
Definition: FXComposite.h:32
void setIconX(FXint x)
Change iconified position.
Definition: FXMDIChild.h:216
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
void setNormalX(FXint x)
Change normal (restored) position.
Definition: FXMDIChild.h:204
Definition: FX4Splitter.h:28
An Icon is an image with two additional server-side resources: a shape bitmap, which is used to mask ...
Definition: FXIcon.h:42
FXint getIconX() const
Return iconified position.
Definition: FXMDIChild.h:222
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:134
The MDI client window manages a number of MDI child windows in a multiple-document interface (MDI) ap...
Definition: FXMDIClient.h:53
Font class.
Definition: FXFont.h:137
FXColor getHiliteColor() const
Get colors.
Definition: FXMDIChild.h:237
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42

Copyright © 1997-2022 Jeroen van der Zijp