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 // this window does not exist really
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 wxDisplaySize( 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 MacCreateRealWindow( title
, pos
, size
, MacRemoveBordersFromStyle(style
) , name
) ;
182 m_macWindowData
->m_macWindowBackgroundTheme
= kThemeBrushDocumentWindowBackground
;
184 wxModelessWindows
.Append(this);
188 wxMDIChildFrame::~wxMDIChildFrame()
192 // Set the client size (i.e. leave the calculation of borders etc.
194 void wxMDIChildFrame::SetClientSize(int width
, int height
)
199 void wxMDIChildFrame::GetPosition(int *x
, int *y
) const
204 void wxMDIChildFrame::SetMenuBar(wxMenuBar
*menu_bar
)
206 return wxFrame::SetMenuBar( menu_bar
) ;
210 void wxMDIChildFrame::Maximize()
215 void wxMDIChildFrame::Restore()
220 void wxMDIChildFrame::Activate()
227 wxMDIClientWindow::wxMDIClientWindow()
231 wxMDIClientWindow::~wxMDIClientWindow()
235 bool wxMDIClientWindow::CreateClient(wxMDIParentFrame
*parent
, long style
)
237 // TODO create client window
238 m_backgroundColour
= wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE
);
243 // Explicitly call default scroll behaviour
244 void wxMDIClientWindow::OnScroll(wxScrollEvent
& event
)