]>
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" | |
189da67c | 24 | #include "wx/aui/auibook.h" |
a3219eea | 25 | |
a3219eea BW |
26 | //----------------------------------------------------------------------------- |
27 | // classes | |
28 | //----------------------------------------------------------------------------- | |
29 | ||
a3a5df9d | 30 | class WXDLLIMPEXP_AUI wxAuiMDIParentFrame; |
8856768e | 31 | class WXDLLIMPEXP_AUI wxAuiMDIClientWindow; |
a3a5df9d | 32 | class WXDLLIMPEXP_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 | ||
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 | ||
a3a5df9d | 67 | void SetChildMenuBar(wxAuiMDIChildFrame *pChild); |
a3219eea BW |
68 | |
69 | virtual bool ProcessEvent(wxEvent& event); | |
70 | ||
a3a5df9d BW |
71 | wxAuiMDIChildFrame *GetActiveChild() const; |
72 | inline void SetActiveChild(wxAuiMDIChildFrame* pChildFrame); | |
a3219eea | 73 | |
8856768e BW |
74 | wxAuiMDIClientWindow *GetClientWindow() const; |
75 | virtual wxAuiMDIClientWindow *OnCreateClient(); | |
a3219eea BW |
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: | |
8856768e | 84 | wxAuiMDIClientWindow *m_pClientWindow; |
a3a5df9d | 85 | wxAuiMDIChildFrame *m_pActiveChild; |
4444d148 | 86 | |
a3219eea BW |
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() | |
a3a5df9d | 106 | DECLARE_DYNAMIC_CLASS(wxAuiMDIParentFrame) |
a3219eea BW |
107 | }; |
108 | ||
109 | //----------------------------------------------------------------------------- | |
a3a5df9d | 110 | // wxAuiMDIChildFrame |
a3219eea BW |
111 | //----------------------------------------------------------------------------- |
112 | ||
a3a5df9d | 113 | class WXDLLIMPEXP_AUI wxAuiMDIChildFrame : public wxPanel |
a3219eea BW |
114 | { |
115 | public: | |
a3a5df9d BW |
116 | wxAuiMDIChildFrame(); |
117 | wxAuiMDIChildFrame(wxAuiMDIParentFrame *parent, | |
a3219eea BW |
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 | ||
a3a5df9d BW |
125 | virtual ~wxAuiMDIChildFrame(); |
126 | bool Create(wxAuiMDIParentFrame *parent, | |
a3219eea BW |
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(); | |
4444d148 | 144 | |
a3219eea BW |
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); | |
4444d148 | 192 | |
a3a5df9d BW |
193 | void SetMDIParentFrame(wxAuiMDIParentFrame* parent); |
194 | wxAuiMDIParentFrame* GetMDIParentFrame() const; | |
a3219eea BW |
195 | |
196 | protected: | |
a3a5df9d | 197 | wxAuiMDIParentFrame *m_pMDIParentFrame; |
a3219eea BW |
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: | |
a3a5df9d | 221 | DECLARE_DYNAMIC_CLASS(wxAuiMDIChildFrame) |
a3219eea BW |
222 | DECLARE_EVENT_TABLE() |
223 | ||
8856768e | 224 | friend class wxAuiMDIClientWindow; |
a3219eea BW |
225 | }; |
226 | ||
227 | //----------------------------------------------------------------------------- | |
8856768e | 228 | // wxAuiMDIClientWindow |
a3219eea BW |
229 | //----------------------------------------------------------------------------- |
230 | ||
8856768e | 231 | class WXDLLIMPEXP_AUI wxAuiMDIClientWindow : public wxAuiNotebook |
a3219eea BW |
232 | { |
233 | public: | |
8856768e BW |
234 | wxAuiMDIClientWindow(); |
235 | wxAuiMDIClientWindow(wxAuiMDIParentFrame *parent, long style = 0); | |
236 | ~wxAuiMDIClientWindow(); | |
4444d148 | 237 | |
a3a5df9d | 238 | virtual bool CreateClient(wxAuiMDIParentFrame *parent, |
a3219eea BW |
239 | long style = wxVSCROLL | wxHSCROLL); |
240 | ||
241 | virtual int SetSelection(size_t page); | |
242 | ||
243 | protected: | |
244 | ||
4444d148 | 245 | void PageChanged(int old_selection, int new_selection); |
a3219eea BW |
246 | void OnPageChanged(wxAuiNotebookEvent& event); |
247 | void OnSize(wxSizeEvent& evt); | |
248 | ||
249 | private: | |
8856768e | 250 | DECLARE_DYNAMIC_CLASS(wxAuiMDIClientWindow) |
a3219eea BW |
251 | DECLARE_EVENT_TABLE() |
252 | }; | |
25f70bc4 | 253 | #endif // wxUSE_AUI |
a3219eea BW |
254 | |
255 | #endif // _WX_AUITABMDI_H_ |