mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 22:00:38 +00:00
Fix implementation of tracking rectangles to use the coordinate system
of their views, as they do under Cocoa. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@35645 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4bc8763f12
commit
4d7ff1de4a
5 changed files with 24 additions and 55 deletions
|
@ -63,13 +63,11 @@
|
|||
{
|
||||
id object;
|
||||
void *data;
|
||||
NSRect viewRect;
|
||||
}
|
||||
- (void*) data;
|
||||
- (id) initWithObject: (id)o userData: (void*)d rect: (NSRect)r;
|
||||
- (id) initWithObject: (id)o userData: (void*)d;
|
||||
- (id) object;
|
||||
- (void) setObject: (id)o;
|
||||
- (NSRect) viewRect;
|
||||
@end
|
||||
|
||||
@implementation GSTTProvider
|
||||
|
@ -82,10 +80,9 @@
|
|||
[self setObject: nil];
|
||||
[super dealloc];
|
||||
}
|
||||
- (id) initWithObject: (id)o userData: (void*)d rect: (NSRect)r
|
||||
- (id) initWithObject: (id)o userData: (void*)d
|
||||
{
|
||||
data = d;
|
||||
viewRect = r;
|
||||
[self setObject: o];
|
||||
return self;
|
||||
}
|
||||
|
@ -116,10 +113,6 @@
|
|||
object = [[object description] copy];
|
||||
}
|
||||
}
|
||||
- (NSRect) viewRect
|
||||
{
|
||||
return viewRect;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface GSTTPanel : NSPanel
|
||||
|
@ -233,8 +226,7 @@ static BOOL restoreMouseMoved;
|
|||
}
|
||||
|
||||
provider = [[GSTTProvider alloc] initWithObject: anObject
|
||||
userData: data
|
||||
rect: aRect];
|
||||
userData: data];
|
||||
tag = [view addTrackingRect: aRect
|
||||
owner: self
|
||||
userData: provider
|
||||
|
@ -350,35 +342,6 @@ static BOOL restoreMouseMoved;
|
|||
[window setFrameOrigin: origin];
|
||||
}
|
||||
|
||||
- (void) rebuild
|
||||
{
|
||||
NSEnumerator *enumerator;
|
||||
GSTrackingRect *rect;
|
||||
|
||||
enumerator = [((NSViewPtr)view)->_tracking_rects objectEnumerator];
|
||||
while ((rect = [enumerator nextObject]) != nil)
|
||||
{
|
||||
if (rect->owner == self)
|
||||
{
|
||||
GSTTProvider *provider = (GSTTProvider *)rect->user_data;
|
||||
NSRect frame;
|
||||
|
||||
if (rect->tag == toolTipTag)
|
||||
{
|
||||
frame = [view bounds];
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIXME is this the thing to do with tooltips other than
|
||||
// the main one (which we know should cover the whole view)?
|
||||
frame = [provider viewRect];
|
||||
}
|
||||
frame = [view convertRect: frame toView: nil];
|
||||
[rect reset: frame inside: NO];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) removeAllToolTips
|
||||
{
|
||||
NSEnumerator *enumerator;
|
||||
|
@ -461,8 +424,7 @@ static BOOL restoreMouseMoved;
|
|||
|
||||
rect = [view bounds];
|
||||
provider = [[GSTTProvider alloc] initWithObject: string
|
||||
userData: nil
|
||||
rect: rect];
|
||||
userData: nil];
|
||||
toolTipTag = [view addTrackingRect: rect
|
||||
owner: self
|
||||
userData: provider
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue