2004-02-03 08:31:26 +00:00
|
|
|
#include "gui/Size.h"
|
|
|
|
#include "gui/Point.h"
|
|
|
|
#include "gui/Rect.h"
|
|
|
|
#include "gui/View.h"
|
|
|
|
|
|
|
|
@implementation View
|
|
|
|
|
2011-03-25 07:46:32 +00:00
|
|
|
- (id) initWithComponents: (int)x : (int)y : (int)w : (int)h
|
2004-02-03 08:31:26 +00:00
|
|
|
{
|
2004-02-13 02:51:38 +00:00
|
|
|
self = [self init];
|
2004-02-03 08:31:26 +00:00
|
|
|
xpos = xabs = x;
|
|
|
|
ypos = yabs = y;
|
|
|
|
xlen = w;
|
2004-02-13 05:36:35 +00:00
|
|
|
ylen = h;
|
2011-01-14 03:07:40 +00:00
|
|
|
parent = nil;
|
2004-02-03 08:31:26 +00:00
|
|
|
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];
|
|
|
|
}
|
|
|
|
|
2011-03-25 07:46:32 +00:00
|
|
|
- (id) canFocus: (int) cf
|
2004-11-18 05:08:00 +00:00
|
|
|
{
|
|
|
|
flags |= 1;
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2011-03-25 07:46:32 +00:00
|
|
|
- (int) canFocus
|
2004-11-18 05:08:00 +00:00
|
|
|
{
|
|
|
|
return flags & 1;
|
|
|
|
}
|
|
|
|
|
2010-11-17 09:59:39 +00:00
|
|
|
- (Point) basePos
|
|
|
|
{
|
|
|
|
return makePoint (xabs, yabs);
|
|
|
|
}
|
|
|
|
|
2011-03-25 07:46:32 +00:00
|
|
|
- (void) setBasePos: (int) x y: (int) y
|
2004-02-03 08:31:26 +00:00
|
|
|
{
|
2010-11-17 06:50:07 +00:00
|
|
|
local Point point = {x, y};
|
2010-11-17 09:59:39 +00:00
|
|
|
xabs = xpos + x;
|
|
|
|
yabs = ypos + y;
|
2004-02-04 02:35:57 +00:00
|
|
|
}
|
|
|
|
|
2011-02-14 13:13:55 +00:00
|
|
|
- (void) setBasePosFromView: (View *) view
|
2004-02-04 02:35:57 +00:00
|
|
|
{
|
2010-11-17 09:59:39 +00:00
|
|
|
Point pos = [view basePos];
|
2004-02-04 02:35:57 +00:00
|
|
|
xabs = xpos + pos.x;
|
|
|
|
yabs = ypos + pos.y;
|
2004-02-03 08:31:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
-(void) draw
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-03-25 07:46:32 +00:00
|
|
|
- (int) keyEvent:(int)key unicode:(int)unicode down:(int)down
|
2004-11-18 05:08:00 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-02-03 08:31:26 +00:00
|
|
|
@end
|