1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: MDI classes
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "mdi.h"
18 extern wxList wxModelessWindows
;
20 IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame
, wxFrame
)
21 IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame
, wxFrame
)
22 IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow
, wxWindow
)
24 BEGIN_EVENT_TABLE(wxMDIParentFrame
, wxFrame
)
25 EVT_SIZE(wxMDIParentFrame::OnSize
)
26 EVT_ACTIVATE(wxMDIParentFrame::OnActivate
)
27 EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged
)
30 BEGIN_EVENT_TABLE(wxMDIClientWindow
, wxWindow
)
31 EVT_SCROLL(wxMDIClientWindow::OnScroll
)
37 wxMDIParentFrame::wxMDIParentFrame()
41 bool wxMDIParentFrame::Create(wxWindow
*parent
,
43 const wxString
& title
,
50 wxTopLevelWindows
.Append(this);
53 m_windowStyle
= style
;
55 if (parent
) parent
->AddChild(this);
60 m_windowId
= (int)NewControlId();
62 // TODO: create MDI parent frame
64 wxModelessWindows
.Append(this);
69 wxMDIParentFrame::~wxMDIParentFrame()
73 // Get size *available for subwindows* i.e. excluding menu bar.
74 void wxMDIParentFrame::GetClientSize(int *x
, int *y
) const
79 void wxMDIParentFrame::SetMenuBar(wxMenuBar
*menu_bar
)
84 m_frameMenuBar
= NULL
;
88 if (menu_bar
->m_menuBarFrame
)
91 m_frameMenuBar
= menu_bar
;
94 void wxMDIParentFrame::OnSize(wxSizeEvent
& event
)
103 GetClientSize(&width
, &height
);
105 if ( GetClientWindow() )
106 GetClientWindow()->SetSize(x
, y
, width
, height
);
109 void wxMDIParentFrame::OnActivate(wxActivateEvent
& event
)
114 // Returns the active MDI child window
115 wxMDIChildFrame
*wxMDIParentFrame::GetActiveChild() const
121 // Create the client window class (don't Create the window,
122 // just return a new class)
123 wxMDIClientWindow
*wxMDIParentFrame::OnCreateClient()
125 return new wxMDIClientWindow
;
128 // Responds to colour changes, and passes event on to children.
129 void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent
& event
)
133 // Propagate the event to the non-top-level children
134 wxFrame::OnSysColourChanged(event
);
138 void wxMDIParentFrame::Cascade()
143 void wxMDIParentFrame::Tile()
148 void wxMDIParentFrame::ArrangeIcons()
153 void wxMDIParentFrame::ActivateNext()
158 void wxMDIParentFrame::ActivatePrevious()
165 wxMDIChildFrame::wxMDIChildFrame()
169 bool wxMDIChildFrame::Create(wxMDIParentFrame
*parent
,
171 const wxString
& title
,
175 const wxString
& name
)
182 m_windowId
= (int)NewControlId();
184 if (parent
) parent
->AddChild(this);
186 // TODO: create child frame
188 wxModelessWindows
.Append(this);
192 wxMDIChildFrame::~wxMDIChildFrame()
196 // Set the client size (i.e. leave the calculation of borders etc.
198 void wxMDIChildFrame::SetClientSize(int width
, int height
)
203 void wxMDIChildFrame::GetPosition(int *x
, int *y
) const
208 void wxMDIChildFrame::SetMenuBar(wxMenuBar
*menu_bar
)
213 m_frameMenuBar
= NULL
;
217 if (menu_bar
->m_menuBarFrame
)
219 m_frameMenuBar
= menu_bar
;
223 void wxMDIChildFrame::Maximize()
228 void wxMDIChildFrame::Restore()
233 void wxMDIChildFrame::Activate()
240 wxMDIClientWindow::wxMDIClientWindow()
244 wxMDIClientWindow::~wxMDIClientWindow()
248 bool wxMDIClientWindow::CreateClient(wxMDIParentFrame
*parent
, long style
)
250 // TODO create client window
251 m_backgroundColour
= wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE
);
256 // Explicitly call default scroll behaviour
257 void wxMDIClientWindow::OnScroll(wxScrollEvent
& event
)
259 Default(); // Default processing