-
Notifications
You must be signed in to change notification settings - Fork 36
/
IGKForwardView.m
61 lines (49 loc) · 1.36 KB
/
IGKForwardView.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//
// IGKForwardView.m
// Ingredients
//
// Created by Jean-Nicolas Jolivet on 10-05-06.
// Written in 2010 by SilverCocoa.
//
#import "IGKForwardView.h"
@implementation IGKForwardView
- (id)actionForwardee
{
BOOL isFullscreen = NO;
NSWindowController *controller = [[self window] windowController];
if (!controller || ([controller respondsToSelector:@selector(isInFullscreen)] && [controller isInFullscreen]))
isFullscreen = YES;
if (isFullscreen)
return [[[NSApp delegate] kitController] fullscreenWindowController];
return nil;
}
- (BOOL)respondsToSelector:(SEL)aSelector
{
if ([super respondsToSelector:aSelector])
return YES;
if ([[self actionForwardee] respondsToSelector:aSelector])
return YES;
return NO;
}
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
if ([super respondsToSelector:aSelector])
return [super methodSignatureForSelector:aSelector];
id forwardee = [self actionForwardee];
if ([forwardee respondsToSelector:aSelector])
return [forwardee methodSignatureForSelector:aSelector];
return [super methodSignatureForSelector:aSelector];
}
- (void)forwardInvocation:(NSInvocation *)anInvocation
{
id forwardee = [self actionForwardee];
if ([forwardee respondsToSelector:[anInvocation selector]])
{
[anInvocation invokeWithTarget:forwardee];
}
else
{
[super forwardInvocation:anInvocation];
}
}
@end