]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/mdig.h
add SetNativeTheme() (slightly modified patch 1884553)
[wxWidgets.git] / include / wx / generic / mdig.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/mdig.h
3 // Purpose: Generic MDI (Multiple Document Interface) classes
4 // Author: Hans Van Leemputten
5 // Modified by:
6 // Created: 29/07/2002
7 // RCS-ID: $Id$
8 // Copyright: (c) Hans Van Leemputten
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_MDIG_H_
13 #define _WX_MDIG_H_
14
15 // ----------------------------------------------------------------------------
16 // headers
17 // ----------------------------------------------------------------------------
18
19 #include "wx/frame.h"
20 #include "wx/panel.h"
21 #include "wx/notebook.h"
22
23 class WXDLLIMPEXP_FWD_CORE wxIcon;
24 class WXDLLIMPEXP_FWD_CORE wxIconBundle;
25
26 extern WXDLLEXPORT_DATA(const char) wxStatusLineNameStr[];
27
28
29 //-----------------------------------------------------------------------------
30 // classes
31 //-----------------------------------------------------------------------------
32
33 class WXDLLIMPEXP_FWD_CORE wxGenericMDIParentFrame;
34 class WXDLLIMPEXP_FWD_CORE wxGenericMDIClientWindow;
35 class WXDLLIMPEXP_FWD_CORE wxGenericMDIChildFrame;
36
37 //-----------------------------------------------------------------------------
38 // wxGenericMDIParentFrame
39 //-----------------------------------------------------------------------------
40
41 class WXDLLEXPORT wxGenericMDIParentFrame: public wxFrame
42 {
43 public:
44 wxGenericMDIParentFrame();
45 wxGenericMDIParentFrame(wxWindow *parent,
46 wxWindowID winid,
47 const wxString& title,
48 const wxPoint& pos = wxDefaultPosition,
49 const wxSize& size = wxDefaultSize,
50 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
51 const wxString& name = wxFrameNameStr);
52
53 virtual ~wxGenericMDIParentFrame();
54 bool Create( wxWindow *parent,
55 wxWindowID winid,
56 const wxString& title,
57 const wxPoint& pos = wxDefaultPosition,
58 const wxSize& size = wxDefaultSize,
59 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
60 const wxString& name = wxFrameNameStr );
61
62 #if wxUSE_MENUS
63 wxMenu* GetWindowMenu() const { return m_pWindowMenu; };
64 void SetWindowMenu(wxMenu* pMenu);
65
66 virtual void SetMenuBar(wxMenuBar *pMenuBar);
67 #endif // wxUSE_MENUS
68
69 void SetChildMenuBar(wxGenericMDIChildFrame *pChild);
70
71 virtual bool ProcessEvent(wxEvent& event);
72
73 wxGenericMDIChildFrame *GetActiveChild() const;
74 inline void SetActiveChild(wxGenericMDIChildFrame* pChildFrame);
75
76 wxGenericMDIClientWindow *GetClientWindow() const;
77 virtual wxGenericMDIClientWindow *OnCreateClient();
78
79 virtual void Cascade() { /* Has no effect */ }
80 virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL) { }
81 virtual void ArrangeIcons() { /* Has no effect */ }
82 virtual void ActivateNext();
83 virtual void ActivatePrevious();
84
85 protected:
86 wxGenericMDIClientWindow *m_pClientWindow;
87 wxGenericMDIChildFrame *m_pActiveChild;
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(wxGenericMDIParentFrame)
108 };
109
110 //-----------------------------------------------------------------------------
111 // wxGenericMDIChildFrame
112 //-----------------------------------------------------------------------------
113
114 class WXDLLEXPORT wxGenericMDIChildFrame: public wxPanel
115 {
116 public:
117 wxGenericMDIChildFrame();
118 wxGenericMDIChildFrame( wxGenericMDIParentFrame *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 ~wxGenericMDIChildFrame();
127 bool Create( wxGenericMDIParentFrame *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
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 #if wxUSE_TOOLBAR
159 // no toolbar bars
160 virtual wxToolBar* CreateToolBar( long WXUNUSED(style),
161 wxWindowID WXUNUSED(winid),
162 const wxString& WXUNUSED(name) )
163 { return (wxToolBar*)NULL; }
164 virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; }
165 #endif
166
167 // no icon
168 void SetIcon(const wxIcon& WXUNUSED(icon)) { }
169 virtual void SetIcons( const wxIconBundle& WXUNUSED(icons) ) { }
170
171 // no maximize etc
172 virtual void Maximize( bool WXUNUSED(maximize) = true) { /* Has no effect */ }
173 virtual void Restore() { /* Has no effect */ }
174 virtual void Iconize(bool WXUNUSED(iconize) = true) { /* Has no effect */ }
175 virtual bool IsMaximized() const { return true; }
176 virtual bool IsIconized() const { return false; }
177 virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style)) { return false; }
178 virtual bool IsFullScreen() const { return false; }
179
180 virtual bool IsTopLevel() const { return false; }
181
182 void OnMenuHighlight(wxMenuEvent& event);
183 void OnActivate(wxActivateEvent& event);
184
185 // The next 2 are copied from top level...
186 void OnCloseWindow(wxCloseEvent& event);
187 void OnSize(wxSizeEvent& event);
188
189 void SetMDIParentFrame(wxGenericMDIParentFrame* parentFrame);
190 wxGenericMDIParentFrame* GetMDIParentFrame() const;
191
192 protected:
193 wxGenericMDIParentFrame *m_pMDIParentFrame;
194 wxRect m_MDIRect;
195 wxString m_Title;
196
197 #if wxUSE_MENUS
198 wxMenuBar *m_pMenuBar;
199 #endif // wxUSE_MENUS
200
201 protected:
202 void Init();
203
204 virtual void DoMoveWindow(int x, int y, int width, int height);
205
206 // no size hints
207 virtual void DoSetSizeHints(int WXUNUSED(minW), int WXUNUSED(minH),
208 int WXUNUSED(maxW), int WXUNUSED(maxH),
209 int WXUNUSED(incW), int WXUNUSED(incH)) {}
210
211 // This function needs to be called when a size change is confirmed,
212 // we needed this function to prevent any body from the outside
213 // changing the panel... it messes the UI layout when we would allow it.
214 void ApplyMDIChildFrameRect();
215
216 private:
217 DECLARE_DYNAMIC_CLASS(wxGenericMDIChildFrame)
218 DECLARE_EVENT_TABLE()
219
220 friend class wxGenericMDIClientWindow;
221 };
222
223 //-----------------------------------------------------------------------------
224 // wxGenericMDIClientWindow
225 //-----------------------------------------------------------------------------
226
227 class WXDLLEXPORT wxGenericMDIClientWindow: public wxNotebook
228 {
229 public:
230 wxGenericMDIClientWindow();
231 wxGenericMDIClientWindow( wxGenericMDIParentFrame *parent, long style = 0 );
232 virtual ~wxGenericMDIClientWindow();
233 virtual bool CreateClient( wxGenericMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL );
234
235 virtual int SetSelection(size_t nPage);
236
237 protected:
238 void PageChanged(int OldSelection, int newSelection);
239
240 void OnPageChanged(wxNotebookEvent& event);
241 void OnSize(wxSizeEvent& event);
242
243 private:
244 DECLARE_DYNAMIC_CLASS(wxGenericMDIClientWindow)
245 DECLARE_EVENT_TABLE()
246 };
247
248
249 /*
250 * Define normal wxMDI classes based on wxGenericMDI
251 */
252
253 #ifndef wxUSE_GENERIC_MDI_AS_NATIVE
254 #if defined(__WXUNIVERSAL__) || defined(__WXPM__) || defined(__WXCOCOA__)
255 #define wxUSE_GENERIC_MDI_AS_NATIVE 1
256 #else
257 #define wxUSE_GENERIC_MDI_AS_NATIVE 0
258 #endif
259 #endif // wxUSE_GENERIC_MDI_AS_NATIVE
260
261 #if wxUSE_GENERIC_MDI_AS_NATIVE
262
263 class wxMDIChildFrame ;
264
265 //-----------------------------------------------------------------------------
266 // wxMDIParentFrame
267 //-----------------------------------------------------------------------------
268
269 class WXDLLEXPORT wxMDIParentFrame: public wxGenericMDIParentFrame
270 {
271 public:
272 wxMDIParentFrame() {}
273 wxMDIParentFrame(wxWindow *parent,
274 wxWindowID winid,
275 const wxString& title,
276 const wxPoint& pos = wxDefaultPosition,
277 const wxSize& size = wxDefaultSize,
278 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
279 const wxString& name = wxFrameNameStr)
280 :wxGenericMDIParentFrame(parent, winid, title, pos, size, style, name)
281 {
282 }
283
284 wxMDIChildFrame * GetActiveChild() const ;
285
286
287 private:
288 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
289 };
290
291 //-----------------------------------------------------------------------------
292 // wxMDIChildFrame
293 //-----------------------------------------------------------------------------
294
295 class WXDLLEXPORT wxMDIChildFrame: public wxGenericMDIChildFrame
296 {
297 public:
298 wxMDIChildFrame() {}
299
300 wxMDIChildFrame( wxGenericMDIParentFrame *parent,
301 wxWindowID winid,
302 const wxString& title,
303 const wxPoint& pos = wxDefaultPosition,
304 const wxSize& size = wxDefaultSize,
305 long style = wxDEFAULT_FRAME_STYLE,
306 const wxString& name = wxFrameNameStr )
307 :wxGenericMDIChildFrame(parent, winid, title, pos, size, style, name)
308 {
309 }
310 private:
311 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
312 };
313
314 //-----------------------------------------------------------------------------
315 // wxMDIClientWindow
316 //-----------------------------------------------------------------------------
317
318 class WXDLLEXPORT wxMDIClientWindow: public wxGenericMDIClientWindow
319 {
320 public:
321 wxMDIClientWindow() {}
322
323 wxMDIClientWindow( wxGenericMDIParentFrame *parent, long style = 0 )
324 :wxGenericMDIClientWindow(parent, style)
325 {
326 }
327
328 private:
329 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
330 };
331
332 #endif
333
334 #endif
335 // _WX_MDIG_H_