Mercurial > dwindows
comparison mac/dw.m @ 944:cdb7a53e5515
Some motion notify changes... so it can handle events without the mouse button pressed on Mac.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 30 Apr 2011 18:43:07 +0000 |
parents | 675c12b1b90e |
children | 254b50be1bc1 |
comparison
equal
deleted
inserted
replaced
943:675c12b1b90e | 944:cdb7a53e5515 |
---|---|
762 _event_handler(self, nil, 13); | 762 _event_handler(self, nil, 13); |
763 } | 763 } |
764 -(void)setMenu:(NSMenu *)input { windowmenu = input; [windowmenu retain]; } | 764 -(void)setMenu:(NSMenu *)input { windowmenu = input; [windowmenu retain]; } |
765 -(void)menuHandler:(id)sender { _event_handler(sender, nil, 8); } | 765 -(void)menuHandler:(id)sender { _event_handler(sender, nil, 8); } |
766 -(void)mouseDragged:(NSEvent *)theEvent { if(_DWCapture == self) { _event_handler(self, theEvent, 5); } } | 766 -(void)mouseDragged:(NSEvent *)theEvent { if(_DWCapture == self) { _event_handler(self, theEvent, 5); } } |
767 -(void)mouseMoved:(NSEvent *)theEvent | |
768 { | |
769 id hit = [self hitTest:[theEvent locationInWindow]]; | |
770 | |
771 if(_DWCapture == hit) | |
772 { | |
773 _event_handler(hit, theEvent, 5); | |
774 } | |
775 } | |
767 @end | 776 @end |
768 | 777 |
769 /* Subclass for a button type */ | 778 /* Subclass for a button type */ |
770 @interface DWButton : NSButton | 779 @interface DWButton : NSButton |
771 { | 780 { |
6730 DWView *view = [[DWView alloc] init]; | 6739 DWView *view = [[DWView alloc] init]; |
6731 | 6740 |
6732 [window setContentView:view]; | 6741 [window setContentView:view]; |
6733 [window setDelegate:view]; | 6742 [window setDelegate:view]; |
6734 [window setAutorecalculatesKeyViewLoop:YES]; | 6743 [window setAutorecalculatesKeyViewLoop:YES]; |
6744 [window setAcceptsMouseMovedEvents:YES]; | |
6735 [view release]; | 6745 [view release]; |
6736 | 6746 |
6737 /* If it isn't a toplevel window... */ | 6747 /* If it isn't a toplevel window... */ |
6738 if(hwndOwner) | 6748 if(hwndOwner) |
6739 { | 6749 { |
7048 * handle: Handle to receive mouse input. | 7058 * handle: Handle to receive mouse input. |
7049 */ | 7059 */ |
7050 void API dw_window_capture(HWND handle) | 7060 void API dw_window_capture(HWND handle) |
7051 { | 7061 { |
7052 id object = handle; | 7062 id object = handle; |
7053 id window = handle; | 7063 |
7054 | 7064 _DWCapture = object; |
7055 if(![object isMemberOfClass:[DWWindow class]]) | |
7056 { | |
7057 window = [object window]; | |
7058 } | |
7059 if(window) | |
7060 { | |
7061 _DWCapture = object; | |
7062 } | |
7063 } | 7065 } |
7064 | 7066 |
7065 /* | 7067 /* |
7066 * Releases previous mouse capture. | 7068 * Releases previous mouse capture. |
7067 */ | 7069 */ |