]> git.saurik.com Git - wxWidgets.git/blame - src/qt/mdi.cpp
wxUpdateUIEvent derives from wxCommandEvent now
[wxWidgets.git] / src / qt / mdi.cpp
CommitLineData
7c78e7c7
RR
1/////////////////////////////////////////////////////////////////////////////
2// Name: mdi.cpp
01b2eeec
KB
3// Purpose: MDI classes
4// Author: AUTHOR
5// Modified by:
6// Created: ??/??/98
7// RCS-ID: $Id$
8// Copyright: (c) AUTHOR
7c78e7c7
RR
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "mdi.h"
14#endif
15
16#include "wx/mdi.h"
7c78e7c7 17
01b2eeec 18extern wxList wxModelessWindows;
7c78e7c7 19
01b2eeec
KB
20#if !USE_SHARED_LIBRARY
21IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
22IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
23IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
7c78e7c7 24
01b2eeec
KB
25BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
26 EVT_SIZE(wxMDIParentFrame::OnSize)
27 EVT_ACTIVATE(wxMDIParentFrame::OnActivate)
28 EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged)
29END_EVENT_TABLE()
7c78e7c7 30
01b2eeec
KB
31BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow)
32 EVT_SCROLL(wxMDIClientWindow::OnScroll)
33END_EVENT_TABLE()
7c78e7c7 34
01b2eeec 35#endif
7c78e7c7 36
01b2eeec 37// Parent frame
7c78e7c7 38
01b2eeec 39wxMDIParentFrame::wxMDIParentFrame()
7c78e7c7 40{
01b2eeec 41}
7c78e7c7 42
01b2eeec
KB
43bool wxMDIParentFrame::Create(wxWindow *parent,
44 wxWindowID id,
45 const wxString& title,
46 const wxPoint& pos,
47 const wxSize& size,
48 long style,
49 const wxString& name)
7c78e7c7 50{
01b2eeec
KB
51 if (!parent)
52 wxTopLevelWindows.Append(this);
53
54 SetName(name);
55 m_windowStyle = style;
56
57 if (parent) parent->AddChild(this);
7c78e7c7 58
01b2eeec
KB
59 if ( id > -1 )
60 m_windowId = id;
61 else
62 m_windowId = (int)NewControlId();
63
64 // TODO: create MDI parent frame
65
66 wxModelessWindows.Append(this);
67
68 return TRUE;
69}
70
71wxMDIParentFrame::~wxMDIParentFrame()
7c78e7c7 72{
01b2eeec 73}
7c78e7c7 74
01b2eeec
KB
75// Get size *available for subwindows* i.e. excluding menu bar.
76void wxMDIParentFrame::GetClientSize(int *x, int *y) const
7c78e7c7 77{
01b2eeec
KB
78 // TODO
79}
7c78e7c7 80
01b2eeec 81void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
7c78e7c7 82{
01b2eeec
KB
83 // TODO
84 if (!menu_bar)
85 {
86 m_frameMenuBar = NULL;
87 return;
88 }
89
90 if (menu_bar->m_menuBarFrame)
91 return;
7c78e7c7 92
01b2eeec
KB
93 m_frameMenuBar = menu_bar;
94}
95
96void wxMDIParentFrame::OnSize(wxSizeEvent& event)
7c78e7c7 97{
01b2eeec
KB
98#if USE_CONSTRAINTS
99 if (GetAutoLayout())
100 Layout();
101#endif
102 int x = 0;
103 int y = 0;
104 int width, height;
105 GetClientSize(&width, &height);
106
107 if ( GetClientWindow() )
108 GetClientWindow()->SetSize(x, y, width, height);
109}
7c78e7c7 110
01b2eeec 111void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
7c78e7c7 112{
01b2eeec
KB
113 // Do nothing
114}
7c78e7c7 115
01b2eeec
KB
116// Returns the active MDI child window
117wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
7c78e7c7 118{
01b2eeec
KB
119 // TODO
120 return NULL;
121}
7c78e7c7 122
01b2eeec
KB
123// Create the client window class (don't Create the window,
124// just return a new class)
125wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
7c78e7c7 126{
01b2eeec
KB
127 return new wxMDIClientWindow ;
128}
7c78e7c7 129
01b2eeec
KB
130// Responds to colour changes, and passes event on to children.
131void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
7c78e7c7 132{
01b2eeec 133 // TODO
7c78e7c7 134
01b2eeec
KB
135 // Propagate the event to the non-top-level children
136 wxFrame::OnSysColourChanged(event);
137}
138
139// MDI operations
140void wxMDIParentFrame::Cascade()
7c78e7c7 141{
01b2eeec
KB
142 // TODO
143}
7c78e7c7 144
01b2eeec 145void wxMDIParentFrame::Tile()
7c78e7c7 146{
01b2eeec
KB
147 // TODO
148}
7c78e7c7 149
01b2eeec
KB
150void wxMDIParentFrame::ArrangeIcons()
151{
152 // TODO
153}
7c78e7c7 154
01b2eeec
KB
155void wxMDIParentFrame::ActivateNext()
156{
157 // TODO
158}
7c78e7c7 159
01b2eeec 160void wxMDIParentFrame::ActivatePrevious()
7c78e7c7 161{
01b2eeec
KB
162 // TODO
163}
164
165// Child frame
7c78e7c7 166
01b2eeec 167wxMDIChildFrame::wxMDIChildFrame()
7c78e7c7 168{
01b2eeec 169}
7c78e7c7 170
01b2eeec
KB
171bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
172 wxWindowID id,
173 const wxString& title,
174 const wxPoint& pos,
175 const wxSize& size,
176 long style,
177 const wxString& name)
7c78e7c7 178{
01b2eeec
KB
179 SetName(name);
180
181 if ( id > -1 )
182 m_windowId = id;
183 else
184 m_windowId = (int)NewControlId();
185
186 if (parent) parent->AddChild(this);
187
188 // TODO: create child frame
7c78e7c7 189
01b2eeec
KB
190 wxModelessWindows.Append(this);
191 return FALSE;
192}
193
194wxMDIChildFrame::~wxMDIChildFrame()
7c78e7c7 195{
01b2eeec 196}
7c78e7c7 197
01b2eeec
KB
198// Set the client size (i.e. leave the calculation of borders etc.
199// to wxWindows)
200void wxMDIChildFrame::SetClientSize(int width, int height)
7c78e7c7 201{
01b2eeec 202 // TODO
7c78e7c7
RR
203}
204
01b2eeec 205void wxMDIChildFrame::GetPosition(int *x, int *y) const
7c78e7c7 206{
01b2eeec 207 // TODO
7c78e7c7 208}
01b2eeec
KB
209
210void wxMDIChildFrame::SetMenuBar(wxMenuBar *menu_bar)
211{
212 // TODO
213 if (!menu_bar)
7c78e7c7 214 {
01b2eeec
KB
215 m_frameMenuBar = NULL;
216 return;
7c78e7c7 217 }
01b2eeec
KB
218
219 if (menu_bar->m_menuBarFrame)
220 return;
221 m_frameMenuBar = menu_bar;
222}
7c78e7c7 223
01b2eeec
KB
224// MDI operations
225void wxMDIChildFrame::Maximize()
7c78e7c7 226{
01b2eeec
KB
227 // TODO
228}
7c78e7c7 229
01b2eeec 230void wxMDIChildFrame::Restore()
7c78e7c7 231{
01b2eeec
KB
232 // TODO
233}
7c78e7c7 234
01b2eeec 235void wxMDIChildFrame::Activate()
7c78e7c7 236{
01b2eeec
KB
237 // TODO
238}
7c78e7c7 239
01b2eeec 240// Client window
7c78e7c7 241
01b2eeec 242wxMDIClientWindow::wxMDIClientWindow()
7c78e7c7 243{
01b2eeec 244}
7c78e7c7 245
01b2eeec 246wxMDIClientWindow::~wxMDIClientWindow()
7c78e7c7 247{
01b2eeec 248}
7c78e7c7 249
01b2eeec 250bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
7c78e7c7 251{
01b2eeec
KB
252 // TODO create client window
253 m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
7c78e7c7 254
01b2eeec
KB
255 return FALSE;
256}
7c78e7c7 257
01b2eeec
KB
258// Explicitly call default scroll behaviour
259void wxMDIClientWindow::OnScroll(wxScrollEvent& event)
7c78e7c7 260{
01b2eeec
KB
261 Default(); // Default processing
262}
7c78e7c7 263