]> git.saurik.com Git - wxWidgets.git/blob - include/wx/aui/tabmdi.h
Add wxActivateEvent::GetActivationReason().
[wxWidgets.git] / include / wx / aui / tabmdi.h
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
6 // Created: 29/07/2002
7 // Copyright: (c) Hans Van Leemputten
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_AUITABMDI_H_
12 #define _WX_AUITABMDI_H_
13
14 #if wxUSE_AUI
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #include "wx/frame.h"
21 #include "wx/panel.h"
22 #include "wx/notebook.h"
23 #include "wx/icon.h"
24 #include "wx/aui/auibook.h"
25
26 //-----------------------------------------------------------------------------
27 // classes
28 //-----------------------------------------------------------------------------
29
30 class WXDLLIMPEXP_FWD_AUI wxAuiMDIParentFrame;
31 class WXDLLIMPEXP_FWD_AUI wxAuiMDIClientWindow;
32 class WXDLLIMPEXP_FWD_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 wxAuiMDIChildFrame *GetActiveChild() const;
74 void SetActiveChild(wxAuiMDIChildFrame* pChildFrame);
75
76 wxAuiMDIClientWindow *GetClientWindow() const;
77 virtual wxAuiMDIClientWindow *OnCreateClient();
78
79 virtual void Cascade() { /* Has no effect */ }
80 virtual void Tile(wxOrientation orient = wxHORIZONTAL);
81 virtual void ArrangeIcons() { /* Has no effect */ }
82 virtual void ActivateNext();
83 virtual void ActivatePrevious();
84
85 protected:
86 wxAuiMDIClientWindow* m_pClientWindow;
87 wxEvent* m_pLastEvt;
88
89 #if wxUSE_MENUS
90 wxMenu *m_pWindowMenu;
91 wxMenuBar *m_pMyMenuBar;
92 #endif // wxUSE_MENUS
93
94 protected:
95 void Init();
96
97 #if wxUSE_MENUS
98 void RemoveWindowMenu(wxMenuBar *pMenuBar);
99 void AddWindowMenu(wxMenuBar *pMenuBar);
100
101 void DoHandleMenu(wxCommandEvent &event);
102 void DoHandleUpdateUI(wxUpdateUIEvent &event);
103 #endif // wxUSE_MENUS
104
105 virtual bool ProcessEvent(wxEvent& event);
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 *menuBar);
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 SetIcons(const wxIconBundle& icons);
148 virtual const wxIconBundle& GetIcons() const;
149
150 virtual void SetIcon(const wxIcon& icon);
151 virtual const wxIcon& GetIcon() const;
152
153 virtual void Activate();
154 virtual bool Destroy();
155
156 virtual bool Show(bool show = true);
157
158 #if wxUSE_STATUSBAR
159 // no status bars
160 virtual wxStatusBar* CreateStatusBar(int WXUNUSED(number) = 1,
161 long WXUNUSED(style) = 1,
162 wxWindowID WXUNUSED(winid) = 1,
163 const wxString& WXUNUSED(name) = wxEmptyString)
164 { return NULL; }
165
166 virtual wxStatusBar *GetStatusBar() const { return NULL; }
167 virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {}
168 virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {}
169 #endif
170
171 #if wxUSE_TOOLBAR
172 // no toolbar bars
173 virtual wxToolBar* CreateToolBar(long WXUNUSED(style),
174 wxWindowID WXUNUSED(winid),
175 const wxString& WXUNUSED(name))
176 { return NULL; }
177 virtual wxToolBar *GetToolBar() const { return NULL; }
178 #endif
179
180
181 // no maximize etc
182 virtual void Maximize(bool WXUNUSED(maximize) = true) { /* Has no effect */ }
183 virtual void Restore() { /* Has no effect */ }
184 virtual void Iconize(bool WXUNUSED(iconize) = true) { /* Has no effect */ }
185 virtual bool IsMaximized() const { return true; }
186 virtual bool IsIconized() const { return false; }
187 virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style)) { return false; }
188 virtual bool IsFullScreen() const { return false; }
189
190 virtual bool IsTopLevel() const { return false; }
191
192 void OnMenuHighlight(wxMenuEvent& evt);
193 void OnActivate(wxActivateEvent& evt);
194 void OnCloseWindow(wxCloseEvent& evt);
195
196 void SetMDIParentFrame(wxAuiMDIParentFrame* parent);
197 wxAuiMDIParentFrame* GetMDIParentFrame() const;
198
199 protected:
200 void Init();
201 virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags);
202 virtual void DoMoveWindow(int x, int y, int width, int height);
203
204 // no size hints
205 virtual void DoSetSizeHints(int WXUNUSED(minW), int WXUNUSED(minH),
206 int WXUNUSED(maxW), int WXUNUSED(maxH),
207 int WXUNUSED(incW), int WXUNUSED(incH)) {}
208 public:
209 // This function needs to be called when a size change is confirmed,
210 // we needed this function to prevent anybody from the outside
211 // changing the panel... it messes the UI layout when we would allow it.
212 void ApplyMDIChildFrameRect();
213 void DoShow(bool show);
214
215 protected:
216 wxAuiMDIParentFrame* m_pMDIParentFrame;
217 wxRect m_mdiNewRect;
218 wxRect m_mdiCurRect;
219 wxString m_title;
220 wxIcon m_icon;
221 wxIconBundle m_iconBundle;
222 bool m_activateOnCreate;
223
224 #if wxUSE_MENUS
225 wxMenuBar* m_pMenuBar;
226 #endif // wxUSE_MENUS
227
228
229
230 private:
231 DECLARE_DYNAMIC_CLASS(wxAuiMDIChildFrame)
232 DECLARE_EVENT_TABLE()
233
234 friend class wxAuiMDIClientWindow;
235 };
236
237 //-----------------------------------------------------------------------------
238 // wxAuiMDIClientWindow
239 //-----------------------------------------------------------------------------
240
241 class WXDLLIMPEXP_AUI wxAuiMDIClientWindow : public wxAuiNotebook
242 {
243 public:
244 wxAuiMDIClientWindow();
245 wxAuiMDIClientWindow(wxAuiMDIParentFrame *parent, long style = 0);
246
247 virtual bool CreateClient(wxAuiMDIParentFrame *parent,
248 long style = wxVSCROLL | wxHSCROLL);
249
250 virtual int SetSelection(size_t page);
251 virtual wxAuiMDIChildFrame* GetActiveChild();
252 virtual void SetActiveChild(wxAuiMDIChildFrame* pChildFrame)
253 {
254 SetSelection(GetPageIndex(pChildFrame));
255 }
256
257 protected:
258
259 void PageChanged(int oldSelection, int newSelection);
260 void OnPageClose(wxAuiNotebookEvent& evt);
261 void OnPageChanged(wxAuiNotebookEvent& evt);
262 void OnSize(wxSizeEvent& evt);
263
264 private:
265 DECLARE_DYNAMIC_CLASS(wxAuiMDIClientWindow)
266 DECLARE_EVENT_TABLE()
267 };
268 #endif // wxUSE_AUI
269
270 #endif // _WX_AUITABMDI_H_