]>
git.saurik.com Git - wxWidgets.git/blob - src/qt/mdi.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
12 #pragma implementation "mdi.h"
16 #include "wx/dialog.h"
19 //-----------------------------------------------------------------------------
21 extern wxList wxPendingDelete
;
23 //-----------------------------------------------------------------------------
25 //-----------------------------------------------------------------------------
27 //-----------------------------------------------------------------------------
29 IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame
,wxFrame
)
31 BEGIN_EVENT_TABLE(wxMDIParentFrame
, wxFrame
)
34 wxMDIParentFrame::wxMDIParentFrame(void)
36 m_clientWindow
= NULL
;
37 m_currentChild
= NULL
;
38 m_parentFrameActive
= TRUE
;
41 wxMDIParentFrame::wxMDIParentFrame( wxWindow
*parent
,
42 wxWindowID id
, const wxString
& title
,
43 const wxPoint
& pos
, const wxSize
& size
,
44 long style
, const wxString
& name
)
46 m_clientWindow
= NULL
;
47 m_currentChild
= NULL
;
48 m_parentFrameActive
= TRUE
;
49 Create( parent
, id
, title
, pos
, size
, style
, name
);
52 wxMDIParentFrame::~wxMDIParentFrame(void)
56 bool wxMDIParentFrame::Create( wxWindow
*parent
,
57 wxWindowID id
, const wxString
& title
,
58 const wxPoint
& pos
, const wxSize
& size
,
59 long style
, const wxString
& name
)
61 wxFrame::Create( parent
, id
, title
, pos
, size
, style
, name
);
68 void wxMDIParentFrame::GetClientSize(int *width
, int *height
) const
70 wxFrame::GetClientSize( width
, height
);
73 wxMDIChildFrame
*wxMDIParentFrame::GetActiveChild(void) const
75 return m_currentChild
;
78 wxMDIClientWindow
*wxMDIParentFrame::GetClientWindow(void) const
80 return m_clientWindow
;
83 wxMDIClientWindow
*wxMDIParentFrame::OnCreateClient(void)
85 m_clientWindow
= new wxMDIClientWindow( this );
86 return m_clientWindow
;
89 void wxMDIParentFrame::ActivateNext(void)
93 void wxMDIParentFrame::ActivatePrevious(void)
97 void wxMDIParentFrame::OnActivate( wxActivateEvent
& WXUNUSED(event
) )
101 void wxMDIParentFrame::OnSysColourChanged( wxSysColourChangedEvent
& WXUNUSED(event
) )
105 //-----------------------------------------------------------------------------
107 //-----------------------------------------------------------------------------
109 IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame
,wxFrame
)
111 BEGIN_EVENT_TABLE(wxMDIChildFrame
, wxFrame
)
112 EVT_ACTIVATE(wxMDIChildFrame::OnActivate
)
115 wxMDIChildFrame::wxMDIChildFrame(void)
119 wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame
*parent
,
120 wxWindowID id
, const wxString
& title
,
121 const wxPoint
& WXUNUSED(pos
), const wxSize
& size
,
122 long style
, const wxString
& name
)
124 Create( parent
, id
, title
, wxDefaultPosition
, size
, style
, name
);
127 wxMDIChildFrame::~wxMDIChildFrame(void)
131 bool wxMDIChildFrame::Create( wxMDIParentFrame
*parent
,
132 wxWindowID id
, const wxString
& title
,
133 const wxPoint
& WXUNUSED(pos
), const wxSize
& size
,
134 long style
, const wxString
& name
)
137 return wxWindow::Create( parent
->GetClientWindow(), id
, wxDefaultPosition
, size
, style
, name
);
140 void wxMDIChildFrame::GetClientSize( int *width
, int *height
) const
142 wxWindow::GetClientSize( width
, height
);
145 void wxMDIChildFrame::AddChild( wxWindow
*child
)
147 wxWindow::AddChild( child
);
150 static void SetInvokingWindow( wxMenu
*menu
, wxWindow
*win
)
152 menu
->SetInvokingWindow( win
);
153 wxNode
*node
= menu
->m_items
.First();
156 wxMenuItem
*menuitem
= (wxMenuItem
*)node
->Data();
157 if (menuitem
->IsSubMenu())
158 SetInvokingWindow( menuitem
->GetSubMenu(), win
);
163 void wxMDIChildFrame::SetMenuBar( wxMenuBar
*menu_bar
)
165 m_menuBar
= menu_bar
;
169 wxMDIParentFrame
*mdi_frame
= (wxMDIParentFrame
*)m_parent
->m_parent
;
171 if (m_menuBar
->m_parent
!= this)
173 wxNode
*node
= m_menuBar
->m_menus
.First();
176 wxMenu
*menu
= (wxMenu
*)node
->Data();
177 SetInvokingWindow( menu
, this );
181 m_menuBar
->m_parent
= mdi_frame
;
183 mdi_frame
->SetMDIMenuBar( m_menuBar
);
188 wxMenuBar
*wxMDIChildFrame::GetMenuBar()
193 void wxMDIChildFrame::Activate(void)
197 void wxMDIChildFrame::OnActivate( wxActivateEvent
&WXUNUSED(event
) )
201 //-----------------------------------------------------------------------------
203 //-----------------------------------------------------------------------------
205 IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow
,wxWindow
)
207 wxMDIClientWindow::wxMDIClientWindow(void)
211 wxMDIClientWindow::wxMDIClientWindow( wxMDIParentFrame
*parent
, long style
)
213 CreateClient( parent
, style
);
216 wxMDIClientWindow::~wxMDIClientWindow(void)
220 bool wxMDIClientWindow::CreateClient( wxMDIParentFrame
*WXUNUSED(parent
), long WXUNUSED(style
) )
225 void wxMDIClientWindow::AddChild( wxWindow
*WXUNUSED(child
) )