mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 21:17:03 +00:00
Fixed: the way to add the tooltip's window is wrong
Previously when adding a tooltip, we added it to the platformWindow. Now we add id to the window of the targeted view. Fixed #2110
This commit is contained in:
+9
-8
@@ -40,6 +40,7 @@ var _CPToolTipHeight = 24.0,
|
||||
*/
|
||||
@implementation _CPToolTip : CPWindow
|
||||
{
|
||||
CPWindow _toolTipWindow;
|
||||
CPTextField _content;
|
||||
}
|
||||
|
||||
@@ -78,9 +79,7 @@ var _CPToolTipHeight = 24.0,
|
||||
|
||||
var callbackFunction = function() {
|
||||
[_CPToolTip invalidateCurrentToolTipIfNeeded];
|
||||
_CPToolTipCurrentToolTip = [_CPToolTip toolTipWithString:[aView toolTip]];
|
||||
[_CPToolTipCurrentToolTip setPlatformWindow:[[aView window] platformWindow]];
|
||||
[[aView window] addChildWindow:_CPToolTipCurrentToolTip ordered:CPWindowAbove];
|
||||
_CPToolTipCurrentToolTip = [_CPToolTip toolTipWithString:[aView toolTip] toolTipWindow:[aView window]];
|
||||
};
|
||||
|
||||
_CPToolTipCurrentToolTipTimer = [CPTimer scheduledTimerWithTimeInterval:_CPToolTipDelay
|
||||
@@ -92,9 +91,9 @@ var _CPToolTipHeight = 24.0,
|
||||
/*! 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
|
||||
+ (_CPToolTip)toolTipWithString:(CPString)aString toolTipWindow:(CPWindow)aWindow
|
||||
{
|
||||
var tooltip = [[_CPToolTip alloc] initWithString:aString styleMask:_CPToolTipWindowMask];
|
||||
var tooltip = [[_CPToolTip alloc] initWithString:aString styleMask:_CPToolTipWindowMask toolTipWindow:aWindow];
|
||||
|
||||
[tooltip showToolTip];
|
||||
|
||||
@@ -159,7 +158,7 @@ var _CPToolTipHeight = 24.0,
|
||||
@param aString the content of the tooltip
|
||||
@param aStyleMask the tooltip's style mask
|
||||
*/
|
||||
- (id)initWithString:(CPString)aString styleMask:(unsigned)aStyleMask
|
||||
- (id)initWithString:(CPString)aString styleMask:(unsigned)aStyleMask toolTipWindow:(CPWindow)aWindow
|
||||
{
|
||||
var toolTipFrame = CGRectMake(0.0, 0.0, 250.0, _CPToolTipHeight),
|
||||
layout = [_CPToolTip computeCorrectSize:toolTipFrame.size text:aString],
|
||||
@@ -169,6 +168,7 @@ var _CPToolTipHeight = 24.0,
|
||||
|
||||
if (self = [super initWithContentRect:toolTipFrame styleMask:aStyleMask])
|
||||
{
|
||||
_toolTipWindow = aWindow;
|
||||
_constrainsToUsableScreen = NO;
|
||||
|
||||
textFrameSize.height += 4;
|
||||
@@ -204,7 +204,7 @@ var _CPToolTipHeight = 24.0,
|
||||
- (void)showToolTip
|
||||
{
|
||||
var mousePosition = [[CPApp currentEvent] globalLocation],
|
||||
nativeRect = [[self platformWindow] nativeContentRect];
|
||||
nativeRect = [[_toolTipWindow platformWindow] nativeContentRect];
|
||||
|
||||
mousePosition.y += 20;
|
||||
|
||||
@@ -218,7 +218,8 @@ var _CPToolTipHeight = 24.0,
|
||||
mousePosition.y = mousePosition.y - CGRectGetHeight([self frame]) - 40;
|
||||
|
||||
[self setFrameOrigin:mousePosition];
|
||||
[self orderFront:nil];
|
||||
|
||||
[_toolTipWindow addChildWindow:self ordered:CPWindowAbove];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user