bwalkin / BWToolkit (http://brandonwalkin.com/bwtoolkit/)
BWToolkit is an Interface Builder plugin that contains commonly used UI elements and other objects designed to simplify development for the Mac.
Clone this repository (size: 1.5 MB): HTTPS / SSH
$ hg clone http://bitbucket.org/bwalkin/bwtoolkit/
| commit 111: | 1e85d624944c |
| parent 110: | 0b639e42a88d |
| branch: | default |
Split view - Updated inspector to use bwAnimator category method
2 months ago
Changed (Δ474 bytes):
raw changeset »
BWSplitViewInspector.m (4 lines added, 19 lines removed)
Up to file-list BWSplitViewInspector.m:
8 |
8 |
|
9 |
9 |
#import "BWSplitViewInspector.h" |
10 |
10 |
#import "NSView+BWAdditions.h" |
11 |
#import "NSEvent+BWAdditions.h" |
|
11 |
12 |
|
12 |
13 |
@interface BWSplitViewInspector (BWSVIPrivate) |
13 |
14 |
- (void)updateSizeInputFields; |
60 |
61 |
} |
61 |
62 |
} |
62 |
63 |
|
63 |
- (void)setDividerCheckboxWantsLayer:(NSString *)flag |
|
64 |
{ |
|
65 |
if ([flag isEqualToString:@"YES"]) |
|
66 |
[dividerCheckbox setWantsLayer:YES]; |
|
67 |
else |
|
68 |
[dividerCheckbox setWantsLayer:NO]; |
|
69 |
} |
|
70 |
||
71 |
64 |
- (BOOL)toggleDividerCheckboxVisibilityWithAnimation:(BOOL)shouldAnimate |
72 |
65 |
{ |
73 |
66 |
// Conditions that must be met for a visibility switch to take place. If any of them fail, we return early. |
78 |
71 |
else |
79 |
72 |
return NO; |
80 |
73 |
|
81 |
float |
|
74 |
float alpha, duration = [NSEvent bwShiftKeyIsDown] ? 0.1 * 10 : 0.1; |
|
82 |
75 |
NSRect targetFrame = NSZeroRect; |
83 |
76 |
|
84 |
77 |
if (dividerCheckboxCollapsed) |
92 |
85 |
alpha = 0.0; |
93 |
86 |
} |
94 |
87 |
|
95 |
[self performSelector:@selector(setDividerCheckboxWantsLayer:) withObject:@"YES" afterDelay:0]; |
|
96 |
||
97 |
88 |
if (shouldAnimate) |
98 |
89 |
{ |
99 |
90 |
[NSAnimationContext beginGrouping]; |
100 |
91 |
[[NSAnimationContext currentContext] setDuration:duration]; |
101 |
[[dividerCheckbox animator] setAlphaValue:alpha]; |
|
102 |
[[[self view] animator] setFrame:targetFrame]; |
|
92 |
[[dividerCheckbox bwAnimator] setAlphaValue:alpha]; |
|
93 |
[[[self view] bwAnimator] setFrame:targetFrame]; |
|
103 |
94 |
[NSAnimationContext endGrouping]; |
104 |
||
105 |
if (dividerCheckboxCollapsed) |
|
106 |
[self performSelector:@selector(setDividerCheckboxWantsLayer:) withObject:@"NO" afterDelay:duration]; |
|
107 |
95 |
} |
108 |
96 |
else |
109 |
97 |
{ |
110 |
98 |
[dividerCheckbox setAlphaValue:alpha]; |
111 |
99 |
[[self view] setFrame:targetFrame]; |
112 |
||
113 |
if (dividerCheckboxCollapsed) |
|
114 |
[self performSelector:@selector(setDividerCheckboxWantsLayer:) withObject:@"NO" afterDelay:0]; |
|
115 |
100 |
} |
116 |
101 |
|
117 |
102 |
dividerCheckboxCollapsed = !dividerCheckboxCollapsed; |
