1996-05-30 20:03:15 +00:00
|
|
|
/*
|
1998-12-09 01:26:37 +00:00
|
|
|
GSTrackingRect.m
|
1996-05-30 20:03:15 +00:00
|
|
|
|
|
|
|
Tracking rectangle class
|
|
|
|
|
|
|
|
Copyright (C) 1996 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Author: Scott Christley <scottc@net-community.com>
|
|
|
|
Date: 1996
|
|
|
|
|
|
|
|
This file is part of the GNUstep GUI Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
1996-10-18 17:14:13 +00:00
|
|
|
License along with this library; see the file COPYING.LIB.
|
|
|
|
If not, write to the Free Software Foundation,
|
|
|
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1996-05-30 20:03:15 +00:00
|
|
|
*/
|
|
|
|
|
1997-09-23 22:43:24 +00:00
|
|
|
#include <gnustep/gui/config.h>
|
1998-12-09 01:26:37 +00:00
|
|
|
#include <gnustep/gui/GSTrackingRect.h>
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1998-12-09 01:26:37 +00:00
|
|
|
@implementation GSTrackingRect
|
1996-05-30 20:03:15 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Class methods
|
|
|
|
//
|
1999-03-25 21:23:32 +00:00
|
|
|
+ (void) initialize
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-03-25 21:23:32 +00:00
|
|
|
if (self == [GSTrackingRect class])
|
|
|
|
{
|
|
|
|
[self setVersion: 1];
|
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Instance methods
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Initialization
|
|
|
|
//
|
1999-03-25 21:23:32 +00:00
|
|
|
- initWithRect: (NSRect)aRect
|
|
|
|
tag: (NSTrackingRectTag)aTag
|
|
|
|
owner: anObject
|
|
|
|
userData: (void *)theData
|
|
|
|
inside: (BOOL)flag
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-03-25 21:23:32 +00:00
|
|
|
rectangle = aRect;
|
|
|
|
tag = aTag;
|
|
|
|
owner = anObject;
|
1999-05-06 19:36:54 +00:00
|
|
|
if (owner)
|
1999-05-07 11:06:37 +00:00
|
|
|
{
|
|
|
|
[owner retain];
|
|
|
|
if ([owner respondsToSelector: @selector(mouseEntered:)])
|
|
|
|
ownerRespondsToMouseEntered = YES;
|
|
|
|
if ([owner respondsToSelector: @selector(mouseExited:)])
|
|
|
|
ownerRespondsToMouseExited = YES;
|
|
|
|
}
|
1999-03-25 21:23:32 +00:00
|
|
|
user_data = theData;
|
|
|
|
inside = flag;
|
|
|
|
isValid = YES;
|
|
|
|
return self;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-03-02 08:58:30 +00:00
|
|
|
- (void) dealloc
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-05-06 19:36:54 +00:00
|
|
|
if (owner)
|
|
|
|
[owner release];
|
1999-03-02 08:58:30 +00:00
|
|
|
[super dealloc];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-03-02 08:58:30 +00:00
|
|
|
- (NSRect) rectangle
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-03-02 08:58:30 +00:00
|
|
|
return rectangle;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-03-25 21:23:32 +00:00
|
|
|
- (NSTrackingRectTag) tag
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-03-02 08:58:30 +00:00
|
|
|
return tag;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- owner
|
|
|
|
{
|
1999-03-25 21:23:32 +00:00
|
|
|
return owner;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void *) userData
|
|
|
|
{
|
|
|
|
return user_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) inside
|
|
|
|
{
|
|
|
|
return inside;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-03-25 21:23:32 +00:00
|
|
|
- (BOOL) isValid
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-03-25 21:23:32 +00:00
|
|
|
return isValid;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-03-25 21:23:32 +00:00
|
|
|
- (void) invalidate
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-03-25 21:23:32 +00:00
|
|
|
if (isValid)
|
|
|
|
{
|
|
|
|
isValid = NO;
|
1999-05-06 19:36:54 +00:00
|
|
|
if (owner)
|
|
|
|
{
|
|
|
|
[owner release];
|
|
|
|
owner = nil;
|
1999-05-07 11:06:37 +00:00
|
|
|
ownerRespondsToMouseEntered = NO;
|
|
|
|
ownerRespondsToMouseExited = NO;
|
1999-05-06 19:36:54 +00:00
|
|
|
}
|
1999-03-25 21:23:32 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// NSCoding protocol
|
|
|
|
//
|
1999-03-02 08:58:30 +00:00
|
|
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-03-02 08:58:30 +00:00
|
|
|
[aCoder encodeRect: rectangle];
|
|
|
|
[aCoder encodeValueOfObjCType: @encode(NSTrackingRectTag) at: &tag];
|
|
|
|
[aCoder encodeObject: owner];
|
|
|
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &inside];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-03-02 08:58:30 +00:00
|
|
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-03-02 08:58:30 +00:00
|
|
|
rectangle = [aDecoder decodeRect];
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(NSTrackingRectTag) at: &tag];
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &owner];
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &inside];
|
|
|
|
return self;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|