Fixes for tooltips

This commit is contained in:
Airy ANDRE 2012-01-10 14:12:09 +01:00
parent b57452087f
commit a1b53c1bf2
5 changed files with 45 additions and 33 deletions

View File

@ -92,9 +92,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
messageSize.width += 2.; // Shouldn't be neccessary.
messageSize.height += TEXTFIELD_MARGIN * 2;
[_textField setBoundsSize:messageSize];
[_textField setFrameSize:messageSize];
windowFrame.origin = [NSEvent mouseLocation];
windowFrame.origin.x += 10.;
windowFrame.origin.y += 10.;

View File

@ -263,7 +263,6 @@ extern NSSize _NSToolbarIconSizeSmall;
view=[view retain];
[_view release];
_view=view;
if(view!=nil){
_minSize=[_view frame].size;
_maxSize=[_view frame].size;

View File

@ -230,6 +230,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
[item _setItemViewFrame:frames[i]];
if([item _enclosingView]!=self)
[self addSubview:[item _enclosingView]];
[[item _enclosingView] setToolTip:[item toolTip]];
x+=frames[i].size.width;
}
}

View File

@ -2768,32 +2768,37 @@ NSString * const NSWindowDidAnimateNotification=@"NSWindowDidAnimateNotification
BOOL mouseIsInside=NSPointInRect(mousePoint,[area _rectInWindow]);
id owner=[area owner];
if([area _isToolTip]==YES){
NSToolTipWindow *toolTipWindow=[NSToolTipWindow sharedToolTipWindow];
if([self isKeyWindow]==NO || [self _sheetContext]!=nil)
mouseIsInside=NO;
if(mouseWasInside==YES && mouseIsInside==NO && [toolTipWindow _trackingArea]==area){
[NSObject cancelPreviousPerformRequestsWithTarget:toolTipWindow selector:@selector(orderFront:) object:nil];
[toolTipWindow orderOut:nil];
}
if(mouseWasInside==NO && mouseIsInside==YES){ // AllowsToolTipsWhenApplicationIsInactive
// is handled when rebuilding areas.
[NSObject cancelPreviousPerformRequestsWithTarget:toolTipWindow selector:@selector(orderFront:) object:nil];
[toolTipWindow orderOut:nil];
if([owner respondsToSelector:@selector(view:stringForToolTip:point:userData:)]==YES)
[toolTipWindow setToolTip:[owner view:[area _view] stringForToolTip:area point:mousePoint userData:[area userInfo]]];
else
[toolTipWindow setToolTip:[owner description]];
// This gives us some protection when ToolTip areas overlap:
[toolTipWindow _setTrackingArea:area];
raiseToolTipWindow=YES;
}
}
else{ // not ToolTip
if([area _isToolTip]==YES){
NSToolTipWindow *toolTipWindow=[NSToolTipWindow sharedToolTipWindow];
if([self isKeyWindow]==NO || [self _sheetContext]!=nil)
mouseIsInside=NO;
if(mouseWasInside==YES && mouseIsInside==NO && [toolTipWindow _trackingArea]==area){
[NSObject cancelPreviousPerformRequestsWithTarget:toolTipWindow selector:@selector(orderFront:) object:nil];
[toolTipWindow orderOut:nil];
}
if(mouseWasInside==NO && mouseIsInside==YES){ // AllowsToolTipsWhenApplicationIsInactive
// is handled when rebuilding areas.
[NSObject cancelPreviousPerformRequestsWithTarget:toolTipWindow selector:@selector(orderFront:) object:nil];
[toolTipWindow orderOut:nil];
NSString *tooltip = nil;
if([owner respondsToSelector:@selector(view:stringForToolTip:point:userData:)]==YES) {
NSPoint pt =[[area _view] convertPoint:mousePoint fromView:nil];
tooltip = [owner view:[area _view] stringForToolTip:area point:pt userData:[area userInfo]];
} else {
tooltip = [owner description];
}
[toolTipWindow setToolTip:tooltip];
// This gives us some protection when ToolTip areas overlap:
[toolTipWindow _setTrackingArea:area];
raiseToolTipWindow=YES;
}
}
else{ // not ToolTip
NSTrackingAreaOptions options=[area options];
// Options by view activation.

View File

@ -33,15 +33,22 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
-(void)establishConnection {
#if 0
if ([[self file] isEqualToString:@"NSToolTipHelpKey"])
[_destination setToolTip:[self marker]];
#endif
}
-initWithCoder:(NSCoder *)coder {
return self;
if ((self = [super initWithCoder:coder])) {
if ([coder allowsKeyedCoding]) {
if ([coder containsValueForKey: @"NSFile"]) {
_file = [[coder decodeObjectForKey: @"NSFile"] retain];
}
if ([coder containsValueForKey: @"NSMarker"]) {
_marker = [[coder decodeObjectForKey: @"NSMarker"] retain];
}
}
}
return self;
}
@end