2020-03-24 12:02:54 +00:00
|
|
|
#include "qwaq-proxyview.h"
|
|
|
|
|
|
|
|
@implementation ProxyView
|
|
|
|
- (void) forward: (SEL) sel : (@va_list) args
|
|
|
|
{
|
|
|
|
if (!view) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
obj_msg_sendv (view, sel, args);
|
|
|
|
}
|
|
|
|
|
|
|
|
-initWithView:(View *) view
|
|
|
|
{
|
|
|
|
if (!(self = [super init])) {
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
self.view = view;
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
-setView:(View *) view
|
|
|
|
{
|
|
|
|
int state = [self.view state];
|
2020-03-26 04:20:10 +00:00
|
|
|
id<TextContext> context = [self.view context];
|
|
|
|
|
2020-03-24 12:02:54 +00:00
|
|
|
if (state & sfInFocus) {
|
|
|
|
[self.view loseFocus];
|
|
|
|
}
|
2020-03-26 04:20:10 +00:00
|
|
|
[self.view hide];
|
|
|
|
[self.view setContext:nil];
|
2020-03-24 12:02:54 +00:00
|
|
|
|
|
|
|
self.view = view;
|
2020-03-26 04:20:10 +00:00
|
|
|
[view setContext:context];
|
2020-03-24 12:02:54 +00:00
|
|
|
if (state & sfDrawn) {
|
|
|
|
[view draw];
|
|
|
|
}
|
|
|
|
if (state & sfInFocus) {
|
|
|
|
[view takeFocus];
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
@end
|