Mercurial > dwindows
comparison mac/dw.m @ 854:d44bb4c4902d
Fixed an error on the close event handler on the Mac.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 31 Mar 2011 18:50:52 +0000 |
parents | c27ce204302b |
children | 0103a8751ab4 |
comparison
equal
deleted
inserted
replaced
853:c27ce204302b | 854:d44bb4c4902d |
---|---|
468 * going to work. -Brian | 468 * going to work. -Brian |
469 */ | 469 */ |
470 | 470 |
471 /* Subclass for a box type */ | 471 /* Subclass for a box type */ |
472 @interface DWBox : NSView | 472 @interface DWBox : NSView |
473 #ifdef BUILDING_FOR_SNOW_LEOPARD | |
474 <NSWindowDelegate> | |
475 #endif | |
476 { | 473 { |
477 Box *box; | 474 Box *box; |
478 void *userdata; | 475 void *userdata; |
479 NSColor *bgcolor; | 476 NSColor *bgcolor; |
480 } | 477 } |
570 -(void)setUserdata:(void *)input { userdata = input; } | 567 -(void)setUserdata:(void *)input { userdata = input; } |
571 @end | 568 @end |
572 | 569 |
573 /* Subclass for a top-level window */ | 570 /* Subclass for a top-level window */ |
574 @interface DWView : DWBox | 571 @interface DWView : DWBox |
572 #ifdef BUILDING_FOR_SNOW_LEOPARD | |
573 <NSWindowDelegate> | |
574 #endif | |
575 { | 575 { |
576 NSMenu *windowmenu; | 576 NSMenu *windowmenu; |
577 } | 577 } |
578 -(BOOL)windowShouldClose:(id)sender; | 578 -(BOOL)windowShouldClose:(id)sender; |
579 -(void)setMenu:(NSMenu *)input; | 579 -(void)setMenu:(NSMenu *)input; |
583 @end | 583 @end |
584 | 584 |
585 @implementation DWView | 585 @implementation DWView |
586 -(BOOL)windowShouldClose:(id)sender | 586 -(BOOL)windowShouldClose:(id)sender |
587 { | 587 { |
588 if(_event_handler(self, nil, 6) == FALSE) | 588 if(_event_handler(sender, nil, 6) == FALSE) |
589 return NO; | 589 return YES; |
590 return YES; | 590 return NO; |
591 } | 591 } |
592 - (void)viewDidMoveToWindow | 592 - (void)viewDidMoveToWindow |
593 { | 593 { |
594 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowResized:) name:NSWindowDidResizeNotification object:[self window]]; | 594 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowResized:) name:NSWindowDidResizeNotification object:[self window]]; |
595 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidBecomeMain:) name:NSWindowDidBecomeMainNotification object:[self window]]; | 595 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidBecomeMain:) name:NSWindowDidBecomeMainNotification object:[self window]]; |