]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/mdig.h
Minor corrections to make dist after reports
[wxWidgets.git] / include / wx / generic / mdig.h
CommitLineData
6c70a9b5
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/generic/mdig.h
3// Purpose: Generic MDI (Multiple Document Interface) classes
4// Author: Hans Van Leemputten
5// Modified by:
6// Created: 29/07/2002
7// RCS-ID: $Id$
8// Copyright: (c) Hans Van Leemputten
65571936 9// Licence: wxWindows licence
6c70a9b5
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_MDIG_H_
13#define _WX_MDIG_H_
14
6c70a9b5
JS
15// ----------------------------------------------------------------------------
16// headers
17// ----------------------------------------------------------------------------
18
19#include "wx/frame.h"
20#include "wx/panel.h"
21#include "wx/notebook.h"
22
75aea0d8
VZ
23class WXDLLIMPEXP_FWD_CORE wxIcon;
24class WXDLLIMPEXP_FWD_CORE wxIconBundle;
25
53a2db12 26extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusLineNameStr[];
6c70a9b5
JS
27
28
29//-----------------------------------------------------------------------------
30// classes
31//-----------------------------------------------------------------------------
32
b5dbe15d
VS
33class WXDLLIMPEXP_FWD_CORE wxGenericMDIParentFrame;
34class WXDLLIMPEXP_FWD_CORE wxGenericMDIClientWindow;
35class WXDLLIMPEXP_FWD_CORE wxGenericMDIChildFrame;
6c70a9b5
JS
36
37//-----------------------------------------------------------------------------
38// wxGenericMDIParentFrame
39//-----------------------------------------------------------------------------
40
53a2db12 41class WXDLLIMPEXP_CORE wxGenericMDIParentFrame: public wxFrame
6c70a9b5
JS
42{
43public:
44 wxGenericMDIParentFrame();
45 wxGenericMDIParentFrame(wxWindow *parent,
aa6f64c7 46 wxWindowID winid,
6c70a9b5
JS
47 const wxString& title,
48 const wxPoint& pos = wxDefaultPosition,
49 const wxSize& size = wxDefaultSize,
50 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
51 const wxString& name = wxFrameNameStr);
52
d3c7fc99 53 virtual ~wxGenericMDIParentFrame();
6c70a9b5 54 bool Create( wxWindow *parent,
aa6f64c7 55 wxWindowID winid,
6c70a9b5
JS
56 const wxString& title,
57 const wxPoint& pos = wxDefaultPosition,
58 const wxSize& size = wxDefaultSize,
59 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
60 const wxString& name = wxFrameNameStr );
61
62#if wxUSE_MENUS
63 wxMenu* GetWindowMenu() const { return m_pWindowMenu; };
923b48fc 64 void SetWindowMenu(wxMenu* pMenu);
6c70a9b5
JS
65
66 virtual void SetMenuBar(wxMenuBar *pMenuBar);
67#endif // wxUSE_MENUS
68
69 void SetChildMenuBar(wxGenericMDIChildFrame *pChild);
70
71 virtual bool ProcessEvent(wxEvent& event);
72
73 wxGenericMDIChildFrame *GetActiveChild() const;
74 inline void SetActiveChild(wxGenericMDIChildFrame* pChildFrame);
75
76 wxGenericMDIClientWindow *GetClientWindow() const;
77 virtual wxGenericMDIClientWindow *OnCreateClient();
78
79 virtual void Cascade() { /* Has no effect */ }
0d97c090 80 virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL) { }
6c70a9b5
JS
81 virtual void ArrangeIcons() { /* Has no effect */ }
82 virtual void ActivateNext();
83 virtual void ActivatePrevious();
84
85protected:
86 wxGenericMDIClientWindow *m_pClientWindow;
87 wxGenericMDIChildFrame *m_pActiveChild;
88#if wxUSE_MENUS
89 wxMenu *m_pWindowMenu;
90 wxMenuBar *m_pMyMenuBar;
91#endif // wxUSE_MENUS
92
93protected:
94 void Init();
95
96#if wxUSE_MENUS
97 void RemoveWindowMenu(wxMenuBar *pMenuBar);
98 void AddWindowMenu(wxMenuBar *pMenuBar);
99
100 void DoHandleMenu(wxCommandEvent &event);
101#endif // wxUSE_MENUS
102
103 virtual void DoGetClientSize(int *width, int *height) const;
104
105private:
106 DECLARE_EVENT_TABLE()
107 DECLARE_DYNAMIC_CLASS(wxGenericMDIParentFrame)
108};
109
110//-----------------------------------------------------------------------------
111// wxGenericMDIChildFrame
112//-----------------------------------------------------------------------------
113
53a2db12 114class WXDLLIMPEXP_CORE wxGenericMDIChildFrame: public wxPanel
6c70a9b5
JS
115{
116public:
117 wxGenericMDIChildFrame();
118 wxGenericMDIChildFrame( wxGenericMDIParentFrame *parent,
aa6f64c7 119 wxWindowID winid,
6c70a9b5
JS
120 const wxString& title,
121 const wxPoint& pos = wxDefaultPosition,
122 const wxSize& size = wxDefaultSize,
123 long style = wxDEFAULT_FRAME_STYLE,
124 const wxString& name = wxFrameNameStr );
125
126 virtual ~wxGenericMDIChildFrame();
127 bool Create( wxGenericMDIParentFrame *parent,
aa6f64c7 128 wxWindowID winid,
6c70a9b5
JS
129 const wxString& title,
130 const wxPoint& pos = wxDefaultPosition,
131 const wxSize& size = wxDefaultSize,
132 long style = wxDEFAULT_FRAME_STYLE,
133 const wxString& name = wxFrameNameStr );
134
923b48fc 135#if wxUSE_MENUS
6c70a9b5
JS
136 virtual void SetMenuBar( wxMenuBar *menu_bar );
137 virtual wxMenuBar *GetMenuBar() const;
923b48fc 138#endif // wxUSE_MENUS
6c70a9b5
JS
139
140 virtual void SetTitle(const wxString& title);
923b48fc 141 virtual wxString GetTitle() const;
6c70a9b5
JS
142
143 virtual void Activate();
144
145#if wxUSE_STATUSBAR
146 // no status bars
147 virtual wxStatusBar* CreateStatusBar( int WXUNUSED(number) = 1,
148 long WXUNUSED(style) = 1,
aa6f64c7 149 wxWindowID WXUNUSED(winid) = 1,
6c70a9b5
JS
150 const wxString& WXUNUSED(name) = wxEmptyString)
151 { return (wxStatusBar*)NULL; }
152
153 virtual wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; }
154 virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {}
155 virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {}
156#endif
157
6c70a9b5
JS
158#if wxUSE_TOOLBAR
159 // no toolbar bars
160 virtual wxToolBar* CreateToolBar( long WXUNUSED(style),
aa6f64c7 161 wxWindowID WXUNUSED(winid),
6c70a9b5
JS
162 const wxString& WXUNUSED(name) )
163 { return (wxToolBar*)NULL; }
164 virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; }
165#endif
166
167 // no icon
75aea0d8 168 void SetIcon(const wxIcon& WXUNUSED(icon)) { }
ea098413 169 virtual void SetIcons( const wxIconBundle& WXUNUSED(icons) ) { }
6c70a9b5
JS
170
171 // no maximize etc
ca65c044 172 virtual void Maximize( bool WXUNUSED(maximize) = true) { /* Has no effect */ }
6c70a9b5 173 virtual void Restore() { /* Has no effect */ }
ca65c044
WS
174 virtual void Iconize(bool WXUNUSED(iconize) = true) { /* Has no effect */ }
175 virtual bool IsMaximized() const { return true; }
176 virtual bool IsIconized() const { return false; }
177 virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style)) { return false; }
178 virtual bool IsFullScreen() const { return false; }
6c70a9b5 179
ca65c044 180 virtual bool IsTopLevel() const { return false; }
923b48fc 181
6c70a9b5
JS
182 void OnMenuHighlight(wxMenuEvent& event);
183 void OnActivate(wxActivateEvent& event);
184
185 // The next 2 are copied from top level...
186 void OnCloseWindow(wxCloseEvent& event);
187 void OnSize(wxSizeEvent& event);
188
189 void SetMDIParentFrame(wxGenericMDIParentFrame* parentFrame);
190 wxGenericMDIParentFrame* GetMDIParentFrame() const;
191
192protected:
193 wxGenericMDIParentFrame *m_pMDIParentFrame;
194 wxRect m_MDIRect;
195 wxString m_Title;
196
197#if wxUSE_MENUS
198 wxMenuBar *m_pMenuBar;
923b48fc 199#endif // wxUSE_MENUS
6c70a9b5
JS
200
201protected:
202 void Init();
203
204 virtual void DoMoveWindow(int x, int y, int width, int height);
205
b2e10dac
PC
206 // no size hints
207 virtual void DoSetSizeHints(int WXUNUSED(minW), int WXUNUSED(minH),
208 int WXUNUSED(maxW), int WXUNUSED(maxH),
209 int WXUNUSED(incW), int WXUNUSED(incH)) {}
210
6c70a9b5 211 // This function needs to be called when a size change is confirmed,
923b48fc 212 // we needed this function to prevent any body from the outside
6c70a9b5
JS
213 // changing the panel... it messes the UI layout when we would allow it.
214 void ApplyMDIChildFrameRect();
215
216private:
217 DECLARE_DYNAMIC_CLASS(wxGenericMDIChildFrame)
218 DECLARE_EVENT_TABLE()
219
220 friend class wxGenericMDIClientWindow;
221};
222
223//-----------------------------------------------------------------------------
224// wxGenericMDIClientWindow
225//-----------------------------------------------------------------------------
226
53a2db12 227class WXDLLIMPEXP_CORE wxGenericMDIClientWindow: public wxNotebook
6c70a9b5
JS
228{
229public:
230 wxGenericMDIClientWindow();
231 wxGenericMDIClientWindow( wxGenericMDIParentFrame *parent, long style = 0 );
d3c7fc99 232 virtual ~wxGenericMDIClientWindow();
6c70a9b5
JS
233 virtual bool CreateClient( wxGenericMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL );
234
8a39593e 235 virtual int SetSelection(size_t nPage);
6c70a9b5
JS
236
237protected:
238 void PageChanged(int OldSelection, int newSelection);
239
3e97a905 240 void OnPageChanged(wxBookCtrlEvent& event);
6c70a9b5
JS
241 void OnSize(wxSizeEvent& event);
242
243private:
244 DECLARE_DYNAMIC_CLASS(wxGenericMDIClientWindow)
245 DECLARE_EVENT_TABLE()
246};
247
248
249/*
250 * Define normal wxMDI classes based on wxGenericMDI
251 */
252
253#ifndef wxUSE_GENERIC_MDI_AS_NATIVE
8029fe03 254#if defined(__WXUNIVERSAL__) || defined(__WXPM__) || defined(__WXCOCOA__)
6c70a9b5
JS
255#define wxUSE_GENERIC_MDI_AS_NATIVE 1
256#else
257#define wxUSE_GENERIC_MDI_AS_NATIVE 0
258#endif
259#endif // wxUSE_GENERIC_MDI_AS_NATIVE
260
261#if wxUSE_GENERIC_MDI_AS_NATIVE
262
2b5f62a0
VZ
263class wxMDIChildFrame ;
264
6c70a9b5
JS
265//-----------------------------------------------------------------------------
266// wxMDIParentFrame
267//-----------------------------------------------------------------------------
268
53a2db12 269class WXDLLIMPEXP_CORE wxMDIParentFrame: public wxGenericMDIParentFrame
6c70a9b5
JS
270{
271public:
6463b9f5 272 wxMDIParentFrame() {}
6c70a9b5 273 wxMDIParentFrame(wxWindow *parent,
aa6f64c7 274 wxWindowID winid,
6c70a9b5
JS
275 const wxString& title,
276 const wxPoint& pos = wxDefaultPosition,
277 const wxSize& size = wxDefaultSize,
278 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
cde47db3
JS
279 const wxString& name = wxFrameNameStr)
280 :wxGenericMDIParentFrame(parent, winid, title, pos, size, style, name)
281 {
282 }
6c70a9b5 283
2b5f62a0 284 wxMDIChildFrame * GetActiveChild() const ;
ca65c044
WS
285
286
6c70a9b5
JS
287private:
288 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
289};
290
291//-----------------------------------------------------------------------------
292// wxMDIChildFrame
293//-----------------------------------------------------------------------------
294
53a2db12 295class WXDLLIMPEXP_CORE wxMDIChildFrame: public wxGenericMDIChildFrame
6c70a9b5
JS
296{
297public:
6463b9f5
JS
298 wxMDIChildFrame() {}
299
6c70a9b5 300 wxMDIChildFrame( wxGenericMDIParentFrame *parent,
aa6f64c7 301 wxWindowID winid,
6c70a9b5
JS
302 const wxString& title,
303 const wxPoint& pos = wxDefaultPosition,
304 const wxSize& size = wxDefaultSize,
305 long style = wxDEFAULT_FRAME_STYLE,
cde47db3
JS
306 const wxString& name = wxFrameNameStr )
307 :wxGenericMDIChildFrame(parent, winid, title, pos, size, style, name)
308 {
309 }
6c70a9b5
JS
310private:
311 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
312};
313
314//-----------------------------------------------------------------------------
315// wxMDIClientWindow
316//-----------------------------------------------------------------------------
317
53a2db12 318class WXDLLIMPEXP_CORE wxMDIClientWindow: public wxGenericMDIClientWindow
6c70a9b5
JS
319{
320public:
6463b9f5
JS
321 wxMDIClientWindow() {}
322
323 wxMDIClientWindow( wxGenericMDIParentFrame *parent, long style = 0 )
324 :wxGenericMDIClientWindow(parent, style)
325 {
326 }
6c70a9b5
JS
327
328private:
329 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
330};
331
332#endif
333
334#endif
335 // _WX_MDIG_H_