mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-21 09:51:41 +00:00
[qwaq] Get context from owner instead of prev view
The previous view might be nil, which would result in the new view not getting a context.
This commit is contained in:
parent
e018f5cf71
commit
e893421dba
4 changed files with 24 additions and 2 deletions
|
@ -18,6 +18,8 @@
|
|||
id<TextContext> context;
|
||||
}
|
||||
-initWithContext: (id<TextContext>) context owner: (View *) owner;
|
||||
-(id<TextContext>)context;
|
||||
-setContext: (id<TextContext>) context;
|
||||
-insert: (View *) view;
|
||||
-insertDrawn: (View *) view;
|
||||
-insertSelected: (View *) view;
|
||||
|
|
|
@ -24,6 +24,17 @@
|
|||
[views release];
|
||||
}
|
||||
|
||||
-(id<TextContext>)context
|
||||
{
|
||||
return context;
|
||||
}
|
||||
|
||||
-setContext: (id<TextContext>) context
|
||||
{
|
||||
self.context = context;
|
||||
return self;
|
||||
}
|
||||
|
||||
-insert: (View *) view
|
||||
{
|
||||
[views addObject: view];
|
||||
|
|
|
@ -3,9 +3,12 @@
|
|||
|
||||
#include "qwaq-view.h"
|
||||
|
||||
@class Group;
|
||||
|
||||
@interface ProxyView : Object
|
||||
{
|
||||
View *view;
|
||||
Group *owner;
|
||||
}
|
||||
-initWithView:(View *) view;
|
||||
-setView: (View *) view;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include "qwaq-group.h"
|
||||
#include "qwaq-proxyview.h"
|
||||
|
||||
@implementation ProxyView
|
||||
|
@ -18,10 +19,15 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
-setOwner:(Group *)owner
|
||||
{
|
||||
self.owner = owner;
|
||||
return [view setOwner:owner];
|
||||
}
|
||||
|
||||
-setView:(View *) view
|
||||
{
|
||||
int state = [self.view state];
|
||||
id<TextContext> context = [self.view context];
|
||||
|
||||
if (state & sfInFocus) {
|
||||
[self.view loseFocus];
|
||||
|
@ -30,7 +36,7 @@
|
|||
[self.view setContext:nil];
|
||||
|
||||
self.view = view;
|
||||
[view setContext:context];
|
||||
[view setContext:[owner context]];
|
||||
if (state & sfDrawn) {
|
||||
[view draw];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue