2024-11-14 14:55:44 -07:00
|
|
|
/* -*- c++ -*- */
|
2024-11-14 15:16:41 -07:00
|
|
|
|
|
|
|
|
#include <cstdlib>
|
2024-11-14 14:55:44 -07:00
|
|
|
#include <stdio.h>
|
|
|
|
|
#include "view.h"
|
|
|
|
|
|
|
|
|
|
@implementation CTView
|
|
|
|
|
|
|
|
|
|
-(BOOL)acceptsFirstResponder
|
|
|
|
|
{
|
|
|
|
|
printf ("acceptsFirstResponder\n");
|
|
|
|
|
return YES;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-(void) timedUpdate
|
|
|
|
|
{
|
|
|
|
|
printf ("ping\n");
|
2024-11-14 15:16:41 -07:00
|
|
|
NSRect rect = NSMakeRect (random() % 100, random() % 100, random() % 400, random() % 400);
|
|
|
|
|
[self setNeedsDisplayInRect:rect];
|
2024-11-14 14:55:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-(BOOL)becomeFirstResponder
|
|
|
|
|
{
|
|
|
|
|
printf ("becomeFirstResponder\n");
|
|
|
|
|
return YES;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-(BOOL)resignFirstResponder
|
|
|
|
|
{
|
|
|
|
|
printf ("resignFirstResponder\n");
|
|
|
|
|
return YES;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-(void) keyDown: (NSEvent *) theEvent
|
|
|
|
|
{
|
|
|
|
|
printf ("keyDown\n");
|
|
|
|
|
[self interpretKeyEvents: [NSArray arrayWithObject: theEvent]];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-(void)noop: (id)sender
|
|
|
|
|
{
|
|
|
|
|
printf ("noop\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-(BOOL)isFlipped
|
|
|
|
|
{
|
|
|
|
|
return YES;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-(void)drawRect: (NSRect)rect
|
|
|
|
|
{
|
|
|
|
|
printf ("here we are!\n");
|
2024-11-14 15:16:41 -07:00
|
|
|
printf ("%g, %g %g x %g\n", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
|
|
|
|
|
|
|
|
|
|
const NSRect *drawn_rects;
|
|
|
|
|
NSInteger count;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
[self getRectsBeingDrawn: &drawn_rects count: &count];
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < count; i++) {
|
|
|
|
|
printf ("rect %d: %g, %g %g x %g\n", i, drawn_rects[i].origin.x, drawn_rects[i].origin.y, drawn_rects[i].size.width, drawn_rects[i].size.height);
|
|
|
|
|
}
|
2024-11-14 14:55:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|