1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/aui/tabmdi.h
3 // Purpose: Generic MDI (Multiple Document Interface) classes
4 // Author: Hans Van Leemputten
5 // Modified by: Benjamin I. Williams / Kirix Corporation
8 // Copyright: (c) Hans Van Leemputten
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_AUITABMDI_H_
13 #define _WX_AUITABMDI_H_
17 // ----------------------------------------------------------------------------
19 // ----------------------------------------------------------------------------
23 #include "wx/notebook.h"
25 #include "wx/aui/auibook.h"
27 //-----------------------------------------------------------------------------
29 //-----------------------------------------------------------------------------
31 class WXDLLIMPEXP_FWD_AUI wxAuiMDIParentFrame
;
32 class WXDLLIMPEXP_FWD_AUI wxAuiMDIClientWindow
;
33 class WXDLLIMPEXP_FWD_AUI wxAuiMDIChildFrame
;
35 //-----------------------------------------------------------------------------
36 // wxAuiMDIParentFrame
37 //-----------------------------------------------------------------------------
39 class WXDLLIMPEXP_AUI wxAuiMDIParentFrame
: public wxFrame
42 wxAuiMDIParentFrame();
43 wxAuiMDIParentFrame(wxWindow
*parent
,
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
);
51 ~wxAuiMDIParentFrame();
53 bool Create(wxWindow
*parent
,
55 const wxString
& title
,
56 const wxPoint
& pos
= wxDefaultPosition
,
57 const wxSize
& size
= wxDefaultSize
,
58 long style
= wxDEFAULT_FRAME_STYLE
| wxVSCROLL
| wxHSCROLL
,
59 const wxString
& name
= wxFrameNameStr
);
61 void SetArtProvider(wxAuiTabArt
* provider
);
62 wxAuiTabArt
* GetArtProvider();
63 wxAuiNotebook
* GetNotebook() const;
66 wxMenu
* GetWindowMenu() const { return m_pWindowMenu
; }
67 void SetWindowMenu(wxMenu
* pMenu
);
69 virtual void SetMenuBar(wxMenuBar
*pMenuBar
);
72 void SetChildMenuBar(wxAuiMDIChildFrame
*pChild
);
74 wxAuiMDIChildFrame
*GetActiveChild() const;
75 void SetActiveChild(wxAuiMDIChildFrame
* pChildFrame
);
77 wxAuiMDIClientWindow
*GetClientWindow() const;
78 virtual wxAuiMDIClientWindow
*OnCreateClient();
80 virtual void Cascade() { /* Has no effect */ }
81 virtual void Tile(wxOrientation orient
= wxHORIZONTAL
);
82 virtual void ArrangeIcons() { /* Has no effect */ }
83 virtual void ActivateNext();
84 virtual void ActivatePrevious();
87 wxAuiMDIClientWindow
* m_pClientWindow
;
88 wxAuiMDIChildFrame
* m_pActiveChild
;
92 wxMenu
*m_pWindowMenu
;
93 wxMenuBar
*m_pMyMenuBar
;
100 void RemoveWindowMenu(wxMenuBar
*pMenuBar
);
101 void AddWindowMenu(wxMenuBar
*pMenuBar
);
103 void DoHandleMenu(wxCommandEvent
&event
);
104 void DoHandleUpdateUI(wxUpdateUIEvent
&event
);
105 #endif // wxUSE_MENUS
107 virtual bool ProcessEvent(wxEvent
& event
);
109 virtual void DoGetClientSize(int *width
, int *height
) const;
112 DECLARE_EVENT_TABLE()
113 DECLARE_DYNAMIC_CLASS(wxAuiMDIParentFrame
)
116 //-----------------------------------------------------------------------------
117 // wxAuiMDIChildFrame
118 //-----------------------------------------------------------------------------
120 class WXDLLIMPEXP_AUI wxAuiMDIChildFrame
: public wxPanel
123 wxAuiMDIChildFrame();
124 wxAuiMDIChildFrame(wxAuiMDIParentFrame
*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
);
132 virtual ~wxAuiMDIChildFrame();
133 bool Create(wxAuiMDIParentFrame
*parent
,
135 const wxString
& title
,
136 const wxPoint
& pos
= wxDefaultPosition
,
137 const wxSize
& size
= wxDefaultSize
,
138 long style
= wxDEFAULT_FRAME_STYLE
,
139 const wxString
& name
= wxFrameNameStr
);
142 virtual void SetMenuBar(wxMenuBar
*menuBar
);
143 virtual wxMenuBar
*GetMenuBar() const;
144 #endif // wxUSE_MENUS
146 virtual void SetTitle(const wxString
& title
);
147 virtual wxString
GetTitle() const;
149 virtual void SetIcons(const wxIconBundle
& icons
);
150 virtual const wxIconBundle
& GetIcons() const;
152 virtual void SetIcon(const wxIcon
& icon
);
153 virtual const wxIcon
& GetIcon() const;
155 virtual void Activate();
156 virtual bool Destroy();
158 virtual bool Show(bool show
= true);
162 virtual wxStatusBar
* CreateStatusBar(int WXUNUSED(number
) = 1,
163 long WXUNUSED(style
) = 1,
164 wxWindowID
WXUNUSED(winid
) = 1,
165 const wxString
& WXUNUSED(name
) = wxEmptyString
)
168 virtual wxStatusBar
*GetStatusBar() const { return NULL
; }
169 virtual void SetStatusText( const wxString
&WXUNUSED(text
), int WXUNUSED(number
)=0 ) {}
170 virtual void SetStatusWidths( int WXUNUSED(n
), const int WXUNUSED(widths_field
)[] ) {}
175 virtual wxToolBar
* CreateToolBar(long WXUNUSED(style
),
176 wxWindowID
WXUNUSED(winid
),
177 const wxString
& WXUNUSED(name
))
179 virtual wxToolBar
*GetToolBar() const { return NULL
; }
184 virtual void Maximize(bool WXUNUSED(maximize
) = true) { /* Has no effect */ }
185 virtual void Restore() { /* Has no effect */ }
186 virtual void Iconize(bool WXUNUSED(iconize
) = true) { /* Has no effect */ }
187 virtual bool IsMaximized() const { return true; }
188 virtual bool IsIconized() const { return false; }
189 virtual bool ShowFullScreen(bool WXUNUSED(show
), long WXUNUSED(style
)) { return false; }
190 virtual bool IsFullScreen() const { return false; }
192 virtual bool IsTopLevel() const { return false; }
194 void OnMenuHighlight(wxMenuEvent
& evt
);
195 void OnActivate(wxActivateEvent
& evt
);
196 void OnCloseWindow(wxCloseEvent
& evt
);
198 void SetMDIParentFrame(wxAuiMDIParentFrame
* parent
);
199 wxAuiMDIParentFrame
* GetMDIParentFrame() const;
203 virtual void DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
);
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 anybody from the outside
213 // changing the panel... it messes the UI layout when we would allow it.
214 void ApplyMDIChildFrameRect();
215 void DoShow(bool show
);
218 wxAuiMDIParentFrame
* m_pMDIParentFrame
;
223 wxIconBundle m_iconBundle
;
224 bool m_activateOnCreate
;
227 wxMenuBar
* m_pMenuBar
;
228 #endif // wxUSE_MENUS
233 DECLARE_DYNAMIC_CLASS(wxAuiMDIChildFrame
)
234 DECLARE_EVENT_TABLE()
236 friend class wxAuiMDIClientWindow
;
239 //-----------------------------------------------------------------------------
240 // wxAuiMDIClientWindow
241 //-----------------------------------------------------------------------------
243 class WXDLLIMPEXP_AUI wxAuiMDIClientWindow
: public wxAuiNotebook
246 wxAuiMDIClientWindow();
247 wxAuiMDIClientWindow(wxAuiMDIParentFrame
*parent
, long style
= 0);
249 virtual bool CreateClient(wxAuiMDIParentFrame
*parent
,
250 long style
= wxVSCROLL
| wxHSCROLL
);
252 virtual int SetSelection(size_t page
);
256 void PageChanged(int oldSelection
, int newSelection
);
257 void OnPageClose(wxAuiNotebookEvent
& evt
);
258 void OnPageChanged(wxAuiNotebookEvent
& evt
);
259 void OnSize(wxSizeEvent
& evt
);
262 DECLARE_DYNAMIC_CLASS(wxAuiMDIClientWindow
)
263 DECLARE_EVENT_TABLE()
267 #endif // _WX_AUITABMDI_H_