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