Fixed: code style in CPPopover

This commit is contained in:
Alexandre Wilhelm committed 2014-07-07 19:21:00 -07:00
1 parent 5c66104d25
commit d7f0ff84d6
2 files changed
+11 -17

No files matched your search

+6 -14
View File
@@ -192,7 +192,7 @@ Set the behavior of the CPPopover. It can be:
return;
_behavior = aBehavior;
[_popoverWindow setStyleMask:[self styleMaskForBehavior]];
[_popoverWindow setStyleMask:[self _styleMaskForBehavior]];
}
- (void)setDelegate:(id <CPPopoverDelegate>)aDelegate
@@ -244,7 +244,7 @@ Set the behavior of the CPPopover. It can be:
_positioningView = positioningView;
if (!_popoverWindow)
_popoverWindow = [[_CPPopoverWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:[self styleMaskForBehavior]];
_popoverWindow = [[_CPPopoverWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:[self _styleMaskForBehavior]];
if (_positioningView != positioningView)
[_popoverWindow setPlatformWindow:[[positioningView window] platformWindow]];
@@ -265,20 +265,12 @@ Set the behavior of the CPPopover. It can be:
[self _popoverDidShow];
}
- (unsigned)styleMaskForBehavior
- (unsigned)_styleMaskForBehavior
{
switch (_behavior)
{
case CPPopoverBehaviorSemitransient:
case CPPopoverBehaviorTransient:
return CPClosableOnBlurWindowMask;
if (_behavior == CPPopoverBehaviorApplicationDefined)
return 0;
case CPPopoverBehaviorApplicationDefined:
return 0;
default:
return 0;
}
return CPClosableOnBlurWindowMask
}
/*!
+5 -3
View File
@@ -680,15 +680,17 @@ var _CPPopoverWindow_shouldClose_ = 1 << 4,
switch ([_delegate behavior])
{
case CPPopoverBehaviorSemitransient:
var superview = [_delegate._positioningView superview],
positioningViewFrame = [_delegate._positioningView frame];
// Click on the same button
// Or click on a different window (we just care about the parentWindow)
// We use targetWindow bacause parentWindow is set to nil when opening a semi-transient window in a bridgeless window
if (CGRectContainsPoint([_delegate._positioningView frame], [[_delegate._positioningView superview] convertPointFromBase:[anEvent locationInWindow]])
if (CGRectContainsPoint(positioningViewFrame, [superview convertPointFromBase:[anEvent locationInWindow]])
|| mouseWindow != _targetWindow)
{
[self _trapNextMouseDown];
return;
break;
}
[_delegate close];
@@ -700,7 +702,7 @@ var _CPPopoverWindow_shouldClose_ = 1 << 4,
case CPPopoverBehaviorApplicationDefined:
[self _trapNextMouseDown];
return;
break;
}
}
}