]>
Commit | Line | Data |
---|---|---|
a3219eea BW |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/generic/mdig.h | |
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" | |
22 | #include "wx/aui/notebook.h" | |
23 | ||
24 | extern WXDLLEXPORT_DATA(const wxChar) wxFrameNameStr[]; | |
25 | extern WXDLLEXPORT_DATA(const wxChar) wxStatusLineNameStr[]; | |
26 | ||
27 | //----------------------------------------------------------------------------- | |
28 | // classes | |
29 | //----------------------------------------------------------------------------- | |
30 | ||
31 | class WXDLLEXPORT wxTabMDIParentFrame; | |
32 | class WXDLLEXPORT wxTabMDIClientWindow; | |
33 | class WXDLLEXPORT wxTabMDIChildFrame; | |
34 | ||
35 | //----------------------------------------------------------------------------- | |
36 | // wxTabMDIParentFrame | |
37 | //----------------------------------------------------------------------------- | |
38 | ||
39 | class WXDLLEXPORT wxTabMDIParentFrame : public wxFrame | |
40 | { | |
41 | public: | |
42 | wxTabMDIParentFrame(); | |
43 | wxTabMDIParentFrame(wxWindow *parent, | |
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 | ||
51 | ~wxTabMDIParentFrame(); | |
52 | ||
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 | ||
61 | #if wxUSE_MENUS | |
62 | wxMenu* GetWindowMenu() const { return m_pWindowMenu; }; | |
63 | void SetWindowMenu(wxMenu* pMenu); | |
64 | ||
65 | virtual void SetMenuBar(wxMenuBar *pMenuBar); | |
66 | #endif // wxUSE_MENUS | |
67 | ||
68 | void SetChildMenuBar(wxTabMDIChildFrame *pChild); | |
69 | ||
70 | virtual bool ProcessEvent(wxEvent& event); | |
71 | ||
72 | wxTabMDIChildFrame *GetActiveChild() const; | |
73 | inline void SetActiveChild(wxTabMDIChildFrame* pChildFrame); | |
74 | ||
75 | wxTabMDIClientWindow *GetClientWindow() const; | |
76 | virtual wxTabMDIClientWindow *OnCreateClient(); | |
77 | ||
78 | virtual void Cascade() { /* Has no effect */ } | |
79 | virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL) { } | |
80 | virtual void ArrangeIcons() { /* Has no effect */ } | |
81 | virtual void ActivateNext(); | |
82 | virtual void ActivatePrevious(); | |
83 | ||
84 | protected: | |
85 | wxTabMDIClientWindow *m_pClientWindow; | |
86 | wxTabMDIChildFrame *m_pActiveChild; | |
87 | ||
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() | |
107 | DECLARE_DYNAMIC_CLASS(wxTabMDIParentFrame) | |
108 | }; | |
109 | ||
110 | //----------------------------------------------------------------------------- | |
111 | // wxTabMDIChildFrame | |
112 | //----------------------------------------------------------------------------- | |
113 | ||
114 | class WXDLLEXPORT wxTabMDIChildFrame : public wxPanel | |
115 | { | |
116 | public: | |
117 | wxTabMDIChildFrame(); | |
118 | wxTabMDIChildFrame(wxTabMDIParentFrame *parent, | |
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 | ||
126 | virtual ~wxTabMDIChildFrame(); | |
127 | bool Create(wxTabMDIParentFrame *parent, | |
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(); | |
145 | ||
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); | |
193 | ||
194 | void SetMDIParentFrame(wxTabMDIParentFrame* parent); | |
195 | wxTabMDIParentFrame* GetMDIParentFrame() const; | |
196 | ||
197 | protected: | |
198 | wxTabMDIParentFrame *m_pMDIParentFrame; | |
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: | |
222 | DECLARE_DYNAMIC_CLASS(wxTabMDIChildFrame) | |
223 | DECLARE_EVENT_TABLE() | |
224 | ||
225 | friend class wxTabMDIClientWindow; | |
226 | }; | |
227 | ||
228 | //----------------------------------------------------------------------------- | |
229 | // wxTabMDIClientWindow | |
230 | //----------------------------------------------------------------------------- | |
231 | ||
232 | class WXDLLEXPORT wxTabMDIClientWindow : public wxAuiMultiNotebook | |
233 | { | |
234 | public: | |
235 | wxTabMDIClientWindow(); | |
236 | wxTabMDIClientWindow(wxTabMDIParentFrame *parent, long style = 0); | |
237 | ~wxTabMDIClientWindow(); | |
238 | ||
239 | virtual bool CreateClient(wxTabMDIParentFrame *parent, | |
240 | long style = wxVSCROLL | wxHSCROLL); | |
241 | ||
242 | virtual int SetSelection(size_t page); | |
243 | ||
244 | protected: | |
245 | ||
246 | void PageChanged(int old_selection, int new_selection); | |
247 | void OnPageChanged(wxAuiNotebookEvent& event); | |
248 | void OnSize(wxSizeEvent& evt); | |
249 | ||
250 | private: | |
251 | DECLARE_DYNAMIC_CLASS(wxTabMDIClientWindow) | |
252 | DECLARE_EVENT_TABLE() | |
253 | }; | |
254 | ||
255 | #endif // _WX_AUITABMDI_H_ |