@interface wxNSView : NSView
{
- wxWidgetImpl* impl;
+ wxWidgetCocoaImpl* impl;
}
- (void)drawRect: (NSRect) rect;
--(void)mouseDown:(NSEvent *)event ;
--(void)rightMouseDown:(NSEvent *)event ;
--(void)otherMouseDown:(NSEvent *)event ;
--(void)mouseUp:(NSEvent *)event ;
--(void)rightMouseUp:(NSEvent *)event ;
--(void)otherMouseUp:(NSEvent *)event ;
--(void)handleMouseEvent:(NSEvent *)event;
+WXCOCOAIMPL_COMMON_MOUSE_INTERFACE
- (void)keyDown:(NSEvent *)event;
- (void)keyUp:(NSEvent *)event;
- (void)flagsChanged:(NSEvent *)event;
- (void)handleKeyEvent:(NSEvent *)event;
-- (void)setImplementation: (wxWidgetImpl *) theImplementation;
-- (wxWidgetImpl*) implementation;
+- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation;
+- (wxWidgetCocoaImpl*) implementation;
- (BOOL) isFlipped;
- (BOOL) becomeFirstResponder;
- (BOOL) resignFirstResponder;
void SetupKeyEvent( wxKeyEvent &wxevent , NSEvent * nsEvent )
{
UInt32 modifiers = [nsEvent modifierFlags] ;
+ int eventType = [nsEvent type];
wxevent.m_shiftDown = modifiers & NSShiftKeyMask;
wxevent.m_controlDown = modifiers & NSControlKeyMask;
wxevent.m_metaDown = modifiers & NSCommandKeyMask;
wxString chars;
- NSString* nschars = [nsEvent characters];
- if ( nschars )
+ if ( eventType != NSFlagsChanged )
{
- wxCFStringRef cfchars((CFStringRef)[nschars retain]);
- chars = cfchars.AsString();
+ NSString* nschars = [nsEvent characters];
+ if ( nschars )
+ {
+ wxCFStringRef cfchars((CFStringRef)[nschars retain]);
+ chars = cfchars.AsString();
+ }
}
int unichar = chars.Length() > 0 ? chars[0] : 0;
wxevent.m_rawFlags = modifiers;
wxevent.SetTimestamp( [nsEvent timestamp] * 1000.0 ) ;
- int eventType = [nsEvent type];
switch (eventType)
{
case NSKeyDown :
}
}
--(void)mouseDown:(NSEvent *)event
-{
- [self handleMouseEvent:event];
-}
-
--(void)rightMouseDown:(NSEvent *)event
-{
- [self handleMouseEvent:event];
-}
-
--(void)otherMouseDown:(NSEvent *)event
-{
- [self handleMouseEvent:event];
-}
-
--(void)mouseUp:(NSEvent *)event
-{
- [self handleMouseEvent:event];
-}
-
--(void)rightMouseUp:(NSEvent *)event
-{
- [self handleMouseEvent:event];
-}
-
--(void)otherMouseUp:(NSEvent *)event
-{
- [self handleMouseEvent:event];
-}
-
--(void)handleMouseEvent:(NSEvent *)event
-{
- NSPoint clickLocation;
- clickLocation = [self convertPoint:[event locationInWindow] fromView:nil];
- wxPoint pt = wxFromNSPoint( self, clickLocation );
- wxMouseEvent wxevent(wxEVT_LEFT_DOWN);
- SetupMouseEvent( wxevent , event ) ;
- wxevent.m_x = pt.x;
- wxevent.m_y = pt.y;
- impl->GetWXPeer()->HandleWindowEvent(wxevent);
-}
+WXCOCOAIMPL_COMMON_MOUSE_IMPLEMENTATION
- (void)keyDown:(NSEvent *)event
{
}
-- (void)setImplementation: (wxWidgetImpl *) theImplementation
+- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
{
impl = theImplementation;
}
-- (wxWidgetImpl*) implementation
+- (wxWidgetCocoaImpl*) implementation
{
return impl;
}
// TODO
}
+void wxWidgetCocoaImpl::InstallEventHandler( WXWidget control )
+{
+}
+
+void wxWidgetCocoaImpl::DoHandleMouseEvent(NSEvent *event)
+{
+ NSPoint clickLocation;
+ clickLocation = [m_osxView convertPoint:[event locationInWindow] fromView:nil];
+ wxPoint pt = wxFromNSPoint( m_osxView, clickLocation );
+ wxMouseEvent wxevent(wxEVT_LEFT_DOWN);
+ SetupMouseEvent( wxevent , event ) ;
+ wxevent.m_x = pt.x;
+ wxevent.m_y = pt.y;
+ GetWXPeer()->HandleWindowEvent(wxevent);
+}
+
+
//
// Factory methods
//