2020-06-21 14:15:17 +00:00
|
|
|
#include "ruamoko/qwaq/ui/group.h"
|
|
|
|
#include "ruamoko/qwaq/ui/proxyview.h"
|
2020-03-24 12:02:54 +00:00
|
|
|
|
|
|
|
@implementation ProxyView
|
2020-03-30 07:30:58 +00:00
|
|
|
+(ProxyView *)withView:(View *)view
|
|
|
|
{
|
|
|
|
return [[[self alloc] initWithView:view] autorelease];
|
|
|
|
}
|
|
|
|
|
2020-03-24 12:02:54 +00:00
|
|
|
- (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;
|
|
|
|
}
|
2020-03-30 07:30:58 +00:00
|
|
|
self.view = [view retain];
|
2020-03-24 12:02:54 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2020-03-26 05:46:48 +00:00
|
|
|
-setOwner:(Group *)owner
|
|
|
|
{
|
|
|
|
self.owner = owner;
|
|
|
|
return [view setOwner:owner];
|
|
|
|
}
|
|
|
|
|
2020-03-24 12:02:54 +00:00
|
|
|
-setView:(View *) view
|
|
|
|
{
|
|
|
|
int state = [self.view state];
|
2020-03-26 04:20:10 +00:00
|
|
|
|
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-30 16:22:54 +00:00
|
|
|
[self.view setOwner:nil];
|
2020-03-24 12:02:54 +00:00
|
|
|
|
2020-03-30 07:30:58 +00:00
|
|
|
[view retain];
|
|
|
|
[self.view release];
|
2020-03-24 12:02:54 +00:00
|
|
|
self.view = view;
|
2020-03-30 07:30:58 +00:00
|
|
|
|
2020-03-30 16:22:54 +00:00
|
|
|
[view setOwner:owner];
|
2020-03-26 05:46:48 +00:00
|
|
|
[view setContext:[owner context]];
|
2020-03-24 12:02:54 +00:00
|
|
|
if (state & sfDrawn) {
|
|
|
|
[view draw];
|
|
|
|
}
|
|
|
|
if (state & sfInFocus) {
|
|
|
|
[view takeFocus];
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
@end
|