2004-02-03 08:31:26 +00:00
|
|
|
#include "gui/Size.h"
|
2002-08-17 06:47:03 +00:00
|
|
|
|
|
|
|
@implementation Size
|
|
|
|
|
|
|
|
- (id) initWithComponents: (integer)w : (integer)h
|
|
|
|
{
|
2004-02-13 02:51:38 +00:00
|
|
|
self = [self init];
|
2002-08-17 06:47:03 +00:00
|
|
|
width = w;
|
|
|
|
height = h;
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initWithSize: (Size)aSize
|
|
|
|
{
|
2004-02-13 02:51:38 +00:00
|
|
|
self = [self init];
|
2002-08-17 06:47:03 +00:00
|
|
|
|
|
|
|
if (!self || !aSize)
|
|
|
|
return NIL;
|
|
|
|
|
|
|
|
width = [aSize width];
|
|
|
|
height = [aSize height];
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) copy
|
|
|
|
{
|
|
|
|
local id myCopy = [super copy];
|
|
|
|
|
|
|
|
if (!myCopy)
|
|
|
|
myCopy = [[self class] alloc];
|
|
|
|
|
|
|
|
return [myCopy initWithComponents: width : height];
|
|
|
|
}
|
|
|
|
|
2003-04-22 15:48:39 +00:00
|
|
|
- (integer) width
|
2002-08-17 06:47:03 +00:00
|
|
|
{
|
|
|
|
return width;
|
|
|
|
}
|
|
|
|
|
2003-04-22 15:48:39 +00:00
|
|
|
- (integer) height
|
2002-08-17 06:47:03 +00:00
|
|
|
{
|
|
|
|
return height;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setSize: (Size)aSize
|
|
|
|
{
|
|
|
|
width = [aSize width];
|
|
|
|
height = [aSize height];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setWidth: (integer) w
|
|
|
|
{
|
|
|
|
width = w;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setHeight: (integer) h
|
|
|
|
{
|
|
|
|
height = h;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) addSize: (Size)aSize
|
|
|
|
{
|
|
|
|
width += [aSize width];
|
|
|
|
height += [aSize height];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) subtractSize: (Size)aSize
|
|
|
|
{
|
|
|
|
width += [aSize width];
|
|
|
|
height += [aSize height];
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|