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