]>
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: | |
7e1f1a13 BW |
84 | wxAuiMDIClientWindow* m_pClientWindow; |
85 | wxAuiMDIChildFrame* m_pActiveChild; | |
86 | wxEvent* m_pLastEvt; | |
4444d148 | 87 | |
a3219eea BW |
88 | #if wxUSE_MENUS |
89 | wxMenu *m_pWindowMenu; | |
90 | wxMenuBar *m_pMyMenuBar; | |
91 | #endif // wxUSE_MENUS | |
92 | ||
93 | protected: | |
94 | void Init(); | |
95 | ||
96 | #if wxUSE_MENUS | |
97 | void RemoveWindowMenu(wxMenuBar *pMenuBar); | |
98 | void AddWindowMenu(wxMenuBar *pMenuBar); | |
99 | ||
100 | void DoHandleMenu(wxCommandEvent &event); | |
101 | #endif // wxUSE_MENUS | |
102 | ||
103 | virtual void DoGetClientSize(int *width, int *height) const; | |
104 | ||
105 | private: | |
106 | DECLARE_EVENT_TABLE() | |
a3a5df9d | 107 | DECLARE_DYNAMIC_CLASS(wxAuiMDIParentFrame) |
a3219eea BW |
108 | }; |
109 | ||
110 | //----------------------------------------------------------------------------- | |
a3a5df9d | 111 | // wxAuiMDIChildFrame |
a3219eea BW |
112 | //----------------------------------------------------------------------------- |
113 | ||
a3a5df9d | 114 | class WXDLLIMPEXP_AUI wxAuiMDIChildFrame : public wxPanel |
a3219eea BW |
115 | { |
116 | public: | |
a3a5df9d BW |
117 | wxAuiMDIChildFrame(); |
118 | wxAuiMDIChildFrame(wxAuiMDIParentFrame *parent, | |
a3219eea BW |
119 | wxWindowID winid, |
120 | const wxString& title, | |
121 | const wxPoint& pos = wxDefaultPosition, | |
122 | const wxSize& size = wxDefaultSize, | |
123 | long style = wxDEFAULT_FRAME_STYLE, | |
124 | const wxString& name = wxFrameNameStr); | |
125 | ||
a3a5df9d BW |
126 | virtual ~wxAuiMDIChildFrame(); |
127 | bool Create(wxAuiMDIParentFrame *parent, | |
a3219eea BW |
128 | wxWindowID winid, |
129 | const wxString& title, | |
130 | const wxPoint& pos = wxDefaultPosition, | |
131 | const wxSize& size = wxDefaultSize, | |
132 | long style = wxDEFAULT_FRAME_STYLE, | |
133 | const wxString& name = wxFrameNameStr); | |
134 | ||
135 | #if wxUSE_MENUS | |
136 | virtual void SetMenuBar(wxMenuBar *menu_bar); | |
137 | virtual wxMenuBar *GetMenuBar() const; | |
138 | #endif // wxUSE_MENUS | |
139 | ||
140 | virtual void SetTitle(const wxString& title); | |
141 | virtual wxString GetTitle() const; | |
142 | ||
143 | virtual void Activate(); | |
144 | virtual bool Destroy(); | |
4444d148 | 145 | |
a3219eea BW |
146 | #if wxUSE_STATUSBAR |
147 | // no status bars | |
148 | virtual wxStatusBar* CreateStatusBar(int WXUNUSED(number) = 1, | |
149 | long WXUNUSED(style) = 1, | |
150 | wxWindowID WXUNUSED(winid) = 1, | |
151 | const wxString& WXUNUSED(name) = wxEmptyString) | |
152 | { return (wxStatusBar*)NULL; } | |
153 | ||
154 | virtual wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; } | |
155 | virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {} | |
156 | virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {} | |
157 | #endif | |
158 | ||
159 | // no size hints | |
160 | virtual void DoSetSizeHints(int WXUNUSED(minW), | |
161 | int WXUNUSED(minH), | |
162 | int WXUNUSED(maxW) = wxDefaultCoord, | |
163 | int WXUNUSED(maxH) = wxDefaultCoord, | |
164 | int WXUNUSED(incW) = wxDefaultCoord, | |
165 | int WXUNUSED(incH) = wxDefaultCoord) {} | |
166 | #if wxUSE_TOOLBAR | |
167 | // no toolbar bars | |
168 | virtual wxToolBar* CreateToolBar(long WXUNUSED(style), | |
169 | wxWindowID WXUNUSED(winid), | |
170 | const wxString& WXUNUSED(name)) | |
171 | { return (wxToolBar*)NULL; } | |
172 | virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; } | |
173 | #endif | |
174 | ||
175 | // no icon | |
176 | void SetIcon(const wxIcon& WXUNUSED(icon)) { } | |
177 | void SetIcons(const wxIconBundle& WXUNUSED(icons)) { } | |
178 | ||
179 | // no maximize etc | |
180 | virtual void Maximize(bool WXUNUSED(maximize) = true) { /* Has no effect */ } | |
181 | virtual void Restore() { /* Has no effect */ } | |
182 | virtual void Iconize(bool WXUNUSED(iconize) = true) { /* Has no effect */ } | |
183 | virtual bool IsMaximized() const { return true; } | |
184 | virtual bool IsIconized() const { return false; } | |
185 | virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style)) { return false; } | |
186 | virtual bool IsFullScreen() const { return false; } | |
187 | ||
188 | virtual bool IsTopLevel() const { return false; } | |
189 | ||
190 | void OnMenuHighlight(wxMenuEvent& evt); | |
191 | void OnActivate(wxActivateEvent& evt); | |
192 | void OnCloseWindow(wxCloseEvent& evt); | |
4444d148 | 193 | |
a3a5df9d BW |
194 | void SetMDIParentFrame(wxAuiMDIParentFrame* parent); |
195 | wxAuiMDIParentFrame* GetMDIParentFrame() const; | |
a3219eea BW |
196 | |
197 | protected: | |
a3a5df9d | 198 | wxAuiMDIParentFrame *m_pMDIParentFrame; |
a3219eea BW |
199 | wxRect m_mdi_newrect; |
200 | wxRect m_mdi_currect; | |
201 | wxString m_title; | |
202 | ||
203 | #if wxUSE_MENUS | |
204 | wxMenuBar *m_pMenuBar; | |
205 | #endif // wxUSE_MENUS | |
206 | ||
207 | protected: | |
208 | void Init(); | |
209 | ||
210 | virtual bool Show(bool show = true); | |
211 | virtual void DoSetSize(int x, int y, int width, int height, int size_flags); | |
212 | virtual void DoMoveWindow(int x, int y, int width, int height); | |
213 | ||
214 | public: | |
215 | // This function needs to be called when a size change is confirmed, | |
216 | // we needed this function to prevent anybody from the outside | |
217 | // changing the panel... it messes the UI layout when we would allow it. | |
218 | void ApplyMDIChildFrameRect(); | |
219 | void DoShow(bool show); | |
220 | ||
221 | private: | |
a3a5df9d | 222 | DECLARE_DYNAMIC_CLASS(wxAuiMDIChildFrame) |
a3219eea BW |
223 | DECLARE_EVENT_TABLE() |
224 | ||
8856768e | 225 | friend class wxAuiMDIClientWindow; |
a3219eea BW |
226 | }; |
227 | ||
228 | //----------------------------------------------------------------------------- | |
8856768e | 229 | // wxAuiMDIClientWindow |
a3219eea BW |
230 | //----------------------------------------------------------------------------- |
231 | ||
8856768e | 232 | class WXDLLIMPEXP_AUI wxAuiMDIClientWindow : public wxAuiNotebook |
a3219eea BW |
233 | { |
234 | public: | |
8856768e BW |
235 | wxAuiMDIClientWindow(); |
236 | wxAuiMDIClientWindow(wxAuiMDIParentFrame *parent, long style = 0); | |
237 | ~wxAuiMDIClientWindow(); | |
4444d148 | 238 | |
a3a5df9d | 239 | virtual bool CreateClient(wxAuiMDIParentFrame *parent, |
a3219eea BW |
240 | long style = wxVSCROLL | wxHSCROLL); |
241 | ||
242 | virtual int SetSelection(size_t page); | |
243 | ||
244 | protected: | |
245 | ||
4444d148 | 246 | void PageChanged(int old_selection, int new_selection); |
a3219eea BW |
247 | void OnPageChanged(wxAuiNotebookEvent& event); |
248 | void OnSize(wxSizeEvent& evt); | |
249 | ||
250 | private: | |
8856768e | 251 | DECLARE_DYNAMIC_CLASS(wxAuiMDIClientWindow) |
a3219eea BW |
252 | DECLARE_EVENT_TABLE() |
253 | }; | |
25f70bc4 | 254 | #endif // wxUSE_AUI |
a3219eea BW |
255 | |
256 | #endif // _WX_AUITABMDI_H_ |