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