]> git.saurik.com Git - wxWidgets.git/blob - include/wx/aui/tabmdi.h
accessor functions for wxAuiMDIParentFrame
[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 void SetArtProvider(wxAuiTabArt* provider);
61 wxAuiTabArt* GetArtProvider();
62 wxAuiNotebook* GetNotebook() const;
63
64 #if wxUSE_MENUS
65 wxMenu* GetWindowMenu() const { return m_pWindowMenu; };
66 void SetWindowMenu(wxMenu* pMenu);
67
68 virtual void SetMenuBar(wxMenuBar *pMenuBar);
69 #endif // wxUSE_MENUS
70
71 void SetChildMenuBar(wxAuiMDIChildFrame *pChild);
72
73 virtual bool ProcessEvent(wxEvent& event);
74
75 wxAuiMDIChildFrame *GetActiveChild() const;
76 inline void SetActiveChild(wxAuiMDIChildFrame* pChildFrame);
77
78 wxAuiMDIClientWindow *GetClientWindow() const;
79 virtual wxAuiMDIClientWindow *OnCreateClient();
80
81 virtual void Cascade() { /* Has no effect */ }
82 virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL) { }
83 virtual void ArrangeIcons() { /* Has no effect */ }
84 virtual void ActivateNext();
85 virtual void ActivatePrevious();
86
87 protected:
88 wxAuiMDIClientWindow* m_pClientWindow;
89 wxAuiMDIChildFrame* m_pActiveChild;
90 wxEvent* m_pLastEvt;
91
92 #if wxUSE_MENUS
93 wxMenu *m_pWindowMenu;
94 wxMenuBar *m_pMyMenuBar;
95 #endif // wxUSE_MENUS
96
97 protected:
98 void Init();
99
100 #if wxUSE_MENUS
101 void RemoveWindowMenu(wxMenuBar *pMenuBar);
102 void AddWindowMenu(wxMenuBar *pMenuBar);
103
104 void DoHandleMenu(wxCommandEvent &event);
105 #endif // wxUSE_MENUS
106
107 virtual void DoGetClientSize(int *width, int *height) const;
108
109 private:
110 DECLARE_EVENT_TABLE()
111 DECLARE_DYNAMIC_CLASS(wxAuiMDIParentFrame)
112 };
113
114 //-----------------------------------------------------------------------------
115 // wxAuiMDIChildFrame
116 //-----------------------------------------------------------------------------
117
118 class WXDLLIMPEXP_AUI wxAuiMDIChildFrame : public wxPanel
119 {
120 public:
121 wxAuiMDIChildFrame();
122 wxAuiMDIChildFrame(wxAuiMDIParentFrame *parent,
123 wxWindowID winid,
124 const wxString& title,
125 const wxPoint& pos = wxDefaultPosition,
126 const wxSize& size = wxDefaultSize,
127 long style = wxDEFAULT_FRAME_STYLE,
128 const wxString& name = wxFrameNameStr);
129
130 virtual ~wxAuiMDIChildFrame();
131 bool Create(wxAuiMDIParentFrame *parent,
132 wxWindowID winid,
133 const wxString& title,
134 const wxPoint& pos = wxDefaultPosition,
135 const wxSize& size = wxDefaultSize,
136 long style = wxDEFAULT_FRAME_STYLE,
137 const wxString& name = wxFrameNameStr);
138
139 #if wxUSE_MENUS
140 virtual void SetMenuBar(wxMenuBar *menu_bar);
141 virtual wxMenuBar *GetMenuBar() const;
142 #endif // wxUSE_MENUS
143
144 virtual void SetTitle(const wxString& title);
145 virtual wxString GetTitle() const;
146
147 virtual void Activate();
148 virtual bool Destroy();
149
150 #if wxUSE_STATUSBAR
151 // no status bars
152 virtual wxStatusBar* CreateStatusBar(int WXUNUSED(number) = 1,
153 long WXUNUSED(style) = 1,
154 wxWindowID WXUNUSED(winid) = 1,
155 const wxString& WXUNUSED(name) = wxEmptyString)
156 { return (wxStatusBar*)NULL; }
157
158 virtual wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; }
159 virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {}
160 virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {}
161 #endif
162
163 // no size hints
164 virtual void DoSetSizeHints(int WXUNUSED(minW),
165 int WXUNUSED(minH),
166 int WXUNUSED(maxW) = wxDefaultCoord,
167 int WXUNUSED(maxH) = wxDefaultCoord,
168 int WXUNUSED(incW) = wxDefaultCoord,
169 int WXUNUSED(incH) = wxDefaultCoord) {}
170 #if wxUSE_TOOLBAR
171 // no toolbar bars
172 virtual wxToolBar* CreateToolBar(long WXUNUSED(style),
173 wxWindowID WXUNUSED(winid),
174 const wxString& WXUNUSED(name))
175 { return (wxToolBar*)NULL; }
176 virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; }
177 #endif
178
179 // no icon
180 void SetIcon(const wxIcon& WXUNUSED(icon)) { }
181 void SetIcons(const wxIconBundle& WXUNUSED(icons)) { }
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);
197
198 void SetMDIParentFrame(wxAuiMDIParentFrame* parent);
199 wxAuiMDIParentFrame* GetMDIParentFrame() const;
200
201 protected:
202 wxAuiMDIParentFrame *m_pMDIParentFrame;
203 wxRect m_mdi_newrect;
204 wxRect m_mdi_currect;
205 wxString m_title;
206
207 #if wxUSE_MENUS
208 wxMenuBar *m_pMenuBar;
209 #endif // wxUSE_MENUS
210
211 protected:
212 void Init();
213
214 virtual bool Show(bool show = true);
215 virtual void DoSetSize(int x, int y, int width, int height, int size_flags);
216 virtual void DoMoveWindow(int x, int y, int width, int height);
217
218 public:
219 // This function needs to be called when a size change is confirmed,
220 // we needed this function to prevent anybody from the outside
221 // changing the panel... it messes the UI layout when we would allow it.
222 void ApplyMDIChildFrameRect();
223 void DoShow(bool show);
224
225 private:
226 DECLARE_DYNAMIC_CLASS(wxAuiMDIChildFrame)
227 DECLARE_EVENT_TABLE()
228
229 friend class wxAuiMDIClientWindow;
230 };
231
232 //-----------------------------------------------------------------------------
233 // wxAuiMDIClientWindow
234 //-----------------------------------------------------------------------------
235
236 class WXDLLIMPEXP_AUI wxAuiMDIClientWindow : public wxAuiNotebook
237 {
238 public:
239 wxAuiMDIClientWindow();
240 wxAuiMDIClientWindow(wxAuiMDIParentFrame *parent, long style = 0);
241 ~wxAuiMDIClientWindow();
242
243 virtual bool CreateClient(wxAuiMDIParentFrame *parent,
244 long style = wxVSCROLL | wxHSCROLL);
245
246 virtual int SetSelection(size_t page);
247
248 protected:
249
250 void PageChanged(int old_selection, int new_selection);
251 void OnPageChanged(wxAuiNotebookEvent& event);
252 void OnSize(wxSizeEvent& evt);
253
254 private:
255 DECLARE_DYNAMIC_CLASS(wxAuiMDIClientWindow)
256 DECLARE_EVENT_TABLE()
257 };
258 #endif // wxUSE_AUI
259
260 #endif // _WX_AUITABMDI_H_