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