mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-17 04:00:42 +00:00
CPWindow: add CPWindowWillStartLiveResizeNotification and CPWindowDidEndLiveResizeNotification
Also fixed CPView -(BOOL)inLiveResize If a view is added during a live resize, it will not receive a willStart notif. If a view is removed during a live resize it will not receive a Didend notif.
This commit is contained in:
1 parent
d0cd976246
commit
0f767d9dfc
4 files changed
+33
-2
No files matched your search
+1
-1
@@ -2983,7 +2983,7 @@ setBoundsOrigin:
|
||||
*/
|
||||
- (BOOL)inLiveResize
|
||||
{
|
||||
return _inLiveResize;
|
||||
return [self window] && [[self window] _inLiveResize];
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -2018,6 +2018,25 @@ CPTexturedBackgroundWindowMask
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_startLiveResize
|
||||
{
|
||||
[[CPNotificationCenter defaultCenter]
|
||||
postNotificationName:CPWindowWillStartLiveResizeNotification
|
||||
object:self];
|
||||
}
|
||||
|
||||
- (void)_endLiveResize
|
||||
{
|
||||
[[CPNotificationCenter defaultCenter]
|
||||
postNotificationName:CPWindowDidEndLiveResizeNotification
|
||||
object:self];
|
||||
}
|
||||
|
||||
- (BOOL)_inLiveResize
|
||||
{
|
||||
return [_windowView _isTracking];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the window's number in the desktop's screen list
|
||||
*/
|
||||
|
||||
@@ -176,6 +176,8 @@ CPWindowDidEndSheetNotification = @"CPWindowDidEndSheetNotificat
|
||||
CPWindowDidMiniaturizeNotification = @"CPWindowDidMiniaturizeNotification";
|
||||
CPWindowWillMiniaturizeNotification = @"CPWindowWillMiniaturizeNotification";
|
||||
CPWindowDidDeminiaturizeNotification = @"CPWindowDidDeminiaturizeNotification";
|
||||
CPWindowWillStartLiveResizeNotification = @"CPWindowWillStartLiveResizeNotification";
|
||||
CPWindowDidEndLiveResizeNotification = @"CPWindowDidEndLiveResizeNotification";
|
||||
|
||||
_CPWindowDidChangeFirstResponderNotification = @"_CPWindowDidChangeFirstResponderNotification";
|
||||
|
||||
|
||||
@@ -64,6 +64,8 @@ _CPWindowViewResizeSlop = 3;
|
||||
CGRect _cachedScreenFrame;
|
||||
|
||||
CPView _sheetShadowView;
|
||||
|
||||
BOOL _isTracking @accessors(getter=_isTracking);
|
||||
}
|
||||
|
||||
+ (CGRect)contentRectForFrameRect:(CGRect)aFrameRect
|
||||
@@ -148,6 +150,7 @@ _CPWindowViewResizeSlop = 3;
|
||||
_styleMask = aStyleMask;
|
||||
_resizeIndicatorOffset = CGSizeMakeZero();
|
||||
_toolbarOffset = CGSizeMakeZero();
|
||||
_isTracking = NO;
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -458,6 +461,8 @@ _CPWindowViewResizeSlop = 3;
|
||||
if (type === CPLeftMouseUp)
|
||||
{
|
||||
_cachedScreenFrame = nil;
|
||||
_isTracking = NO;
|
||||
[_window _endLiveResize];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -474,6 +479,12 @@ _CPWindowViewResizeSlop = 3;
|
||||
}
|
||||
else if (type === CPLeftMouseDragged)
|
||||
{
|
||||
if (!_isTracking)
|
||||
{
|
||||
_isTracking = YES;
|
||||
[_window _startLiveResize];
|
||||
}
|
||||
|
||||
var deltaX = globalLocation.x - _mouseDraggedPoint.x,
|
||||
deltaY = globalLocation.y - _mouseDraggedPoint.y,
|
||||
startX = CGRectGetMinX(_cachedFrame),
|
||||
@@ -985,4 +996,3 @@ _CPWindowViewResizeSlop = 3;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in new issue
Block a user