]> git.saurik.com Git - wxWidgets.git/blob - src/qt/mdi.cpp
More configure fixes
[wxWidgets.git] / src / qt / mdi.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: mdi.cpp
3 // Purpose:
4 // Author: Robert Roebling
5 // Created: 01/02/97
6 // Id:
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifdef __GNUG__
12 #pragma implementation "mdi.h"
13 #endif
14
15 #include "wx/mdi.h"
16 #include "wx/dialog.h"
17 #include "wx/menu.h"
18
19 //-----------------------------------------------------------------------------
20
21 extern wxList wxPendingDelete;
22
23 //-----------------------------------------------------------------------------
24 // wxMDIParentFrame
25 //-----------------------------------------------------------------------------
26
27 //-----------------------------------------------------------------------------
28
29 IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame,wxFrame)
30
31 BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
32 END_EVENT_TABLE()
33
34 wxMDIParentFrame::wxMDIParentFrame(void)
35 {
36 m_clientWindow = NULL;
37 m_currentChild = NULL;
38 m_parentFrameActive = TRUE;
39 };
40
41 wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent,
42 wxWindowID id, const wxString& title,
43 const wxPoint& pos, const wxSize& size,
44 long style, const wxString& name )
45 {
46 m_clientWindow = NULL;
47 m_currentChild = NULL;
48 m_parentFrameActive = TRUE;
49 Create( parent, id, title, pos, size, style, name );
50 };
51
52 wxMDIParentFrame::~wxMDIParentFrame(void)
53 {
54 };
55
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 )
60 {
61 wxFrame::Create( parent, id, title, pos, size, style, name );
62
63 OnCreateClient();
64
65 return TRUE;
66 };
67
68 void wxMDIParentFrame::GetClientSize(int *width, int *height ) const
69 {
70 wxFrame::GetClientSize( width, height );
71 };
72
73 wxMDIChildFrame *wxMDIParentFrame::GetActiveChild(void) const
74 {
75 return m_currentChild;
76 };
77
78 wxMDIClientWindow *wxMDIParentFrame::GetClientWindow(void) const
79 {
80 return m_clientWindow;
81 };
82
83 wxMDIClientWindow *wxMDIParentFrame::OnCreateClient(void)
84 {
85 m_clientWindow = new wxMDIClientWindow( this );
86 return m_clientWindow;
87 };
88
89 void wxMDIParentFrame::ActivateNext(void)
90 {
91 };
92
93 void wxMDIParentFrame::ActivatePrevious(void)
94 {
95 };
96
97 void wxMDIParentFrame::OnActivate( wxActivateEvent& WXUNUSED(event) )
98 {
99 };
100
101 void wxMDIParentFrame::OnSysColourChanged( wxSysColourChangedEvent& WXUNUSED(event) )
102 {
103 };
104
105 //-----------------------------------------------------------------------------
106 // wxMDIChildFrame
107 //-----------------------------------------------------------------------------
108
109 IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxFrame)
110
111 BEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame)
112 EVT_ACTIVATE(wxMDIChildFrame::OnActivate)
113 END_EVENT_TABLE()
114
115 wxMDIChildFrame::wxMDIChildFrame(void)
116 {
117 };
118
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 )
123 {
124 Create( parent, id, title, wxDefaultPosition, size, style, name );
125 };
126
127 wxMDIChildFrame::~wxMDIChildFrame(void)
128 {
129 };
130
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 )
135 {
136 m_title = title;
137 return wxWindow::Create( parent->GetClientWindow(), id, wxDefaultPosition, size, style, name );
138 };
139
140 void wxMDIChildFrame::GetClientSize( int *width, int *height ) const
141 {
142 wxWindow::GetClientSize( width, height );
143 }
144
145 void wxMDIChildFrame::AddChild( wxWindow *child )
146 {
147 wxWindow::AddChild( child );
148 }
149
150 static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
151 {
152 menu->SetInvokingWindow( win );
153 wxNode *node = menu->m_items.First();
154 while (node)
155 {
156 wxMenuItem *menuitem = (wxMenuItem*)node->Data();
157 if (menuitem->IsSubMenu())
158 SetInvokingWindow( menuitem->GetSubMenu(), win );
159 node = node->Next();
160 };
161 };
162
163 void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar )
164 {
165 m_menuBar = menu_bar;
166
167 if (m_menuBar)
168 {
169 wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->m_parent;
170
171 if (m_menuBar->m_parent != this)
172 {
173 wxNode *node = m_menuBar->m_menus.First();
174 while (node)
175 {
176 wxMenu *menu = (wxMenu*)node->Data();
177 SetInvokingWindow( menu, this );
178 node = node->Next();
179 };
180
181 m_menuBar->m_parent = mdi_frame;
182 }
183 mdi_frame->SetMDIMenuBar( m_menuBar );
184
185 }
186 };
187
188 wxMenuBar *wxMDIChildFrame::GetMenuBar()
189 {
190 return m_menuBar;
191 };
192
193 void wxMDIChildFrame::Activate(void)
194 {
195 };
196
197 void wxMDIChildFrame::OnActivate( wxActivateEvent &WXUNUSED(event) )
198 {
199 };
200
201 //-----------------------------------------------------------------------------
202 // wxMDIClientWindow
203 //-----------------------------------------------------------------------------
204
205 IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow,wxWindow)
206
207 wxMDIClientWindow::wxMDIClientWindow(void)
208 {
209 };
210
211 wxMDIClientWindow::wxMDIClientWindow( wxMDIParentFrame *parent, long style )
212 {
213 CreateClient( parent, style );
214 };
215
216 wxMDIClientWindow::~wxMDIClientWindow(void)
217 {
218 };
219
220 bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *WXUNUSED(parent), long WXUNUSED(style) )
221 {
222 return TRUE;
223 };
224
225 void wxMDIClientWindow::AddChild( wxWindow *WXUNUSED(child) )
226 {
227 };
228
229