1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/aui/tabmdi.h
3 // Purpose: Generic MDI (Multiple Document Interface) classes
4 // Author: Hans Van Leemputten
5 // Modified by: Benjamin I. Williams / Kirix Corporation
7 // Copyright: (c) Hans Van Leemputten
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_AUITABMDI_H_
12 #define _WX_AUITABMDI_H_
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
22 #include "wx/notebook.h"
24 #include "wx/aui/auibook.h"
26 //-----------------------------------------------------------------------------
28 //-----------------------------------------------------------------------------
30 class WXDLLIMPEXP_FWD_AUI wxAuiMDIParentFrame
;
31 class WXDLLIMPEXP_FWD_AUI wxAuiMDIClientWindow
;
32 class WXDLLIMPEXP_FWD_AUI wxAuiMDIChildFrame
;
34 //-----------------------------------------------------------------------------
35 // wxAuiMDIParentFrame
36 //-----------------------------------------------------------------------------
38 class WXDLLIMPEXP_AUI wxAuiMDIParentFrame
: public wxFrame
41 wxAuiMDIParentFrame();
42 wxAuiMDIParentFrame(wxWindow
*parent
,
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
);
50 ~wxAuiMDIParentFrame();
52 bool Create(wxWindow
*parent
,
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
);
60 void SetArtProvider(wxAuiTabArt
* provider
);
61 wxAuiTabArt
* GetArtProvider();
62 wxAuiNotebook
* GetNotebook() const;
65 wxMenu
* GetWindowMenu() const { return m_pWindowMenu
; }
66 void SetWindowMenu(wxMenu
* pMenu
);
68 virtual void SetMenuBar(wxMenuBar
*pMenuBar
);
71 void SetChildMenuBar(wxAuiMDIChildFrame
*pChild
);
73 wxAuiMDIChildFrame
*GetActiveChild() const;
74 void SetActiveChild(wxAuiMDIChildFrame
* pChildFrame
);
76 wxAuiMDIClientWindow
*GetClientWindow() const;
77 virtual wxAuiMDIClientWindow
*OnCreateClient();
79 virtual void Cascade() { /* Has no effect */ }
80 virtual void Tile(wxOrientation orient
= wxHORIZONTAL
);
81 virtual void ArrangeIcons() { /* Has no effect */ }
82 virtual void ActivateNext();
83 virtual void ActivatePrevious();
86 wxAuiMDIClientWindow
* m_pClientWindow
;
90 wxMenu
*m_pWindowMenu
;
91 wxMenuBar
*m_pMyMenuBar
;
98 void RemoveWindowMenu(wxMenuBar
*pMenuBar
);
99 void AddWindowMenu(wxMenuBar
*pMenuBar
);
101 void DoHandleMenu(wxCommandEvent
&event
);
102 void DoHandleUpdateUI(wxUpdateUIEvent
&event
);
103 #endif // wxUSE_MENUS
105 virtual bool ProcessEvent(wxEvent
& event
);
107 virtual void DoGetClientSize(int *width
, int *height
) const;
110 DECLARE_EVENT_TABLE()
111 DECLARE_DYNAMIC_CLASS(wxAuiMDIParentFrame
)
114 //-----------------------------------------------------------------------------
115 // wxAuiMDIChildFrame
116 //-----------------------------------------------------------------------------
118 class WXDLLIMPEXP_AUI wxAuiMDIChildFrame
: public wxPanel
121 wxAuiMDIChildFrame();
122 wxAuiMDIChildFrame(wxAuiMDIParentFrame
*parent
,
124 const wxString
& title
,
125 const wxPoint
& pos
= wxDefaultPosition
,
126 const wxSize
& size
= wxDefaultSize
,
127 long style
= wxDEFAULT_FRAME_STYLE
,
128 const wxString
& name
= wxFrameNameStr
);
130 virtual ~wxAuiMDIChildFrame();
131 bool Create(wxAuiMDIParentFrame
*parent
,
133 const wxString
& title
,
134 const wxPoint
& pos
= wxDefaultPosition
,
135 const wxSize
& size
= wxDefaultSize
,
136 long style
= wxDEFAULT_FRAME_STYLE
,
137 const wxString
& name
= wxFrameNameStr
);
140 virtual void SetMenuBar(wxMenuBar
*menuBar
);
141 virtual wxMenuBar
*GetMenuBar() const;
142 #endif // wxUSE_MENUS
144 virtual void SetTitle(const wxString
& title
);
145 virtual wxString
GetTitle() const;
147 virtual void SetIcons(const wxIconBundle
& icons
);
148 virtual const wxIconBundle
& GetIcons() const;
150 virtual void SetIcon(const wxIcon
& icon
);
151 virtual const wxIcon
& GetIcon() const;
153 virtual void Activate();
154 virtual bool Destroy();
156 virtual bool Show(bool show
= true);
160 virtual wxStatusBar
* CreateStatusBar(int WXUNUSED(number
) = 1,
161 long WXUNUSED(style
) = 1,
162 wxWindowID
WXUNUSED(winid
) = 1,
163 const wxString
& WXUNUSED(name
) = wxEmptyString
)
166 virtual wxStatusBar
*GetStatusBar() const { return NULL
; }
167 virtual void SetStatusText( const wxString
&WXUNUSED(text
), int WXUNUSED(number
)=0 ) {}
168 virtual void SetStatusWidths( int WXUNUSED(n
), const int WXUNUSED(widths_field
)[] ) {}
173 virtual wxToolBar
* CreateToolBar(long WXUNUSED(style
),
174 wxWindowID
WXUNUSED(winid
),
175 const wxString
& WXUNUSED(name
))
177 virtual wxToolBar
*GetToolBar() const { return NULL
; }
182 virtual void Maximize(bool WXUNUSED(maximize
) = true) { /* Has no effect */ }
183 virtual void Restore() { /* Has no effect */ }
184 virtual void Iconize(bool WXUNUSED(iconize
) = true) { /* Has no effect */ }
185 virtual bool IsMaximized() const { return true; }
186 virtual bool IsIconized() const { return false; }
187 virtual bool ShowFullScreen(bool WXUNUSED(show
), long WXUNUSED(style
)) { return false; }
188 virtual bool IsFullScreen() const { return false; }
190 virtual bool IsTopLevel() const { return false; }
192 void OnMenuHighlight(wxMenuEvent
& evt
);
193 void OnActivate(wxActivateEvent
& evt
);
194 void OnCloseWindow(wxCloseEvent
& evt
);
196 void SetMDIParentFrame(wxAuiMDIParentFrame
* parent
);
197 wxAuiMDIParentFrame
* GetMDIParentFrame() const;
201 virtual void DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
);
202 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
205 virtual void DoSetSizeHints(int WXUNUSED(minW
), int WXUNUSED(minH
),
206 int WXUNUSED(maxW
), int WXUNUSED(maxH
),
207 int WXUNUSED(incW
), int WXUNUSED(incH
)) {}
209 // This function needs to be called when a size change is confirmed,
210 // we needed this function to prevent anybody from the outside
211 // changing the panel... it messes the UI layout when we would allow it.
212 void ApplyMDIChildFrameRect();
213 void DoShow(bool show
);
216 wxAuiMDIParentFrame
* m_pMDIParentFrame
;
221 wxIconBundle m_iconBundle
;
222 bool m_activateOnCreate
;
225 wxMenuBar
* m_pMenuBar
;
226 #endif // wxUSE_MENUS
231 DECLARE_DYNAMIC_CLASS(wxAuiMDIChildFrame
)
232 DECLARE_EVENT_TABLE()
234 friend class wxAuiMDIClientWindow
;
237 //-----------------------------------------------------------------------------
238 // wxAuiMDIClientWindow
239 //-----------------------------------------------------------------------------
241 class WXDLLIMPEXP_AUI wxAuiMDIClientWindow
: public wxAuiNotebook
244 wxAuiMDIClientWindow();
245 wxAuiMDIClientWindow(wxAuiMDIParentFrame
*parent
, long style
= 0);
247 virtual bool CreateClient(wxAuiMDIParentFrame
*parent
,
248 long style
= wxVSCROLL
| wxHSCROLL
);
250 virtual int SetSelection(size_t page
);
251 virtual wxAuiMDIChildFrame
* GetActiveChild();
252 virtual void SetActiveChild(wxAuiMDIChildFrame
* pChildFrame
)
254 SetSelection(GetPageIndex(pChildFrame
));
259 void PageChanged(int oldSelection
, int newSelection
);
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_