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 IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame
, wxFrame
) 
  23 IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame
, wxFrame
) 
  24 IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow
, wxWindow
) 
  26 BEGIN_EVENT_TABLE(wxMDIParentFrame
, wxFrame
) 
  27   EVT_SIZE(wxMDIParentFrame::OnSize
) 
  28   EVT_ACTIVATE(wxMDIParentFrame::OnActivate
) 
  29   EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged
) 
  32 BEGIN_EVENT_TABLE(wxMDIClientWindow
, wxWindow
) 
  33   EVT_SCROLL(wxMDIClientWindow::OnScroll
) 
  39 wxMDIParentFrame::wxMDIParentFrame() 
  43 bool wxMDIParentFrame::Create(wxWindow 
*parent
, 
  45            const wxString
& title
, 
  52         wxTopLevelWindows
.Append(this); 
  55     m_windowStyle 
= style
; 
  57     if (parent
) parent
->AddChild(this); 
  62         m_windowId 
= (int)NewControlId(); 
  64     // TODO: create MDI parent frame 
  66     wxModelessWindows
.Append(this); 
  71 wxMDIParentFrame::~wxMDIParentFrame() 
  75 // Get size *available for subwindows* i.e. excluding menu bar. 
  76 void wxMDIParentFrame::DoGetClientSize(int *x
, int *y
) const 
  78    wxFrame::DoGetClientSize( x 
, y 
) ; 
  81 void wxMDIParentFrame::SetMenuBar(wxMenuBar 
*menu_bar
) 
  83         wxFrame::SetMenuBar( menu_bar 
) ; 
  86 void wxMDIParentFrame::OnSize(wxSizeEvent
& event
) 
  95     GetClientSize(&width
, &height
); 
  97     if ( GetClientWindow() ) 
  98         GetClientWindow()->SetSize(x
, y
, width
, height
); 
 101 void wxMDIParentFrame::OnActivate(wxActivateEvent
& event
) 
 106 // Returns the active MDI child window 
 107 wxMDIChildFrame 
*wxMDIParentFrame::GetActiveChild() const 
 113 // Create the client window class (don't Create the window, 
 114 // just return a new class) 
 115 wxMDIClientWindow 
*wxMDIParentFrame::OnCreateClient() 
 117         return new wxMDIClientWindow 
; 
 120 // Responds to colour changes, and passes event on to children. 
 121 void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent
& event
) 
 125     // Propagate the event to the non-top-level children 
 126     wxFrame::OnSysColourChanged(event
); 
 130 void wxMDIParentFrame::Cascade() 
 135 void wxMDIParentFrame::Tile() 
 140 void wxMDIParentFrame::ArrangeIcons() 
 145 void wxMDIParentFrame::ActivateNext() 
 150 void wxMDIParentFrame::ActivatePrevious() 
 157 wxMDIChildFrame::wxMDIChildFrame() 
 161 bool wxMDIChildFrame::Create(wxMDIParentFrame 
*parent
, 
 163            const wxString
& title
, 
 167            const wxString
& name
) 
 174         m_windowId 
= (int)NewControlId(); 
 176     if (parent
) parent
->AddChild(this); 
 178     // TODO: create child frame 
 180     wxModelessWindows
.Append(this); 
 184 wxMDIChildFrame::~wxMDIChildFrame() 
 188 // Set the client size (i.e. leave the calculation of borders etc. 
 190 void wxMDIChildFrame::SetClientSize(int width
, int height
) 
 195 void wxMDIChildFrame::GetPosition(int *x
, int *y
) const 
 200 void wxMDIChildFrame::SetMenuBar(wxMenuBar 
*menu_bar
) 
 202         return wxFrame::SetMenuBar( menu_bar 
) ; 
 206 void wxMDIChildFrame::Maximize() 
 211 void wxMDIChildFrame::Restore() 
 216 void wxMDIChildFrame::Activate() 
 223 wxMDIClientWindow::wxMDIClientWindow() 
 227 wxMDIClientWindow::~wxMDIClientWindow() 
 231 bool wxMDIClientWindow::CreateClient(wxMDIParentFrame 
*parent
, long style
) 
 233     // TODO create client window 
 234     m_backgroundColour 
= wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE
); 
 239 // Explicitly call default scroll behaviour 
 240 void wxMDIClientWindow::OnScroll(wxScrollEvent
& event
)