109 |
109 |
CvMouseCallback mouseCallback;
|
110 |
110 |
void *mouseParam;
|
111 |
111 |
BOOL autosize;
|
112 |
|
BOOL firstContent;
|
|
112 |
BOOL firstContent;
|
|
113 |
int status;
|
113 |
114 |
}
|
114 |
115 |
@property(assign) CvMouseCallback mouseCallback;
|
115 |
116 |
@property(assign) void *mouseParam;
|
116 |
117 |
@property(assign) BOOL autosize;
|
117 |
118 |
@property(assign) BOOL firstContent;
|
118 |
119 |
@property(retain) NSMutableDictionary *sliders;
|
|
120 |
@property(readwrite) int status;
|
119 |
121 |
- (CVView *)contentView;
|
120 |
122 |
- (void)cvSendMouseEvent:(NSEvent *)event type:(int)type flags:(int)flags;
|
121 |
123 |
- (void)cvMouseEvent:(NSEvent *)event;
|
... | ... | |
533 |
535 |
return returnCode;
|
534 |
536 |
}
|
535 |
537 |
|
|
538 |
double cvGetModeWindow_COCOA( const char* name )
|
|
539 |
{
|
|
540 |
double result = -1;
|
|
541 |
CVWindow *window = nil;
|
|
542 |
|
|
543 |
CV_FUNCNAME( "cvGetModeWindow_COCOA" );
|
|
544 |
|
|
545 |
__BEGIN__;
|
|
546 |
if( name == NULL )
|
|
547 |
{
|
|
548 |
CV_ERROR( CV_StsNullPtr, "NULL name string" );
|
|
549 |
}
|
|
550 |
|
|
551 |
window = cvGetWindow( name );
|
|
552 |
if ( window == NULL )
|
|
553 |
{
|
|
554 |
CV_ERROR( CV_StsNullPtr, "NULL window" );
|
|
555 |
}
|
|
556 |
|
|
557 |
result = window.status;
|
|
558 |
|
|
559 |
__END__;
|
|
560 |
return result;
|
|
561 |
}
|
|
562 |
|
|
563 |
void cvSetModeWindow_COCOA( const char* name, double prop_value )
|
|
564 |
{
|
|
565 |
CVWindow *window = nil;
|
|
566 |
NSDictionary *fullscreenOptions = nil;
|
|
567 |
NSAutoreleasePool* localpool = nil;
|
|
568 |
|
|
569 |
CV_FUNCNAME( "cvSetModeWindow_COCOA" );
|
|
570 |
|
|
571 |
__BEGIN__;
|
|
572 |
if( name == NULL )
|
|
573 |
{
|
|
574 |
CV_ERROR( CV_StsNullPtr, "NULL name string" );
|
|
575 |
}
|
|
576 |
|
|
577 |
window = cvGetWindow(name);
|
|
578 |
if ( window == NULL )
|
|
579 |
{
|
|
580 |
CV_ERROR( CV_StsNullPtr, "NULL window" );
|
|
581 |
}
|
|
582 |
|
|
583 |
if ( [window autosize] )
|
|
584 |
{
|
|
585 |
return;
|
|
586 |
}
|
|
587 |
|
|
588 |
localpool = [[NSAutoreleasePool alloc] init];
|
|
589 |
|
|
590 |
fullscreenOptions = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:NSFullScreenModeSetting];
|
|
591 |
if ( [[window contentView] isInFullScreenMode] && prop_value==CV_WINDOW_NORMAL )
|
|
592 |
{
|
|
593 |
[[window contentView] exitFullScreenModeWithOptions:fullscreenOptions];
|
|
594 |
window.status=CV_WINDOW_NORMAL;
|
|
595 |
}
|
|
596 |
else if( ![[window contentView] isInFullScreenMode] && prop_value==CV_WINDOW_FULLSCREEN )
|
|
597 |
{
|
|
598 |
[[window contentView] enterFullScreenMode:[NSScreen mainScreen] withOptions:fullscreenOptions];
|
|
599 |
window.status=CV_WINDOW_FULLSCREEN;
|
|
600 |
}
|
|
601 |
|
|
602 |
[localpool drain];
|
|
603 |
|
|
604 |
__END__;
|
|
605 |
}
|
|
606 |
|
536 |
607 |
@implementation CVWindow
|
537 |
608 |
|
538 |
609 |
@synthesize mouseCallback;
|
... | ... | |
540 |
611 |
@synthesize autosize;
|
541 |
612 |
@synthesize firstContent;
|
542 |
613 |
@synthesize sliders;
|
|
614 |
@synthesize status;
|
543 |
615 |
|
544 |
616 |
- (void)cvSendMouseEvent:(NSEvent *)event type:(int)type flags:(int)flags {
|
545 |
617 |
//cout << "cvSendMouseEvent" << endl;
|
... | ... | |
787 |
859 |
NSAutoreleasePool* localpool = [[NSAutoreleasePool alloc] init];
|
788 |
860 |
CVWindow *cvwindow = (CVWindow *)[self window];
|
789 |
861 |
int height = 0;
|
790 |
|
for(NSString *key in [cvwindow sliders]) {
|
791 |
|
height += [[[cvwindow sliders] valueForKey:key] frame].size.height;
|
792 |
|
}
|
|
862 |
if ([cvwindow respondsToSelector:@selector(sliders)]) {
|
|
863 |
for(NSString *key in [cvwindow sliders]) {
|
|
864 |
height += [[[cvwindow sliders] valueForKey:key] frame].size.height;
|
|
865 |
}
|
|
866 |
}
|
793 |
867 |
|
794 |
868 |
|
795 |
869 |
NSRect imageRect = {{0,0}, {[image size].width, [image size].height}};
|