]>
Commit | Line | Data |
---|---|---|
a15eb0a5 SC |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: mac/toplevel.cpp | |
d66c3960 SC |
3 | // Purpose: implements wxTopLevelWindow for Mac |
4 | // Author: Stefan Csomor | |
a15eb0a5 SC |
5 | // Modified by: |
6 | // Created: 24.09.01 | |
7 | // RCS-ID: $Id$ | |
d66c3960 | 8 | // Copyright: (c) 2001-2004 Stefan Csomor |
65571936 | 9 | // License: wxWindows licence |
a15eb0a5 SC |
10 | /////////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | // ============================================================================ | |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
20 | #ifdef __GNUG__ | |
21 | #pragma implementation "toplevel.h" | |
22 | #endif | |
23 | ||
24 | // For compilers that support precompilation, includes "wx.h". | |
25 | #include "wx/wxprec.h" | |
26 | ||
27 | #ifdef __BORLANDC__ | |
28 | #pragma hdrstop | |
29 | #endif | |
30 | ||
31 | #ifndef WX_PRECOMP | |
32 | #include "wx/app.h" | |
33 | #include "wx/toplevel.h" | |
422644a3 | 34 | #include "wx/frame.h" |
a15eb0a5 SC |
35 | #include "wx/string.h" |
36 | #include "wx/log.h" | |
37 | #include "wx/intl.h" | |
37ec2bd3 | 38 | #include "wx/settings.h" |
a15eb0a5 SC |
39 | #endif //WX_PRECOMP |
40 | ||
5f0b2f22 | 41 | #include "wx/mac/uma.h" |
422644a3 | 42 | #include "wx/mac/aga.h" |
7c091673 | 43 | #include "wx/app.h" |
5f0b2f22 | 44 | #include "wx/tooltip.h" |
a07c1212 | 45 | #include "wx/dnd.h" |
1f90939c SC |
46 | #if wxUSE_SYSTEM_OPTIONS |
47 | #include "wx/sysopt.h" | |
48 | #endif | |
5f0b2f22 | 49 | |
7f0c3a63 | 50 | #include <ToolUtils.h> |
dd49c691 | 51 | |
a15eb0a5 SC |
52 | // ---------------------------------------------------------------------------- |
53 | // globals | |
54 | // ---------------------------------------------------------------------------- | |
55 | ||
56 | // list of all frames and modeless dialogs | |
32b5be3d RR |
57 | wxWindowList wxModelessWindows; |
58 | ||
6a7e6411 RD |
59 | static pascal long wxShapedMacWindowDef(short varCode, WindowRef window, SInt16 message, SInt32 param); |
60 | ||
a15eb0a5 SC |
61 | // ============================================================================ |
62 | // wxTopLevelWindowMac implementation | |
63 | // ============================================================================ | |
64 | ||
facd6764 SC |
65 | BEGIN_EVENT_TABLE(wxTopLevelWindowMac, wxTopLevelWindowBase) |
66 | END_EVENT_TABLE() | |
67 | ||
68 | ||
851b3a88 SC |
69 | // --------------------------------------------------------------------------- |
70 | // Carbon Events | |
71 | // --------------------------------------------------------------------------- | |
72 | ||
851b3a88 SC |
73 | extern long wxMacTranslateKey(unsigned char key, unsigned char code) ; |
74 | ||
1542ea39 | 75 | static const EventTypeSpec eventList[] = |
851b3a88 | 76 | { |
facd6764 | 77 | // TODO remove control related event like key and mouse (except for WindowLeave events) |
949cb163 | 78 | #if 1 |
851b3a88 | 79 | { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent } , |
c5c9378c | 80 | |
e40298d5 | 81 | { kEventClassKeyboard, kEventRawKeyDown } , |
c5c9378c SC |
82 | { kEventClassKeyboard, kEventRawKeyRepeat } , |
83 | { kEventClassKeyboard, kEventRawKeyUp } , | |
84 | { kEventClassKeyboard, kEventRawKeyModifiersChanged } , | |
facd6764 | 85 | #endif |
c5c9378c | 86 | |
16a76184 | 87 | { kEventClassWindow , kEventWindowShown } , |
851b3a88 SC |
88 | { kEventClassWindow , kEventWindowActivated } , |
89 | { kEventClassWindow , kEventWindowDeactivated } , | |
90 | { kEventClassWindow , kEventWindowBoundsChanging } , | |
91 | { kEventClassWindow , kEventWindowBoundsChanged } , | |
92 | { kEventClassWindow , kEventWindowClose } , | |
93 | ||
facd6764 SC |
94 | // we have to catch these events on the toplevel window level, as controls don't get the |
95 | // raw mouse events anymore | |
96 | ||
851b3a88 SC |
97 | { kEventClassMouse , kEventMouseDown } , |
98 | { kEventClassMouse , kEventMouseUp } , | |
de127c69 | 99 | { kEventClassMouse , kEventMouseWheelMoved } , |
851b3a88 SC |
100 | { kEventClassMouse , kEventMouseMoved } , |
101 | { kEventClassMouse , kEventMouseDragged } , | |
851b3a88 SC |
102 | } ; |
103 | ||
104 | static pascal OSStatus TextInputEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) | |
105 | { | |
106 | OSStatus result = eventNotHandledErr ; | |
851b3a88 | 107 | |
c5c9378c | 108 | wxWindow* focus = wxWindow::FindFocus() ; |
e40298d5 | 109 | char charCode ; |
1542ea39 | 110 | UInt32 keyCode ; |
c5c9378c | 111 | UInt32 modifiers ; |
e40298d5 | 112 | Point point ; |
c5c9378c SC |
113 | |
114 | EventRef rawEvent ; | |
1542ea39 | 115 | |
c5c9378c | 116 | GetEventParameter( event , kEventParamTextInputSendKeyboardEvent ,typeEventRef,NULL,sizeof(rawEvent),NULL,&rawEvent ) ; |
1542ea39 | 117 | |
e40298d5 JS |
118 | GetEventParameter( rawEvent, kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode ); |
119 | GetEventParameter( rawEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode ); | |
120 | GetEventParameter( rawEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers); | |
121 | GetEventParameter( rawEvent, kEventParamMouseLocation, typeQDPoint, NULL, | |
122 | sizeof( Point ), NULL, &point ); | |
123 | ||
e40298d5 JS |
124 | switch ( GetEventKind( event ) ) |
125 | { | |
126 | case kEventTextInputUnicodeForKeyEvent : | |
ace07c80 | 127 | // this is only called when no default handler has jumped in, eg a wxControl on a floater window does not |
5d2e69e8 | 128 | // get its own kEventTextInputUnicodeForKeyEvent, so we route back the |
ace07c80 SC |
129 | wxControl* control = wxDynamicCast( focus , wxControl ) ; |
130 | if ( control ) | |
131 | { | |
facd6764 | 132 | ControlRef macControl = (ControlRef) control->GetHandle() ; |
ace07c80 SC |
133 | if ( macControl ) |
134 | { | |
135 | ::HandleControlKey( macControl , keyCode , charCode , modifiers ) ; | |
136 | result = noErr ; | |
137 | } | |
138 | } | |
139 | /* | |
140 | // this may lead to double events sent to a window in case all handlers have skipped the key down event | |
77a4354e VZ |
141 | UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ; |
142 | UInt32 message = (keyCode << 8) + charCode; | |
143 | ||
1542ea39 | 144 | if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent( |
e40298d5 JS |
145 | focus , message , modifiers , when , point.h , point.v ) ) |
146 | { | |
147 | result = noErr ; | |
148 | } | |
ace07c80 | 149 | */ |
e40298d5 JS |
150 | break ; |
151 | } | |
c5c9378c SC |
152 | |
153 | return result ; | |
154 | } | |
155 | ||
156 | static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) | |
157 | { | |
158 | OSStatus result = eventNotHandledErr ; | |
159 | ||
160 | wxWindow* focus = wxWindow::FindFocus() ; | |
92a7272f SC |
161 | if ( focus == NULL ) |
162 | return result ; | |
163 | ||
e40298d5 | 164 | char charCode ; |
1542ea39 | 165 | UInt32 keyCode ; |
c5c9378c | 166 | UInt32 modifiers ; |
e40298d5 JS |
167 | Point point ; |
168 | UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ; | |
169 | ||
170 | GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode ); | |
171 | GetEventParameter( event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode ); | |
172 | GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers); | |
173 | GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL, | |
174 | sizeof( Point ), NULL, &point ); | |
175 | ||
176 | UInt32 message = (keyCode << 8) + charCode; | |
177 | switch( GetEventKind( event ) ) | |
178 | { | |
179 | case kEventRawKeyRepeat : | |
180 | case kEventRawKeyDown : | |
e40298d5 | 181 | { |
404f1d80 SC |
182 | WXEVENTREF formerEvent = wxTheApp->MacGetCurrentEvent() ; |
183 | WXEVENTHANDLERCALLREF formerHandler = wxTheApp->MacGetCurrentEventHandlerCallRef() ; | |
184 | wxTheApp->MacSetCurrentEvent( event , handler ) ; | |
185 | if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent( | |
186 | focus , message , modifiers , when , point.h , point.v ) ) | |
187 | { | |
188 | result = noErr ; | |
189 | } | |
190 | wxTheApp->MacSetCurrentEvent( formerEvent , formerHandler ) ; | |
e40298d5 JS |
191 | } |
192 | break ; | |
193 | case kEventRawKeyUp : | |
1542ea39 | 194 | if ( (focus != NULL) && wxTheApp->MacSendKeyUpEvent( |
e40298d5 JS |
195 | focus , message , modifiers , when , point.h , point.v ) ) |
196 | { | |
197 | result = noErr ; | |
198 | } | |
199 | break ; | |
200 | case kEventRawKeyModifiersChanged : | |
201 | { | |
202 | wxKeyEvent event(wxEVT_KEY_DOWN); | |
203 | ||
204 | event.m_shiftDown = modifiers & shiftKey; | |
205 | event.m_controlDown = modifiers & controlKey; | |
206 | event.m_altDown = modifiers & optionKey; | |
207 | event.m_metaDown = modifiers & cmdKey; | |
208 | ||
209 | event.m_x = point.h; | |
210 | event.m_y = point.v; | |
211 | event.m_timeStamp = when; | |
212 | wxWindow* focus = wxWindow::FindFocus() ; | |
213 | event.SetEventObject(focus); | |
214 | ||
8d60dc8a | 215 | if ( focus && (modifiers ^ wxTheApp->s_lastModifiers ) & controlKey ) |
e40298d5 JS |
216 | { |
217 | event.m_keyCode = WXK_CONTROL ; | |
218 | event.SetEventType( ( modifiers & controlKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ; | |
219 | focus->GetEventHandler()->ProcessEvent( event ) ; | |
220 | } | |
8d60dc8a | 221 | if ( focus && (modifiers ^ wxTheApp->s_lastModifiers ) & shiftKey ) |
e40298d5 JS |
222 | { |
223 | event.m_keyCode = WXK_SHIFT ; | |
224 | event.SetEventType( ( modifiers & shiftKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ; | |
225 | focus->GetEventHandler()->ProcessEvent( event ) ; | |
226 | } | |
8d60dc8a | 227 | if ( focus && (modifiers ^ wxTheApp->s_lastModifiers ) & optionKey ) |
e40298d5 JS |
228 | { |
229 | event.m_keyCode = WXK_ALT ; | |
230 | event.SetEventType( ( modifiers & optionKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ; | |
231 | focus->GetEventHandler()->ProcessEvent( event ) ; | |
232 | } | |
b7aec135 SC |
233 | if ( focus && (modifiers ^ wxTheApp->s_lastModifiers ) & cmdKey ) |
234 | { | |
235 | event.m_keyCode = WXK_COMMAND ; | |
236 | event.SetEventType( ( modifiers & cmdKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ; | |
237 | focus->GetEventHandler()->ProcessEvent( event ) ; | |
238 | } | |
e40298d5 JS |
239 | wxTheApp->s_lastModifiers = modifiers ; |
240 | } | |
241 | break ; | |
242 | } | |
851b3a88 SC |
243 | |
244 | return result ; | |
245 | } | |
246 | ||
facd6764 SC |
247 | // we don't interfere with foreign controls on our toplevel windows, therefore we always give back eventNotHandledErr |
248 | // for windows that we didn't create (like eg Scrollbars in a databrowser) , or for controls where we did not handle the | |
249 | // mouse down at all | |
851b3a88 | 250 | |
facd6764 | 251 | // This handler can also be called from app level where data (ie target window) may be null or a non wx window |
1542ea39 | 252 | |
facd6764 | 253 | wxWindow* g_MacLastWindow = NULL ; |
a3195b73 | 254 | |
86a9144f SC |
255 | static EventMouseButton lastButton = 0 ; |
256 | ||
facd6764 SC |
257 | static void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent ) |
258 | { | |
259 | UInt32 modifiers = cEvent.GetParameter<UInt32>(kEventParamKeyModifiers, typeUInt32) ; | |
260 | Point screenMouseLocation = cEvent.GetParameter<Point>(kEventParamMouseLocation) ; | |
67245665 | 261 | |
facd6764 SC |
262 | // this parameter are not given for all events |
263 | EventMouseButton button = 0 ; | |
264 | UInt32 clickCount = 0 ; | |
265 | cEvent.GetParameter<EventMouseButton>(kEventParamMouseButton, typeMouseButton , &button) ; | |
266 | cEvent.GetParameter<UInt32>(kEventParamClickCount, typeUInt32 , &clickCount ) ; | |
267 | ||
268 | wxevent.m_x = screenMouseLocation.h; | |
269 | wxevent.m_y = screenMouseLocation.v; | |
270 | wxevent.m_shiftDown = modifiers & shiftKey; | |
271 | wxevent.m_controlDown = modifiers & controlKey; | |
272 | wxevent.m_altDown = modifiers & optionKey; | |
273 | wxevent.m_metaDown = modifiers & cmdKey; | |
274 | wxevent.SetTimestamp( cEvent.GetTicks() ) ; | |
275 | // a control click is interpreted as a right click | |
276 | if ( button == kEventMouseButtonPrimary && (modifiers & controlKey) ) | |
851b3a88 | 277 | { |
facd6764 SC |
278 | button = kEventMouseButtonSecondary ; |
279 | } | |
86a9144f SC |
280 | |
281 | // we must make sure that our synthetic 'right' button corresponds in | |
282 | // mouse down, moved and mouse up, and does not deliver a right down and left up | |
283 | ||
284 | if ( cEvent.GetKind() == kEventMouseDown ) | |
285 | lastButton = button ; | |
4e4e6dce SC |
286 | |
287 | if ( button == 0 ) | |
288 | lastButton = 0 ; | |
86a9144f SC |
289 | else if ( lastButton ) |
290 | button = lastButton ; | |
facd6764 SC |
291 | |
292 | // determinate the correct down state, wx does not want a 'down' for a mouseUp event, while mac delivers | |
293 | // this button | |
294 | if ( button != 0 && cEvent.GetKind() != kEventMouseUp ) | |
295 | { | |
296 | switch( button ) | |
e40298d5 | 297 | { |
facd6764 SC |
298 | case kEventMouseButtonPrimary : |
299 | wxevent.m_leftDown = true ; | |
e40298d5 | 300 | break ; |
facd6764 SC |
301 | case kEventMouseButtonSecondary : |
302 | wxevent.m_rightDown = true ; | |
e40298d5 | 303 | break ; |
facd6764 SC |
304 | case kEventMouseButtonTertiary : |
305 | wxevent.m_middleDown = true ; | |
e40298d5 | 306 | break ; |
facd6764 SC |
307 | } |
308 | } | |
90ff87d7 SC |
309 | // translate into wx types |
310 | switch ( cEvent.GetKind() ) | |
facd6764 | 311 | { |
90ff87d7 SC |
312 | case kEventMouseDown : |
313 | switch( button ) | |
314 | { | |
315 | case kEventMouseButtonPrimary : | |
316 | wxevent.SetEventType(clickCount > 1 ? wxEVT_LEFT_DCLICK : wxEVT_LEFT_DOWN ) ; | |
317 | break ; | |
318 | case kEventMouseButtonSecondary : | |
319 | wxevent.SetEventType( clickCount > 1 ? wxEVT_RIGHT_DCLICK : wxEVT_RIGHT_DOWN ) ; | |
320 | break ; | |
321 | case kEventMouseButtonTertiary : | |
322 | wxevent.SetEventType(clickCount > 1 ? wxEVT_MIDDLE_DCLICK : wxEVT_MIDDLE_DOWN ) ; | |
323 | break ; | |
324 | } | |
325 | break ; | |
326 | case kEventMouseUp : | |
327 | switch( button ) | |
328 | { | |
329 | case kEventMouseButtonPrimary : | |
330 | wxevent.SetEventType( wxEVT_LEFT_UP ) ; | |
331 | break ; | |
332 | case kEventMouseButtonSecondary : | |
333 | wxevent.SetEventType( wxEVT_RIGHT_UP ) ; | |
334 | break ; | |
335 | case kEventMouseButtonTertiary : | |
336 | wxevent.SetEventType( wxEVT_MIDDLE_UP ) ; | |
337 | break ; | |
338 | } | |
339 | break ; | |
2cce9b11 JS |
340 | case kEventMouseWheelMoved : |
341 | { | |
facd6764 SC |
342 | wxevent.SetEventType(wxEVT_MOUSEWHEEL ) ; |
343 | ||
344 | // EventMouseWheelAxis axis = cEvent.GetParameter<EventMouseWheelAxis>(kEventParamMouseWheelAxis, typeMouseWheelAxis) ; | |
345 | SInt32 delta = cEvent.GetParameter<SInt32>(kEventParamMouseWheelDelta, typeLongInteger) ; | |
346 | ||
347 | wxevent.m_wheelRotation = delta; | |
348 | wxevent.m_wheelDelta = 1; | |
349 | wxevent.m_linesPerAction = 1; | |
90ff87d7 | 350 | break ; |
2cce9b11 | 351 | } |
90ff87d7 | 352 | default : |
facd6764 | 353 | wxevent.SetEventType(wxEVT_MOTION ) ; |
90ff87d7 SC |
354 | break ; |
355 | } | |
facd6764 SC |
356 | } |
357 | ||
358 | ControlRef wxMacFindSubControl( Point location , ControlRef superControl , ControlPartCode *outPart ) | |
359 | { | |
360 | if ( superControl ) | |
361 | { | |
362 | UInt16 childrenCount = 0 ; | |
363 | OSStatus err = CountSubControls( superControl , &childrenCount ) ; | |
364 | if ( err == errControlIsNotEmbedder ) | |
365 | return NULL ; | |
366 | wxASSERT_MSG( err == noErr , wxT("Unexpected error when accessing subcontrols") ) ; | |
367 | ||
368 | for ( UInt16 i = childrenCount ; i >=1 ; --i ) | |
369 | { | |
370 | ControlHandle sibling ; | |
371 | err = GetIndexedSubControl( superControl , i , & sibling ) ; | |
372 | if ( err == errControlIsNotEmbedder ) | |
373 | return NULL ; | |
374 | ||
375 | wxASSERT_MSG( err == noErr , wxT("Unexpected error when accessing subcontrols") ) ; | |
376 | if ( IsControlVisible( sibling ) ) | |
377 | { | |
378 | Rect r ; | |
d6fd667b | 379 | UMAGetControlBoundsInWindowCoords( sibling , &r ) ; |
facd6764 | 380 | if ( MacPtInRect( location , &r ) ) |
de127c69 | 381 | { |
facd6764 SC |
382 | ControlHandle child = wxMacFindSubControl( location , sibling , outPart ) ; |
383 | if ( child ) | |
384 | return child ; | |
385 | else | |
de127c69 | 386 | { |
d6fd667b SC |
387 | Point testLocation = location ; |
388 | #if TARGET_API_MAC_OSX | |
389 | testLocation.h -= r.left ; | |
390 | testLocation.v -= r.top ; | |
391 | #endif | |
392 | *outPart = TestControl( sibling , testLocation ) ; | |
facd6764 | 393 | return sibling ; |
de127c69 GD |
394 | } |
395 | } | |
facd6764 | 396 | } |
e40298d5 JS |
397 | } |
398 | } | |
facd6764 SC |
399 | return NULL ; |
400 | } | |
1542ea39 | 401 | |
facd6764 SC |
402 | ControlRef wxMacFindControlUnderMouse( Point location , WindowRef window , ControlPartCode *outPart ) |
403 | { | |
404 | #if TARGET_API_MAC_OSX | |
7741dfb1 | 405 | if ( UMAGetSystemVersion() >= 0x1030 ) |
30e0b1c9 SC |
406 | return FindControlUnderMouse( location , window , outPart ) ; |
407 | #endif | |
facd6764 SC |
408 | ControlRef rootControl = NULL ; |
409 | verify_noerr( GetRootControl( window , &rootControl ) ) ; | |
410 | return wxMacFindSubControl( location , rootControl , outPart ) ; | |
30e0b1c9 | 411 | |
facd6764 SC |
412 | } |
413 | pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) | |
414 | { | |
415 | ||
416 | OSStatus result = eventNotHandledErr ; | |
417 | ||
418 | wxMacCarbonEvent cEvent( event ) ; | |
419 | ||
420 | Point screenMouseLocation = cEvent.GetParameter<Point>(kEventParamMouseLocation) ; | |
421 | Point windowMouseLocation = screenMouseLocation ; | |
422 | ||
423 | WindowRef window ; | |
424 | short windowPart = ::FindWindow(screenMouseLocation, &window); | |
425 | ||
426 | wxWindow* currentMouseWindow = NULL ; | |
7741dfb1 | 427 | |
facd6764 SC |
428 | if ( window ) |
429 | { | |
d6fd667b | 430 | QDGlobalToLocalPoint( UMAGetWindowPort(window ) , &windowMouseLocation ) ; |
facd6764 SC |
431 | |
432 | if ( wxTheApp->s_captureWindow && wxTheApp->s_captureWindow->MacGetTopLevelWindowRef() == (WXWindow) window && windowPart == inContent ) | |
433 | { | |
434 | currentMouseWindow = wxTheApp->s_captureWindow ; | |
435 | } | |
436 | else if ( (IsWindowActive(window) && windowPart == inContent) ) | |
437 | { | |
438 | ControlPartCode part ; | |
439 | ControlRef control = wxMacFindControlUnderMouse( windowMouseLocation , window , &part ) ; | |
b19bf058 SC |
440 | if ( control == 0 ) |
441 | currentMouseWindow = (wxWindow*) data ; | |
442 | else | |
443 | currentMouseWindow = wxFindControlFromMacControl( control ) ; | |
facd6764 SC |
444 | } |
445 | } | |
446 | ||
447 | wxMouseEvent wxevent(wxEVT_LEFT_DOWN); | |
448 | SetupMouseEvent( wxevent , cEvent ) ; | |
449 | ||
450 | // handle all enter / leave events | |
451 | ||
452 | if ( currentMouseWindow != g_MacLastWindow ) | |
453 | { | |
454 | if ( g_MacLastWindow ) | |
455 | { | |
456 | wxMouseEvent eventleave(wxevent); | |
457 | eventleave.SetEventType( wxEVT_LEAVE_WINDOW ); | |
458 | g_MacLastWindow->ScreenToClient( &eventleave.m_x, &eventleave.m_y ); | |
459 | eventleave.SetEventObject( g_MacLastWindow ) ; | |
460 | ||
461 | #if wxUSE_TOOLTIPS | |
462 | wxToolTip::RelayEvent( g_MacLastWindow , eventleave); | |
463 | #endif // wxUSE_TOOLTIPS | |
464 | g_MacLastWindow->GetEventHandler()->ProcessEvent(eventleave); | |
465 | } | |
466 | if ( currentMouseWindow ) | |
467 | { | |
468 | wxMouseEvent evententer(wxevent); | |
469 | evententer.SetEventType( wxEVT_ENTER_WINDOW ); | |
470 | currentMouseWindow->ScreenToClient( &evententer.m_x, &evententer.m_y ); | |
471 | evententer.SetEventObject( currentMouseWindow ) ; | |
472 | #if wxUSE_TOOLTIPS | |
473 | wxToolTip::RelayEvent( currentMouseWindow , evententer); | |
474 | #endif // wxUSE_TOOLTIPS | |
475 | currentMouseWindow->GetEventHandler()->ProcessEvent(evententer); | |
476 | } | |
477 | g_MacLastWindow = currentMouseWindow ; | |
478 | } | |
479 | ||
480 | if ( windowPart == inMenuBar ) | |
481 | { | |
482 | // special case menu bar, as we are having a low-level runloop we must do it ourselves | |
483 | if ( cEvent.GetKind() == kEventMouseDown ) | |
484 | { | |
485 | ::MenuSelect( screenMouseLocation ) ; | |
486 | result = noErr ; | |
487 | } | |
488 | } // if ( windowPart == inMenuBar ) | |
489 | else if ( currentMouseWindow ) | |
490 | { | |
491 | currentMouseWindow->ScreenToClient( &wxevent.m_x , &wxevent.m_y ) ; | |
492 | ||
493 | wxevent.SetEventObject( currentMouseWindow ) ; | |
494 | ||
495 | // update cursor | |
496 | ||
497 | wxWindow* cursorTarget = currentMouseWindow ; | |
498 | wxPoint cursorPoint( wxevent.m_x , wxevent.m_y ) ; | |
499 | ||
500 | while( cursorTarget && !cursorTarget->MacSetupCursor( cursorPoint ) ) | |
501 | { | |
502 | cursorTarget = cursorTarget->GetParent() ; | |
503 | if ( cursorTarget ) | |
504 | cursorPoint += cursorTarget->GetPosition() ; | |
505 | } | |
1542ea39 | 506 | |
facd6764 | 507 | // update focus |
851b3a88 | 508 | |
facd6764 SC |
509 | if ( wxevent.GetEventType() == wxEVT_LEFT_DOWN ) |
510 | { | |
511 | // set focus to this window | |
512 | if (currentMouseWindow->AcceptsFocus() && wxWindow::FindFocus()!=currentMouseWindow) | |
513 | currentMouseWindow->SetFocus(); | |
514 | } | |
515 | ||
516 | // make tooltips current | |
517 | ||
518 | #if wxUSE_TOOLTIPS | |
519 | if ( wxevent.GetEventType() == wxEVT_MOTION | |
520 | || wxevent.GetEventType() == wxEVT_ENTER_WINDOW | |
521 | || wxevent.GetEventType() == wxEVT_LEAVE_WINDOW ) | |
522 | wxToolTip::RelayEvent( currentMouseWindow , wxevent); | |
523 | #endif // wxUSE_TOOLTIPS | |
524 | if ( currentMouseWindow->GetEventHandler()->ProcessEvent(wxevent) ) | |
525 | result = noErr; | |
30e0b1c9 SC |
526 | else |
527 | { | |
528 | ControlPartCode dummyPart ; | |
529 | // if built-in find control is finding the wrong control (ie static box instead of overlaid | |
530 | // button, we cannot let the standard handler do its job, but must handle manually | |
531 | ||
532 | if ( ( cEvent.GetKind() == kEventMouseDown ) && | |
533 | (FindControlUnderMouse(windowMouseLocation , window , &dummyPart) != | |
534 | wxMacFindControlUnderMouse( windowMouseLocation , window , &dummyPart ) ) ) | |
535 | { | |
536 | EventModifiers modifiers = cEvent.GetParameter<EventModifiers>(kEventParamKeyModifiers, typeUInt32) ; | |
3a9dc061 SC |
537 | Point clickLocation = windowMouseLocation ; |
538 | #if TARGET_API_MAC_OSX | |
539 | currentMouseWindow->MacRootWindowToWindow( &clickLocation.h , &clickLocation.v ) ; | |
540 | #endif | |
541 | HandleControlClick( (ControlRef) currentMouseWindow->GetHandle() , clickLocation , | |
30e0b1c9 SC |
542 | modifiers , (ControlActionUPP ) -1 ) ; |
543 | result = noErr ; | |
544 | } | |
545 | } | |
facd6764 SC |
546 | if ( cEvent.GetKind() == kEventMouseUp && wxTheApp->s_captureWindow ) |
547 | { | |
548 | wxTheApp->s_captureWindow = NULL ; | |
549 | // update cursor ? | |
550 | } | |
551 | } // else if ( currentMouseWindow ) | |
552 | return result ; | |
851b3a88 | 553 | } |
facd6764 SC |
554 | |
555 | static pascal OSStatus wxMacTopLevelWindowEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) | |
851b3a88 SC |
556 | { |
557 | OSStatus result = eventNotHandledErr ; | |
851b3a88 | 558 | |
facd6764 SC |
559 | wxMacCarbonEvent cEvent( event ) ; |
560 | ||
561 | // WindowRef windowRef = cEvent.GetParameter<WindowRef>(kEventParamDirectObject) ; | |
e40298d5 | 562 | wxTopLevelWindowMac* toplevelWindow = (wxTopLevelWindowMac*) data ; |
1542ea39 | 563 | |
e40298d5 JS |
564 | switch( GetEventKind( event ) ) |
565 | { | |
e40298d5 | 566 | case kEventWindowActivated : |
facd6764 SC |
567 | { |
568 | toplevelWindow->MacActivate( cEvent.GetTicks() , true) ; | |
facd6764 SC |
569 | wxActivateEvent wxevent(wxEVT_ACTIVATE, true , toplevelWindow->GetId()); |
570 | wxevent.SetTimestamp( cEvent.GetTicks() ) ; | |
571 | wxevent.SetEventObject(toplevelWindow); | |
572 | toplevelWindow->GetEventHandler()->ProcessEvent(wxevent); | |
73fe67bd | 573 | // we still sending an eventNotHandledErr in order to allow for default processing |
e40298d5 | 574 | break ; |
facd6764 | 575 | } |
e40298d5 | 576 | case kEventWindowDeactivated : |
facd6764 SC |
577 | { |
578 | toplevelWindow->MacActivate(cEvent.GetTicks() , false) ; | |
579 | wxActivateEvent wxevent(wxEVT_ACTIVATE, false , toplevelWindow->GetId()); | |
580 | wxevent.SetTimestamp( cEvent.GetTicks() ) ; | |
581 | wxevent.SetEventObject(toplevelWindow); | |
582 | toplevelWindow->GetEventHandler()->ProcessEvent(wxevent); | |
73fe67bd | 583 | // we still sending an eventNotHandledErr in order to allow for default processing |
e40298d5 | 584 | break ; |
facd6764 | 585 | } |
16a76184 SC |
586 | case kEventWindowShown : |
587 | toplevelWindow->Refresh() ; | |
588 | result = noErr ; | |
589 | break ; | |
e40298d5 JS |
590 | case kEventWindowClose : |
591 | toplevelWindow->Close() ; | |
592 | result = noErr ; | |
593 | break ; | |
594 | case kEventWindowBoundsChanged : | |
facd6764 SC |
595 | { |
596 | UInt32 attributes = cEvent.GetParameter<UInt32>(kEventParamAttributes,typeUInt32) ; | |
597 | Rect newRect = cEvent.GetParameter<Rect>(kEventParamCurrentBounds) ; | |
598 | wxRect r( newRect.left , newRect.top , newRect.right - newRect.left , newRect.bottom - newRect.top ) ; | |
599 | if ( attributes & kWindowBoundsChangeSizeChanged ) | |
e40298d5 | 600 | { |
facd6764 SC |
601 | // according to the other ports we handle this within the OS level |
602 | // resize event, not within a wxSizeEvent | |
603 | wxFrame *frame = wxDynamicCast( toplevelWindow , wxFrame ) ; | |
604 | if ( frame ) | |
605 | { | |
606 | #if wxUSE_STATUSBAR | |
607 | frame->PositionStatusBar(); | |
608 | #endif | |
609 | #if wxUSE_TOOLBAR | |
610 | frame->PositionToolBar(); | |
611 | #endif | |
612 | } | |
1542ea39 | 613 | |
facd6764 SC |
614 | wxSizeEvent event( r.GetSize() , toplevelWindow->GetId() ) ; |
615 | event.SetEventObject( toplevelWindow ) ; | |
851b3a88 | 616 | |
facd6764 | 617 | toplevelWindow->GetEventHandler()->ProcessEvent(event) ; |
e40298d5 | 618 | } |
facd6764 SC |
619 | if ( attributes & kWindowBoundsChangeOriginChanged ) |
620 | { | |
621 | wxMoveEvent event( r.GetLeftTop() , toplevelWindow->GetId() ) ; | |
622 | event.SetEventObject( toplevelWindow ) ; | |
623 | toplevelWindow->GetEventHandler()->ProcessEvent(event) ; | |
624 | } | |
625 | result = noErr ; | |
e40298d5 | 626 | break ; |
facd6764 | 627 | } |
f81bfef9 | 628 | case kEventWindowBoundsChanging : |
facd6764 SC |
629 | { |
630 | UInt32 attributes = cEvent.GetParameter<UInt32>(kEventParamAttributes,typeUInt32) ; | |
631 | Rect newRect = cEvent.GetParameter<Rect>(kEventParamCurrentBounds) ; | |
83901ec2 | 632 | |
facd6764 SC |
633 | if ( (attributes & kWindowBoundsChangeSizeChanged) || (attributes & kWindowBoundsChangeOriginChanged) ) |
634 | { | |
29281095 SC |
635 | // all (Mac) rects are in content area coordinates, all wxRects in structure coordinates |
636 | int left , top , right , bottom ; | |
637 | toplevelWindow->MacGetContentAreaInset( left , top , right , bottom ) ; | |
638 | wxRect r( newRect.left - left , newRect.top - top , | |
639 | newRect.right - newRect.left + left + right , newRect.bottom - newRect.top + top + bottom ) ; | |
facd6764 SC |
640 | // this is a EVT_SIZING not a EVT_SIZE type ! |
641 | wxSizeEvent wxevent( r , toplevelWindow->GetId() ) ; | |
642 | wxevent.SetEventObject( toplevelWindow ) ; | |
643 | wxRect adjustR = r ; | |
644 | if ( toplevelWindow->GetEventHandler()->ProcessEvent(wxevent) ) | |
facd6764 | 645 | adjustR = wxevent.GetRect() ; |
29281095 | 646 | |
facd6764 SC |
647 | if ( toplevelWindow->GetMaxWidth() != -1 && adjustR.GetWidth() > toplevelWindow->GetMaxWidth() ) |
648 | adjustR.SetWidth( toplevelWindow->GetMaxWidth() ) ; | |
2c25bd55 | 649 | if ( toplevelWindow->GetMaxHeight() != -1 && adjustR.GetHeight() > toplevelWindow->GetMaxHeight() ) |
facd6764 SC |
650 | adjustR.SetHeight( toplevelWindow->GetMaxHeight() ) ; |
651 | if ( toplevelWindow->GetMinWidth() != -1 && adjustR.GetWidth() < toplevelWindow->GetMinWidth() ) | |
652 | adjustR.SetWidth( toplevelWindow->GetMinWidth() ) ; | |
2c25bd55 | 653 | if ( toplevelWindow->GetMinHeight() != -1 && adjustR.GetHeight() < toplevelWindow->GetMinHeight() ) |
facd6764 | 654 | adjustR.SetHeight( toplevelWindow->GetMinHeight() ) ; |
4a5f2351 | 655 | const Rect adjustedRect = { adjustR.y + top , adjustR.x + left , adjustR.y + adjustR.height - bottom , adjustR.x + adjustR.width - right } ; |
facd6764 | 656 | if ( !EqualRect( &newRect , &adjustedRect ) ) |
1f919f38 | 657 | cEvent.SetParameter<Rect>( kEventParamCurrentBounds , &adjustedRect ) ; |
f81bfef9 | 658 | } |
facd6764 SC |
659 | |
660 | result = noErr ; | |
f81bfef9 | 661 | break ; |
facd6764 | 662 | } |
e40298d5 JS |
663 | default : |
664 | break ; | |
665 | } | |
666 | return result ; | |
851b3a88 SC |
667 | } |
668 | ||
facd6764 | 669 | pascal OSStatus wxMacTopLevelEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) |
851b3a88 SC |
670 | { |
671 | OSStatus result = eventNotHandledErr ; | |
672 | ||
673 | switch ( GetEventClass( event ) ) | |
674 | { | |
c5c9378c | 675 | case kEventClassKeyboard : |
e40298d5 | 676 | result = KeyboardEventHandler( handler, event , data ) ; |
c5c9378c | 677 | break ; |
851b3a88 | 678 | case kEventClassTextInput : |
e40298d5 | 679 | result = TextInputEventHandler( handler, event , data ) ; |
851b3a88 SC |
680 | break ; |
681 | case kEventClassWindow : | |
facd6764 | 682 | result = wxMacTopLevelWindowEventHandler( handler, event , data ) ; |
e40298d5 | 683 | break ; |
851b3a88 | 684 | case kEventClassMouse : |
facd6764 | 685 | result = wxMacTopLevelMouseEventHandler( handler, event , data ) ; |
e40298d5 | 686 | break ; |
851b3a88 SC |
687 | default : |
688 | break ; | |
689 | } | |
690 | return result ; | |
691 | } | |
692 | ||
facd6764 | 693 | DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacTopLevelEventHandler ) |
851b3a88 | 694 | |
5f0b2f22 SC |
695 | // --------------------------------------------------------------------------- |
696 | // wxWindowMac utility functions | |
697 | // --------------------------------------------------------------------------- | |
698 | ||
699 | // Find an item given the Macintosh Window Reference | |
700 | ||
facd6764 SC |
701 | wxList wxWinMacWindowList(wxKEY_INTEGER); |
702 | wxTopLevelWindowMac *wxFindWinFromMacWindow(WindowRef inWindowRef) | |
5f0b2f22 | 703 | { |
facd6764 | 704 | wxNode *node = wxWinMacWindowList.Find((long)inWindowRef); |
5f0b2f22 SC |
705 | if (!node) |
706 | return NULL; | |
eb22f2a6 | 707 | return (wxTopLevelWindowMac *)node->GetData(); |
5f0b2f22 SC |
708 | } |
709 | ||
facd6764 SC |
710 | void wxAssociateWinWithMacWindow(WindowRef inWindowRef, wxTopLevelWindowMac *win) ; |
711 | void wxAssociateWinWithMacWindow(WindowRef inWindowRef, wxTopLevelWindowMac *win) | |
5f0b2f22 SC |
712 | { |
713 | // adding NULL WindowRef is (first) surely a result of an error and | |
714 | // (secondly) breaks menu command processing | |
427ff662 | 715 | wxCHECK_RET( inWindowRef != (WindowRef) NULL, wxT("attempt to add a NULL WindowRef to window list") ); |
5f0b2f22 | 716 | |
facd6764 SC |
717 | if ( !wxWinMacWindowList.Find((long)inWindowRef) ) |
718 | wxWinMacWindowList.Append((long)inWindowRef, win); | |
5f0b2f22 SC |
719 | } |
720 | ||
facd6764 | 721 | void wxRemoveMacWindowAssociation(wxTopLevelWindowMac *win) ; |
5f0b2f22 SC |
722 | void wxRemoveMacWindowAssociation(wxTopLevelWindowMac *win) |
723 | { | |
facd6764 | 724 | wxWinMacWindowList.DeleteObject(win); |
5f0b2f22 SC |
725 | } |
726 | ||
727 | ||
a15eb0a5 SC |
728 | // ---------------------------------------------------------------------------- |
729 | // wxTopLevelWindowMac creation | |
730 | // ---------------------------------------------------------------------------- | |
731 | ||
245f3581 | 732 | wxTopLevelWindowMac *wxTopLevelWindowMac::s_macDeactivateWindow = NULL; |
5f0b2f22 | 733 | |
a15eb0a5 SC |
734 | void wxTopLevelWindowMac::Init() |
735 | { | |
736 | m_iconized = | |
737 | m_maximizeOnShow = FALSE; | |
6a17ca35 | 738 | m_macWindow = NULL ; |
facd6764 SC |
739 | #if TARGET_API_MAC_OSX |
740 | m_macUsesCompositing = TRUE; | |
741 | #else | |
742 | m_macUsesCompositing = FALSE; | |
743 | #endif | |
7c091673 | 744 | m_macEventHandler = NULL ; |
a15eb0a5 SC |
745 | } |
746 | ||
118f012e SC |
747 | class wxMacDeferredWindowDeleter : public wxObject |
748 | { | |
749 | public : | |
1542ea39 RD |
750 | wxMacDeferredWindowDeleter( WindowRef windowRef ) |
751 | { | |
752 | m_macWindow = windowRef ; | |
118f012e | 753 | } |
1542ea39 RD |
754 | virtual ~wxMacDeferredWindowDeleter() |
755 | { | |
756 | UMADisposeWindow( (WindowRef) m_macWindow ) ; | |
118f012e SC |
757 | } |
758 | protected : | |
759 | WindowRef m_macWindow ; | |
760 | } ; | |
761 | ||
a15eb0a5 SC |
762 | bool wxTopLevelWindowMac::Create(wxWindow *parent, |
763 | wxWindowID id, | |
764 | const wxString& title, | |
765 | const wxPoint& pos, | |
766 | const wxSize& size, | |
767 | long style, | |
768 | const wxString& name) | |
769 | { | |
770 | // init our fields | |
771 | Init(); | |
772 | ||
773 | m_windowStyle = style; | |
774 | ||
775 | SetName(name); | |
776 | ||
777 | m_windowId = id == -1 ? NewControlId() : id; | |
778 | ||
facd6764 SC |
779 | MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ; |
780 | ||
94d1d0f4 SC |
781 | SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); |
782 | ||
a15eb0a5 SC |
783 | wxTopLevelWindows.Append(this); |
784 | ||
785 | if ( parent ) | |
786 | parent->AddChild(this); | |
787 | ||
788 | return TRUE; | |
789 | } | |
790 | ||
791 | wxTopLevelWindowMac::~wxTopLevelWindowMac() | |
792 | { | |
6a17ca35 SC |
793 | if ( m_macWindow ) |
794 | { | |
795 | wxToolTip::NotifyWindowDelete(m_macWindow) ; | |
118f012e | 796 | wxPendingDelete.Append( new wxMacDeferredWindowDeleter( (WindowRef) m_macWindow ) ) ; |
6a17ca35 | 797 | } |
1542ea39 | 798 | |
7c091673 SC |
799 | if ( m_macEventHandler ) |
800 | { | |
801 | ::RemoveEventHandler((EventHandlerRef) m_macEventHandler); | |
802 | m_macEventHandler = NULL ; | |
803 | } | |
851b3a88 | 804 | |
5f0b2f22 SC |
805 | wxRemoveMacWindowAssociation( this ) ; |
806 | ||
a15eb0a5 SC |
807 | if ( wxModelessWindows.Find(this) ) |
808 | wxModelessWindows.DeleteObject(this); | |
a15eb0a5 SC |
809 | } |
810 | ||
811 | ||
812 | // ---------------------------------------------------------------------------- | |
813 | // wxTopLevelWindowMac maximize/minimize | |
814 | // ---------------------------------------------------------------------------- | |
815 | ||
816 | void wxTopLevelWindowMac::Maximize(bool maximize) | |
817 | { | |
1f90939c SC |
818 | wxMacPortStateHelper help( (GrafPtr) GetWindowPort( (WindowRef) m_macWindow) ) ; |
819 | wxMacWindowClipper clip (this); | |
b7aec135 | 820 | ZoomWindow( (WindowRef)m_macWindow , maximize ? inZoomOut : inZoomIn , false ) ; |
a15eb0a5 SC |
821 | } |
822 | ||
823 | bool wxTopLevelWindowMac::IsMaximized() const | |
824 | { | |
b7aec135 | 825 | return IsWindowInStandardState( (WindowRef)m_macWindow , NULL , NULL ) ; |
a15eb0a5 SC |
826 | } |
827 | ||
828 | void wxTopLevelWindowMac::Iconize(bool iconize) | |
829 | { | |
b7aec135 SC |
830 | if ( IsWindowCollapsable((WindowRef)m_macWindow) ) |
831 | CollapseWindow((WindowRef)m_macWindow , iconize ) ; | |
a15eb0a5 SC |
832 | } |
833 | ||
834 | bool wxTopLevelWindowMac::IsIconized() const | |
835 | { | |
b7aec135 | 836 | return IsWindowCollapsed((WindowRef)m_macWindow ) ; |
a15eb0a5 SC |
837 | } |
838 | ||
839 | void wxTopLevelWindowMac::Restore() | |
840 | { | |
841 | // not available on mac | |
842 | } | |
843 | ||
844 | // ---------------------------------------------------------------------------- | |
845 | // wxTopLevelWindowMac misc | |
846 | // ---------------------------------------------------------------------------- | |
847 | ||
facd6764 SC |
848 | wxPoint wxTopLevelWindowMac::GetClientAreaOrigin() const |
849 | { | |
850 | return wxPoint(0,0) ; | |
851 | } | |
852 | ||
a15eb0a5 SC |
853 | void wxTopLevelWindowMac::SetIcon(const wxIcon& icon) |
854 | { | |
855 | // this sets m_icon | |
856 | wxTopLevelWindowBase::SetIcon(icon); | |
857 | } | |
5f0b2f22 | 858 | |
facd6764 SC |
859 | void wxTopLevelWindowMac::MacSetBackgroundBrush( const wxBrush &brush ) |
860 | { | |
861 | wxTopLevelWindowBase::MacSetBackgroundBrush( brush ) ; | |
862 | ||
863 | if ( m_macBackgroundBrush.Ok() && m_macBackgroundBrush.GetStyle() != wxTRANSPARENT && m_macBackgroundBrush.MacGetBrushKind() == kwxMacBrushTheme ) | |
864 | { | |
865 | SetThemeWindowBackground( (WindowRef) m_macWindow , m_macBackgroundBrush.MacGetTheme() , false ) ; | |
866 | } | |
867 | } | |
868 | ||
949cb163 SC |
869 | void wxTopLevelWindowMac::MacInstallTopLevelWindowEventHandler() |
870 | { | |
871 | if ( m_macEventHandler != NULL ) | |
872 | { | |
873 | verify_noerr( ::RemoveEventHandler( (EventHandlerRef) m_macEventHandler ) ) ; | |
874 | } | |
875 | InstallWindowEventHandler(MAC_WXHWND(m_macWindow), GetwxMacTopLevelEventHandlerUPP(), | |
876 | GetEventTypeCount(eventList), eventList, this, (EventHandlerRef *)&m_macEventHandler); | |
877 | } | |
878 | ||
5f0b2f22 SC |
879 | void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title, |
880 | const wxPoint& pos, | |
881 | const wxSize& size, | |
882 | long style, | |
1542ea39 | 883 | const wxString& name ) |
5f0b2f22 | 884 | { |
47ac4f9b | 885 | OSStatus err = noErr ; |
e40298d5 JS |
886 | SetName(name); |
887 | m_windowStyle = style; | |
888 | m_isShown = FALSE; | |
1542ea39 | 889 | |
e40298d5 | 890 | // create frame. |
1542ea39 | 891 | |
5f0b2f22 | 892 | Rect theBoundsRect; |
1542ea39 | 893 | |
facd6764 SC |
894 | int x = (int)pos.x; |
895 | int y = (int)pos.y; | |
896 | if ( y < 50 ) | |
897 | y = 50 ; | |
898 | if ( x < 20 ) | |
899 | x = 20 ; | |
1542ea39 | 900 | |
facd6764 SC |
901 | int w = WidthDefault(size.x); |
902 | int h = HeightDefault(size.y); | |
1542ea39 | 903 | |
facd6764 | 904 | ::SetRect(&theBoundsRect, x, y , x + w, y + h); |
1542ea39 | 905 | |
5f0b2f22 | 906 | // translate the window attributes in the appropriate window class and attributes |
1542ea39 | 907 | |
5f0b2f22 SC |
908 | WindowClass wclass = 0; |
909 | WindowAttributes attr = kWindowNoAttributes ; | |
1542ea39 | 910 | |
f5744893 | 911 | if ( HasFlag( wxFRAME_TOOL_WINDOW) ) |
5f0b2f22 | 912 | { |
1542ea39 | 913 | if ( |
f5744893 SC |
914 | HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) || |
915 | HasFlag( wxSYSTEM_MENU ) || HasFlag( wxCAPTION ) || | |
916 | HasFlag(wxTINY_CAPTION_HORIZ) || HasFlag(wxTINY_CAPTION_VERT) | |
e40298d5 | 917 | ) |
5f0b2f22 | 918 | { |
f5744893 SC |
919 | wclass = kFloatingWindowClass ; |
920 | if ( HasFlag(wxTINY_CAPTION_VERT) ) | |
921 | { | |
922 | attr |= kWindowSideTitlebarAttribute ; | |
923 | } | |
924 | } | |
925 | else | |
926 | { | |
927 | wclass = kPlainWindowClass ; | |
5f0b2f22 SC |
928 | } |
929 | } | |
930 | else if ( HasFlag( wxCAPTION ) ) | |
931 | { | |
1542ea39 | 932 | wclass = kDocumentWindowClass ; |
5f0b2f22 SC |
933 | } |
934 | else | |
935 | { | |
f5744893 | 936 | if ( HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) || |
47ac4f9b | 937 | HasFlag( wxCLOSE_BOX ) || HasFlag( wxSYSTEM_MENU ) ) |
f5744893 SC |
938 | { |
939 | wclass = kDocumentWindowClass ; | |
940 | } | |
941 | else | |
942 | { | |
943 | wclass = kPlainWindowClass ; | |
944 | } | |
5f0b2f22 | 945 | } |
1542ea39 | 946 | |
47ac4f9b | 947 | if ( HasFlag( wxMINIMIZE_BOX ) ) |
5f0b2f22 | 948 | { |
5f0b2f22 SC |
949 | attr |= kWindowCollapseBoxAttribute ; |
950 | } | |
47ac4f9b SC |
951 | if ( HasFlag( wxMAXIMIZE_BOX ) ) |
952 | { | |
953 | attr |= kWindowFullZoomAttribute ; | |
954 | } | |
5f0b2f22 SC |
955 | if ( HasFlag( wxRESIZE_BORDER ) ) |
956 | { | |
957 | attr |= kWindowResizableAttribute ; | |
958 | } | |
47ac4f9b | 959 | if ( HasFlag( wxCLOSE_BOX) ) |
5f0b2f22 SC |
960 | { |
961 | attr |= kWindowCloseBoxAttribute ; | |
962 | } | |
1542ea39 | 963 | |
eb630bf1 DS |
964 | if (UMAGetSystemVersion() >= 0x1000) |
965 | { | |
facd6764 | 966 | // turn on live resizing (OS X only) |
eb630bf1 DS |
967 | attr |= kWindowLiveResizeAttribute; |
968 | } | |
969 | ||
6a7e6411 | 970 | if (HasFlag(wxSTAY_ON_TOP)) |
eb630bf1 | 971 | wclass = kUtilityWindowClass; |
6a7e6411 | 972 | |
facd6764 SC |
973 | #if TARGET_API_MAC_OSX |
974 | attr |= kWindowCompositingAttribute; | |
d66c3960 | 975 | #endif |
1f90939c | 976 | |
6a7e6411 RD |
977 | if ( HasFlag(wxFRAME_SHAPED) ) |
978 | { | |
979 | WindowDefSpec customWindowDefSpec; | |
980 | customWindowDefSpec.defType = kWindowDefProcPtr; | |
981 | customWindowDefSpec.u.defProc = NewWindowDefUPP(wxShapedMacWindowDef); | |
982 | ||
47ac4f9b | 983 | err = ::CreateCustomWindow( &customWindowDefSpec, wclass, |
6a7e6411 RD |
984 | attr, &theBoundsRect, |
985 | (WindowRef*) &m_macWindow); | |
986 | } | |
987 | else | |
988 | { | |
47ac4f9b | 989 | err = ::CreateNewWindow( wclass , attr , &theBoundsRect , (WindowRef*)&m_macWindow ) ; |
6a7e6411 RD |
990 | } |
991 | ||
47ac4f9b | 992 | wxCHECK_RET( err == noErr, wxT("Mac OS error when trying to create new window") ); |
f83b6761 SC |
993 | |
994 | // the create commands are only for content rect, so we have to set the size again as | |
995 | // structure bounds | |
996 | SetWindowBounds( (WindowRef) m_macWindow , kWindowStructureRgn , &theBoundsRect ) ; | |
997 | ||
facd6764 SC |
998 | wxAssociateWinWithMacWindow( (WindowRef) m_macWindow , this ) ; |
999 | UMASetWTitle( (WindowRef) m_macWindow , title , m_font.GetEncoding() ) ; | |
21fd5529 | 1000 | m_peer = new wxMacControl() ; |
3a9dc061 SC |
1001 | #if TARGET_API_MAC_OSX |
1002 | // There is a bug in 10.2.X for ::GetRootControl returning the window view instead of | |
1003 | // the content view, so we have to retrieve it explicitely | |
1004 | HIViewFindByID( HIViewGetRoot( (WindowRef) m_macWindow ) , kHIViewWindowContentID , | |
5ca0d812 | 1005 | m_peer->GetControlRefAddr() ) ; |
f57d9215 SC |
1006 | if ( !m_peer->Ok() ) |
1007 | { | |
1008 | // compatibility mode fallback | |
5ca0d812 | 1009 | GetRootControl( (WindowRef) m_macWindow , m_peer->GetControlRefAddr() ) ; |
f57d9215 | 1010 | } |
3a9dc061 | 1011 | #else |
5ca0d812 | 1012 | ::CreateRootControl( (WindowRef)m_macWindow , m_peer->GetControlRefAddr() ) ; |
3a9dc061 | 1013 | #endif |
73fe67bd | 1014 | // the root control level handleer |
5ca0d812 | 1015 | MacInstallEventHandler( (WXWidget) m_peer->GetControlRef() ) ; |
facd6764 | 1016 | |
73fe67bd | 1017 | // the frame window event handler |
e40298d5 | 1018 | InstallStandardEventHandler( GetWindowEventTarget(MAC_WXHWND(m_macWindow)) ) ; |
949cb163 | 1019 | MacInstallTopLevelWindowEventHandler() ; |
b19bf058 | 1020 | |
facd6764 | 1021 | m_macFocus = NULL ; |
6a7e6411 RD |
1022 | |
1023 | if ( HasFlag(wxFRAME_SHAPED) ) | |
1024 | { | |
1025 | // default shape matches the window size | |
facd6764 | 1026 | wxRegion rgn(0, 0, w, h); |
6a7e6411 RD |
1027 | SetShape(rgn); |
1028 | } | |
3dfafdb9 RD |
1029 | |
1030 | wxWindowCreateEvent event(this); | |
1031 | GetEventHandler()->ProcessEvent(event); | |
5f0b2f22 SC |
1032 | } |
1033 | ||
5d2e69e8 | 1034 | void wxTopLevelWindowMac::ClearBackground() |
5f0b2f22 | 1035 | { |
5d2e69e8 | 1036 | wxWindow::ClearBackground() ; |
5f0b2f22 SC |
1037 | } |
1038 | ||
5f0b2f22 SC |
1039 | // Raise the window to the top of the Z order |
1040 | void wxTopLevelWindowMac::Raise() | |
1041 | { | |
7f3c339c | 1042 | ::SelectWindow( (WindowRef)m_macWindow ) ; |
5f0b2f22 SC |
1043 | } |
1044 | ||
1045 | // Lower the window to the bottom of the Z order | |
1046 | void wxTopLevelWindowMac::Lower() | |
1047 | { | |
76a5e5d2 | 1048 | ::SendBehind( (WindowRef)m_macWindow , NULL ) ; |
5f0b2f22 SC |
1049 | } |
1050 | ||
851b3a88 | 1051 | |
245f3581 DE |
1052 | void wxTopLevelWindowMac::MacDelayedDeactivation(long timestamp) |
1053 | { | |
1054 | if(s_macDeactivateWindow) | |
1055 | { | |
365796b1 | 1056 | wxLogDebug(wxT("Doing delayed deactivation of %p"),s_macDeactivateWindow); |
245f3581 DE |
1057 | s_macDeactivateWindow->MacActivate(timestamp, false); |
1058 | } | |
1059 | } | |
1060 | ||
851b3a88 | 1061 | void wxTopLevelWindowMac::MacActivate( long timestamp , bool inIsActivating ) |
5f0b2f22 | 1062 | { |
17f8d2a7 VZ |
1063 | // wxLogDebug(wxT("TopLevel=%p::MacActivate"),this); |
1064 | ||
245f3581 DE |
1065 | if(s_macDeactivateWindow==this) |
1066 | s_macDeactivateWindow=NULL; | |
1067 | MacDelayedDeactivation(timestamp); | |
8ab50549 | 1068 | MacPropagateHiliteChanged() ; |
5f0b2f22 SC |
1069 | } |
1070 | ||
1071 | void wxTopLevelWindowMac::SetTitle(const wxString& title) | |
1072 | { | |
1073 | wxWindow::SetTitle( title ) ; | |
16a76184 | 1074 | UMASetWTitle( (WindowRef)m_macWindow , title , m_font.GetEncoding() ) ; |
5f0b2f22 SC |
1075 | } |
1076 | ||
1077 | bool wxTopLevelWindowMac::Show(bool show) | |
1078 | { | |
facd6764 | 1079 | if ( !wxTopLevelWindowBase::Show(show) ) |
5f0b2f22 SC |
1080 | return FALSE; |
1081 | ||
1082 | if (show) | |
1542ea39 | 1083 | { |
1f90939c SC |
1084 | #if wxUSE_SYSTEM_OPTIONS //code contributed by Ryan Wilcox December 18, 2003 |
1085 | if ( (wxSystemOptions::HasOption(wxMAC_WINDOW_PLAIN_TRANSITION) ) && ( wxSystemOptions::GetOptionInt( wxMAC_WINDOW_PLAIN_TRANSITION ) == 1) ) | |
1086 | { | |
1087 | ::ShowWindow( (WindowRef)m_macWindow ); | |
1088 | } | |
1089 | else | |
1090 | #endif | |
1091 | { | |
1092 | ::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowShowTransitionAction,nil); | |
1093 | } | |
1094 | ::SelectWindow( (WindowRef)m_macWindow ) ; | |
facd6764 SC |
1095 | // as apps expect a size event to occur at this moment |
1096 | wxSizeEvent event( GetSize() , m_windowId); | |
1f90939c SC |
1097 | event.SetEventObject(this); |
1098 | GetEventHandler()->ProcessEvent(event); | |
5f0b2f22 SC |
1099 | } |
1100 | else | |
1101 | { | |
1f90939c SC |
1102 | #if wxUSE_SYSTEM_OPTIONS |
1103 | if ( (wxSystemOptions::HasOption(wxMAC_WINDOW_PLAIN_TRANSITION) ) && ( wxSystemOptions::GetOptionInt( wxMAC_WINDOW_PLAIN_TRANSITION ) == 1) ) | |
1104 | { | |
1105 | ::HideWindow((WindowRef) m_macWindow ); | |
1106 | } | |
1107 | else | |
1108 | #endif | |
1109 | { | |
1110 | ::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowHideTransitionAction,nil); | |
1111 | } | |
5f0b2f22 SC |
1112 | } |
1113 | ||
facd6764 | 1114 | MacPropagateVisibilityChanged() ; |
5f0b2f22 | 1115 | |
facd6764 | 1116 | return TRUE ; |
5f0b2f22 SC |
1117 | } |
1118 | ||
facd6764 SC |
1119 | // we are still using coordinates of the content view, todo switch to structure bounds |
1120 | ||
29281095 SC |
1121 | void wxTopLevelWindowMac::MacGetContentAreaInset( int &left , int &top , int &right , int &bottom ) |
1122 | { | |
1123 | Rect content ; | |
1124 | Rect structure ; | |
1125 | GetWindowBounds( (WindowRef) m_macWindow, kWindowStructureRgn , &structure ) ; | |
1126 | GetWindowBounds( (WindowRef) m_macWindow, kWindowContentRgn , &content ) ; | |
1127 | ||
1128 | left = content.left - structure.left ; | |
1129 | top = content.top - structure.top ; | |
1130 | right = structure.right - content.right ; | |
1131 | bottom = structure.bottom - content.bottom ; | |
1132 | } | |
1133 | ||
5f0b2f22 SC |
1134 | void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height) |
1135 | { | |
facd6764 SC |
1136 | Rect bounds = { y , x , y + height , x + width } ; |
1137 | verify_noerr(SetWindowBounds( (WindowRef) m_macWindow, kWindowStructureRgn , &bounds )) ; | |
5f0b2f22 SC |
1138 | } |
1139 | ||
facd6764 | 1140 | void wxTopLevelWindowMac::DoGetPosition( int *x, int *y ) const |
5f0b2f22 | 1141 | { |
facd6764 SC |
1142 | Rect bounds ; |
1143 | verify_noerr(GetWindowBounds((WindowRef) m_macWindow, kWindowStructureRgn , &bounds )) ; | |
1144 | if(x) *x = bounds.left ; | |
1145 | if(y) *y = bounds.top ; | |
1146 | } | |
1147 | void wxTopLevelWindowMac::DoGetSize( int *width, int *height ) const | |
1148 | { | |
1149 | Rect bounds ; | |
1150 | verify_noerr(GetWindowBounds((WindowRef) m_macWindow, kWindowStructureRgn , &bounds )) ; | |
1151 | if(width) *width = bounds.right - bounds.left ; | |
1152 | if(height) *height = bounds.bottom - bounds.top ; | |
1153 | } | |
1542ea39 | 1154 | |
facd6764 SC |
1155 | void wxTopLevelWindowMac::DoGetClientSize( int *width, int *height ) const |
1156 | { | |
1157 | Rect bounds ; | |
1158 | verify_noerr(GetWindowBounds((WindowRef) m_macWindow, kWindowContentRgn , &bounds )) ; | |
1159 | if(width) *width = bounds.right - bounds.left ; | |
1160 | if(height) *height = bounds.bottom - bounds.top ; | |
1161 | } | |
1542ea39 | 1162 | |
facd6764 SC |
1163 | void wxTopLevelWindowMac::MacSetMetalAppearance( bool set ) |
1164 | { | |
1165 | #if TARGET_API_MAC_OSX | |
1166 | UInt32 attr = 0 ; | |
1167 | GetWindowAttributes((WindowRef) m_macWindow , &attr ) ; | |
1168 | wxASSERT_MSG( attr & kWindowCompositingAttribute , | |
1169 | wxT("Cannot set metal appearance on a non-compositing window") ) ; | |
1170 | ||
1171 | MacChangeWindowAttributes( set ? kWindowMetalAttribute : kWindowNoAttributes , | |
1172 | set ? kWindowNoAttributes : kWindowMetalAttribute ) ; | |
1173 | #endif | |
1174 | } | |
1542ea39 | 1175 | |
6aab345b SC |
1176 | bool wxTopLevelWindowMac::MacGetMetalAppearance() const |
1177 | { | |
1178 | #if TARGET_API_MAC_OSX | |
1179 | return MacGetWindowAttributes() & kWindowMetalAttribute ; | |
1180 | #else | |
1181 | return false ; | |
1182 | #endif | |
1183 | } | |
1184 | ||
facd6764 SC |
1185 | void wxTopLevelWindowMac::MacChangeWindowAttributes( wxUint32 attributesToSet , wxUint32 attributesToClear ) |
1186 | { | |
1187 | ChangeWindowAttributes ( (WindowRef) m_macWindow , attributesToSet, attributesToClear ) ; | |
1188 | } | |
1542ea39 | 1189 | |
facd6764 SC |
1190 | wxUint32 wxTopLevelWindowMac::MacGetWindowAttributes() const |
1191 | { | |
1192 | UInt32 attr = 0 ; | |
1193 | GetWindowAttributes((WindowRef) m_macWindow , &attr ) ; | |
1194 | return attr ; | |
5f0b2f22 | 1195 | } |
a07c1212 | 1196 | |
facd6764 SC |
1197 | // --------------------------------------------------------------------------- |
1198 | // Shape implementation | |
1199 | // --------------------------------------------------------------------------- | |
1200 | ||
6a7e6411 | 1201 | |
1542ea39 RD |
1202 | bool wxTopLevelWindowMac::SetShape(const wxRegion& region) |
1203 | { | |
6a7e6411 RD |
1204 | wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), FALSE, |
1205 | _T("Shaped windows must be created with the wxFRAME_SHAPED style.")); | |
1206 | ||
1207 | // The empty region signifies that the shape should be removed from the | |
1208 | // window. | |
1209 | if ( region.IsEmpty() ) | |
1210 | { | |
1211 | wxSize sz = GetClientSize(); | |
1212 | wxRegion rgn(0, 0, sz.x, sz.y); | |
1213 | return SetShape(rgn); | |
1214 | } | |
1215 | ||
1216 | // Make a copy of the region | |
1217 | RgnHandle shapeRegion = NewRgn(); | |
1218 | CopyRgn( (RgnHandle)region.GetWXHRGN(), shapeRegion ); | |
1219 | ||
1220 | // Dispose of any shape region we may already have | |
1221 | RgnHandle oldRgn = (RgnHandle)GetWRefCon( (WindowRef)MacGetWindowRef() ); | |
1222 | if ( oldRgn ) | |
1223 | DisposeRgn(oldRgn); | |
1224 | ||
1225 | // Save the region so we can use it later | |
1226 | SetWRefCon((WindowRef)MacGetWindowRef(), (SInt32)shapeRegion); | |
1227 | ||
1228 | // Tell the window manager that the window has changed shape | |
1229 | ReshapeCustomWindow((WindowRef)MacGetWindowRef()); | |
1230 | return TRUE; | |
1231 | } | |
1232 | ||
6a7e6411 RD |
1233 | // --------------------------------------------------------------------------- |
1234 | // Support functions for shaped windows, based on Apple's CustomWindow sample at | |
1235 | // http://developer.apple.com/samplecode/Sample_Code/Human_Interface_Toolbox/Mac_OS_High_Level_Toolbox/CustomWindow.htm | |
1236 | // --------------------------------------------------------------------------- | |
1237 | ||
6a7e6411 RD |
1238 | static void wxShapedMacWindowGetPos(WindowRef window, Rect* inRect) |
1239 | { | |
1240 | GetWindowPortBounds(window, inRect); | |
1241 | Point pt = {inRect->left, inRect->top}; | |
d6fd667b | 1242 | QDLocalToGlobalPoint( GetWindowPort(window) , &pt ) ; |
6a7e6411 RD |
1243 | inRect->top = pt.v; |
1244 | inRect->left = pt.h; | |
1245 | inRect->bottom += pt.v; | |
1246 | inRect->right += pt.h; | |
1247 | } | |
1248 | ||
1249 | ||
1250 | static SInt32 wxShapedMacWindowGetFeatures(WindowRef window, SInt32 param) | |
1251 | { | |
1252 | /*------------------------------------------------------ | |
1253 | Define which options your custom window supports. | |
1254 | --------------------------------------------------------*/ | |
1255 | //just enable everything for our demo | |
1256 | *(OptionBits*)param=//kWindowCanGrow| | |
1257 | //kWindowCanZoom| | |
1258 | //kWindowCanCollapse| | |
1259 | //kWindowCanGetWindowRegion| | |
1260 | //kWindowHasTitleBar| | |
1261 | //kWindowSupportsDragHilite| | |
1262 | kWindowCanDrawInCurrentPort| | |
1263 | //kWindowCanMeasureTitle| | |
1264 | kWindowWantsDisposeAtProcessDeath| | |
1265 | kWindowSupportsSetGrowImageRegion| | |
1266 | kWindowDefSupportsColorGrafPort; | |
1267 | return 1; | |
1542ea39 | 1268 | } |
6a7e6411 RD |
1269 | |
1270 | // The content region is left as a rectangle matching the window size, this is | |
1271 | // so the origin in the paint event, and etc. still matches what the | |
1272 | // programmer expects. | |
1273 | static void wxShapedMacWindowContentRegion(WindowRef window, RgnHandle rgn) | |
1274 | { | |
1275 | SetEmptyRgn(rgn); | |
1276 | wxTopLevelWindowMac* win = wxFindWinFromMacWindow(window); | |
1277 | if (win) | |
1278 | { | |
b19bf058 SC |
1279 | Rect r ; |
1280 | wxShapedMacWindowGetPos(window, &r ) ; | |
1281 | RectRgn( rgn , &r ) ; | |
6a7e6411 RD |
1282 | } |
1283 | } | |
1284 | ||
1285 | // The structure region is set to the shape given to the SetShape method. | |
1286 | static void wxShapedMacWindowStructureRegion(WindowRef window, RgnHandle rgn) | |
1287 | { | |
1288 | RgnHandle cachedRegion = (RgnHandle) GetWRefCon(window); | |
1289 | ||
1290 | SetEmptyRgn(rgn); | |
1291 | if (cachedRegion) | |
1292 | { | |
1293 | Rect windowRect; | |
1294 | wxShapedMacWindowGetPos(window, &windowRect); //how big is the window | |
1295 | CopyRgn(cachedRegion, rgn); //make a copy of our cached region | |
1296 | OffsetRgn(rgn, windowRect.left, windowRect.top); // position it over window | |
1297 | //MapRgn(rgn, &mMaskSize, &windowRect); //scale it to our actual window size | |
1298 | } | |
1299 | } | |
1300 | ||
1301 | ||
1302 | ||
1303 | static SInt32 wxShapedMacWindowGetRegion(WindowRef window, SInt32 param) | |
1304 | { | |
1305 | GetWindowRegionPtr rgnRec=(GetWindowRegionPtr)param; | |
1306 | ||
1307 | switch(rgnRec->regionCode) | |
1308 | { | |
1309 | case kWindowStructureRgn: | |
1310 | wxShapedMacWindowStructureRegion(window, rgnRec->winRgn); | |
1311 | break; | |
1312 | case kWindowContentRgn: | |
1313 | wxShapedMacWindowContentRegion(window, rgnRec->winRgn); | |
1314 | break; | |
1315 | default: | |
1316 | SetEmptyRgn(rgnRec->winRgn); | |
1317 | } //switch | |
1318 | ||
1319 | return noErr; | |
1320 | } | |
1321 | ||
1322 | ||
1323 | static SInt32 wxShapedMacWindowHitTest(WindowRef window,SInt32 param) | |
1324 | { | |
1325 | /*------------------------------------------------------ | |
1326 | Determine the region of the window which was hit | |
1327 | --------------------------------------------------------*/ | |
1328 | Point hitPoint; | |
1329 | static RgnHandle tempRgn=nil; | |
1330 | ||
1331 | if(!tempRgn) | |
1332 | tempRgn=NewRgn(); | |
1333 | ||
1334 | SetPt(&hitPoint,LoWord(param),HiWord(param));//get the point clicked | |
1335 | ||
1336 | //Mac OS 8.5 or later | |
1337 | wxShapedMacWindowStructureRegion(window, tempRgn); | |
1338 | if (PtInRgn(hitPoint, tempRgn)) //in window content region? | |
1339 | return wInContent; | |
1340 | ||
1341 | return wNoHit;//no significant area was hit. | |
1342 | } | |
1343 | ||
1344 | ||
1345 | static pascal long wxShapedMacWindowDef(short varCode, WindowRef window, SInt16 message, SInt32 param) | |
1346 | { | |
1347 | switch(message) | |
1348 | { | |
1349 | case kWindowMsgHitTest: | |
1350 | return wxShapedMacWindowHitTest(window,param); | |
1351 | ||
1352 | case kWindowMsgGetFeatures: | |
1353 | return wxShapedMacWindowGetFeatures(window,param); | |
1354 | ||
1355 | // kWindowMsgGetRegion is sent during CreateCustomWindow and ReshapeCustomWindow | |
1356 | case kWindowMsgGetRegion: | |
1357 | return wxShapedMacWindowGetRegion(window,param); | |
1358 | } | |
1359 | ||
1360 | return 0; | |
1361 | } | |
1925be65 | 1362 | |
6a7e6411 | 1363 | // --------------------------------------------------------------------------- |
1925be65 | 1364 |