From 55fa6024dbade24c5263ded5aa61d471c22b825a Mon Sep 17 00:00:00 2001 From: M ESCO Date: Sat, 7 Feb 2009 14:26:37 +0100 Subject: [PATCH] Added tooltip support --- AppKit/CPControl.j | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/AppKit/CPControl.j b/AppKit/CPControl.j index 23fbf5b1e..3edb5a8bb 100644 --- a/AppKit/CPControl.j +++ b/AppKit/CPControl.j @@ -100,6 +100,8 @@ var CPControlBlackColor = [CPColor blackColor]; CPCellImagePosition _imagePosition; CPImageScaling _imageScaling; + CPString _toolTip; + // Target-Action Support id _target; SEL _action; @@ -314,6 +316,30 @@ var CPControlBlackColor = [CPColor blackColor]; return _textShadow; } +/*! + Sets the tooltip for the receiver. + @param aToolTip the tooltip +*/ +-(void)setToolTip:(CPString)aToolTip +{ + if (_toolTip == aToolTip) + return; + + _toolTip = aToolTip; + +#if PLATFORM(DOM) + _DOMElement.title = [aToolTip cssString]; +#endif +} + +/*! + Returns the receiver's tooltip +*/ +-(CPString)toolTip +{ + return _toolTip; +} + /*! Returns the receiver's target action */