]> git.saurik.com Git - wxWidgets.git/blob - include/wx/aui/tabmdi.h
add a header placeholder
[wxWidgets.git] / include / wx / aui / tabmdi.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/tabmdi.h
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
15 #if wxUSE_AUI
16
17 // ----------------------------------------------------------------------------
18 // headers
19 // ----------------------------------------------------------------------------
20
21 #include "wx/frame.h"
22 #include "wx/panel.h"
23 #include "wx/notebook.h"
24 #include "wx/aui/auibook.h"
25
26 //-----------------------------------------------------------------------------
27 // classes
28 //-----------------------------------------------------------------------------
29
30 class WXDLLIMPEXP_AUI wxAuiMDIParentFrame;
31 class WXDLLIMPEXP_AUI wxAuiMDIClientWindow;
32 class WXDLLIMPEXP_AUI wxAuiMDIChildFrame;
33
34 //-----------------------------------------------------------------------------
35 // wxAuiMDIParentFrame
36 //-----------------------------------------------------------------------------
37
38 class WXDLLIMPEXP_AUI wxAuiMDIParentFrame : public wxFrame
39 {
40 public:
41 wxAuiMDIParentFrame();
42 wxAuiMDIParentFrame(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 ~wxAuiMDIParentFrame();
51
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(wxAuiMDIChildFrame *pChild);
68
69 virtual bool ProcessEvent(wxEvent& event);
70
71 wxAuiMDIChildFrame *GetActiveChild() const;
72 inline void SetActiveChild(wxAuiMDIChildFrame* pChildFrame);
73
74 wxAuiMDIClientWindow *GetClientWindow() const;
75 virtual wxAuiMDIClientWindow *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
83 protected:
84 wxAuiMDIClientWindow *m_pClientWindow;
85 wxAuiMDIChildFrame *m_pActiveChild;
86
87 #if wxUSE_MENUS
88 wxMenu *m_pWindowMenu;
89 wxMenuBar *m_pMyMenuBar;
90 #endif // wxUSE_MENUS
91
92 protected:
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
104 private:
105 DECLARE_EVENT_TABLE()
106 DECLARE_DYNAMIC_CLASS(wxAuiMDIParentFrame)
107 };
108
109 //-----------------------------------------------------------------------------
110 // wxAuiMDIChildFrame
111 //-----------------------------------------------------------------------------
112
113 class WXDLLIMPEXP_AUI wxAuiMDIChildFrame : public wxPanel
114 {
115 public:
116 wxAuiMDIChildFrame();
117 wxAuiMDIChildFrame(wxAuiMDIParentFrame *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 ~wxAuiMDIChildFrame();
126 bool Create(wxAuiMDIParentFrame *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();
144
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);
192
193 void SetMDIParentFrame(wxAuiMDIParentFrame* parent);
194 wxAuiMDIParentFrame* GetMDIParentFrame() const;
195
196 protected:
197 wxAuiMDIParentFrame *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
206 protected:
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
213 public:
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
220 private:
221 DECLARE_DYNAMIC_CLASS(wxAuiMDIChildFrame)
222 DECLARE_EVENT_TABLE()
223
224 friend class wxAuiMDIClientWindow;
225 };
226
227 //-----------------------------------------------------------------------------
228 // wxAuiMDIClientWindow
229 //-----------------------------------------------------------------------------
230
231 class WXDLLIMPEXP_AUI wxAuiMDIClientWindow : public wxAuiNotebook
232 {
233 public:
234 wxAuiMDIClientWindow();
235 wxAuiMDIClientWindow(wxAuiMDIParentFrame *parent, long style = 0);
236 ~wxAuiMDIClientWindow();
237
238 virtual bool CreateClient(wxAuiMDIParentFrame *parent,
239 long style = wxVSCROLL | wxHSCROLL);
240
241 virtual int SetSelection(size_t page);
242
243 protected:
244
245 void PageChanged(int old_selection, int new_selection);
246 void OnPageChanged(wxAuiNotebookEvent& event);
247 void OnSize(wxSizeEvent& evt);
248
249 private:
250 DECLARE_DYNAMIC_CLASS(wxAuiMDIClientWindow)
251 DECLARE_EVENT_TABLE()
252 };
253 #endif // wxUSE_AUI
254
255 #endif // _WX_AUITABMDI_H_