1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: MDI classes
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "mdi.h"
18 #include "wx/settings.h"
20 extern wxList wxModelessWindows
;
22 #if !USE_SHARED_LIBRARY
23 IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame
, wxFrame
)
24 IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame
, wxFrame
)
25 IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow
, wxWindow
)
27 BEGIN_EVENT_TABLE(wxMDIParentFrame
, wxFrame
)
28 EVT_SIZE(wxMDIParentFrame::OnSize
)
29 EVT_ACTIVATE(wxMDIParentFrame::OnActivate
)
30 EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged
)
33 BEGIN_EVENT_TABLE(wxMDIClientWindow
, wxWindow
)
34 EVT_SCROLL(wxMDIClientWindow::OnScroll
)
41 wxMDIParentFrame::wxMDIParentFrame()
45 bool wxMDIParentFrame::Create(wxWindow
*parent
,
47 const wxString
& title
,
54 wxTopLevelWindows
.Append(this);
57 m_windowStyle
= style
;
59 if (parent
) parent
->AddChild(this);
64 m_windowId
= (int)NewControlId();
66 // TODO: create MDI parent frame
68 wxModelessWindows
.Append(this);
73 wxMDIParentFrame::~wxMDIParentFrame()
77 // Get size *available for subwindows* i.e. excluding menu bar.
78 void wxMDIParentFrame::DoGetClientSize(int *x
, int *y
) const
80 wxFrame::DoGetClientSize( x
, y
) ;
83 void wxMDIParentFrame::SetMenuBar(wxMenuBar
*menu_bar
)
85 wxFrame::SetMenuBar( menu_bar
) ;
88 void wxMDIParentFrame::OnSize(wxSizeEvent
& event
)
97 GetClientSize(&width
, &height
);
99 if ( GetClientWindow() )
100 GetClientWindow()->SetSize(x
, y
, width
, height
);
103 void wxMDIParentFrame::OnActivate(wxActivateEvent
& event
)
108 // Returns the active MDI child window
109 wxMDIChildFrame
*wxMDIParentFrame::GetActiveChild() const
115 // Create the client window class (don't Create the window,
116 // just return a new class)
117 wxMDIClientWindow
*wxMDIParentFrame::OnCreateClient()
119 return new wxMDIClientWindow
;
122 // Responds to colour changes, and passes event on to children.
123 void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent
& event
)
127 // Propagate the event to the non-top-level children
128 wxFrame::OnSysColourChanged(event
);
132 void wxMDIParentFrame::Cascade()
137 void wxMDIParentFrame::Tile()
142 void wxMDIParentFrame::ArrangeIcons()
147 void wxMDIParentFrame::ActivateNext()
152 void wxMDIParentFrame::ActivatePrevious()
159 wxMDIChildFrame::wxMDIChildFrame()
163 bool wxMDIChildFrame::Create(wxMDIParentFrame
*parent
,
165 const wxString
& title
,
169 const wxString
& name
)
176 m_windowId
= (int)NewControlId();
178 if (parent
) parent
->AddChild(this);
180 // TODO: create child frame
182 wxModelessWindows
.Append(this);
186 wxMDIChildFrame::~wxMDIChildFrame()
190 // Set the client size (i.e. leave the calculation of borders etc.
192 void wxMDIChildFrame::SetClientSize(int width
, int height
)
197 void wxMDIChildFrame::GetPosition(int *x
, int *y
) const
202 void wxMDIChildFrame::SetMenuBar(wxMenuBar
*menu_bar
)
204 return wxFrame::SetMenuBar( menu_bar
) ;
208 void wxMDIChildFrame::Maximize()
213 void wxMDIChildFrame::Restore()
218 void wxMDIChildFrame::Activate()
225 wxMDIClientWindow::wxMDIClientWindow()
229 wxMDIClientWindow::~wxMDIClientWindow()
233 bool wxMDIClientWindow::CreateClient(wxMDIParentFrame
*parent
, long style
)
235 // TODO create client window
236 m_backgroundColour
= wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE
);
241 // Explicitly call default scroll behaviour
242 void wxMDIClientWindow::OnScroll(wxScrollEvent
& event
)
244 Default(); // Default processing