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

FXMDIClient.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * M u l t i p l e D o c u m e n t C l i e n t W i n d o w *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1998,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (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 GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXMDIClient.h,v 1.32 2006/01/22 17:58:05 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXMDICLIENT_H
25 #define FXMDICLIENT_H
26 
27 #ifndef FXCOMPOSITE_H
28 #include "FXComposite.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 class FXMDIChild;
35 
36 
37 /**
38 * The MDI client window manages a number of MDI child windows in a multiple-document
39 * interface (MDI) application. MDI child windows usually receive messages from the GUI controls
40 * by delegation via the MDI client. This is accomplished by making the MDI client window
41 * the target for most GUI controls. The MDI client filters out messages intented for itself,
42 * and delegates the remaining messages to its currently active MDI child, if any.
43 * If you use the auto-gray or auto-hide feature available in some GUI controls, these
44 * controls can be automatically grayed out or hidden when there is no active MDI child.
45 * When delegating messages via MDI client to MDI child windows of different types, care
46 * should be taken that message ID's do not overlap, so that all message ID's only map to
47 * the intented handlers no matter which MDI child window type is active.
48 * The MDI client sends a SEL_CHANGED message to its target when the active MDI child is
49 * switched, with the void* pointer refering to the new MDI child.
50 * A MDI Window selection dialog can be brought up through the ID_MDI_OVER_X messages;
51 * a menu button connected to the MDI client with the ID_MDI_OVER_X message will be
52 * automatically grayed out if there are less than X MDI child windows.
53 */
54 class FXAPI FXMDIClient : public FXComposite {
56  friend class FXMDIChild;
57 protected:
58  FXMDIChild *active; // Active child
59  FXint cascadex; // Cascade offset X
60  FXint cascadey; // Cascade offset Y
61 protected:
62  FXMDIClient();
63 private:
64  FXMDIClient(const FXMDIClient&);
65  FXMDIClient &operator=(const FXMDIClient&);
66 public:
67  long onCmdActivateNext(FXObject*,FXSelector,void*);
68  long onCmdActivatePrev(FXObject*,FXSelector,void*);
69  long onCmdTileHorizontal(FXObject*,FXSelector,void*);
70  long onCmdTileVertical(FXObject*,FXSelector,void*);
71  long onCmdCascade(FXObject*,FXSelector,void*);
72  long onUpdActivateNext(FXObject*,FXSelector,void*);
73  long onUpdActivatePrev(FXObject*,FXSelector,void*);
74  long onUpdTileVertical(FXObject*,FXSelector,void*);
75  long onUpdTileHorizontal(FXObject*,FXSelector,void*);
76  long onUpdCascade(FXObject*,FXSelector,void*);
77  long onUpdClose(FXObject*,FXSelector,void*);
78  long onUpdMenuClose(FXObject*,FXSelector,void*);
79  long onUpdRestore(FXObject*,FXSelector,void*);
80  long onUpdMenuRestore(FXObject*,FXSelector,void*);
81  long onUpdMinimize(FXObject*,FXSelector,void*);
82  long onUpdMenuMinimize(FXObject*,FXSelector,void*);
83  long onUpdMaximize(FXObject*,FXSelector,void*);
84  long onUpdMenuWindow(FXObject*,FXSelector,void*);
85  long onCmdWindowSelect(FXObject*,FXSelector,void*);
86  long onUpdWindowSelect(FXObject*,FXSelector,void*);
87  long onCmdOthersWindows(FXObject*,FXSelector,void*);
88  long onUpdOthersWindows(FXObject*,FXSelector,void*);
89  long onUpdAnyWindows(FXObject*,FXSelector,void*);
90  virtual long onDefault(FXObject*,FXSelector,void*);
91 public:
92  enum {
93  ID_MDI_ANY=65400,
94  ID_MDI_1, // Select MDI child 1
95  ID_MDI_2,
96  ID_MDI_3,
97  ID_MDI_4,
98  ID_MDI_5,
99  ID_MDI_6,
100  ID_MDI_7,
101  ID_MDI_8,
102  ID_MDI_9,
103  ID_MDI_10,
104  ID_MDI_OVER_1, // Sensitize MDI menu when 1 or more children
105  ID_MDI_OVER_2,
106  ID_MDI_OVER_3,
107  ID_MDI_OVER_4,
108  ID_MDI_OVER_5,
109  ID_MDI_OVER_6,
110  ID_MDI_OVER_7,
111  ID_MDI_OVER_8,
112  ID_MDI_OVER_9,
113  ID_MDI_OVER_10,
114  ID_LAST
115  };
116 public:
117 
118  /// Construct MDI Client window
119  FXMDIClient(FXComposite* p,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
120 
121  /// Return default width
122  virtual FXint getDefaultWidth();
123 
124  /// Return default height
125  virtual FXint getDefaultHeight();
126 
127  /// Perform layout
128  virtual void layout();
129 
130  /**
131  * Pass message to all MDI windows, stopping when one of
132  * the MDI windows fails to handle the message.
133  */
134  long forallWindows(FXObject* sender,FXSelector sel,void* ptr);
135 
136  /**
137  * Pass message once to all MDI windows with the same document,
138  * stopping when one of the MDI windows fails to handle the message.
139  */
140  long forallDocuments(FXObject* sender,FXSelector sel,void* ptr);
141 
142  /**
143  * Pass message to all MDI Child windows whose target is document,
144  * stopping when one of the MDI windows fails to handle the message.
145  */
146  long forallDocWindows(FXObject* document,FXObject* sender,FXSelector sel,void* ptr);
147 
148  /// Set active MDI Child
149  virtual FXbool setActiveChild(FXMDIChild* child=NULL,FXbool notify=TRUE);
150 
151  /// Get current active child; may be NULL!
152  FXMDIChild* getActiveChild() const { return active; }
153 
154  /// Cascade windows
155  virtual void cascade(FXbool notify=FALSE);
156 
157  /// Layout horizontally
158  virtual void horizontal(FXbool notify=FALSE);
159 
160  /// Layout vertically
161  virtual void vertical(FXbool notify=FALSE);
162 
163  /// Change cascade offset X
164  void setCascadeX(FXint off){ cascadex=off; }
165 
166  /// Change cascade offset Y
167  void setCascadeY(FXint off){ cascadey=off; }
168 
169  /// Get cascade offset X
170  FXint getCascadeX() const { return cascadex; }
171 
172  /// Get cascade offset Y
173  FXint getCascadeY() const { return cascadey; }
174 
175  /// Save object to a stream
176  virtual void save(FXStream& store) const;
177 
178  /// Load object from a stream
179  virtual void load(FXStream& store);
180 
181  /// Destructor
182  virtual ~FXMDIClient();
183  };
184 
185 }
186 
187 #endif
The MDI child window contains the application work area in a Multiple Document Interface application...
Definition: FXMDIChild.h:80
#define TRUE
Definition: fxdefs.h:32
unsigned int FXuint
Definition: fxdefs.h:389
FXuint FXSelector
Association key.
Definition: FXObject.h:53
#define FXAPI
Definition: fxdefs.h:122
FXuchar FXbool
Definition: fxdefs.h:386
Base composite.
Definition: FXComposite.h:35
#define NULL
Definition: fxdefs.h:41
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:390
#define FALSE
Definition: fxdefs.h:35
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
The MDI client window manages a number of MDI child windows in a multiple-document interface (MDI) ap...
Definition: FXMDIClient.h:54
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92

Copyright © 1997-2005 Jeroen van der Zijp