mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
[qwaq] Add a proxy view class
The idea is that the view can be switched out readily: the proxy simply passes all messages to its view object.
This commit is contained in:
parent
05e377c3ac
commit
fd0700f9ae
3 changed files with 56 additions and 0 deletions
|
@ -32,6 +32,7 @@ qwaq_app_dat_src= \
|
||||||
qwaq-garray.r \
|
qwaq-garray.r \
|
||||||
qwaq-group.r \
|
qwaq-group.r \
|
||||||
qwaq-listener.r \
|
qwaq-listener.r \
|
||||||
|
qwaq-proxyview.r \
|
||||||
qwaq-rect.r \
|
qwaq-rect.r \
|
||||||
qwaq-screen.r \
|
qwaq-screen.r \
|
||||||
qwaq-textcontext.r \
|
qwaq-textcontext.r \
|
||||||
|
|
17
ruamoko/qwaq/qwaq-proxyview.h
Normal file
17
ruamoko/qwaq/qwaq-proxyview.h
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef __qwaq_proxyview_h
|
||||||
|
#define __qwaq_proxyview_h
|
||||||
|
|
||||||
|
#include "qwaq-view.h"
|
||||||
|
|
||||||
|
@interface ProxyView : Object
|
||||||
|
{
|
||||||
|
View *view;
|
||||||
|
}
|
||||||
|
-initWithView:(View *) view;
|
||||||
|
-setView: (View *) view;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface ProxyView (View) <View, TextContext>
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif//__qwaq_proxyview_h
|
38
ruamoko/qwaq/qwaq-proxyview.r
Normal file
38
ruamoko/qwaq/qwaq-proxyview.r
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#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];
|
||||||
|
if (state & sfInFocus) {
|
||||||
|
[self.view loseFocus];
|
||||||
|
[self.view hide];
|
||||||
|
}
|
||||||
|
|
||||||
|
self.view = view;
|
||||||
|
if (state & sfDrawn) {
|
||||||
|
[view draw];
|
||||||
|
}
|
||||||
|
if (state & sfInFocus) {
|
||||||
|
[view takeFocus];
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
@end
|
Loading…
Reference in a new issue