2020-02-29 15:40:55 +00:00
|
|
|
#include "qwaq-curses.h"
|
|
|
|
#include "qwaq-view.h"
|
|
|
|
|
|
|
|
Rect
|
|
|
|
makeRect (int xpos, int ypos, int xlen, int ylen)
|
|
|
|
{
|
|
|
|
Rect rect = {xpos, ypos, xlen, ylen};
|
|
|
|
return rect;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
rectContainsPoint (Rect *rect, Point *point)
|
|
|
|
{
|
|
|
|
return ((point.x >= rect.xpos && point.x < rect.xpos + rect.xlen)
|
|
|
|
&& (point.y >= rect.ypos && point.y < rect.ypos + rect.ylen));
|
|
|
|
}
|
|
|
|
|
|
|
|
@implementation View
|
|
|
|
|
|
|
|
-initWithRect: (Rect) rect
|
|
|
|
{
|
|
|
|
if (!(self = [super init])) {
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
self.rect = rect;
|
|
|
|
self.absRect = rect;
|
2020-03-01 09:25:02 +00:00
|
|
|
self.window = nil;
|
2020-02-29 15:40:55 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2020-03-02 06:22:54 +00:00
|
|
|
-draw
|
2020-02-29 15:40:55 +00:00
|
|
|
{
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2020-03-03 12:30:47 +00:00
|
|
|
-setParent: parent
|
|
|
|
{
|
|
|
|
self.parent = parent;
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
-redraw
|
|
|
|
{
|
|
|
|
return [parent redraw];
|
|
|
|
}
|
|
|
|
|
2020-02-29 15:40:55 +00:00
|
|
|
@end
|
|
|
|
|
|
|
|
Rect getwrect (window_t window) = #0;
|