quakeforge/ruamoko/gui/View.r

70 lines
1 KiB
R
Raw Normal View History

#include <gui/Size.h>
#include <gui/Point.h>
#include <gui/Rect.h>
#include <gui/View.h>
@implementation View
- (id) initWithComponents: (int)x : (int)y : (int)w : (int)h
{
self = [self init];
xpos = xabs = x;
ypos = yabs = y;
xlen = w;
ylen = h;
2011-01-14 03:07:40 +00:00
parent = nil;
return self;
}
- (id) initWithOrigin: (Point)anOrigin size: (Size)aSize
{
return [self initWithComponents:anOrigin.x :anOrigin.y
:aSize.width :aSize.height];
}
- (id) initWithBounds: (Rect)aRect
{
return [self initWithOrigin:aRect.origin size:aRect.size];
}
- (id) canFocus: (int) cf
{
flags |= 1;
return self;
}
- (int) canFocus
{
return flags & 1;
}
- (Point) basePos
{
return makePoint (xabs, yabs);
}
- (void) setBasePos: (int) x y: (int) y
{
local Point point = {x, y};
xabs = xpos + x;
yabs = ypos + y;
2004-02-04 02:35:57 +00:00
}
- (void) setBasePosFromView: (View *) view
2004-02-04 02:35:57 +00:00
{
Point pos = [view basePos];
2004-02-04 02:35:57 +00:00
xabs = xpos + pos.x;
yabs = ypos + pos.y;
}
-(void) draw
{
}
- (int) keyEvent:(int)key unicode:(int)unicode down:(int)down
{
return 0;
}
@end