Catch and forward the following mouse related events:

mouseMoved, mouseEntered, mouseExited
mouseDown, mouseDragged, mouseUp
rightMouseDown, rightMouseDragged, rightMouseUp
otherMouseDown, otherMouseDragged, oterMouseUp


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20215 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott
2003-04-14 03:51:59 +00:00
parent b67d3706d9
commit fe802fc2ed
2 changed files with 108 additions and 0 deletions

View File

@@ -30,6 +30,18 @@ protected:
public:
virtual void Cocoa_FrameChanged(void) = 0;
virtual bool Cocoa_drawRect(const NSRect &rect) = 0;
virtual bool Cocoa_mouseDown(WX_NSEvent theEvent) = 0;
virtual bool Cocoa_mouseDragged(WX_NSEvent theEvent) = 0;
virtual bool Cocoa_mouseUp(WX_NSEvent theEvent) = 0;
virtual bool Cocoa_mouseMoved(WX_NSEvent theEvent) = 0;
virtual bool Cocoa_mouseEntered(WX_NSEvent theEvent) = 0;
virtual bool Cocoa_mouseExited(WX_NSEvent theEvent) = 0;
virtual bool Cocoa_rightMouseDown(WX_NSEvent theEvent) = 0;
virtual bool Cocoa_rightMouseDragged(WX_NSEvent theEvent) = 0;
virtual bool Cocoa_rightMouseUp(WX_NSEvent theEvent) = 0;
virtual bool Cocoa_otherMouseDown(WX_NSEvent theEvent) = 0;
virtual bool Cocoa_otherMouseDragged(WX_NSEvent theEvent) = 0;
virtual bool Cocoa_otherMouseUp(WX_NSEvent theEvent) = 0;
};
#endif // _WX_COCOA_NSVIEW_H_

View File

@@ -54,6 +54,18 @@ void wxCocoaNSView::DisassociateNSView(WX_NSView cocoaNSView)
}
- (void)drawRect: (NSRect)rect;
- (void)mouseDown:(NSEvent *)theEvent;
- (void)mouseDragged:(NSEvent *)theEvent;
- (void)mouseUp:(NSEvent *)theEvent;
- (void)mouseMoved:(NSEvent *)theEvent;
- (void)mouseEntered:(NSEvent *)theEvent;
- (void)mouseExited:(NSEvent *)theEvent;
- (void)rightMouseDown:(NSEvent *)theEvent;
- (void)rightMouseDragged:(NSEvent *)theEvent;
- (void)rightMouseUp:(NSEvent *)theEvent;
- (void)otherMouseDown:(NSEvent *)theEvent;
- (void)otherMouseDragged:(NSEvent *)theEvent;
- (void)otherMouseUp:(NSEvent *)theEvent;
@end // wxPoserNSView
WX_IMPLEMENT_POSER(wxPoserNSView);
@@ -66,6 +78,90 @@ WX_IMPLEMENT_POSER(wxPoserNSView);
[super drawRect:rect];
}
- (void)mouseDown:(NSEvent *)theEvent
{
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
if( !win || !win->Cocoa_mouseDown(theEvent) )
[super mouseDown:theEvent];
}
- (void)mouseDragged:(NSEvent *)theEvent
{
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
if( !win || !win->Cocoa_mouseDragged(theEvent) )
[super mouseDragged:theEvent];
}
- (void)mouseUp:(NSEvent *)theEvent
{
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
if( !win || !win->Cocoa_mouseUp(theEvent) )
[super mouseUp:theEvent];
}
- (void)mouseMoved:(NSEvent *)theEvent
{
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
if( !win || !win->Cocoa_mouseMoved(theEvent) )
[super mouseMoved:theEvent];
}
- (void)mouseEntered:(NSEvent *)theEvent
{
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
if( !win || !win->Cocoa_mouseEntered(theEvent) )
[super mouseEntered:theEvent];
}
- (void)mouseExited:(NSEvent *)theEvent
{
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
if( !win || !win->Cocoa_mouseExited(theEvent) )
[super mouseExited:theEvent];
}
- (void)rightMouseDown:(NSEvent *)theEvent
{
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
if( !win || !win->Cocoa_rightMouseDown(theEvent) )
[super rightMouseDown:theEvent];
}
- (void)rightMouseDragged:(NSEvent *)theEvent
{
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
if( !win || !win->Cocoa_rightMouseDragged(theEvent) )
[super rightMouseDragged:theEvent];
}
- (void)rightMouseUp:(NSEvent *)theEvent
{
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
if( !win || !win->Cocoa_rightMouseUp(theEvent) )
[super rightMouseUp:theEvent];
}
- (void)otherMouseDown:(NSEvent *)theEvent
{
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
if( !win || !win->Cocoa_otherMouseDown(theEvent) )
[super otherMouseDown:theEvent];
}
- (void)otherMouseDragged:(NSEvent *)theEvent
{
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
if( !win || !win->Cocoa_otherMouseDragged(theEvent) )
[super otherMouseDragged:theEvent];
}
- (void)otherMouseUp:(NSEvent *)theEvent
{
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
if( !win || !win->Cocoa_otherMouseUp(theEvent) )
[super otherMouseUp:theEvent];
}
@end // implementation wxPoserNSView
@interface wxNSViewNotificationObserver : NSObject