]>
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 | ||
f39fddcd BW |
60 | void SetArtProvider(wxAuiTabArt* provider); |
61 | wxAuiTabArt* GetArtProvider(); | |
62 | wxAuiNotebook* GetNotebook() const; | |
63 | ||
a3219eea BW |
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 | ||
a3a5df9d | 71 | void SetChildMenuBar(wxAuiMDIChildFrame *pChild); |
a3219eea BW |
72 | |
73 | virtual bool ProcessEvent(wxEvent& event); | |
74 | ||
a3a5df9d BW |
75 | wxAuiMDIChildFrame *GetActiveChild() const; |
76 | inline void SetActiveChild(wxAuiMDIChildFrame* pChildFrame); | |
a3219eea | 77 | |
8856768e BW |
78 | wxAuiMDIClientWindow *GetClientWindow() const; |
79 | virtual wxAuiMDIClientWindow *OnCreateClient(); | |
a3219eea BW |
80 | |
81 | virtual void Cascade() { /* Has no effect */ } | |
82 | virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL) { } | |
83 | virtual void ArrangeIcons() { /* Has no effect */ } | |
84 | virtual void ActivateNext(); | |
85 | virtual void ActivatePrevious(); | |
86 | ||
87 | protected: | |
7e1f1a13 BW |
88 | wxAuiMDIClientWindow* m_pClientWindow; |
89 | wxAuiMDIChildFrame* m_pActiveChild; | |
90 | wxEvent* m_pLastEvt; | |
4444d148 | 91 | |
a3219eea BW |
92 | #if wxUSE_MENUS |
93 | wxMenu *m_pWindowMenu; | |
94 | wxMenuBar *m_pMyMenuBar; | |
95 | #endif // wxUSE_MENUS | |
96 | ||
97 | protected: | |
98 | void Init(); | |
99 | ||
100 | #if wxUSE_MENUS | |
101 | void RemoveWindowMenu(wxMenuBar *pMenuBar); | |
102 | void AddWindowMenu(wxMenuBar *pMenuBar); | |
103 | ||
104 | void DoHandleMenu(wxCommandEvent &event); | |
105 | #endif // wxUSE_MENUS | |
106 | ||
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 | |
140 | virtual void SetMenuBar(wxMenuBar *menu_bar); | |
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; | |
149 | ||
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 | |
a3219eea BW |
156 | #if wxUSE_STATUSBAR |
157 | // no status bars | |
158 | virtual wxStatusBar* CreateStatusBar(int WXUNUSED(number) = 1, | |
159 | long WXUNUSED(style) = 1, | |
160 | wxWindowID WXUNUSED(winid) = 1, | |
161 | const wxString& WXUNUSED(name) = wxEmptyString) | |
162 | { return (wxStatusBar*)NULL; } | |
163 | ||
164 | virtual wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; } | |
165 | virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {} | |
166 | virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {} | |
167 | #endif | |
168 | ||
169 | // no size hints | |
170 | virtual void DoSetSizeHints(int WXUNUSED(minW), | |
171 | int WXUNUSED(minH), | |
172 | int WXUNUSED(maxW) = wxDefaultCoord, | |
173 | int WXUNUSED(maxH) = wxDefaultCoord, | |
174 | int WXUNUSED(incW) = wxDefaultCoord, | |
175 | int WXUNUSED(incH) = wxDefaultCoord) {} | |
176 | #if wxUSE_TOOLBAR | |
177 | // no toolbar bars | |
178 | virtual wxToolBar* CreateToolBar(long WXUNUSED(style), | |
179 | wxWindowID WXUNUSED(winid), | |
180 | const wxString& WXUNUSED(name)) | |
181 | { return (wxToolBar*)NULL; } | |
182 | virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; } | |
183 | #endif | |
184 | ||
a3219eea BW |
185 | |
186 | // no maximize etc | |
187 | virtual void Maximize(bool WXUNUSED(maximize) = true) { /* Has no effect */ } | |
188 | virtual void Restore() { /* Has no effect */ } | |
189 | virtual void Iconize(bool WXUNUSED(iconize) = true) { /* Has no effect */ } | |
190 | virtual bool IsMaximized() const { return true; } | |
191 | virtual bool IsIconized() const { return false; } | |
192 | virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style)) { return false; } | |
193 | virtual bool IsFullScreen() const { return false; } | |
194 | ||
195 | virtual bool IsTopLevel() const { return false; } | |
196 | ||
197 | void OnMenuHighlight(wxMenuEvent& evt); | |
198 | void OnActivate(wxActivateEvent& evt); | |
199 | void OnCloseWindow(wxCloseEvent& evt); | |
4444d148 | 200 | |
a3a5df9d BW |
201 | void SetMDIParentFrame(wxAuiMDIParentFrame* parent); |
202 | wxAuiMDIParentFrame* GetMDIParentFrame() const; | |
e0dc13d4 | 203 | |
a3219eea BW |
204 | protected: |
205 | void Init(); | |
a3219eea BW |
206 | virtual bool Show(bool show = true); |
207 | virtual void DoSetSize(int x, int y, int width, int height, int size_flags); | |
208 | virtual void DoMoveWindow(int x, int y, int width, int height); | |
209 | ||
210 | public: | |
211 | // This function needs to be called when a size change is confirmed, | |
212 | // we needed this function to prevent anybody from the outside | |
213 | // changing the panel... it messes the UI layout when we would allow it. | |
214 | void ApplyMDIChildFrameRect(); | |
215 | void DoShow(bool show); | |
216 | ||
e0dc13d4 BW |
217 | protected: |
218 | wxAuiMDIParentFrame* m_pMDIParentFrame; | |
219 | wxRect m_mdi_newrect; | |
220 | wxRect m_mdi_currect; | |
221 | wxString m_title; | |
222 | wxIcon m_icon; | |
223 | wxIconBundle m_icon_bundle; | |
224 | ||
225 | #if wxUSE_MENUS | |
226 | wxMenuBar* m_pMenuBar; | |
227 | #endif // wxUSE_MENUS | |
228 | ||
229 | ||
230 | ||
a3219eea | 231 | private: |
a3a5df9d | 232 | DECLARE_DYNAMIC_CLASS(wxAuiMDIChildFrame) |
a3219eea BW |
233 | DECLARE_EVENT_TABLE() |
234 | ||
8856768e | 235 | friend class wxAuiMDIClientWindow; |
a3219eea BW |
236 | }; |
237 | ||
238 | //----------------------------------------------------------------------------- | |
8856768e | 239 | // wxAuiMDIClientWindow |
a3219eea BW |
240 | //----------------------------------------------------------------------------- |
241 | ||
8856768e | 242 | class WXDLLIMPEXP_AUI wxAuiMDIClientWindow : public wxAuiNotebook |
a3219eea BW |
243 | { |
244 | public: | |
8856768e BW |
245 | wxAuiMDIClientWindow(); |
246 | wxAuiMDIClientWindow(wxAuiMDIParentFrame *parent, long style = 0); | |
247 | ~wxAuiMDIClientWindow(); | |
4444d148 | 248 | |
a3a5df9d | 249 | virtual bool CreateClient(wxAuiMDIParentFrame *parent, |
a3219eea BW |
250 | long style = wxVSCROLL | wxHSCROLL); |
251 | ||
252 | virtual int SetSelection(size_t page); | |
253 | ||
254 | protected: | |
255 | ||
4444d148 | 256 | void PageChanged(int old_selection, int new_selection); |
a3219eea BW |
257 | void OnPageChanged(wxAuiNotebookEvent& event); |
258 | void OnSize(wxSizeEvent& evt); | |
259 | ||
260 | private: | |
8856768e | 261 | DECLARE_DYNAMIC_CLASS(wxAuiMDIClientWindow) |
a3219eea BW |
262 | DECLARE_EVENT_TABLE() |
263 | }; | |
25f70bc4 | 264 | #endif // wxUSE_AUI |
a3219eea BW |
265 | |
266 | #endif // _WX_AUITABMDI_H_ |