1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/mdig.h
3 // Purpose: Generic MDI (Multiple Document Interface) classes
4 // Author: Hans Van Leemputten
8 // Copyright: (c) Hans Van Leemputten
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
21 #include "wx/notebook.h"
23 class WXDLLIMPEXP_FWD_CORE wxIcon
;
24 class WXDLLIMPEXP_FWD_CORE wxIconBundle
;
26 extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusLineNameStr
[];
29 //-----------------------------------------------------------------------------
31 //-----------------------------------------------------------------------------
33 class WXDLLIMPEXP_FWD_CORE wxGenericMDIParentFrame
;
34 class WXDLLIMPEXP_FWD_CORE wxGenericMDIClientWindow
;
35 class WXDLLIMPEXP_FWD_CORE wxGenericMDIChildFrame
;
37 //-----------------------------------------------------------------------------
38 // wxGenericMDIParentFrame
39 //-----------------------------------------------------------------------------
41 class WXDLLIMPEXP_CORE wxGenericMDIParentFrame
: public wxFrame
44 wxGenericMDIParentFrame();
45 wxGenericMDIParentFrame(wxWindow
*parent
,
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
);
53 virtual ~wxGenericMDIParentFrame();
54 bool Create( wxWindow
*parent
,
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
);
63 wxMenu
* GetWindowMenu() const { return m_pWindowMenu
; };
64 void SetWindowMenu(wxMenu
* pMenu
);
66 virtual void SetMenuBar(wxMenuBar
*pMenuBar
);
69 void SetChildMenuBar(wxGenericMDIChildFrame
*pChild
);
71 virtual bool ProcessEvent(wxEvent
& event
);
73 wxGenericMDIChildFrame
*GetActiveChild() const;
74 inline void SetActiveChild(wxGenericMDIChildFrame
* pChildFrame
);
76 wxGenericMDIClientWindow
*GetClientWindow() const;
77 virtual wxGenericMDIClientWindow
*OnCreateClient();
79 virtual void Cascade() { /* Has no effect */ }
80 virtual void Tile(wxOrientation
WXUNUSED(orient
) = wxHORIZONTAL
) { }
81 virtual void ArrangeIcons() { /* Has no effect */ }
82 virtual void ActivateNext();
83 virtual void ActivatePrevious();
86 wxGenericMDIClientWindow
*m_pClientWindow
;
87 wxGenericMDIChildFrame
*m_pActiveChild
;
89 wxMenu
*m_pWindowMenu
;
90 wxMenuBar
*m_pMyMenuBar
;
97 void RemoveWindowMenu(wxMenuBar
*pMenuBar
);
98 void AddWindowMenu(wxMenuBar
*pMenuBar
);
100 void DoHandleMenu(wxCommandEvent
&event
);
101 #endif // wxUSE_MENUS
103 virtual void DoGetClientSize(int *width
, int *height
) const;
106 DECLARE_EVENT_TABLE()
107 DECLARE_DYNAMIC_CLASS(wxGenericMDIParentFrame
)
110 //-----------------------------------------------------------------------------
111 // wxGenericMDIChildFrame
112 //-----------------------------------------------------------------------------
114 class WXDLLIMPEXP_CORE wxGenericMDIChildFrame
: public wxPanel
117 wxGenericMDIChildFrame();
118 wxGenericMDIChildFrame( wxGenericMDIParentFrame
*parent
,
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
);
126 virtual ~wxGenericMDIChildFrame();
127 bool Create( wxGenericMDIParentFrame
*parent
,
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
);
136 virtual void SetMenuBar( wxMenuBar
*menu_bar
);
137 virtual wxMenuBar
*GetMenuBar() const;
138 #endif // wxUSE_MENUS
140 virtual void SetTitle(const wxString
& title
);
141 virtual wxString
GetTitle() const;
143 virtual void Activate();
147 virtual wxStatusBar
* CreateStatusBar( int WXUNUSED(number
) = 1,
148 long WXUNUSED(style
) = 1,
149 wxWindowID
WXUNUSED(winid
) = 1,
150 const wxString
& WXUNUSED(name
) = wxEmptyString
)
151 { return (wxStatusBar
*)NULL
; }
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
)[] ) {}
160 virtual wxToolBar
* CreateToolBar( long WXUNUSED(style
),
161 wxWindowID
WXUNUSED(winid
),
162 const wxString
& WXUNUSED(name
) )
163 { return (wxToolBar
*)NULL
; }
164 virtual wxToolBar
*GetToolBar() const { return (wxToolBar
*)NULL
; }
168 void SetIcon(const wxIcon
& WXUNUSED(icon
)) { }
169 virtual void SetIcons( const wxIconBundle
& WXUNUSED(icons
) ) { }
172 virtual void Maximize( bool WXUNUSED(maximize
) = true) { /* Has no effect */ }
173 virtual void Restore() { /* Has no effect */ }
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; }
180 virtual bool IsTopLevel() const { return false; }
182 void OnMenuHighlight(wxMenuEvent
& event
);
183 void OnActivate(wxActivateEvent
& event
);
185 // The next 2 are copied from top level...
186 void OnCloseWindow(wxCloseEvent
& event
);
187 void OnSize(wxSizeEvent
& event
);
189 void SetMDIParentFrame(wxGenericMDIParentFrame
* parentFrame
);
190 wxGenericMDIParentFrame
* GetMDIParentFrame() const;
193 wxGenericMDIParentFrame
*m_pMDIParentFrame
;
198 wxMenuBar
*m_pMenuBar
;
199 #endif // wxUSE_MENUS
204 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
207 virtual void DoSetSizeHints(int WXUNUSED(minW
), int WXUNUSED(minH
),
208 int WXUNUSED(maxW
), int WXUNUSED(maxH
),
209 int WXUNUSED(incW
), int WXUNUSED(incH
)) {}
211 // This function needs to be called when a size change is confirmed,
212 // we needed this function to prevent any body from the outside
213 // changing the panel... it messes the UI layout when we would allow it.
214 void ApplyMDIChildFrameRect();
217 DECLARE_DYNAMIC_CLASS(wxGenericMDIChildFrame
)
218 DECLARE_EVENT_TABLE()
220 friend class wxGenericMDIClientWindow
;
223 //-----------------------------------------------------------------------------
224 // wxGenericMDIClientWindow
225 //-----------------------------------------------------------------------------
227 class WXDLLIMPEXP_CORE wxGenericMDIClientWindow
: public wxNotebook
230 wxGenericMDIClientWindow();
231 wxGenericMDIClientWindow( wxGenericMDIParentFrame
*parent
, long style
= 0 );
232 virtual ~wxGenericMDIClientWindow();
233 virtual bool CreateClient( wxGenericMDIParentFrame
*parent
, long style
= wxVSCROLL
| wxHSCROLL
);
235 virtual int SetSelection(size_t nPage
);
238 void PageChanged(int OldSelection
, int newSelection
);
240 void OnPageChanged(wxBookCtrlEvent
& event
);
241 void OnSize(wxSizeEvent
& event
);
244 DECLARE_DYNAMIC_CLASS(wxGenericMDIClientWindow
)
245 DECLARE_EVENT_TABLE()
250 * Define normal wxMDI classes based on wxGenericMDI
253 #ifndef wxUSE_GENERIC_MDI_AS_NATIVE
254 #if defined(__WXUNIVERSAL__) || defined(__WXPM__) || defined(__WXCOCOA__)
255 #define wxUSE_GENERIC_MDI_AS_NATIVE 1
257 #define wxUSE_GENERIC_MDI_AS_NATIVE 0
259 #endif // wxUSE_GENERIC_MDI_AS_NATIVE
261 #if wxUSE_GENERIC_MDI_AS_NATIVE
263 class wxMDIChildFrame
;
265 //-----------------------------------------------------------------------------
267 //-----------------------------------------------------------------------------
269 class WXDLLIMPEXP_CORE wxMDIParentFrame
: public wxGenericMDIParentFrame
272 wxMDIParentFrame() {}
273 wxMDIParentFrame(wxWindow
*parent
,
275 const wxString
& title
,
276 const wxPoint
& pos
= wxDefaultPosition
,
277 const wxSize
& size
= wxDefaultSize
,
278 long style
= wxDEFAULT_FRAME_STYLE
| wxVSCROLL
| wxHSCROLL
,
279 const wxString
& name
= wxFrameNameStr
)
280 :wxGenericMDIParentFrame(parent
, winid
, title
, pos
, size
, style
, name
)
284 wxMDIChildFrame
* GetActiveChild() const ;
288 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame
)
291 //-----------------------------------------------------------------------------
293 //-----------------------------------------------------------------------------
295 class WXDLLIMPEXP_CORE wxMDIChildFrame
: public wxGenericMDIChildFrame
300 wxMDIChildFrame( wxGenericMDIParentFrame
*parent
,
302 const wxString
& title
,
303 const wxPoint
& pos
= wxDefaultPosition
,
304 const wxSize
& size
= wxDefaultSize
,
305 long style
= wxDEFAULT_FRAME_STYLE
,
306 const wxString
& name
= wxFrameNameStr
)
307 :wxGenericMDIChildFrame(parent
, winid
, title
, pos
, size
, style
, name
)
311 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame
)
314 //-----------------------------------------------------------------------------
316 //-----------------------------------------------------------------------------
318 class WXDLLIMPEXP_CORE wxMDIClientWindow
: public wxGenericMDIClientWindow
321 wxMDIClientWindow() {}
323 wxMDIClientWindow( wxGenericMDIParentFrame
*parent
, long style
= 0 )
324 :wxGenericMDIClientWindow(parent
, style
)
329 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow
)