]>
Commit | Line | Data |
---|---|---|
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 | |
a3219eea BW |
7 | // Copyright: (c) Hans Van Leemputten |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_AUITABMDI_H_ | |
12 | #define _WX_AUITABMDI_H_ | |
13 | ||
25f70bc4 CE |
14 | #if wxUSE_AUI |
15 | ||
a3219eea BW |
16 | // ---------------------------------------------------------------------------- |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
20 | #include "wx/frame.h" | |
21 | #include "wx/panel.h" | |
22 | #include "wx/notebook.h" | |
7564225f | 23 | #include "wx/icon.h" |
189da67c | 24 | #include "wx/aui/auibook.h" |
a3219eea | 25 | |
a3219eea BW |
26 | //----------------------------------------------------------------------------- |
27 | // classes | |
28 | //----------------------------------------------------------------------------- | |
29 | ||
b5dbe15d VS |
30 | class WXDLLIMPEXP_FWD_AUI wxAuiMDIParentFrame; |
31 | class WXDLLIMPEXP_FWD_AUI wxAuiMDIClientWindow; | |
32 | class WXDLLIMPEXP_FWD_AUI wxAuiMDIChildFrame; | |
a3219eea BW |
33 | |
34 | //----------------------------------------------------------------------------- | |
a3a5df9d | 35 | // wxAuiMDIParentFrame |
a3219eea BW |
36 | //----------------------------------------------------------------------------- |
37 | ||
a3a5df9d | 38 | class WXDLLIMPEXP_AUI wxAuiMDIParentFrame : public wxFrame |
a3219eea BW |
39 | { |
40 | public: | |
a3a5df9d BW |
41 | wxAuiMDIParentFrame(); |
42 | wxAuiMDIParentFrame(wxWindow *parent, | |
a3219eea BW |
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 | ||
a3a5df9d | 50 | ~wxAuiMDIParentFrame(); |
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 | ||
f39fddcd BW |
60 | void SetArtProvider(wxAuiTabArt* provider); |
61 | wxAuiTabArt* GetArtProvider(); | |
62 | wxAuiNotebook* GetNotebook() const; | |
004867db | 63 | |
a3219eea | 64 | #if wxUSE_MENUS |
47b378bd | 65 | wxMenu* GetWindowMenu() const { return m_pWindowMenu; } |
a3219eea BW |
66 | void SetWindowMenu(wxMenu* pMenu); |
67 | ||
68 | virtual void SetMenuBar(wxMenuBar *pMenuBar); | |
69 | #endif // wxUSE_MENUS | |
70 | ||
a3a5df9d | 71 | void SetChildMenuBar(wxAuiMDIChildFrame *pChild); |
a3219eea | 72 | |
a3a5df9d | 73 | wxAuiMDIChildFrame *GetActiveChild() const; |
ffdbfc4a | 74 | void SetActiveChild(wxAuiMDIChildFrame* pChildFrame); |
a3219eea | 75 | |
8856768e BW |
76 | wxAuiMDIClientWindow *GetClientWindow() const; |
77 | virtual wxAuiMDIClientWindow *OnCreateClient(); | |
a3219eea BW |
78 | |
79 | virtual void Cascade() { /* Has no effect */ } | |
d606b6e9 | 80 | virtual void Tile(wxOrientation orient = wxHORIZONTAL); |
a3219eea BW |
81 | virtual void ArrangeIcons() { /* Has no effect */ } |
82 | virtual void ActivateNext(); | |
83 | virtual void ActivatePrevious(); | |
84 | ||
85 | protected: | |
7e1f1a13 | 86 | wxAuiMDIClientWindow* m_pClientWindow; |
7e1f1a13 | 87 | wxEvent* m_pLastEvt; |
4444d148 | 88 | |
a3219eea BW |
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); | |
9827ce92 | 102 | void DoHandleUpdateUI(wxUpdateUIEvent &event); |
a3219eea BW |
103 | #endif // wxUSE_MENUS |
104 | ||
004867db FM |
105 | virtual bool ProcessEvent(wxEvent& event); |
106 | ||
a3219eea BW |
107 | virtual void DoGetClientSize(int *width, int *height) const; |
108 | ||
109 | private: | |
110 | DECLARE_EVENT_TABLE() | |
a3a5df9d | 111 | DECLARE_DYNAMIC_CLASS(wxAuiMDIParentFrame) |
a3219eea BW |
112 | }; |
113 | ||
114 | //----------------------------------------------------------------------------- | |
a3a5df9d | 115 | // wxAuiMDIChildFrame |
a3219eea BW |
116 | //----------------------------------------------------------------------------- |
117 | ||
a3a5df9d | 118 | class WXDLLIMPEXP_AUI wxAuiMDIChildFrame : public wxPanel |
a3219eea BW |
119 | { |
120 | public: | |
a3a5df9d BW |
121 | wxAuiMDIChildFrame(); |
122 | wxAuiMDIChildFrame(wxAuiMDIParentFrame *parent, | |
a3219eea BW |
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 | ||
a3a5df9d BW |
130 | virtual ~wxAuiMDIChildFrame(); |
131 | bool Create(wxAuiMDIParentFrame *parent, | |
a3219eea BW |
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 | |
9a29fe70 | 140 | virtual void SetMenuBar(wxMenuBar *menuBar); |
a3219eea BW |
141 | virtual wxMenuBar *GetMenuBar() const; |
142 | #endif // wxUSE_MENUS | |
143 | ||
144 | virtual void SetTitle(const wxString& title); | |
145 | virtual wxString GetTitle() const; | |
146 | ||
e0dc13d4 BW |
147 | virtual void SetIcons(const wxIconBundle& icons); |
148 | virtual const wxIconBundle& GetIcons() const; | |
004867db | 149 | |
e0dc13d4 BW |
150 | virtual void SetIcon(const wxIcon& icon); |
151 | virtual const wxIcon& GetIcon() const; | |
152 | ||
a3219eea BW |
153 | virtual void Activate(); |
154 | virtual bool Destroy(); | |
4444d148 | 155 | |
cedd7b22 PC |
156 | virtual bool Show(bool show = true); |
157 | ||
a3219eea BW |
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) | |
d3b9f782 | 164 | { return NULL; } |
a3219eea | 165 | |
d3b9f782 | 166 | virtual wxStatusBar *GetStatusBar() const { return NULL; } |
a3219eea BW |
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 | ||
a3219eea BW |
171 | #if wxUSE_TOOLBAR |
172 | // no toolbar bars | |
173 | virtual wxToolBar* CreateToolBar(long WXUNUSED(style), | |
174 | wxWindowID WXUNUSED(winid), | |
175 | const wxString& WXUNUSED(name)) | |
d3b9f782 VZ |
176 | { return NULL; } |
177 | virtual wxToolBar *GetToolBar() const { return NULL; } | |
a3219eea BW |
178 | #endif |
179 | ||
a3219eea BW |
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); | |
4444d148 | 195 | |
a3a5df9d BW |
196 | void SetMDIParentFrame(wxAuiMDIParentFrame* parent); |
197 | wxAuiMDIParentFrame* GetMDIParentFrame() const; | |
004867db | 198 | |
a3219eea BW |
199 | protected: |
200 | void Init(); | |
9a29fe70 | 201 | virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags); |
a3219eea BW |
202 | virtual void DoMoveWindow(int x, int y, int width, int height); |
203 | ||
b2e10dac PC |
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)) {} | |
a3219eea BW |
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 | ||
e0dc13d4 BW |
215 | protected: |
216 | wxAuiMDIParentFrame* m_pMDIParentFrame; | |
9a29fe70 VZ |
217 | wxRect m_mdiNewRect; |
218 | wxRect m_mdiCurRect; | |
e0dc13d4 BW |
219 | wxString m_title; |
220 | wxIcon m_icon; | |
9a29fe70 VZ |
221 | wxIconBundle m_iconBundle; |
222 | bool m_activateOnCreate; | |
e0dc13d4 BW |
223 | |
224 | #if wxUSE_MENUS | |
225 | wxMenuBar* m_pMenuBar; | |
226 | #endif // wxUSE_MENUS | |
227 | ||
228 | ||
229 | ||
a3219eea | 230 | private: |
a3a5df9d | 231 | DECLARE_DYNAMIC_CLASS(wxAuiMDIChildFrame) |
a3219eea BW |
232 | DECLARE_EVENT_TABLE() |
233 | ||
8856768e | 234 | friend class wxAuiMDIClientWindow; |
a3219eea BW |
235 | }; |
236 | ||
237 | //----------------------------------------------------------------------------- | |
8856768e | 238 | // wxAuiMDIClientWindow |
a3219eea BW |
239 | //----------------------------------------------------------------------------- |
240 | ||
8856768e | 241 | class WXDLLIMPEXP_AUI wxAuiMDIClientWindow : public wxAuiNotebook |
a3219eea BW |
242 | { |
243 | public: | |
8856768e BW |
244 | wxAuiMDIClientWindow(); |
245 | wxAuiMDIClientWindow(wxAuiMDIParentFrame *parent, long style = 0); | |
4444d148 | 246 | |
a3a5df9d | 247 | virtual bool CreateClient(wxAuiMDIParentFrame *parent, |
a3219eea BW |
248 | long style = wxVSCROLL | wxHSCROLL); |
249 | ||
250 | virtual int SetSelection(size_t page); | |
0d1dd76b VZ |
251 | virtual wxAuiMDIChildFrame* GetActiveChild(); |
252 | virtual void SetActiveChild(wxAuiMDIChildFrame* pChildFrame) | |
253 | { | |
254 | SetSelection(GetPageIndex(pChildFrame)); | |
255 | } | |
a3219eea BW |
256 | |
257 | protected: | |
258 | ||
9a29fe70 | 259 | void PageChanged(int oldSelection, int newSelection); |
e7e324be BW |
260 | void OnPageClose(wxAuiNotebookEvent& evt); |
261 | void OnPageChanged(wxAuiNotebookEvent& evt); | |
a3219eea BW |
262 | void OnSize(wxSizeEvent& evt); |
263 | ||
264 | private: | |
8856768e | 265 | DECLARE_DYNAMIC_CLASS(wxAuiMDIClientWindow) |
a3219eea BW |
266 | DECLARE_EVENT_TABLE() |
267 | }; | |
25f70bc4 | 268 | #endif // wxUSE_AUI |
a3219eea BW |
269 | |
270 | #endif // _WX_AUITABMDI_H_ |