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
8 // Copyright: (c) Hans Van Leemputten
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_AUITABMDI_H_
13 #define _WX_AUITABMDI_H_
17 // ----------------------------------------------------------------------------
19 // ----------------------------------------------------------------------------
23 #include "wx/notebook.h"
25 #include "wx/aui/auibook.h"
27 //-----------------------------------------------------------------------------
29 //-----------------------------------------------------------------------------
31 class WXDLLIMPEXP_FWD_AUI wxAuiMDIParentFrame
;
32 class WXDLLIMPEXP_FWD_AUI wxAuiMDIClientWindow
;
33 class WXDLLIMPEXP_FWD_AUI wxAuiMDIChildFrame
;
35 //-----------------------------------------------------------------------------
36 // wxAuiMDIParentFrame
37 //-----------------------------------------------------------------------------
39 class WXDLLIMPEXP_AUI wxAuiMDIParentFrame
: public wxFrame
42 wxAuiMDIParentFrame();
43 wxAuiMDIParentFrame(wxWindow
*parent
,
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
);
51 ~wxAuiMDIParentFrame();
53 bool Create(wxWindow
*parent
,
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
);
61 void SetArtProvider(wxAuiTabArt
* provider
);
62 wxAuiTabArt
* GetArtProvider();
63 wxAuiNotebook
* GetNotebook() const;
66 wxMenu
* GetWindowMenu() const { return m_pWindowMenu
; }
67 void SetWindowMenu(wxMenu
* pMenu
);
69 virtual void SetMenuBar(wxMenuBar
*pMenuBar
);
72 void SetChildMenuBar(wxAuiMDIChildFrame
*pChild
);
74 virtual bool ProcessEvent(wxEvent
& event
);
76 wxAuiMDIChildFrame
*GetActiveChild() const;
77 void SetActiveChild(wxAuiMDIChildFrame
* pChildFrame
);
79 wxAuiMDIClientWindow
*GetClientWindow() const;
80 virtual wxAuiMDIClientWindow
*OnCreateClient();
82 virtual void Cascade() { /* Has no effect */ }
83 virtual void Tile(wxOrientation orient
= wxHORIZONTAL
);
84 virtual void ArrangeIcons() { /* Has no effect */ }
85 virtual void ActivateNext();
86 virtual void ActivatePrevious();
89 wxAuiMDIClientWindow
* m_pClientWindow
;
90 wxAuiMDIChildFrame
* m_pActiveChild
;
94 wxMenu
*m_pWindowMenu
;
95 wxMenuBar
*m_pMyMenuBar
;
102 void RemoveWindowMenu(wxMenuBar
*pMenuBar
);
103 void AddWindowMenu(wxMenuBar
*pMenuBar
);
105 void DoHandleMenu(wxCommandEvent
&event
);
106 #endif // wxUSE_MENUS
108 virtual void DoGetClientSize(int *width
, int *height
) const;
111 DECLARE_EVENT_TABLE()
112 DECLARE_DYNAMIC_CLASS(wxAuiMDIParentFrame
)
115 //-----------------------------------------------------------------------------
116 // wxAuiMDIChildFrame
117 //-----------------------------------------------------------------------------
119 class WXDLLIMPEXP_AUI wxAuiMDIChildFrame
: public wxPanel
122 wxAuiMDIChildFrame();
123 wxAuiMDIChildFrame(wxAuiMDIParentFrame
*parent
,
125 const wxString
& title
,
126 const wxPoint
& pos
= wxDefaultPosition
,
127 const wxSize
& size
= wxDefaultSize
,
128 long style
= wxDEFAULT_FRAME_STYLE
,
129 const wxString
& name
= wxFrameNameStr
);
131 virtual ~wxAuiMDIChildFrame();
132 bool Create(wxAuiMDIParentFrame
*parent
,
134 const wxString
& title
,
135 const wxPoint
& pos
= wxDefaultPosition
,
136 const wxSize
& size
= wxDefaultSize
,
137 long style
= wxDEFAULT_FRAME_STYLE
,
138 const wxString
& name
= wxFrameNameStr
);
141 virtual void SetMenuBar(wxMenuBar
*menu_bar
);
142 virtual wxMenuBar
*GetMenuBar() const;
143 #endif // wxUSE_MENUS
145 virtual void SetTitle(const wxString
& title
);
146 virtual wxString
GetTitle() const;
148 virtual void SetIcons(const wxIconBundle
& icons
);
149 virtual const wxIconBundle
& GetIcons() const;
151 virtual void SetIcon(const wxIcon
& icon
);
152 virtual const wxIcon
& GetIcon() const;
154 virtual void Activate();
155 virtual bool Destroy();
157 virtual bool Show(bool show
= true);
161 virtual wxStatusBar
* CreateStatusBar(int WXUNUSED(number
) = 1,
162 long WXUNUSED(style
) = 1,
163 wxWindowID
WXUNUSED(winid
) = 1,
164 const wxString
& WXUNUSED(name
) = wxEmptyString
)
165 { return (wxStatusBar
*)NULL
; }
167 virtual wxStatusBar
*GetStatusBar() const { return (wxStatusBar
*)NULL
; }
168 virtual void SetStatusText( const wxString
&WXUNUSED(text
), int WXUNUSED(number
)=0 ) {}
169 virtual void SetStatusWidths( int WXUNUSED(n
), const int WXUNUSED(widths_field
)[] ) {}
173 virtual void DoSetSizeHints(int WXUNUSED(minW
),
175 int WXUNUSED(maxW
) = wxDefaultCoord
,
176 int WXUNUSED(maxH
) = wxDefaultCoord
,
177 int WXUNUSED(incW
) = wxDefaultCoord
,
178 int WXUNUSED(incH
) = wxDefaultCoord
) {}
181 virtual wxToolBar
* CreateToolBar(long WXUNUSED(style
),
182 wxWindowID
WXUNUSED(winid
),
183 const wxString
& WXUNUSED(name
))
184 { return (wxToolBar
*)NULL
; }
185 virtual wxToolBar
*GetToolBar() const { return (wxToolBar
*)NULL
; }
190 virtual void Maximize(bool WXUNUSED(maximize
) = true) { /* Has no effect */ }
191 virtual void Restore() { /* Has no effect */ }
192 virtual void Iconize(bool WXUNUSED(iconize
) = true) { /* Has no effect */ }
193 virtual bool IsMaximized() const { return true; }
194 virtual bool IsIconized() const { return false; }
195 virtual bool ShowFullScreen(bool WXUNUSED(show
), long WXUNUSED(style
)) { return false; }
196 virtual bool IsFullScreen() const { return false; }
198 virtual bool IsTopLevel() const { return false; }
200 void OnMenuHighlight(wxMenuEvent
& evt
);
201 void OnActivate(wxActivateEvent
& evt
);
202 void OnCloseWindow(wxCloseEvent
& evt
);
204 void SetMDIParentFrame(wxAuiMDIParentFrame
* parent
);
205 wxAuiMDIParentFrame
* GetMDIParentFrame() const;
209 virtual void DoSetSize(int x
, int y
, int width
, int height
, int size_flags
);
210 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
213 // This function needs to be called when a size change is confirmed,
214 // we needed this function to prevent anybody from the outside
215 // changing the panel... it messes the UI layout when we would allow it.
216 void ApplyMDIChildFrameRect();
217 void DoShow(bool show
);
220 wxAuiMDIParentFrame
* m_pMDIParentFrame
;
221 wxRect m_mdi_newrect
;
222 wxRect m_mdi_currect
;
225 wxIconBundle m_icon_bundle
;
226 bool m_activate_on_create
;
229 wxMenuBar
* m_pMenuBar
;
230 #endif // wxUSE_MENUS
235 DECLARE_DYNAMIC_CLASS(wxAuiMDIChildFrame
)
236 DECLARE_EVENT_TABLE()
238 friend class wxAuiMDIClientWindow
;
241 //-----------------------------------------------------------------------------
242 // wxAuiMDIClientWindow
243 //-----------------------------------------------------------------------------
245 class WXDLLIMPEXP_AUI wxAuiMDIClientWindow
: public wxAuiNotebook
248 wxAuiMDIClientWindow();
249 wxAuiMDIClientWindow(wxAuiMDIParentFrame
*parent
, long style
= 0);
250 ~wxAuiMDIClientWindow();
252 virtual bool CreateClient(wxAuiMDIParentFrame
*parent
,
253 long style
= wxVSCROLL
| wxHSCROLL
);
255 virtual int SetSelection(size_t page
);
259 void PageChanged(int old_selection
, int new_selection
);
260 void OnPageClose(wxAuiNotebookEvent
& evt
);
261 void OnPageChanged(wxAuiNotebookEvent
& evt
);
262 void OnSize(wxSizeEvent
& evt
);
265 DECLARE_DYNAMIC_CLASS(wxAuiMDIClientWindow
)
266 DECLARE_EVENT_TABLE()
270 #endif // _WX_AUITABMDI_H_