mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-31 05:00:35 +00:00
working on scripted menus; video works
dealloc -> release This is an imperfect revision of history.
This commit is contained in:
parent
c366bd7826
commit
73e45cc8ee
13 changed files with 455 additions and 78 deletions
|
@ -13,7 +13,7 @@
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
[picture dealloc];
|
||||
[picture release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ integer HUDHandleClass;
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
[origin dealloc];
|
||||
[origin release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ integer HUDHandleClass;
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
[picture dealloc];
|
||||
[picture release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ integer HUDHandleClass;
|
|||
|
||||
- (void) setFile: (string) _file
|
||||
{
|
||||
[picture dealloc];
|
||||
[picture release];
|
||||
picture = [[QPic alloc] initName :_file];
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ integer HUDHandleClass;
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
[frames dealloc];
|
||||
[frames release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ GZ=
|
|||
endif
|
||||
STRIP=$(shell echo `echo -n $(srcdir)/ | sed -e 's/[^/]//g' | wc -c`)
|
||||
|
||||
menu_data=menu.dat$(GZ)
|
||||
menu_data=menu.dat$(GZ) menu.plist
|
||||
|
||||
if BUILD_RUAMOKO
|
||||
data=$(menu_data)
|
||||
|
@ -46,5 +46,6 @@ EXTRA_DIST= $(menu_src) \
|
|||
Frame.h HUD.h \
|
||||
client_menu.h controls_o.h \
|
||||
menu.h options.h \
|
||||
options_util.h servlist.h
|
||||
options_util.h servlist.h \
|
||||
menu.plist
|
||||
CLEANFILES= *.dat *.sym *.gz *.qfo
|
||||
|
|
135
ruamoko/cl_menu/menu.plist
Normal file
135
ruamoko/cl_menu/menu.plist
Normal file
|
@ -0,0 +1,135 @@
|
|||
{
|
||||
video_options = {
|
||||
Class = MenuGroup;
|
||||
Messages = (
|
||||
(initWithBounds:, $rect),
|
||||
(addViews:, $views),
|
||||
(setBase:, 4)
|
||||
);
|
||||
rect = "[0, 0, 320, 200]";
|
||||
views = (
|
||||
{
|
||||
Class = Pic;
|
||||
Messages = (
|
||||
(initWithBounds:, $rect),
|
||||
(setPic:, "\"gfx/qplaque.lmp\"")
|
||||
);
|
||||
rect = "[16, 4, 0, 0]";
|
||||
},
|
||||
{
|
||||
Class = CenterPic;
|
||||
Messages = (
|
||||
(initWithBounds:, $rect),
|
||||
(setPic:, "\"gfx/p_option.lmp\"")
|
||||
);
|
||||
rect = "[160, 4, 0, 0]";
|
||||
},
|
||||
{
|
||||
Class = Text;
|
||||
Messages = (
|
||||
(initWithBounds:, $rect),
|
||||
(setText:, "\"Video\"")
|
||||
);
|
||||
rect = "[54, 40, 40, 8]";
|
||||
},
|
||||
{
|
||||
Class = Text;
|
||||
Messages = (
|
||||
(initWithBounds:, $rect),
|
||||
(setText:, "\"-----\"")
|
||||
);
|
||||
rect = "[54, 50, 40, 8]";
|
||||
},
|
||||
{
|
||||
Class = CvarToggleView;
|
||||
Messages = (
|
||||
(initWithBounds:title::, $rect, "\"Fullscreen\"", $toggle)
|
||||
);
|
||||
rect = "[70, 60, 224, 8]";
|
||||
toggle = {
|
||||
Class = CvarToggle;
|
||||
Messages = (
|
||||
(initWithCvar:, "\"vid_fullscreen\"")
|
||||
);
|
||||
};
|
||||
},
|
||||
{
|
||||
Class = Text;
|
||||
Messages = (
|
||||
(initWithBounds:, $rect),
|
||||
(setText:, "\"Crosshair\"")
|
||||
);
|
||||
rect = "[70, 70, 224, 8]";
|
||||
},
|
||||
{
|
||||
Class = CrosshairView;
|
||||
crosshair = {
|
||||
Class = CrosshairCvar;
|
||||
Messages = (
|
||||
(initWithCvar:, "\"crosshair\"")
|
||||
);
|
||||
};
|
||||
rect = "[256, 67, 14, 14]";
|
||||
Messages = (
|
||||
(initWithBounds::, $rect, $crosshair)
|
||||
);
|
||||
},
|
||||
{
|
||||
Class = CvarToggleView;
|
||||
Messages = (
|
||||
(initWithBounds:title::, $rect, "\"Show FPS\"", $toggle)
|
||||
);
|
||||
rect = "[70, 80, 224, 8]";
|
||||
toggle = {
|
||||
Class = CvarToggle;
|
||||
Messages = (
|
||||
(initWithCvar:, "\"hud_fps\"")
|
||||
);
|
||||
};
|
||||
},
|
||||
{
|
||||
Class = CvarToggleView;
|
||||
Messages = (
|
||||
(initWithBounds:title::, $rect, "\"Show time\"", $toggle)
|
||||
);
|
||||
rect = "[70, 90, 224, 8]";
|
||||
toggle = {
|
||||
Class = CvarToggle;
|
||||
Messages = (
|
||||
(initWithCvar:, "\"hud_time\"")
|
||||
);
|
||||
};
|
||||
},
|
||||
{
|
||||
Class = CvarRangeView;
|
||||
Messages = (
|
||||
(initWithBounds:title:sliderWidth::,
|
||||
$rect, "\"Gamma\"", 136, $range)
|
||||
);
|
||||
rect = "[70, 100, 224, 8]";
|
||||
range = {
|
||||
Class = CvarRange;
|
||||
Messages = (
|
||||
(initWithCvar:min:max:step:,
|
||||
"\"vid_gamma\"", 0.4, 3.0, 0.1)
|
||||
);
|
||||
};
|
||||
},
|
||||
{
|
||||
Class = CvarRangeView;
|
||||
Messages = (
|
||||
(initWithBounds:title:sliderWidth::,
|
||||
$rect, "\"Viewsize\"", 112, $range)
|
||||
);
|
||||
rect = "[70, 110, 224, 8]";
|
||||
range = {
|
||||
Class = CvarRange;
|
||||
Messages = (
|
||||
(initWithCvar:min:max:step:,
|
||||
"\"viewsize\"", 30.0, 120.0, 10.0)
|
||||
);
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
|
@ -34,6 +34,9 @@
|
|||
#include "key.h"
|
||||
#include "controls_o.h"
|
||||
#include "options_util.h"
|
||||
#include "qfs.h"
|
||||
|
||||
#include "PropertyList.h"
|
||||
|
||||
#include "gui/InputLine.h"
|
||||
#include "gui/Pic.h"
|
||||
|
@ -155,10 +158,132 @@ DRAW_video_options =
|
|||
[video_options setBasePos:x y:y];
|
||||
[video_options draw];
|
||||
|
||||
opt_cursor (x + 62, y + (Menu_GetIndex () * 10) + 60);
|
||||
return 1;
|
||||
};
|
||||
|
||||
void dprint (string str) = #0;
|
||||
|
||||
integer (integer key, integer unicode, integer down)
|
||||
KEY_video_options =
|
||||
{
|
||||
return [video_options keyEvent:key unicode:unicode down:down];
|
||||
}
|
||||
|
||||
id object_from_plist (PLItem plist);
|
||||
|
||||
id
|
||||
class_from_plist (PLDictionary pldict)
|
||||
{
|
||||
local @param [8]params;
|
||||
local @va_list va_list = { 0, params };
|
||||
local string classname, selname, paramstr;
|
||||
local Class class;
|
||||
local id obj;
|
||||
local PLArray messages, msg;
|
||||
local integer message_count, i, j;
|
||||
local SEL sel;
|
||||
local PLItem item;
|
||||
|
||||
classname = [(PLString) [pldict getObjectForKey:"Class"] string];
|
||||
class = obj_lookup_class (classname);
|
||||
if (!class) {
|
||||
dprint ("could not find " + classname + "\n");
|
||||
return NIL;
|
||||
}
|
||||
obj = [class alloc];
|
||||
|
||||
messages = (PLArray) [pldict getObjectForKey:"Messages"];
|
||||
message_count = [messages count];
|
||||
for (i = 0; i < message_count; i++) {
|
||||
msg = (PLArray) [messages getObjectAtIndex:i];
|
||||
selname = [(PLString) [msg getObjectAtIndex:0] string];
|
||||
sel = sel_get_uid (selname);
|
||||
va_list.count = [msg count] - 1;
|
||||
for (j = 0; j < va_list.count; j++) {
|
||||
paramstr = [(PLString) [msg getObjectAtIndex:j + 1] string];
|
||||
switch (str_mid (paramstr, 0, 1)) {
|
||||
case "\"":
|
||||
va_list.list[j].string_val = str_mid (paramstr, 1, -1);
|
||||
break;
|
||||
case "$":
|
||||
item = [pldict getObjectForKey:str_mid (paramstr, 1)];
|
||||
va_list.list[j].pointer_val = object_from_plist (item);
|
||||
break;
|
||||
case "0": case "1": case "2": case "3": case "4":
|
||||
case "5": case "6": case "7": case "8": case "9":
|
||||
if (str_str (paramstr, "."))
|
||||
va_list.list[j].float_val = stof (paramstr);
|
||||
else
|
||||
va_list.list[j].integer_val = stoi (paramstr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
obj_msg_sendv (obj, sel, va_list);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
id
|
||||
array_from_plist (PLArray plarray)
|
||||
{
|
||||
local Array array;
|
||||
local integer i, count;
|
||||
|
||||
array = [[Array alloc] init];
|
||||
count = [plarray count];
|
||||
for (i = 0; i < count; i++)
|
||||
[array addItem: object_from_plist ([plarray getObjectAtIndex:i])];
|
||||
return array;
|
||||
}
|
||||
|
||||
id
|
||||
string_from_plist (PLString plstring)
|
||||
{
|
||||
local string str = [plstring string];
|
||||
local string tmp;
|
||||
local integer xp, yp, xl, yl;
|
||||
local PLItem item;
|
||||
|
||||
if (str_mid (str, 0, 1) == "[") {
|
||||
tmp = "(" + str_mid (str, 1, -1) + ")";
|
||||
item = [PLItem newFromString:tmp];
|
||||
xp = stoi ([(PLString) [item getObjectAtIndex:0] string]);
|
||||
yp = stoi ([(PLString) [item getObjectAtIndex:1] string]);
|
||||
xl = stoi ([(PLString) [item getObjectAtIndex:2] string]);
|
||||
yl = stoi ([(PLString) [item getObjectAtIndex:3] string]);
|
||||
return [[Rect alloc] initWithComponents:xp :yp :xl :yl];
|
||||
}
|
||||
return NIL;
|
||||
}
|
||||
|
||||
id
|
||||
object_from_plist (PLItem plist)
|
||||
{
|
||||
switch ([plist type]) {
|
||||
case QFDictionary:
|
||||
return class_from_plist ((PLDictionary) plist);
|
||||
case QFArray:
|
||||
return array_from_plist ((PLArray) plist);
|
||||
case QFBinary:
|
||||
return NIL;
|
||||
case QFString:
|
||||
return string_from_plist ((PLString) plist);
|
||||
}
|
||||
}
|
||||
|
||||
PLItem read_plist (void)
|
||||
{
|
||||
local string plist_data, l;
|
||||
local QFile file;
|
||||
|
||||
file = QFS_OpenFile ("menu.plist");
|
||||
plist_data = "";
|
||||
while ((l = Qgetline (file)))
|
||||
plist_data += l;
|
||||
Qclose (file);
|
||||
return [PLItem newFromString:plist_data];
|
||||
}
|
||||
|
||||
/*
|
||||
MENU_video_options
|
||||
|
||||
|
@ -167,74 +292,17 @@ DRAW_video_options =
|
|||
void ()
|
||||
MENU_video_options =
|
||||
{
|
||||
local integer bar_pad;
|
||||
local Rect rect, r;
|
||||
local id view;
|
||||
local PLItem plist;
|
||||
|
||||
Menu_Begin (54, 50, "Video");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_Draw (DRAW_video_options);
|
||||
Menu_KeyEvent (KEY_video_options);
|
||||
|
||||
video_options = [[Group alloc] initWithComponents:0 :0 :320 :200];
|
||||
plist = read_plist ();
|
||||
|
||||
view = [[Pic alloc] initWithComponents:16 :4 :0 :0];
|
||||
[view setPic:"gfx/qplaque.lmp"];
|
||||
[video_options addView:view];
|
||||
video_options = object_from_plist ([plist getObjectForKey:"video_options"]);
|
||||
|
||||
view = [[CenterPic alloc] initWithComponents:160 :4 :0 :0];
|
||||
[view setPic:"gfx/p_option.lmp"];
|
||||
[video_options addView:view];
|
||||
|
||||
view = [[Text alloc] initWithComponents:54 :40 :40 :8];
|
||||
[view setText:"Video"];
|
||||
[video_options addView:view];
|
||||
|
||||
view = [[Text alloc] initWithComponents:54 :50 :40 :8];
|
||||
[view setText:"-----"];
|
||||
[video_options addView:view];
|
||||
|
||||
rect = [[Rect alloc] initWithComponents:70 :60 :224 :8];
|
||||
fullscreen_view = [[CvarToggleView alloc] initWithBounds:rect title:"Fullscreen" :[[CvarToggle alloc] initWithCvar:"vid_fullscreen"]];
|
||||
[video_options addView:fullscreen_view];
|
||||
|
||||
rect.origin.y += 10;
|
||||
view = [[Text alloc] initWithBounds:rect];
|
||||
[view setText:"Crosshair"];
|
||||
[video_options addView:view];
|
||||
r = [[Rect alloc] initWithComponents: 0 :rect.origin.y - 3 :14 :14];
|
||||
r.origin.x = rect.origin.x + rect.size.width - 24 - r.size.width;
|
||||
crosshair_view = [[CrosshairView alloc] initWithBounds:r :[[CrosshairCvar alloc] initWithCvar:"crosshair"]];
|
||||
[r dealloc];
|
||||
[video_options addView:crosshair_view];
|
||||
|
||||
rect.origin.y += 10;
|
||||
fps_view = [[CvarToggleView alloc] initWithBounds:rect title:"Show FPS" :[[CvarToggle alloc] initWithCvar:"hud_fps"]];
|
||||
[video_options addView:fps_view];
|
||||
|
||||
|
||||
rect.origin.y += 10;
|
||||
time_view = [[CvarToggleView alloc] initWithBounds:rect title:"Show time" :[[CvarToggle alloc] initWithCvar:"hud_time"]];
|
||||
[video_options addView:time_view];
|
||||
|
||||
|
||||
rect.origin.y += 10;
|
||||
gamma_view = [[CvarRangeView alloc] initWithBounds:rect title:"Gamma:" sliderWidth:17 * 8 :[[CvarRange alloc] initWithCvar:"vid_gamma" min:MIN_GAMMA max:MAX_GAMMA step:GAMMA_STEP]];
|
||||
[video_options addView:gamma_view];
|
||||
|
||||
rect.origin.y += 10;
|
||||
viewsize_view = [[CvarRangeView alloc] initWithBounds:rect title:"Viewsize:" sliderWidth:14 * 8 :[[CvarRange alloc] initWithCvar:"viewsize" min:MIN_VIEWSIZE max:MAX_VIEWSIZE step:VIEWSIZE_STEP]];
|
||||
[video_options addView:viewsize_view];
|
||||
|
||||
[rect dealloc];
|
||||
|
||||
Menu_Item (54, 60, "fullscreen", CB_video_options, 0);
|
||||
Menu_Item (54, 70, "crosshair", CB_video_options, 0);
|
||||
Menu_Item (54, 80, "fps", CB_video_options, 0);
|
||||
Menu_Item (54, 80, "time", CB_video_options, 0);
|
||||
bar_pad = 90;
|
||||
|
||||
Menu_Item (54, bar_pad + 10, "gamma", CB_video_options, 1);
|
||||
Menu_Item (54, bar_pad + 20, "viewsize", CB_video_options, 1);
|
||||
Menu_End ();
|
||||
};
|
||||
|
||||
|
@ -326,7 +394,7 @@ MENU_audio_options =
|
|||
bgmvolume_view = [[CvarRangeView alloc] initWithBounds:rect title:"Music :" sliderWidth:14 * 8 :[[CvarRange alloc] initWithCvar:"bgmvolume" min:MIN_VOLUME max:MAX_VOLUME step:VOLUME_STEP]];
|
||||
[audio_options addView:bgmvolume_view];
|
||||
|
||||
[rect dealloc];
|
||||
[rect release];
|
||||
|
||||
bar_pad = 0;
|
||||
Menu_Item (54, bar_pad + 10, "volume", CB_audio_options, 1);
|
||||
|
@ -461,7 +529,7 @@ MENU_control_options =
|
|||
lookstrafe_view = [[CvarToggleView alloc] initWithBounds:rect title:"Lookstrafe" :[[CvarToggle alloc] initWithCvar:"lookstrafe"]];
|
||||
[control_options addView:lookstrafe_view];
|
||||
|
||||
[rect dealloc];
|
||||
[rect release];
|
||||
|
||||
MENU_control_binding ();
|
||||
|
||||
|
@ -559,7 +627,7 @@ MENU_feature_options =
|
|||
fraglog_view = [[CvarToggleView alloc] initWithBounds:rect title:"Frag Logging" :[[CvarToggle alloc] initWithCvar:"cl_fraglog"]];
|
||||
[feature_options addView:fraglog_view];
|
||||
|
||||
[rect dealloc];
|
||||
[rect release];
|
||||
|
||||
Menu_Item (54, 70, "cl_autorecord", CB_feature_options, 0);
|
||||
Menu_Item (54, 80, "cl_fraglog", CB_feature_options, 0);
|
||||
|
@ -766,7 +834,7 @@ MENU_player_options =
|
|||
bottomcolor_view = [[CvarColorView alloc] initWithBounds:rect :[[CvarColor alloc] initWithCvar:"bottomcolor"]];
|
||||
[player_options addView:bottomcolor_view];
|
||||
|
||||
[rect dealloc];
|
||||
[rect release];
|
||||
|
||||
Menu_Begin (54, 80, "Player");
|
||||
Menu_FadeScreen (1);
|
||||
|
|
|
@ -6,6 +6,14 @@
|
|||
@class Text;
|
||||
@class Slider;
|
||||
|
||||
@interface MenuGroup : Group
|
||||
{
|
||||
integer base;
|
||||
integer current;
|
||||
}
|
||||
-(void)setBase:(integer)b;
|
||||
@end
|
||||
|
||||
@interface CvarObject : Object
|
||||
{
|
||||
string name;
|
||||
|
@ -85,6 +93,13 @@
|
|||
-(void) next;
|
||||
@end
|
||||
|
||||
@interface ProxyView : View
|
||||
{
|
||||
View view;
|
||||
}
|
||||
-(id)initWithBounds:(Rect)aRect title:(string)_title view:(View)aView;
|
||||
@end
|
||||
|
||||
|
||||
@extern void (integer x, integer y) opt_cursor;
|
||||
@extern void (integer x, integer y, integer spacing, string spacechar, string label, string valstr) draw_item;
|
||||
|
|
|
@ -28,12 +28,72 @@
|
|||
#include "draw.h"
|
||||
#include "system.h"
|
||||
#include "string.h"
|
||||
#include "key.h"
|
||||
|
||||
#include "Array.h"
|
||||
#include "gui/Text.h"
|
||||
#include "gui/Rect.h"
|
||||
#include "gui/Slider.h"
|
||||
#include "options_util.h"
|
||||
|
||||
@implementation MenuGroup
|
||||
-(id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
current = base = 0;
|
||||
}
|
||||
|
||||
-(void)setBase:(integer)b
|
||||
{
|
||||
if (b >= [views count])
|
||||
b = [views count] - 1;
|
||||
if (b < 0)
|
||||
b = 0;
|
||||
current = base = b;
|
||||
}
|
||||
|
||||
- (integer) keyEvent:(integer)key unicode:(integer)unicode down:(integer)down
|
||||
{
|
||||
switch (key) {
|
||||
case QFK_DOWN:
|
||||
case QFM_WHEEL_DOWN:
|
||||
[self next];
|
||||
return 1;
|
||||
case QFK_UP:
|
||||
case QFM_WHEEL_UP:
|
||||
[self prev];
|
||||
return 1;
|
||||
default:
|
||||
return [[views getItemAt:current]
|
||||
keyEvent:key
|
||||
unicode:unicode
|
||||
down:down];
|
||||
}
|
||||
}
|
||||
|
||||
-(void) next
|
||||
{
|
||||
if (++current >= [views count])
|
||||
current = base;
|
||||
}
|
||||
|
||||
-(void) prev
|
||||
{
|
||||
if (--current < base)
|
||||
current = [views count] - 1;
|
||||
}
|
||||
|
||||
- (void) draw
|
||||
{
|
||||
local View cur;
|
||||
|
||||
[super draw];
|
||||
cur = (View) [views getItemAt:current];
|
||||
opt_cursor (cur.xabs - 8, cur.yabs);
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@implementation CvarObject
|
||||
-(id)init
|
||||
{
|
||||
|
@ -137,6 +197,18 @@
|
|||
[self update];
|
||||
}
|
||||
|
||||
- (integer) keyEvent:(integer)key unicode:(integer)unicode down:(integer)down
|
||||
{
|
||||
switch (key) {
|
||||
case QFK_RETURN:
|
||||
case QFM_BUTTON1:
|
||||
[self toggle];
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CvarColor
|
||||
|
@ -187,6 +259,20 @@
|
|||
Draw_Fill (xabs + 8, yabs + 8, xl * 8, ylen - 16,
|
||||
[color value] * 16 + 8);
|
||||
}
|
||||
|
||||
- (integer) keyEvent:(integer)key unicode:(integer)unicode down:(integer)down
|
||||
{
|
||||
switch (key) {
|
||||
case QFK_DOWN:
|
||||
case QFM_WHEEL_DOWN:
|
||||
[self next];
|
||||
return 1;
|
||||
case QFK_UP:
|
||||
case QFM_WHEEL_UP:
|
||||
[self prev];
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation CvarRange
|
||||
|
@ -280,6 +366,18 @@
|
|||
[self update];
|
||||
}
|
||||
|
||||
- (integer) keyEvent:(integer)key unicode:(integer)unicode down:(integer)down
|
||||
{
|
||||
switch (key) {
|
||||
case QFK_RIGHT:
|
||||
[self inc];
|
||||
return 1;
|
||||
case QFK_LEFT:
|
||||
[self dec];
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CrosshairCvar
|
||||
|
@ -317,6 +415,37 @@
|
|||
Draw_Fill (xabs, yabs, xlen, ylen, 0);
|
||||
Draw_Crosshair ([crosshair crosshair], xabs + xlen / 2, yabs + ylen / 2);
|
||||
}
|
||||
|
||||
- (integer) keyEvent:(integer)key unicode:(integer)unicode down:(integer)down
|
||||
{
|
||||
switch (key) {
|
||||
case QFK_RETURN:
|
||||
case QFM_BUTTON1:
|
||||
[self next];
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation ProxyView
|
||||
|
||||
-(id)initWithBounds:(Rect)aRect title:(string)_title view:(View)aView
|
||||
{
|
||||
self = [super initWidthBounds:aRect text:_title];
|
||||
if (!self)
|
||||
return self;
|
||||
|
||||
view = aView;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (integer) keyEvent:(integer)key unicode:(integer)unicode down:(integer)down
|
||||
{
|
||||
return [view keyEvent:key unicode:unicode down:down];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
/*
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
[views dealloc];
|
||||
[views release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,13 @@
|
|||
return aView;
|
||||
}
|
||||
|
||||
- (id) addViews: (Array)viewlist
|
||||
{
|
||||
while ([viewlist count])
|
||||
[self addView:[viewlist removeItemAt:0]];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) moveTo: (integer)x y:(integer)y
|
||||
{
|
||||
[self setBasePos: x y:y];
|
||||
|
@ -33,7 +40,7 @@
|
|||
[super setBasePos:pos];
|
||||
local Point point = [[Point alloc] initWithComponents:xabs :yabs];
|
||||
[views makeObjectsPerformSelector:@selector (setBasePos:) withObject:point];
|
||||
[point dealloc];
|
||||
[point release];
|
||||
}
|
||||
|
||||
- (void) draw
|
||||
|
|
|
@ -92,7 +92,7 @@ string (inputline_t il) InputLine_GetText = #0;
|
|||
yl = aRect.size.height;
|
||||
r = [[Rect alloc] initWithComponents:xp :yp :xl :yl];
|
||||
input_line = [[InputLine alloc] initWithBounds:r promptCharacter:char];
|
||||
[r dealloc];
|
||||
[r release];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,11 +27,22 @@
|
|||
return [self initWithOrigin:aRect.origin size:aRect.size];
|
||||
}
|
||||
|
||||
- (id) canFocus: (integer) cf
|
||||
{
|
||||
flags |= 1;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (integer) canFocus
|
||||
{
|
||||
return flags & 1;
|
||||
}
|
||||
|
||||
- (void) setBasePos: (integer) x y: (integer) y
|
||||
{
|
||||
local Point point = [[Point alloc] initWithComponents:x :y];
|
||||
[self setBasePos:point];
|
||||
[point dealloc];
|
||||
[point release];
|
||||
}
|
||||
|
||||
- (void) setBasePos: (Point)pos
|
||||
|
@ -44,4 +55,9 @@
|
|||
{
|
||||
}
|
||||
|
||||
- (integer) keyEvent:(integer)key unicode:(integer)unicode down:(integer)down
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
}
|
||||
- (void) dealloc;
|
||||
- (View) addView: (View)aView;
|
||||
- (id) addViews: (Array)viewlist;
|
||||
- (void) moveTo: (integer)x y:(integer)y;
|
||||
- (void) setBasePos: (Point)pos;
|
||||
- (void) draw;
|
||||
|
|
|
@ -14,14 +14,19 @@
|
|||
integer xlen, ylen;
|
||||
integer xabs, yabs;
|
||||
View parent;
|
||||
integer flags;
|
||||
}
|
||||
|
||||
- (id) initWithComponents: (integer)x : (integer)y : (integer)w : (integer)h;
|
||||
- (id) initWithOrigin: (Point)anOrigin size: (Size)aSize;
|
||||
- (id) initWithBounds: (Rect)aRect;
|
||||
- (id) canFocus: (integer)cf;
|
||||
- (integer) canFocus;
|
||||
- (void) setBasePos: (integer)x y: (integer)y;
|
||||
- (void) setBasePos: (Point)pos;
|
||||
- (void) draw;
|
||||
|
||||
- (integer) keyEvent:(integer)key unicode:(integer)unicode down:(integer)down;
|
||||
@end
|
||||
|
||||
#endif //__ruamoko_gui_View_h
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
{
|
||||
local integer i;
|
||||
for (i = 0; i < count; i++)
|
||||
[array[i] dealloc];
|
||||
[array[i] release];
|
||||
obj_free (array);
|
||||
[super dealloc];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue