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 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "mdig.h"
19 // ----------------------------------------------------------------------------
21 // ----------------------------------------------------------------------------
25 #include "wx/notebook.h"
27 WXDLLEXPORT_DATA(extern const wxChar
*) wxFrameNameStr
;
28 WXDLLEXPORT_DATA(extern const wxChar
*) wxStatusLineNameStr
;
31 //-----------------------------------------------------------------------------
33 //-----------------------------------------------------------------------------
35 class WXDLLEXPORT wxGenericMDIParentFrame
;
36 class WXDLLEXPORT wxGenericMDIClientWindow
;
37 class WXDLLEXPORT wxGenericMDIChildFrame
;
39 //-----------------------------------------------------------------------------
40 // wxGenericMDIParentFrame
41 //-----------------------------------------------------------------------------
43 class WXDLLEXPORT wxGenericMDIParentFrame
: public wxFrame
46 wxGenericMDIParentFrame();
47 wxGenericMDIParentFrame(wxWindow
*parent
,
49 const wxString
& title
,
50 const wxPoint
& pos
= wxDefaultPosition
,
51 const wxSize
& size
= wxDefaultSize
,
52 long style
= wxDEFAULT_FRAME_STYLE
| wxVSCROLL
| wxHSCROLL
,
53 const wxString
& name
= wxFrameNameStr
);
55 ~wxGenericMDIParentFrame();
56 bool Create( wxWindow
*parent
,
58 const wxString
& title
,
59 const wxPoint
& pos
= wxDefaultPosition
,
60 const wxSize
& size
= wxDefaultSize
,
61 long style
= wxDEFAULT_FRAME_STYLE
| wxVSCROLL
| wxHSCROLL
,
62 const wxString
& name
= wxFrameNameStr
);
65 wxMenu
* GetWindowMenu() const { return m_pWindowMenu
; };
66 void SetWindowMenu(wxMenu
* pMenu
);
68 virtual void SetMenuBar(wxMenuBar
*pMenuBar
);
71 void SetChildMenuBar(wxGenericMDIChildFrame
*pChild
);
73 virtual bool ProcessEvent(wxEvent
& event
);
75 wxGenericMDIChildFrame
*GetActiveChild() const;
76 inline void SetActiveChild(wxGenericMDIChildFrame
* pChildFrame
);
78 wxGenericMDIClientWindow
*GetClientWindow() const;
79 virtual wxGenericMDIClientWindow
*OnCreateClient();
81 virtual void Cascade() { /* Has no effect */ }
82 virtual void Tile() { /* Has no effect */ }
83 virtual void ArrangeIcons() { /* Has no effect */ }
84 virtual void ActivateNext();
85 virtual void ActivatePrevious();
88 wxGenericMDIClientWindow
*m_pClientWindow
;
89 wxGenericMDIChildFrame
*m_pActiveChild
;
91 wxMenu
*m_pWindowMenu
;
92 wxMenuBar
*m_pMyMenuBar
;
99 void RemoveWindowMenu(wxMenuBar
*pMenuBar
);
100 void AddWindowMenu(wxMenuBar
*pMenuBar
);
102 void DoHandleMenu(wxCommandEvent
&event
);
103 #endif // wxUSE_MENUS
105 virtual void DoGetClientSize(int *width
, int *height
) const;
108 DECLARE_EVENT_TABLE()
109 DECLARE_DYNAMIC_CLASS(wxGenericMDIParentFrame
)
112 //-----------------------------------------------------------------------------
113 // wxGenericMDIChildFrame
114 //-----------------------------------------------------------------------------
116 class WXDLLEXPORT wxGenericMDIChildFrame
: public wxPanel
119 wxGenericMDIChildFrame();
120 wxGenericMDIChildFrame( wxGenericMDIParentFrame
*parent
,
122 const wxString
& title
,
123 const wxPoint
& pos
= wxDefaultPosition
,
124 const wxSize
& size
= wxDefaultSize
,
125 long style
= wxDEFAULT_FRAME_STYLE
,
126 const wxString
& name
= wxFrameNameStr
);
128 virtual ~wxGenericMDIChildFrame();
129 bool Create( wxGenericMDIParentFrame
*parent
,
131 const wxString
& title
,
132 const wxPoint
& pos
= wxDefaultPosition
,
133 const wxSize
& size
= wxDefaultSize
,
134 long style
= wxDEFAULT_FRAME_STYLE
,
135 const wxString
& name
= wxFrameNameStr
);
138 virtual void SetMenuBar( wxMenuBar
*menu_bar
);
139 virtual wxMenuBar
*GetMenuBar() const;
140 #endif // wxUSE_MENUS
142 virtual void SetTitle(const wxString
& title
);
143 virtual wxString
GetTitle();
145 virtual void Activate();
149 virtual wxStatusBar
* CreateStatusBar( int WXUNUSED(number
) = 1,
150 long WXUNUSED(style
) = 1,
151 wxWindowID
WXUNUSED(id
) = 1,
152 const wxString
& WXUNUSED(name
) = wxEmptyString
)
153 { return (wxStatusBar
*)NULL
; }
155 virtual wxStatusBar
*GetStatusBar() const { return (wxStatusBar
*)NULL
; }
156 virtual void SetStatusText( const wxString
&WXUNUSED(text
), int WXUNUSED(number
)=0 ) {}
157 virtual void SetStatusWidths( int WXUNUSED(n
), const int WXUNUSED(widths_field
)[] ) {}
161 virtual void SetSizeHints( int WXUNUSED(minW
),
163 int WXUNUSED(maxW
) = -1,
164 int WXUNUSED(maxH
) = -1,
165 int WXUNUSED(incW
) = -1,
166 int WXUNUSED(incH
) = -1) {}
170 virtual wxToolBar
* CreateToolBar( long WXUNUSED(style
),
171 wxWindowID
WXUNUSED(id
),
172 const wxString
& WXUNUSED(name
) )
173 { return (wxToolBar
*)NULL
; }
174 virtual wxToolBar
*GetToolBar() const { return (wxToolBar
*)NULL
; }
178 void SetIcon( const wxIcon
&icon
) { /*m_icons = wxIconBundle( icon );*/}
179 void SetIcons( const wxIconBundle
&icons
) { /*m_icons = icons;*/ }
182 virtual void Maximize( bool WXUNUSED(maximize
) = TRUE
) { /* Has no effect */ }
183 virtual void Restore() { /* Has no effect */ }
184 virtual void Iconize(bool WXUNUSED(iconize
) = TRUE
) { /* Has no effect */ }
185 virtual bool IsMaximized() const { return TRUE
; }
186 virtual bool IsIconized() const { return FALSE
; }
187 virtual bool ShowFullScreen(bool WXUNUSED(show
), long WXUNUSED(style
)) { return FALSE
; }
188 virtual bool IsFullScreen() const { return FALSE
; }
190 virtual bool IsTopLevel() const { return FALSE
; }
192 void OnMenuHighlight(wxMenuEvent
& event
);
193 void OnActivate(wxActivateEvent
& event
);
195 // The next 2 are copied from top level...
196 void OnCloseWindow(wxCloseEvent
& event
);
197 void OnSize(wxSizeEvent
& event
);
199 void SetMDIParentFrame(wxGenericMDIParentFrame
* parentFrame
);
200 wxGenericMDIParentFrame
* GetMDIParentFrame() const;
203 wxGenericMDIParentFrame
*m_pMDIParentFrame
;
208 wxMenuBar
*m_pMenuBar
;
209 #endif // wxUSE_MENUS
214 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
216 // This function needs to be called when a size change is confirmed,
217 // we needed this function to prevent any body from the outside
218 // changing the panel... it messes the UI layout when we would allow it.
219 void ApplyMDIChildFrameRect();
222 DECLARE_DYNAMIC_CLASS(wxGenericMDIChildFrame
)
223 DECLARE_EVENT_TABLE()
225 friend class wxGenericMDIClientWindow
;
228 //-----------------------------------------------------------------------------
229 // wxGenericMDIClientWindow
230 //-----------------------------------------------------------------------------
232 class WXDLLEXPORT wxGenericMDIClientWindow
: public wxNotebook
235 wxGenericMDIClientWindow();
236 wxGenericMDIClientWindow( wxGenericMDIParentFrame
*parent
, long style
= 0 );
237 ~wxGenericMDIClientWindow();
238 virtual bool CreateClient( wxGenericMDIParentFrame
*parent
, long style
= wxVSCROLL
| wxHSCROLL
);
240 virtual int SetSelection(int nPage
);
243 void PageChanged(int OldSelection
, int newSelection
);
245 void OnPageChanged(wxNotebookEvent
& event
);
246 void OnSize(wxSizeEvent
& event
);
249 DECLARE_DYNAMIC_CLASS(wxGenericMDIClientWindow
)
250 DECLARE_EVENT_TABLE()
255 * Define normal wxMDI classes based on wxGenericMDI
258 #ifndef wxUSE_GENERIC_MDI_AS_NATIVE
259 #if defined(__WXUNIVERSAL__)
260 #define wxUSE_GENERIC_MDI_AS_NATIVE 1
262 #define wxUSE_GENERIC_MDI_AS_NATIVE 0
264 #endif // wxUSE_GENERIC_MDI_AS_NATIVE
266 #if wxUSE_GENERIC_MDI_AS_NATIVE
268 //-----------------------------------------------------------------------------
270 //-----------------------------------------------------------------------------
272 class WXDLLEXPORT wxMDIParentFrame
: public wxGenericMDIParentFrame
275 wxMDIParentFrame() {}
276 wxMDIParentFrame(wxWindow
*parent
,
278 const wxString
& title
,
279 const wxPoint
& pos
= wxDefaultPosition
,
280 const wxSize
& size
= wxDefaultSize
,
281 long style
= wxDEFAULT_FRAME_STYLE
| wxVSCROLL
| wxHSCROLL
,
282 const wxString
& name
= wxFrameNameStr
)
283 :wxGenericMDIParentFrame(parent
, id
, title
, pos
, size
, style
, name
)
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
, id
, title
, pos
, size
, style
, name
)
312 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame
)
315 //-----------------------------------------------------------------------------
317 //-----------------------------------------------------------------------------
319 class WXDLLEXPORT wxMDIClientWindow
: public wxGenericMDIClientWindow
322 wxMDIClientWindow() {}
324 wxMDIClientWindow( wxGenericMDIParentFrame
*parent
, long style
= 0 )
325 :wxGenericMDIClientWindow(parent
, style
)
330 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow
)