// For embedded use. By default does nothing.
virtual void MacHandleUnhandledEvent( WXEVENTREF ev );
- bool MacSendKeyDownEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey ) ;
- bool MacSendKeyUpEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey ) ;
+ bool MacSendKeyDownEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) ;
+ bool MacSendKeyUpEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) ;
virtual short MacHandleAEODoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
virtual short MacHandleAEPDoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
#endif
-bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey )
+bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey , wxChar uniChar )
{
if ( !focus )
return false ;
event.m_altDown = modifiers & optionKey;
event.m_metaDown = modifiers & cmdKey;
event.m_keyCode = keyval ;
+#if wxUSE_UNICODE
+ event.m_uniChar = uniChar ;
+#endif
event.m_x = wherex;
event.m_y = wherey;
return handled ;
}
-bool wxApp::MacSendKeyUpEvent( wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey )
+bool wxApp::MacSendKeyUpEvent( wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey , wxChar uniChar )
{
if ( !focus )
return false ;
event.m_altDown = modifiers & optionKey;
event.m_metaDown = modifiers & cmdKey;
event.m_keyCode = keyval ;
+#if wxUSE_UNICODE
+ event.m_uniChar = uniChar ;
+#endif
event.m_x = wherex;
event.m_y = wherey;
#include "wx/log.h"
#include "wx/intl.h"
#include "wx/settings.h"
+ #include "wx/strconv.h"
#include "wx/control.h"
#endif //WX_PRECOMP
return result ;
char charCode ;
+ wxChar uniChar = 0 ;
UInt32 keyCode ;
UInt32 modifiers ;
Point point ;
UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
+#if wxUSE_UNICODE
+ UInt32 dataSize = 0 ;
+ if ( GetEventParameter( event, kEventParamKeyUnicodes, typeUnicodeText, NULL, 0 , &dataSize , NULL ) == noErr )
+ {
+ UniChar buf[2] ;
+
+ UniChar* charBuf = buf ;
+
+ if ( dataSize > 4 )
+ charBuf = new UniChar[ dataSize / sizeof( UniChar) ] ;
+ GetEventParameter( event, kEventParamKeyUnicodes, typeUnicodeText, NULL, dataSize , NULL , charBuf ) ;
+#if SIZEOF_WCHAR_T == 2
+ uniChar = charBuf[0] ;
+#else
+ wxMBConvUTF16BE converter ;
+ converter.MB2WC( &uniChar , (const char*)charBuf , 1 ) ;
+#endif
+ if ( dataSize > 4 )
+ delete[] charBuf ;
+ }
+#endif
+
GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
GetEventParameter( event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL,
sizeof( Point ), NULL, &point );
-
+
UInt32 message = (keyCode << 8) + charCode;
switch( GetEventKind( event ) )
{
WXEVENTHANDLERCALLREF formerHandler = wxTheApp->MacGetCurrentEventHandlerCallRef() ;
wxTheApp->MacSetCurrentEvent( event , handler ) ;
if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent(
- focus , message , modifiers , when , point.h , point.v ) )
+ focus , message , modifiers , when , point.h , point.v , uniChar ) )
{
result = noErr ;
}
break ;
case kEventRawKeyUp :
if ( (focus != NULL) && wxTheApp->MacSendKeyUpEvent(
- focus , message , modifiers , when , point.h , point.v ) )
+ focus , message , modifiers , when , point.h , point.v , uniChar ) )
{
result = noErr ;
}
event.m_controlDown = modifiers & controlKey;
event.m_altDown = modifiers & optionKey;
event.m_metaDown = modifiers & cmdKey;
-
+#if wxUSE_UNICODE
+ event.m_uniChar = uniChar ;
+#endif
event.m_x = point.h;
event.m_y = point.v;
event.SetTimestamp(when);