X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ce00f59b5b169752d2f05ce3bb1a88ddc1b38b4c..ec2df34e27ba41f202ecbf096cdfed082a9ddb8f:/src/osx/carbon/window.cpp diff --git a/src/osx/carbon/window.cpp b/src/osx/carbon/window.cpp index 831217ef94..b918d152d8 100644 --- a/src/osx/carbon/window.cpp +++ b/src/osx/carbon/window.cpp @@ -87,6 +87,12 @@ WXWidget wxWidgetImpl::FindFocus() return control; } +// no compositing to take into account under carbon +wxWidgetImpl* wxWidgetImpl::FindBestFromWXWidget(WXWidget control) +{ + return FindFromWXWidget(control); +} + // --------------------------------------------------------------------------- // Carbon Events // --------------------------------------------------------------------------- @@ -585,7 +591,7 @@ wxMacWindowServiceEventHandler(EventHandlerCallRef WXUNUSED(handler), return result ; } -pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) +WXDLLEXPORT pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) { OSStatus result = eventNotHandledErr ; wxWindowMac* focus = (wxWindowMac*) data ; @@ -610,14 +616,9 @@ pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , Even uniChars = new wchar_t[ numChars ] ; GetEventParameter( event, kEventParamTextInputSendText, typeUnicodeText, NULL, dataSize , NULL , charBuf ) ; charBuf[ numChars - 1 ] = 0; -#if SIZEOF_WCHAR_T == 2 - uniChars = (wchar_t*) charBuf ; -/* memcpy( uniChars , charBuf , numChars * 2 ) ;*/ // is there any point in copying charBuf over itself? (in fact, memcpy isn't even guaranteed to work correctly if the source and destination ranges overlap...) -#else // the resulting string will never have more chars than the utf16 version, so this is safe wxMBConvUTF16 converter ; numChars = converter.MB2WC( uniChars , (const char*)charBuf , numChars ) ; -#endif } switch ( GetEventKind( event ) ) @@ -658,8 +659,7 @@ pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , Even I don't have time to look into that right now. -- CL */ - if ( wxTheApp->MacSendCharEvent( - focus , message , 0 , when , 0 , 0 , uniChars[pos] ) ) + if ( wxTheApp->MacSendCharEvent( focus , message , 0 , when , uniChars[pos] ) ) { result = noErr ; } @@ -671,15 +671,13 @@ pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , Even case kEventTextInputUnicodeForKeyEvent : { UInt32 keyCode, modifiers ; - Point point ; EventRef rawEvent ; unsigned char charCode ; GetEventParameter( event, kEventParamTextInputSendKeyboardEvent, typeEventRef, NULL, sizeof(rawEvent), NULL, &rawEvent ) ; - GetEventParameter( rawEvent, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &charCode ); + GetEventParameter( rawEvent, kEventParamKeyMacCharCodes, typeChar, NULL, 1, NULL, &charCode ); GetEventParameter( rawEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode ); GetEventParameter( rawEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers ); - GetEventParameter( rawEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &point ); UInt32 message = (keyCode << 8) + charCode; @@ -691,8 +689,7 @@ pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , Even WXEVENTHANDLERCALLREF formerHandler = wxTheApp->MacGetCurrentEventHandlerCallRef() ; wxTheApp->MacSetCurrentEvent( event , handler ) ; - if ( wxTheApp->MacSendCharEvent( - focus , message , modifiers , when , point.h , point.v , uniChars[pos] ) ) + if ( wxTheApp->MacSendCharEvent( focus , message , modifiers , when , uniChars[pos] ) ) { result = noErr ; } @@ -841,7 +838,7 @@ wxWidgetImplType* wxWidgetImpl::CreateUserPane( wxWindowMac* wxpeer, { OSStatus err = noErr; Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ; - wxMacControl* c = new wxMacControl(wxpeer) ; + wxMacControl* c = new wxMacControl(wxpeer, false, true) ; UInt32 features = 0 | kControlSupportsEmbedding | kControlSupportsLiveFeedback @@ -873,8 +870,8 @@ wxMacControl::wxMacControl() Init(); } -wxMacControl::wxMacControl(wxWindowMac* peer , bool isRootControl ) : - wxWidgetImpl( peer, isRootControl ) +wxMacControl::wxMacControl(wxWindowMac* peer , bool isRootControl, bool isUserPane ) : + wxWidgetImpl( peer, isRootControl, isUserPane ) { Init(); } @@ -1413,7 +1410,15 @@ void wxMacControl::Enable( bool enable ) void wxMacControl::SetDrawingEnabled( bool enable ) { - HIViewSetDrawingEnabled( m_controlRef , enable ); + if ( enable ) + { + HIViewSetDrawingEnabled( m_controlRef , true ); + HIViewSetNeedsDisplay( m_controlRef, true); + } + else + { + HIViewSetDrawingEnabled( m_controlRef , false ); + } } void wxMacControl::GetRectInWindowCoords( Rect *r )