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 extern WXDLLEXPORT_DATA(const wxChar
) wxStatusLineNameStr
[];
26 //-----------------------------------------------------------------------------
28 //-----------------------------------------------------------------------------
30 class WXDLLEXPORT wxGenericMDIParentFrame
;
31 class WXDLLEXPORT wxGenericMDIClientWindow
;
32 class WXDLLEXPORT wxGenericMDIChildFrame
;
34 //-----------------------------------------------------------------------------
35 // wxGenericMDIParentFrame
36 //-----------------------------------------------------------------------------
38 class WXDLLEXPORT wxGenericMDIParentFrame
: public wxFrame
41 wxGenericMDIParentFrame();
42 wxGenericMDIParentFrame(wxWindow
*parent
,
44 const wxString
& title
,
45 const wxPoint
& pos
= wxDefaultPosition
,
46 const wxSize
& size
= wxDefaultSize
,
47 long style
= wxDEFAULT_FRAME_STYLE
| wxVSCROLL
| wxHSCROLL
,
48 const wxString
& name
= wxFrameNameStr
);
50 virtual ~wxGenericMDIParentFrame();
51 bool Create( wxWindow
*parent
,
53 const wxString
& title
,
54 const wxPoint
& pos
= wxDefaultPosition
,
55 const wxSize
& size
= wxDefaultSize
,
56 long style
= wxDEFAULT_FRAME_STYLE
| wxVSCROLL
| wxHSCROLL
,
57 const wxString
& name
= wxFrameNameStr
);
60 wxMenu
* GetWindowMenu() const { return m_pWindowMenu
; };
61 void SetWindowMenu(wxMenu
* pMenu
);
63 virtual void SetMenuBar(wxMenuBar
*pMenuBar
);
66 void SetChildMenuBar(wxGenericMDIChildFrame
*pChild
);
68 virtual bool ProcessEvent(wxEvent
& event
);
70 wxGenericMDIChildFrame
*GetActiveChild() const;
71 inline void SetActiveChild(wxGenericMDIChildFrame
* pChildFrame
);
73 wxGenericMDIClientWindow
*GetClientWindow() const;
74 virtual wxGenericMDIClientWindow
*OnCreateClient();
76 virtual void Cascade() { /* Has no effect */ }
77 virtual void Tile(wxOrientation
WXUNUSED(orient
) = wxHORIZONTAL
) { }
78 virtual void ArrangeIcons() { /* Has no effect */ }
79 virtual void ActivateNext();
80 virtual void ActivatePrevious();
83 wxGenericMDIClientWindow
*m_pClientWindow
;
84 wxGenericMDIChildFrame
*m_pActiveChild
;
86 wxMenu
*m_pWindowMenu
;
87 wxMenuBar
*m_pMyMenuBar
;
94 void RemoveWindowMenu(wxMenuBar
*pMenuBar
);
95 void AddWindowMenu(wxMenuBar
*pMenuBar
);
97 void DoHandleMenu(wxCommandEvent
&event
);
100 virtual void DoGetClientSize(int *width
, int *height
) const;
103 DECLARE_EVENT_TABLE()
104 DECLARE_DYNAMIC_CLASS(wxGenericMDIParentFrame
)
107 //-----------------------------------------------------------------------------
108 // wxGenericMDIChildFrame
109 //-----------------------------------------------------------------------------
111 class WXDLLEXPORT wxGenericMDIChildFrame
: public wxPanel
114 wxGenericMDIChildFrame();
115 wxGenericMDIChildFrame( wxGenericMDIParentFrame
*parent
,
117 const wxString
& title
,
118 const wxPoint
& pos
= wxDefaultPosition
,
119 const wxSize
& size
= wxDefaultSize
,
120 long style
= wxDEFAULT_FRAME_STYLE
,
121 const wxString
& name
= wxFrameNameStr
);
123 virtual ~wxGenericMDIChildFrame();
124 bool Create( wxGenericMDIParentFrame
*parent
,
126 const wxString
& title
,
127 const wxPoint
& pos
= wxDefaultPosition
,
128 const wxSize
& size
= wxDefaultSize
,
129 long style
= wxDEFAULT_FRAME_STYLE
,
130 const wxString
& name
= wxFrameNameStr
);
133 virtual void SetMenuBar( wxMenuBar
*menu_bar
);
134 virtual wxMenuBar
*GetMenuBar() const;
135 #endif // wxUSE_MENUS
137 virtual void SetTitle(const wxString
& title
);
138 virtual wxString
GetTitle() const;
140 virtual void Activate();
144 virtual wxStatusBar
* CreateStatusBar( int WXUNUSED(number
) = 1,
145 long WXUNUSED(style
) = 1,
146 wxWindowID
WXUNUSED(winid
) = 1,
147 const wxString
& WXUNUSED(name
) = wxEmptyString
)
148 { return (wxStatusBar
*)NULL
; }
150 virtual wxStatusBar
*GetStatusBar() const { return (wxStatusBar
*)NULL
; }
151 virtual void SetStatusText( const wxString
&WXUNUSED(text
), int WXUNUSED(number
)=0 ) {}
152 virtual void SetStatusWidths( int WXUNUSED(n
), const int WXUNUSED(widths_field
)[] ) {}
156 virtual void DoSetSizeHints( int WXUNUSED(minW
),
158 int WXUNUSED(maxW
) = wxDefaultCoord
,
159 int WXUNUSED(maxH
) = wxDefaultCoord
,
160 int WXUNUSED(incW
) = wxDefaultCoord
,
161 int WXUNUSED(incH
) = wxDefaultCoord
) {}
165 virtual wxToolBar
* CreateToolBar( long WXUNUSED(style
),
166 wxWindowID
WXUNUSED(winid
),
167 const wxString
& WXUNUSED(name
) )
168 { return (wxToolBar
*)NULL
; }
169 virtual wxToolBar
*GetToolBar() const { return (wxToolBar
*)NULL
; }
173 void SetIcon( const wxIcon
& WXUNUSED(icon
) ) { }
174 void SetIcons( const wxIconBundle
& WXUNUSED(icons
) ) { }
177 virtual void Maximize( bool WXUNUSED(maximize
) = true) { /* Has no effect */ }
178 virtual void Restore() { /* Has no effect */ }
179 virtual void Iconize(bool WXUNUSED(iconize
) = true) { /* Has no effect */ }
180 virtual bool IsMaximized() const { return true; }
181 virtual bool IsIconized() const { return false; }
182 virtual bool ShowFullScreen(bool WXUNUSED(show
), long WXUNUSED(style
)) { return false; }
183 virtual bool IsFullScreen() const { return false; }
185 virtual bool IsTopLevel() const { return false; }
187 void OnMenuHighlight(wxMenuEvent
& event
);
188 void OnActivate(wxActivateEvent
& event
);
190 // The next 2 are copied from top level...
191 void OnCloseWindow(wxCloseEvent
& event
);
192 void OnSize(wxSizeEvent
& event
);
194 void SetMDIParentFrame(wxGenericMDIParentFrame
* parentFrame
);
195 wxGenericMDIParentFrame
* GetMDIParentFrame() const;
198 wxGenericMDIParentFrame
*m_pMDIParentFrame
;
203 wxMenuBar
*m_pMenuBar
;
204 #endif // wxUSE_MENUS
209 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
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 WXDLLEXPORT 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(wxNotebookEvent
& 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 WXDLLEXPORT 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 WXDLLEXPORT 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 WXDLLEXPORT wxMDIClientWindow
: public wxGenericMDIClientWindow
321 wxMDIClientWindow() {}
323 wxMDIClientWindow( wxGenericMDIParentFrame
*parent
, long style
= 0 )
324 :wxGenericMDIClientWindow(parent
, style
)
329 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow
)