[qwaq] Use forwarding for some text methods

refresh won't be in the drawing buffer protocol, and the move commands
need to be offset by the view's position in its window, but it works as
intended.
This commit is contained in:
Bill Currie 2020-03-10 02:58:30 +09:00
parent 4b7d5447bb
commit f9d798c314
2 changed files with 15 additions and 15 deletions

View File

@ -59,12 +59,16 @@ enum {
-redraw;
- (void) refresh;
- (void) printf: (string) fmt, ...;
- (void) vprintf: (string) fmt, @va_list args;
- (void) addch: (int) ch;
- (void) mvprintf: (Point) pos, string fmt, ...;
- (void) mvvprintf: (Point) pos, string fmt, @va_list args;
- (void) mvaddch: (Point) pos, int ch;
@end
//These are forwarded (FIXME make a protocol)
@interface View (TextContext)
- (void) printf: (string) fmt, ...;
- (void) vprintf: (string) fmt, @va_list args;
- (void) addch: (int) ch;
@end
#endif//__qwaq_view_h

View File

@ -89,14 +89,15 @@ updateScreenCursor (View *view)
return ▭
}
- (void) printf: (string) fmt, ...
- (void) forward: (SEL) sel : (@va_list) args
{
[textContext vprintf: fmt, @args];
}
- (void) vprintf: (string) fmt, @va_list args
{
[textContext vprintf: fmt, args];
if (!textContext) {
return;
}
if (!__obj_responds_to (textContext, sel)) {
[self error: "no implementation for %s", sel_get_name (sel)];
}
obj_msg_sendv (textContext, sel, args);
}
- (void) refresh
@ -104,11 +105,6 @@ updateScreenCursor (View *view)
[textContext refresh];
}
- (void) addch: (int) ch
{
[textContext addch:ch];
}
- (void) mvprintf: (Point) pos, string fmt, ...
{
pos.x += xpos;