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