]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/mdi.h
don't call OnCloseDocument() from OnNewDocument(), this plainly doesn't make sense...
[wxWidgets.git] / interface / wx / mdi.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: mdi.h
e54c96f1 3// Purpose: interface of wxMDIClientWindow
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxMDIClientWindow
7c913512 11
23324ae1
FM
12 An MDI client window is a child of wxMDIParentFrame, and manages zero or
13 more wxMDIChildFrame objects.
7c913512 14
23324ae1
FM
15 @library{wxcore}
16 @category{FIXME}
7c913512 17
e54c96f1 18 @see wxMDIChildFrame, wxMDIParentFrame, wxFrame
23324ae1
FM
19*/
20class wxMDIClientWindow : public wxWindow
21{
22public:
23 //@{
24 /**
25 Constructor, creating the window.
3c4f71cc 26
7c913512 27 @param parent
4cc4bfaf 28 The window parent.
7c913512 29 @param style
4cc4bfaf 30 The window style. Currently unused.
3c4f71cc 31
23324ae1 32 @remarks The second style of constructor is called within
4cc4bfaf 33 wxMDIParentFrame::OnCreateClient.
3c4f71cc 34
4cc4bfaf 35 @see wxMDIParentFrame::wxMDIParentFrame, wxMDIParentFrame::OnCreateClient
23324ae1
FM
36 */
37 wxMDIClientWindow();
7c913512 38 wxMDIClientWindow(wxMDIParentFrame* parent, long style = 0);
23324ae1
FM
39 //@}
40
41 /**
42 Destructor.
43 */
44 ~wxMDIClientWindow();
45
46 /**
47 Used in two-step frame construction. See wxMDIClientWindow()
48 for further details.
49 */
50 bool CreateClient(wxMDIParentFrame* parent, long style = 0);
51};
52
53
e54c96f1 54
23324ae1
FM
55/**
56 @class wxMDIParentFrame
7c913512 57
23324ae1
FM
58 An MDI (Multiple Document Interface) parent frame is a window which can contain
59 MDI child frames in its own 'desktop'. It is a convenient way to avoid window
60 clutter,
61 and is used in many popular Windows applications, such as Microsoft Word(TM).
7c913512 62
23324ae1 63 @beginStyleTable
8c6791e4 64 @style{wxCAPTION}
23324ae1 65 Puts a caption on the frame.
8c6791e4 66 @style{wxDEFAULT_FRAME_STYLE}
7c913512 67 Defined as wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxTHICK_FRAME |
23324ae1 68 wxSYSTEM_MENU | wxCAPTION.
8c6791e4 69 @style{wxHSCROLL}
23324ae1
FM
70 Displays a horizontal scrollbar in the client window, allowing the
71 user to view child frames that are off the current view.
8c6791e4 72 @style{wxICONIZE}
23324ae1 73 Display the frame iconized (minimized) (Windows only).
8c6791e4 74 @style{wxMAXIMIZE}
23324ae1 75 Displays the frame maximized (Windows only).
8c6791e4 76 @style{wxMAXIMIZE_BOX}
23324ae1 77 Displays a maximize box on the frame (Windows and Motif only).
8c6791e4 78 @style{wxMINIMIZE}
23324ae1 79 Identical to wxICONIZE.
8c6791e4 80 @style{wxMINIMIZE_BOX}
23324ae1 81 Displays a minimize box on the frame (Windows and Motif only).
8c6791e4 82 @style{wxRESIZE_BORDER}
23324ae1
FM
83 Displays a resizeable border around the window (Motif only; for
84 Windows, it is implicit in wxTHICK_FRAME).
8c6791e4 85 @style{wxSTAY_ON_TOP}
23324ae1 86 Stay on top of other windows (Windows only).
8c6791e4 87 @style{wxSYSTEM_MENU}
23324ae1 88 Displays a system menu (Windows and Motif only).
8c6791e4 89 @style{wxTHICK_FRAME}
23324ae1 90 Displays a thick frame around the window (Windows and Motif only).
8c6791e4 91 @style{wxVSCROLL}
23324ae1
FM
92 Displays a vertical scrollbar in the client window, allowing the
93 user to view child frames that are off the current view.
8c6791e4 94 @style{wxFRAME_NO_WINDOW_MENU}
23324ae1
FM
95 Under Windows, removes the Window menu that is normally added
96 automatically.
97 @endStyleTable
7c913512 98
23324ae1
FM
99 @library{wxcore}
100 @category{managedwnd}
7c913512 101
e54c96f1 102 @see wxMDIChildFrame, wxMDIClientWindow, wxFrame, wxDialog
23324ae1
FM
103*/
104class wxMDIParentFrame : public wxFrame
105{
106public:
107 //@{
108 /**
109 Constructor, creating the window.
3c4f71cc 110
7c913512 111 @param parent
4cc4bfaf 112 The window parent. This should be @NULL.
7c913512 113 @param id
4cc4bfaf
FM
114 The window identifier. It may take a value of -1 to indicate a default
115 value.
7c913512 116 @param title
4cc4bfaf 117 The caption to be displayed on the frame's title bar.
7c913512 118 @param pos
4cc4bfaf
FM
119 The window position. The value wxDefaultPosition indicates a default position,
120 chosen by
121 either the windowing system or wxWidgets, depending on platform.
7c913512 122 @param size
4cc4bfaf
FM
123 The window size. The value wxDefaultSize indicates a default size, chosen by
124 either the windowing system or wxWidgets, depending on platform.
7c913512 125 @param style
4cc4bfaf 126 The window style. See wxMDIParentFrame.
7c913512 127 @param name
4cc4bfaf 128 The name of the window. This parameter is used to associate a name with the
23324ae1 129 item,
4cc4bfaf
FM
130 allowing the application user to set Motif resource values for
131 individual windows.
3c4f71cc 132
23324ae1 133 @remarks During the construction of the frame, the client window will be
4cc4bfaf
FM
134 created. To use a different class from
135 wxMDIClientWindow, override
136 OnCreateClient().
3c4f71cc 137
4cc4bfaf 138 @see Create(), OnCreateClient()
23324ae1
FM
139 */
140 wxMDIParentFrame();
7c913512
FM
141 wxMDIParentFrame(wxWindow* parent, wxWindowID id,
142 const wxString& title,
143 const wxPoint& pos = wxDefaultPosition,
144 const wxSize& size = wxDefaultSize,
4cc4bfaf 145 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
7c913512 146 const wxString& name = "frame");
23324ae1
FM
147 //@}
148
149 /**
150 Destructor. Destroys all child windows and menu bar if present.
151 */
152 ~wxMDIParentFrame();
153
154 /**
155 Activates the MDI child following the currently active one.
3c4f71cc 156
4cc4bfaf 157 @see ActivatePrevious()
23324ae1
FM
158 */
159 void ActivateNext();
160
161 /**
162 Activates the MDI child preceding the currently active one.
3c4f71cc 163
4cc4bfaf 164 @see ActivateNext()
23324ae1
FM
165 */
166 void ActivatePrevious();
167
168 /**
169 Arranges any iconized (minimized) MDI child windows.
3c4f71cc 170
4cc4bfaf 171 @see Cascade(), Tile()
23324ae1
FM
172 */
173 void ArrangeIcons();
174
175 /**
176 Arranges the MDI child windows in a cascade.
3c4f71cc 177
4cc4bfaf 178 @see Tile(), ArrangeIcons()
23324ae1
FM
179 */
180 void Cascade();
181
182 /**
183 Used in two-step frame construction. See wxMDIParentFrame()
184 for further details.
185 */
186 bool Create(wxWindow* parent, wxWindowID id,
187 const wxString& title,
188 const wxPoint& pos = wxDefaultPosition,
189 const wxSize& size = wxDefaultSize,
4cc4bfaf 190 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
23324ae1
FM
191 const wxString& name = "frame");
192
193 /**
194 Returns a pointer to the active MDI child, if there is one.
195 */
328f5751 196 wxMDIChildFrame* GetActiveChild() const;
23324ae1
FM
197
198 /**
199 This gets the size of the frame 'client area' in pixels.
3c4f71cc 200
7c913512 201 @param width
4cc4bfaf 202 Receives the client width in pixels.
7c913512 203 @param height
4cc4bfaf 204 Receives the client height in pixels.
3c4f71cc 205
23324ae1 206 @remarks The client area is the area which may be drawn on by the
4cc4bfaf
FM
207 programmer, excluding title bar, border, status bar,
208 and toolbar if present.
3c4f71cc 209
4cc4bfaf
FM
210 @see GetToolBar(), SetToolBar(),
211 wxMDIClientWindow
23324ae1 212 */
328f5751 213 virtual void GetClientSize(int* width, int* height) const;
23324ae1
FM
214
215 /**
216 Returns a pointer to the client window.
3c4f71cc 217
4cc4bfaf 218 @see OnCreateClient()
23324ae1 219 */
328f5751 220 wxMDIClientWindow* GetClientWindow() const;
23324ae1
FM
221
222 /**
223 Returns the window being used as the toolbar for this frame.
3c4f71cc 224
4cc4bfaf 225 @see SetToolBar()
23324ae1 226 */
328f5751 227 virtual wxWindow* GetToolBar() const;
23324ae1
FM
228
229 /**
230 Returns the current Window menu (added by wxWidgets to the menubar). This
231 function
232 is available under Windows only.
233 */
328f5751 234 wxMenu* GetWindowMenu() const;
23324ae1
FM
235
236 /**
237 Override this to return a different kind of client window. If you override this
238 function,
239 you must create your parent frame in two stages, or your function will never be
240 called,
241 due to the way C++ treats virtual functions called from constructors. For
242 example:
3c4f71cc 243
23324ae1 244 @remarks You might wish to derive from wxMDIClientWindow in order to
4cc4bfaf
FM
245 implement different erase behaviour, for example, such
246 as painting a bitmap on the background.
3c4f71cc 247
4cc4bfaf 248 @see GetClientWindow(), wxMDIClientWindow
23324ae1
FM
249 */
250 virtual wxMDIClientWindow* OnCreateClient();
251
252 /**
253 Sets the window to be used as a toolbar for this
254 MDI parent window. It saves the application having to manage the positioning
255 of the toolbar MDI client window.
3c4f71cc 256
7c913512 257 @param toolbar
4cc4bfaf 258 Toolbar to manage.
3c4f71cc 259
23324ae1 260 @remarks When the frame is resized, the toolbar is resized to be the
4cc4bfaf
FM
261 width of the frame client area, and the toolbar height
262 is kept the same.
3c4f71cc 263
4cc4bfaf 264 @see GetToolBar(), GetClientSize()
23324ae1
FM
265 */
266 virtual void SetToolBar(wxWindow* toolbar);
267
268 /**
269 Call this to change the current Window menu. Ownership of the menu object
270 passes to
271 the frame when you call this function.
23324ae1 272 This call is available under Windows only.
23324ae1
FM
273 To remove the window completely, use the wxFRAME_NO_WINDOW_MENU window style.
274 */
275 void SetWindowMenu(wxMenu* menu);
276
277 /**
278 Tiles the MDI child windows either horizontally or vertically depending on
4cc4bfaf 279 whether @a orient is wxHORIZONTAL or wxVERTICAL.
23324ae1
FM
280 Currently only implemented for MSW, does nothing under the other platforms.
281 */
282 void Tile(wxOrientation orient = wxHORIZONTAL);
283};
284
285
e54c96f1 286
23324ae1
FM
287/**
288 @class wxMDIChildFrame
7c913512 289
23324ae1
FM
290 An MDI child frame is a frame that can only exist on a wxMDIClientWindow,
291 which is itself a child of wxMDIParentFrame.
7c913512 292
23324ae1 293 @beginStyleTable
8c6791e4 294 @style{wxCAPTION}
23324ae1 295 Puts a caption on the frame.
8c6791e4 296 @style{wxDEFAULT_FRAME_STYLE}
7c913512 297 Defined as wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxTHICK_FRAME |
23324ae1 298 wxSYSTEM_MENU | wxCAPTION.
8c6791e4 299 @style{wxICONIZE}
23324ae1 300 Display the frame iconized (minimized) (Windows only).
8c6791e4 301 @style{wxMAXIMIZE}
23324ae1 302 Displays the frame maximized (Windows only).
8c6791e4 303 @style{wxMAXIMIZE_BOX}
23324ae1 304 Displays a maximize box on the frame (Windows and Motif only).
8c6791e4 305 @style{wxMINIMIZE}
23324ae1 306 Identical to wxICONIZE.
8c6791e4 307 @style{wxMINIMIZE_BOX}
23324ae1 308 Displays a minimize box on the frame (Windows and Motif only).
8c6791e4 309 @style{wxRESIZE_BORDER}
23324ae1
FM
310 Displays a resizeable border around the window (Motif only; for
311 Windows, it is implicit in wxTHICK_FRAME).
8c6791e4 312 @style{wxSTAY_ON_TOP}
23324ae1 313 Stay on top of other windows (Windows only).
8c6791e4 314 @style{wxSYSTEM_MENU}
23324ae1 315 Displays a system menu (Windows and Motif only).
8c6791e4 316 @style{wxTHICK_FRAME}
23324ae1
FM
317 Displays a thick frame around the window (Windows and Motif only).
318 @endStyleTable
7c913512 319
23324ae1
FM
320 @library{wxcore}
321 @category{managedwnd}
7c913512 322
e54c96f1 323 @see wxMDIClientWindow, wxMDIParentFrame, wxFrame
23324ae1
FM
324*/
325class wxMDIChildFrame : public wxFrame
326{
327public:
328 //@{
329 /**
330 Constructor, creating the window.
3c4f71cc 331
7c913512 332 @param parent
4cc4bfaf 333 The window parent. This should not be @NULL.
7c913512 334 @param id
4cc4bfaf
FM
335 The window identifier. It may take a value of -1 to indicate a default
336 value.
7c913512 337 @param title
4cc4bfaf 338 The caption to be displayed on the frame's title bar.
7c913512 339 @param pos
4cc4bfaf
FM
340 The window position. The value wxDefaultPosition indicates a default position,
341 chosen by
342 either the windowing system or wxWidgets, depending on platform.
7c913512 343 @param size
4cc4bfaf
FM
344 The window size. The value wxDefaultSize indicates a default size, chosen by
345 either the windowing system or wxWidgets, depending on platform.
7c913512 346 @param style
4cc4bfaf 347 The window style. See wxMDIChildFrame.
7c913512 348 @param name
4cc4bfaf 349 The name of the window. This parameter is used to associate a name with the
23324ae1 350 item,
4cc4bfaf
FM
351 allowing the application user to set Motif resource values for
352 individual windows.
3c4f71cc 353
23324ae1 354 @remarks None.
3c4f71cc 355
4cc4bfaf 356 @see Create()
23324ae1
FM
357 */
358 wxMDIChildFrame();
7c913512
FM
359 wxMDIChildFrame(wxMDIParentFrame* parent, wxWindowID id,
360 const wxString& title,
361 const wxPoint& pos = wxDefaultPosition,
362 const wxSize& size = wxDefaultSize,
363 long style = wxDEFAULT_FRAME_STYLE,
364 const wxString& name = "frame");
23324ae1
FM
365 //@}
366
367 /**
368 Destructor. Destroys all child windows and menu bar if present.
369 */
370 ~wxMDIChildFrame();
371
372 /**
373 Activates this MDI child frame.
3c4f71cc 374
4cc4bfaf 375 @see Maximize(), Restore()
23324ae1
FM
376 */
377 void Activate();
378
379 /**
380 Used in two-step frame construction. See wxMDIChildFrame()
381 for further details.
382 */
383 bool Create(wxWindow* parent, wxWindowID id,
384 const wxString& title,
385 const wxPoint& pos = wxDefaultPosition,
386 const wxSize& size = wxDefaultSize,
387 long style = wxDEFAULT_FRAME_STYLE,
388 const wxString& name = "frame");
389
390 /**
391 Maximizes this MDI child frame.
3c4f71cc 392
4cc4bfaf 393 @see Activate(), Restore()
23324ae1
FM
394 */
395 void Maximize(bool maximize);
396
397 /**
398 Restores this MDI child frame (unmaximizes).
399 */
400 void Restore();
401};
e54c96f1 402