UInt32 keyCode ;
UInt32 modifiers ;
- Point point ;
UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
#if wxUSE_UNICODE
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 && */ wxTheApp->MacSendKeyDownEvent(
- focus , message , modifiers , when , point.h , point.v , uniChar[0] ) )
+ focus , message , modifiers , when , uniChar[0] ) )
{
result = noErr ;
}
case kEventRawKeyUp :
if ( /* focus && */ wxTheApp->MacSendKeyUpEvent(
- focus , message , modifiers , when , point.h , point.v , uniChar[0] ) )
+ focus , message , modifiers , when , uniChar[0] ) )
{
result = noErr ;
}
event.m_rawControlDown = modifiers & controlKey;
event.m_altDown = modifiers & optionKey;
event.m_controlDown = modifiers & cmdKey;
- event.m_x = point.h;
- event.m_y = point.v;
#if wxUSE_UNICODE
event.m_uniChar = uniChar[0] ;
@end
+@interface MyUIDelegate : NSObject
+{
+ wxWebKitCtrl* webKitWindow;
+}
+
+- initWithWxWindow: (wxWebKitCtrl*)inWindow;
+
+@end
+
// ----------------------------------------------------------------------------
// creation/destruction
// ----------------------------------------------------------------------------
MyPolicyDelegate* myPolicyDelegate = [[MyPolicyDelegate alloc] initWithWxWindow: this];
[m_webView setPolicyDelegate:myPolicyDelegate];
+ // this is used to provide printing support for JavaScript
+ MyUIDelegate* myUIDelegate = [[MyUIDelegate alloc] initWithWxWindow: this];
+ [m_webView setUIDelegate:myUIDelegate];
+
LoadURL(m_currentURL);
return true;
}
{
MyFrameLoadMonitor* myFrameLoadMonitor = [m_webView frameLoadDelegate];
MyPolicyDelegate* myPolicyDelegate = [m_webView policyDelegate];
+ MyUIDelegate* myUIDelegate = [m_webView UIDelegate];
[m_webView setFrameLoadDelegate: nil];
[m_webView setPolicyDelegate: nil];
+ [m_webView setUIDelegate: nil];
if (myFrameLoadMonitor)
[myFrameLoadMonitor release];
if (myPolicyDelegate)
[myPolicyDelegate release];
+
+ if (myUIDelegate)
+ [myUIDelegate release];
}
// ----------------------------------------------------------------------------
}
@end
+
+@implementation MyUIDelegate
+
+- initWithWxWindow: (wxWebKitCtrl*)inWindow
+{
+ self = [super init];
+ webKitWindow = inWindow; // non retained
+ return self;
+}
+
+- (void)webView:(WebView *)sender printFrameView:(WebFrameView *)frameView
+{
+ wxUnusedVar(sender);
+ wxUnusedVar(frameView);
+
+ webKitWindow->Print(true);
+}
+@end
+
#endif //wxUSE_WEBKIT