From 495b77496502b04fec3fbf8ff56bb840b632512e Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Tue, 1 Dec 2009 17:49:15 -0800 Subject: [PATCH] A bit of cleanup. Reviewed by me. --- AppKit/CPMenu/_CPMenuWindow.j | 18 ++++++++---------- AppKit/CPWindow/CPWindow.j | 5 +++++ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/AppKit/CPMenu/_CPMenuWindow.j b/AppKit/CPMenu/_CPMenuWindow.j index 76169cebb..e380a4d7a 100644 --- a/AppKit/CPMenu/_CPMenuWindow.j +++ b/AppKit/CPMenu/_CPMenuWindow.j @@ -41,7 +41,6 @@ var STICKY_TIME_INTERVAL = 500, CGPoint _lastGlobalLocation; Function _trackingCallback; - BOOL _trackingCanceled; CGRect _unconstrainedFrame; CGRect _constraintRect; @@ -84,9 +83,12 @@ var STICKY_TIME_INTERVAL = 500, _CPMenuWindowMoreBelowImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"_CPMenuWindow/_CPMenuWindowMoreBelow.png"] size:CGSizeMake(38.0, 18.0)]; } -- (id)init +- (id)initWithContentRect:(CGRect)aRect styleMask:(unsigned)aStyleMask { - self = [super initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessWindowMask]; + _constraintRect = _CGRectMakeZero(); + _unconstrainedFrame = _CGRectMakeZero(); + + self = [super initWithContentRect:aRect styleMask:CPBorderlessWindowMask]; if (self) { @@ -95,9 +97,6 @@ var STICKY_TIME_INTERVAL = 500, [self setShadowStyle:CPMenuWindowShadowStyle]; [self setAcceptsMouseMovedEvents:YES]; - _constraintRect = _CGRectMakeZero(); - _unconstrainedFrame = CGRectMakeZero(); - var contentView = [self contentView]; _menuView = [[_CPMenuView alloc] initWithFrame:CGRectMakeZero()]; @@ -344,11 +343,10 @@ var STICKY_TIME_INTERVAL = 500, - (void)beginTrackingWithEvent:(CPEvent)anEvent callback:(Function)aCallback { - CPApp._activeMenu = [_menuView menu]; + CPApp._activeMenu = [self menu]; _startTime = [anEvent timestamp];//new Date(); _scrollingState = _CPMenuWindowScrollingStateNone; - _trackingCanceled = NO; _menuWindowStack = [self]; _trackingCallback = aCallback; @@ -440,7 +438,7 @@ var STICKY_TIME_INTERVAL = 500, - (void)trackEvent:(CPEvent)anEvent { var type = [anEvent type], - menu = [_menuView menu]; + menu = [self menu]; // Close Menu Event. if (type === CPAppKitDefined) @@ -448,7 +446,7 @@ var STICKY_TIME_INTERVAL = 500, // Stop all periodic events at this point. [CPEvent stopPeriodicEvents]; - var highlightedItem = [[_menuView menu] highlightedItem]; + var highlightedItem = [menu highlightedItem]; // Hide all submenus. [self showMenu:nil fromMenu:menu atPoint:nil]; diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j index 65cebee65..b2af4f577 100644 --- a/AppKit/CPWindow/CPWindow.j +++ b/AppKit/CPWindow/CPWindow.j @@ -333,6 +333,11 @@ var CPWindowSaveImage = nil, CPWindowSavingImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPProgressIndicator/CPProgressIndicatorSpinningStyleRegular.gif"] size:CGSizeMake(16.0, 16.0)] } +- (id)init +{ + return [self initWithContentRect:_CGRectMakeZero() styleMask:CPTitledWindowMask]; +} + /*! Initializes the window. The method also takes a style bit mask made up of any of the following values: