]> git.saurik.com Git - wxWidgets.git/blame - include/wx/aui/tabmdi.h
the Append also does an INCREF, that's one more than we need.
[wxWidgets.git] / include / wx / aui / tabmdi.h
CommitLineData
a3219eea 1/////////////////////////////////////////////////////////////////////////////
4444d148 2// Name: wx/generic/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"
189da67c 24#include "wx/aui/auibook.h"
a3219eea 25
a3219eea
BW
26//-----------------------------------------------------------------------------
27// classes
28//-----------------------------------------------------------------------------
29
14a01067
RD
30class WXDLLIMPEXP_AUI wxTabMDIParentFrame;
31class WXDLLIMPEXP_AUI wxTabMDIClientWindow;
32class WXDLLIMPEXP_AUI wxTabMDIChildFrame;
a3219eea
BW
33
34//-----------------------------------------------------------------------------
35// wxTabMDIParentFrame
36//-----------------------------------------------------------------------------
37
82221153 38class WXDLLIMPEXP_AUI wxTabMDIParentFrame : public wxFrame
a3219eea
BW
39{
40public:
41 wxTabMDIParentFrame();
42 wxTabMDIParentFrame(wxWindow *parent,
43 wxWindowID winid,
44 const wxString& title,
45 const wxPoint& pos = wxDefaultPosition,
46 const wxSize& size = wxDefaultSize,
47 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
48 const wxString& name = wxFrameNameStr);
49
50 ~wxTabMDIParentFrame();
4444d148 51
a3219eea
BW
52 bool Create(wxWindow *parent,
53 wxWindowID winid,
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; };
62 void SetWindowMenu(wxMenu* pMenu);
63
64 virtual void SetMenuBar(wxMenuBar *pMenuBar);
65#endif // wxUSE_MENUS
66
67 void SetChildMenuBar(wxTabMDIChildFrame *pChild);
68
69 virtual bool ProcessEvent(wxEvent& event);
70
71 wxTabMDIChildFrame *GetActiveChild() const;
72 inline void SetActiveChild(wxTabMDIChildFrame* pChildFrame);
73
74 wxTabMDIClientWindow *GetClientWindow() const;
75 virtual wxTabMDIClientWindow *OnCreateClient();
76
77 virtual void Cascade() { /* Has no effect */ }
78 virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL) { }
79 virtual void ArrangeIcons() { /* Has no effect */ }
80 virtual void ActivateNext();
81 virtual void ActivatePrevious();
82
83protected:
84 wxTabMDIClientWindow *m_pClientWindow;
85 wxTabMDIChildFrame *m_pActiveChild;
4444d148 86
a3219eea
BW
87#if wxUSE_MENUS
88 wxMenu *m_pWindowMenu;
89 wxMenuBar *m_pMyMenuBar;
90#endif // wxUSE_MENUS
91
92protected:
93 void Init();
94
95#if wxUSE_MENUS
96 void RemoveWindowMenu(wxMenuBar *pMenuBar);
97 void AddWindowMenu(wxMenuBar *pMenuBar);
98
99 void DoHandleMenu(wxCommandEvent &event);
100#endif // wxUSE_MENUS
101
102 virtual void DoGetClientSize(int *width, int *height) const;
103
104private:
105 DECLARE_EVENT_TABLE()
106 DECLARE_DYNAMIC_CLASS(wxTabMDIParentFrame)
107};
108
109//-----------------------------------------------------------------------------
110// wxTabMDIChildFrame
111//-----------------------------------------------------------------------------
112
82221153 113class WXDLLIMPEXP_AUI wxTabMDIChildFrame : public wxPanel
a3219eea
BW
114{
115public:
116 wxTabMDIChildFrame();
117 wxTabMDIChildFrame(wxTabMDIParentFrame *parent,
118 wxWindowID winid,
119 const wxString& title,
120 const wxPoint& pos = wxDefaultPosition,
121 const wxSize& size = wxDefaultSize,
122 long style = wxDEFAULT_FRAME_STYLE,
123 const wxString& name = wxFrameNameStr);
124
125 virtual ~wxTabMDIChildFrame();
126 bool Create(wxTabMDIParentFrame *parent,
127 wxWindowID winid,
128 const wxString& title,
129 const wxPoint& pos = wxDefaultPosition,
130 const wxSize& size = wxDefaultSize,
131 long style = wxDEFAULT_FRAME_STYLE,
132 const wxString& name = wxFrameNameStr);
133
134#if wxUSE_MENUS
135 virtual void SetMenuBar(wxMenuBar *menu_bar);
136 virtual wxMenuBar *GetMenuBar() const;
137#endif // wxUSE_MENUS
138
139 virtual void SetTitle(const wxString& title);
140 virtual wxString GetTitle() const;
141
142 virtual void Activate();
143 virtual bool Destroy();
4444d148 144
a3219eea
BW
145#if wxUSE_STATUSBAR
146 // no status bars
147 virtual wxStatusBar* CreateStatusBar(int WXUNUSED(number) = 1,
148 long WXUNUSED(style) = 1,
149 wxWindowID WXUNUSED(winid) = 1,
150 const wxString& WXUNUSED(name) = wxEmptyString)
151 { return (wxStatusBar*)NULL; }
152
153 virtual wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; }
154 virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {}
155 virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {}
156#endif
157
158 // no size hints
159 virtual void DoSetSizeHints(int WXUNUSED(minW),
160 int WXUNUSED(minH),
161 int WXUNUSED(maxW) = wxDefaultCoord,
162 int WXUNUSED(maxH) = wxDefaultCoord,
163 int WXUNUSED(incW) = wxDefaultCoord,
164 int WXUNUSED(incH) = wxDefaultCoord) {}
165#if wxUSE_TOOLBAR
166 // no toolbar bars
167 virtual wxToolBar* CreateToolBar(long WXUNUSED(style),
168 wxWindowID WXUNUSED(winid),
169 const wxString& WXUNUSED(name))
170 { return (wxToolBar*)NULL; }
171 virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; }
172#endif
173
174 // no icon
175 void SetIcon(const wxIcon& WXUNUSED(icon)) { }
176 void SetIcons(const wxIconBundle& WXUNUSED(icons)) { }
177
178 // no maximize etc
179 virtual void Maximize(bool WXUNUSED(maximize) = true) { /* Has no effect */ }
180 virtual void Restore() { /* Has no effect */ }
181 virtual void Iconize(bool WXUNUSED(iconize) = true) { /* Has no effect */ }
182 virtual bool IsMaximized() const { return true; }
183 virtual bool IsIconized() const { return false; }
184 virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style)) { return false; }
185 virtual bool IsFullScreen() const { return false; }
186
187 virtual bool IsTopLevel() const { return false; }
188
189 void OnMenuHighlight(wxMenuEvent& evt);
190 void OnActivate(wxActivateEvent& evt);
191 void OnCloseWindow(wxCloseEvent& evt);
4444d148 192
a3219eea
BW
193 void SetMDIParentFrame(wxTabMDIParentFrame* parent);
194 wxTabMDIParentFrame* GetMDIParentFrame() const;
195
196protected:
197 wxTabMDIParentFrame *m_pMDIParentFrame;
198 wxRect m_mdi_newrect;
199 wxRect m_mdi_currect;
200 wxString m_title;
201
202#if wxUSE_MENUS
203 wxMenuBar *m_pMenuBar;
204#endif // wxUSE_MENUS
205
206protected:
207 void Init();
208
209 virtual bool Show(bool show = true);
210 virtual void DoSetSize(int x, int y, int width, int height, int size_flags);
211 virtual void DoMoveWindow(int x, int y, int width, int height);
212
213public:
214 // This function needs to be called when a size change is confirmed,
215 // we needed this function to prevent anybody from the outside
216 // changing the panel... it messes the UI layout when we would allow it.
217 void ApplyMDIChildFrameRect();
218 void DoShow(bool show);
219
220private:
221 DECLARE_DYNAMIC_CLASS(wxTabMDIChildFrame)
222 DECLARE_EVENT_TABLE()
223
224 friend class wxTabMDIClientWindow;
225};
226
227//-----------------------------------------------------------------------------
228// wxTabMDIClientWindow
229//-----------------------------------------------------------------------------
230
82221153 231class WXDLLIMPEXP_AUI wxTabMDIClientWindow : public wxAuiMultiNotebook
a3219eea
BW
232{
233public:
234 wxTabMDIClientWindow();
235 wxTabMDIClientWindow(wxTabMDIParentFrame *parent, long style = 0);
236 ~wxTabMDIClientWindow();
4444d148 237
a3219eea
BW
238 virtual bool CreateClient(wxTabMDIParentFrame *parent,
239 long style = wxVSCROLL | wxHSCROLL);
240
241 virtual int SetSelection(size_t page);
242
243protected:
244
4444d148 245 void PageChanged(int old_selection, int new_selection);
a3219eea
BW
246 void OnPageChanged(wxAuiNotebookEvent& event);
247 void OnSize(wxSizeEvent& evt);
248
249private:
250 DECLARE_DYNAMIC_CLASS(wxTabMDIClientWindow)
251 DECLARE_EVENT_TABLE()
252};
25f70bc4 253#endif // wxUSE_AUI
a3219eea
BW
254
255#endif // _WX_AUITABMDI_H_