comparison mac/dw.m @ 886:d94a4fa0359e

Implemented the motion notify event on Mac. Most of it was there except the event handler. Also removed the stub for dw_window_track() this appears to be an unused function only implemented on OS/2.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 07 Apr 2011 18:20:04 +0000
parents 1e7b7f870d88
children 29d8ae25a78c
comparison
equal deleted inserted replaced
885:21ed1421399c 886:d94a4fa0359e
226 226
227 dw_pointer_query_pos(&x, &y); 227 dw_pointer_query_pos(&x, &y);
228 228
229 return buttonfunc(object, (int)x, (int)y, button, handler->data); 229 return buttonfunc(object, (int)x, (int)y, button, handler->data);
230 } 230 }
231 /* Motion notify event */
232 case 5:
233 {
234 int (* API motionfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))handler->signalfunction;
235 int buttonmask = (int)[NSEvent pressedMouseButtons];
236 NSPoint point = [NSEvent mouseLocation];
237
238 return motionfunc(object, (int)point.x, (int)point.y, buttonmask, handler->data);
239 }
231 /* Window close event */ 240 /* Window close event */
232 case 6: 241 case 6:
233 { 242 {
234 int (* API closefunc)(HWND, void *) = (int (* API)(HWND, void *))handler->signalfunction; 243 int (* API closefunc)(HWND, void *) = (int (* API)(HWND, void *))handler->signalfunction;
235 return closefunc(object, handler->data); 244 return closefunc(object, handler->data);
578 -(BOOL)windowShouldClose:(id)sender; 587 -(BOOL)windowShouldClose:(id)sender;
579 -(void)setMenu:(NSMenu *)input; 588 -(void)setMenu:(NSMenu *)input;
580 -(void)windowDidBecomeMain:(id)sender; 589 -(void)windowDidBecomeMain:(id)sender;
581 -(void)menuHandler:(id)sender; 590 -(void)menuHandler:(id)sender;
582 -(void)keyDown:(NSEvent *)theEvent; 591 -(void)keyDown:(NSEvent *)theEvent;
592 -(void)mouseMoved:(NSEvent *)theEvent;
583 @end 593 @end
584 594
585 @implementation DWView 595 @implementation DWView
586 -(BOOL)windowShouldClose:(id)sender 596 -(BOOL)windowShouldClose:(id)sender
587 { 597 {
622 _event_handler(self, nil, 13); 632 _event_handler(self, nil, 13);
623 } 633 }
624 -(void)setMenu:(NSMenu *)input { windowmenu = input; [windowmenu retain]; } 634 -(void)setMenu:(NSMenu *)input { windowmenu = input; [windowmenu retain]; }
625 -(void)menuHandler:(id)sender { _event_handler(sender, nil, 8); } 635 -(void)menuHandler:(id)sender { _event_handler(sender, nil, 8); }
626 -(void)keyDown:(NSEvent *)theEvent { _event_handler(self, theEvent, 2); _event_handler([self window], theEvent, 2); } 636 -(void)keyDown:(NSEvent *)theEvent { _event_handler(self, theEvent, 2); _event_handler([self window], theEvent, 2); }
637 -(void)mouseMoved:(NSEvent *)theEvent { _event_handler(self, theEvent, 5); }
627 @end 638 @end
628 639
629 /* Subclass for a button type */ 640 /* Subclass for a button type */
630 @interface DWButton : NSButton 641 @interface DWButton : NSButton
631 { 642 {
6692 _DWCapture = nil; 6703 _DWCapture = nil;
6693 } 6704 }
6694 } 6705 }
6695 6706
6696 /* 6707 /*
6697 * Tracks this window movement.
6698 * Parameters:
6699 * handle: Handle to frame to be tracked.
6700 */
6701 void API dw_window_track(HWND handle)
6702 {
6703 NSLog(@"dw_window_track() unimplemented\n");
6704 }
6705
6706 /*
6707 * Changes a window's parent to newparent. 6708 * Changes a window's parent to newparent.
6708 * Parameters: 6709 * Parameters:
6709 * handle: The window handle to destroy. 6710 * handle: The window handle to destroy.
6710 * newparent: The window's new parent window. 6711 * newparent: The window's new parent window.
6711 */ 6712 */