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