From 5994c48d5fbfdfbe610afa346370e4172e3bbceb Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Sun, 15 May 2011 18:36:21 -0400 Subject: [PATCH] Refs #1264. Fix accidental global, cleanup. --- AppKit/CPWindow/_CPToolTipWindowView.j | 6 ++--- AppKit/_CPToolTip.j | 35 +++++++++++++++----------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/AppKit/CPWindow/_CPToolTipWindowView.j b/AppKit/CPWindow/_CPToolTipWindowView.j index 4b5aa0353..19bbc01d0 100644 --- a/AppKit/CPWindow/_CPToolTipWindowView.j +++ b/AppKit/CPWindow/_CPToolTipWindowView.j @@ -2,7 +2,7 @@ * _CPToolTipWindowView.j * AppKit * - * Created by Antoine Mercadal + * Created by Antoine Mercadal * Copyright 2011 * * This library is free software; you can redistribute it and/or @@ -42,7 +42,7 @@ + (CGRect)contentRectForFrameRect:(CGRect)aFrameRect { var contentRect = CGRectMakeCopy(aFrameRect); - + contentRect.origin.x += 3; contentRect.origin.y += 3; contentRect.size.width -= 6; @@ -92,7 +92,7 @@ var context = [[CPGraphicsContext currentContext] graphicsPort], radius = 2, strokeWidth = 1; - + CGContextSetStrokeColor(context, _strokeColor); CGContextSetFillColor(context, _backgroundColor); CGContextSetLineWidth(context, strokeWidth); diff --git a/AppKit/_CPToolTip.j b/AppKit/_CPToolTip.j index 2a4ba1e43..cae460366 100644 --- a/AppKit/_CPToolTip.j +++ b/AppKit/_CPToolTip.j @@ -34,8 +34,7 @@ var _CPToolTipHeight = 24.0, /*! @ingroup appkit - This is a basic tooltip that behaves mostlt like - Cocoa ones. + This is a basic tooltip that behaves mostly like Cocoa ones. */ @implementation _CPToolTip : CPWindow { @@ -46,7 +45,7 @@ var _CPToolTipHeight = 24.0, #pragma mark - #pragma mark Class Methods -/*! returns an initialized _CPToolTip with string and attach it to given view +/*! Returns an initialized _CPToolTip with the given text and attach it to given view. @param aString the content of the tooltip */ + (_CPToolTip)toolTipWithString:(CPString)aString @@ -58,7 +57,9 @@ var _CPToolTipHeight = 24.0, return tooltip; } -/*! compute a cool size for the given string +/*! + Compute a cool size for the given string. + @param aToolTipSize the original wanted tool tip size @param aText the wanted text @return CPArray containing the computer toolTipSize and textFrameSize @@ -82,7 +83,9 @@ var _CPToolTipHeight = 24.0, return [aToolTipSize, textFrameSize]; } -/*! override default windowView class loader +/*! + Override default windowView class loader. + @param aStyleMask the window mask @return the windowView class */ @@ -95,7 +98,9 @@ var _CPToolTipHeight = 24.0, #pragma mark - #pragma mark Initialization -/*! returns an initialized _CPToolTip with string +/*! + Returns an initialized _CPToolTip with string. + @param aString the content of the tooltip @param aStyleMask the tooltip's style mask */ @@ -137,7 +142,7 @@ var _CPToolTipHeight = 24.0, #pragma mark Controls /*! - Show the tooltip after computing the position + Show the tooltip after computing the position. */ - (void)showToolTip { @@ -164,7 +169,7 @@ var _CPToolTipHeight = 24.0, /*! @ingroup appkit - Make CPView supporting toolTips. + Add tooltip support to CPView. */ @implementation CPView (toolTips) @@ -183,10 +188,12 @@ var _CPToolTipHeight = 24.0, if (!_DOMElement) return; - var fIn = function(e){ + var fIn = function(e) + { [self _fireToolTip]; - }; - fOut = function(e){ + }, + fOut = function(e) + { [self _invalidateToolTip]; }; @@ -224,7 +231,7 @@ var _CPToolTipHeight = 24.0, } /*! - Returns the receiver's tooltip + Returns the receiver's tooltip. */ - (CPString)toolTip { @@ -232,7 +239,7 @@ var _CPToolTipHeight = 24.0, } /*! @ignore - starts the tooltip timer + Starts the tooltip timer. */ - (void)_fireToolTip { @@ -276,4 +283,4 @@ var _CPToolTipHeight = 24.0, _CPCurrentToolTip = [_CPToolTip toolTipWithString:_toolTip]; } -@end \ No newline at end of file +@end