]> git.saurik.com Git - wxWidgets.git/blame - include/wx/aui/tabmdi.h
synchronize GTK2 minimum version in docs
[wxWidgets.git] / include / wx / aui / tabmdi.h
CommitLineData
a3219eea 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: wx/aui/tabmdi.h
a3219eea
BW
3// Purpose: Generic MDI (Multiple Document Interface) classes
4// Author: Hans Van Leemputten
5// Modified by: Benjamin I. Williams / Kirix Corporation
6// Created: 29/07/2002
7// RCS-ID: $Id$
8// Copyright: (c) Hans Van Leemputten
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_AUITABMDI_H_
13#define _WX_AUITABMDI_H_
14
25f70bc4
CE
15#if wxUSE_AUI
16
a3219eea
BW
17// ----------------------------------------------------------------------------
18// headers
19// ----------------------------------------------------------------------------
20
21#include "wx/frame.h"
22#include "wx/panel.h"
23#include "wx/notebook.h"
7564225f 24#include "wx/icon.h"
189da67c 25#include "wx/aui/auibook.h"
a3219eea 26
a3219eea
BW
27//-----------------------------------------------------------------------------
28// classes
29//-----------------------------------------------------------------------------
30
b5dbe15d
VS
31class WXDLLIMPEXP_FWD_AUI wxAuiMDIParentFrame;
32class WXDLLIMPEXP_FWD_AUI wxAuiMDIClientWindow;
33class WXDLLIMPEXP_FWD_AUI wxAuiMDIChildFrame;
a3219eea
BW
34
35//-----------------------------------------------------------------------------
a3a5df9d 36// wxAuiMDIParentFrame
a3219eea
BW
37//-----------------------------------------------------------------------------
38
a3a5df9d 39class WXDLLIMPEXP_AUI wxAuiMDIParentFrame : public wxFrame
a3219eea
BW
40{
41public:
a3a5df9d
BW
42 wxAuiMDIParentFrame();
43 wxAuiMDIParentFrame(wxWindow *parent,
a3219eea
BW
44 wxWindowID winid,
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
a3a5df9d 51 ~wxAuiMDIParentFrame();
4444d148 52
a3219eea
BW
53 bool Create(wxWindow *parent,
54 wxWindowID winid,
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 );
60
f39fddcd
BW
61 void SetArtProvider(wxAuiTabArt* provider);
62 wxAuiTabArt* GetArtProvider();
63 wxAuiNotebook* GetNotebook() const;
004867db 64
a3219eea 65#if wxUSE_MENUS
47b378bd 66 wxMenu* GetWindowMenu() const { return m_pWindowMenu; }
a3219eea
BW
67 void SetWindowMenu(wxMenu* pMenu);
68
69 virtual void SetMenuBar(wxMenuBar *pMenuBar);
70#endif // wxUSE_MENUS
71
a3a5df9d 72 void SetChildMenuBar(wxAuiMDIChildFrame *pChild);
a3219eea 73
a3a5df9d 74 wxAuiMDIChildFrame *GetActiveChild() const;
ffdbfc4a 75 void SetActiveChild(wxAuiMDIChildFrame* pChildFrame);
a3219eea 76
8856768e
BW
77 wxAuiMDIClientWindow *GetClientWindow() const;
78 virtual wxAuiMDIClientWindow *OnCreateClient();
a3219eea
BW
79
80 virtual void Cascade() { /* Has no effect */ }
d606b6e9 81 virtual void Tile(wxOrientation orient = wxHORIZONTAL);
a3219eea
BW
82 virtual void ArrangeIcons() { /* Has no effect */ }
83 virtual void ActivateNext();
84 virtual void ActivatePrevious();
85
86protected:
7e1f1a13
BW
87 wxAuiMDIClientWindow* m_pClientWindow;
88 wxAuiMDIChildFrame* m_pActiveChild;
89 wxEvent* m_pLastEvt;
4444d148 90
a3219eea
BW
91#if wxUSE_MENUS
92 wxMenu *m_pWindowMenu;
93 wxMenuBar *m_pMyMenuBar;
94#endif // wxUSE_MENUS
95
96protected:
97 void Init();
98
99#if wxUSE_MENUS
100 void RemoveWindowMenu(wxMenuBar *pMenuBar);
101 void AddWindowMenu(wxMenuBar *pMenuBar);
102
103 void DoHandleMenu(wxCommandEvent &event);
9827ce92 104 void DoHandleUpdateUI(wxUpdateUIEvent &event);
a3219eea
BW
105#endif // wxUSE_MENUS
106
004867db
FM
107 virtual bool ProcessEvent(wxEvent& event);
108
a3219eea
BW
109 virtual void DoGetClientSize(int *width, int *height) const;
110
111private:
112 DECLARE_EVENT_TABLE()
a3a5df9d 113 DECLARE_DYNAMIC_CLASS(wxAuiMDIParentFrame)
a3219eea
BW
114};
115
116//-----------------------------------------------------------------------------
a3a5df9d 117// wxAuiMDIChildFrame
a3219eea
BW
118//-----------------------------------------------------------------------------
119
a3a5df9d 120class WXDLLIMPEXP_AUI wxAuiMDIChildFrame : public wxPanel
a3219eea
BW
121{
122public:
a3a5df9d
BW
123 wxAuiMDIChildFrame();
124 wxAuiMDIChildFrame(wxAuiMDIParentFrame *parent,
a3219eea
BW
125 wxWindowID winid,
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);
131
a3a5df9d
BW
132 virtual ~wxAuiMDIChildFrame();
133 bool Create(wxAuiMDIParentFrame *parent,
a3219eea
BW
134 wxWindowID winid,
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);
140
141#if wxUSE_MENUS
9a29fe70 142 virtual void SetMenuBar(wxMenuBar *menuBar);
a3219eea
BW
143 virtual wxMenuBar *GetMenuBar() const;
144#endif // wxUSE_MENUS
145
146 virtual void SetTitle(const wxString& title);
147 virtual wxString GetTitle() const;
148
e0dc13d4
BW
149 virtual void SetIcons(const wxIconBundle& icons);
150 virtual const wxIconBundle& GetIcons() const;
004867db 151
e0dc13d4
BW
152 virtual void SetIcon(const wxIcon& icon);
153 virtual const wxIcon& GetIcon() const;
154
a3219eea
BW
155 virtual void Activate();
156 virtual bool Destroy();
4444d148 157
cedd7b22
PC
158 virtual bool Show(bool show = true);
159
a3219eea
BW
160#if wxUSE_STATUSBAR
161 // no status bars
162 virtual wxStatusBar* CreateStatusBar(int WXUNUSED(number) = 1,
163 long WXUNUSED(style) = 1,
164 wxWindowID WXUNUSED(winid) = 1,
165 const wxString& WXUNUSED(name) = wxEmptyString)
d3b9f782 166 { return NULL; }
a3219eea 167
d3b9f782 168 virtual wxStatusBar *GetStatusBar() const { return NULL; }
a3219eea
BW
169 virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {}
170 virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {}
171#endif
172
a3219eea
BW
173#if wxUSE_TOOLBAR
174 // no toolbar bars
175 virtual wxToolBar* CreateToolBar(long WXUNUSED(style),
176 wxWindowID WXUNUSED(winid),
177 const wxString& WXUNUSED(name))
d3b9f782
VZ
178 { return NULL; }
179 virtual wxToolBar *GetToolBar() const { return NULL; }
a3219eea
BW
180#endif
181
a3219eea
BW
182
183 // no maximize etc
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; }
191
192 virtual bool IsTopLevel() const { return false; }
193
194 void OnMenuHighlight(wxMenuEvent& evt);
195 void OnActivate(wxActivateEvent& evt);
196 void OnCloseWindow(wxCloseEvent& evt);
4444d148 197
a3a5df9d
BW
198 void SetMDIParentFrame(wxAuiMDIParentFrame* parent);
199 wxAuiMDIParentFrame* GetMDIParentFrame() const;
004867db 200
a3219eea
BW
201protected:
202 void Init();
9a29fe70 203 virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags);
a3219eea
BW
204 virtual void DoMoveWindow(int x, int y, int width, int height);
205
b2e10dac
PC
206 // no size hints
207 virtual void DoSetSizeHints(int WXUNUSED(minW), int WXUNUSED(minH),
208 int WXUNUSED(maxW), int WXUNUSED(maxH),
209 int WXUNUSED(incW), int WXUNUSED(incH)) {}
a3219eea
BW
210public:
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);
216
e0dc13d4
BW
217protected:
218 wxAuiMDIParentFrame* m_pMDIParentFrame;
9a29fe70
VZ
219 wxRect m_mdiNewRect;
220 wxRect m_mdiCurRect;
e0dc13d4
BW
221 wxString m_title;
222 wxIcon m_icon;
9a29fe70
VZ
223 wxIconBundle m_iconBundle;
224 bool m_activateOnCreate;
e0dc13d4
BW
225
226#if wxUSE_MENUS
227 wxMenuBar* m_pMenuBar;
228#endif // wxUSE_MENUS
229
230
231
a3219eea 232private:
a3a5df9d 233 DECLARE_DYNAMIC_CLASS(wxAuiMDIChildFrame)
a3219eea
BW
234 DECLARE_EVENT_TABLE()
235
8856768e 236 friend class wxAuiMDIClientWindow;
a3219eea
BW
237};
238
239//-----------------------------------------------------------------------------
8856768e 240// wxAuiMDIClientWindow
a3219eea
BW
241//-----------------------------------------------------------------------------
242
8856768e 243class WXDLLIMPEXP_AUI wxAuiMDIClientWindow : public wxAuiNotebook
a3219eea
BW
244{
245public:
8856768e
BW
246 wxAuiMDIClientWindow();
247 wxAuiMDIClientWindow(wxAuiMDIParentFrame *parent, long style = 0);
4444d148 248
a3a5df9d 249 virtual bool CreateClient(wxAuiMDIParentFrame *parent,
a3219eea
BW
250 long style = wxVSCROLL | wxHSCROLL);
251
252 virtual int SetSelection(size_t page);
253
254protected:
255
9a29fe70 256 void PageChanged(int oldSelection, int newSelection);
e7e324be
BW
257 void OnPageClose(wxAuiNotebookEvent& evt);
258 void OnPageChanged(wxAuiNotebookEvent& evt);
a3219eea
BW
259 void OnSize(wxSizeEvent& evt);
260
261private:
8856768e 262 DECLARE_DYNAMIC_CLASS(wxAuiMDIClientWindow)
a3219eea
BW
263 DECLARE_EVENT_TABLE()
264};
25f70bc4 265#endif // wxUSE_AUI
a3219eea
BW
266
267#endif // _WX_AUITABMDI_H_