]> git.saurik.com Git - wxWidgets.git/blob - include/wx/aui/tabmdi.h
fixes for the dummy classes (used when wxUSE_GRAPHICS_CONTEXT is 0)
[wxWidgets.git] / include / wx / aui / tabmdi.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/tabmdi.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 #if wxUSE_AUI
16
17 // ----------------------------------------------------------------------------
18 // headers
19 // ----------------------------------------------------------------------------
20
21 #include "wx/frame.h"
22 #include "wx/panel.h"
23 #include "wx/notebook.h"
24 #include "wx/aui/auibook.h"
25
26 //-----------------------------------------------------------------------------
27 // classes
28 //-----------------------------------------------------------------------------
29
30 class WXDLLIMPEXP_AUI wxAuiMDIParentFrame;
31 class WXDLLIMPEXP_AUI wxAuiMDIClientWindow;
32 class WXDLLIMPEXP_AUI wxAuiMDIChildFrame;
33
34 //-----------------------------------------------------------------------------
35 // wxAuiMDIParentFrame
36 //-----------------------------------------------------------------------------
37
38 class WXDLLIMPEXP_AUI wxAuiMDIParentFrame : public wxFrame
39 {
40 public:
41 wxAuiMDIParentFrame();
42 wxAuiMDIParentFrame(wxWindow *parent,
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
50 ~wxAuiMDIParentFrame();
51
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
67 void SetChildMenuBar(wxAuiMDIChildFrame *pChild);
68
69 virtual bool ProcessEvent(wxEvent& event);
70
71 wxAuiMDIChildFrame *GetActiveChild() const;
72 inline void SetActiveChild(wxAuiMDIChildFrame* pChildFrame);
73
74 wxAuiMDIClientWindow *GetClientWindow() const;
75 virtual wxAuiMDIClientWindow *OnCreateClient();
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:
84 wxAuiMDIClientWindow* m_pClientWindow;
85 wxAuiMDIChildFrame* m_pActiveChild;
86 wxEvent* m_pLastEvt;
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(wxAuiMDIParentFrame)
108 };
109
110 //-----------------------------------------------------------------------------
111 // wxAuiMDIChildFrame
112 //-----------------------------------------------------------------------------
113
114 class WXDLLIMPEXP_AUI wxAuiMDIChildFrame : public wxPanel
115 {
116 public:
117 wxAuiMDIChildFrame();
118 wxAuiMDIChildFrame(wxAuiMDIParentFrame *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 ~wxAuiMDIChildFrame();
127 bool Create(wxAuiMDIParentFrame *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(wxAuiMDIParentFrame* parent);
195 wxAuiMDIParentFrame* GetMDIParentFrame() const;
196
197 protected:
198 wxAuiMDIParentFrame *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(wxAuiMDIChildFrame)
223 DECLARE_EVENT_TABLE()
224
225 friend class wxAuiMDIClientWindow;
226 };
227
228 //-----------------------------------------------------------------------------
229 // wxAuiMDIClientWindow
230 //-----------------------------------------------------------------------------
231
232 class WXDLLIMPEXP_AUI wxAuiMDIClientWindow : public wxAuiNotebook
233 {
234 public:
235 wxAuiMDIClientWindow();
236 wxAuiMDIClientWindow(wxAuiMDIParentFrame *parent, long style = 0);
237 ~wxAuiMDIClientWindow();
238
239 virtual bool CreateClient(wxAuiMDIParentFrame *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(wxAuiMDIClientWindow)
252 DECLARE_EVENT_TABLE()
253 };
254 #endif // wxUSE_AUI
255
256 #endif // _WX_AUITABMDI_H_