Fix the bindings menus.

That was a lot easier than I expected.
This commit is contained in:
Bill Currie 2011-07-10 18:58:50 +09:00
parent 15cb8849c3
commit ef8b1821d2
5 changed files with 68 additions and 7 deletions

View file

@ -33,7 +33,7 @@ menu_src= \
CrosshairCvar.r CrosshairView.r CvarColor.r CvarColorView.r \ CrosshairCvar.r CrosshairView.r CvarColor.r CvarColorView.r \
CvarObject.r CvarRange.r CvarRangeView.r CvarString.r CvarStringView.r \ CvarObject.r CvarRange.r CvarRangeView.r CvarString.r CvarStringView.r \
CvarToggle.r CvarToggleView.r \ CvarToggle.r CvarToggleView.r \
MenuGroup.r MouseToggle.r ProxyView.r RunToggle.r MenuGroup.r MouseToggle.r ProxyView.r RunToggle.r SubMenu.r
%.qfo: %.r %.qfo: %.r
$(QFCC) $(QCFLAGS) $(QCPPFLAGS) -c -o $@ $< $(QFCC) $(QCFLAGS) $(QCPPFLAGS) -c -o $@ $<
@ -52,7 +52,7 @@ EXTRA_DIST= $(menu_src) \
CrosshairCvar.h CrosshairView.h CvarColor.h CvarColorView.h CvarObject.h \ CrosshairCvar.h CrosshairView.h CvarColor.h CvarColorView.h CvarObject.h \
CvarRange.h CvarRangeView.h CvarString.h CvarStringView.h \ CvarRange.h CvarRangeView.h CvarString.h CvarStringView.h \
CvarToggle.h CvarToggleView.h Frame.h HUD.h \ CvarToggle.h CvarToggleView.h Frame.h HUD.h \
MenuGroup.h MouseToggle.h ProxyView.h RunToggle.h client_menu.h \ MenuGroup.h MouseToggle.h ProxyView.h RunToggle.h SubMenu.h client_menu.h \
controls_o.h menu.h options.h options_util.h plistmenu.h servlist.h \ controls_o.h menu.h options.h options_util.h plistmenu.h servlist.h \
menu.plist menu.plist
CLEANFILES= *.dat *.sym *.gz *.qfo CLEANFILES= *.dat *.sym *.gz *.qfo

14
ruamoko/cl_menu/SubMenu.h Normal file
View file

@ -0,0 +1,14 @@
#ifndef __SubMenu_h
#define __SubMenu_h
#include "gui/View.h"
@interface SubMenu : View
{
View *title;
string menu_name;
}
-(id)initWithBounds:(Rect)aRect title:(View*)aTitle menu:(string)name;
@end
#endif//__SubMenu_h

39
ruamoko/cl_menu/SubMenu.r Normal file
View file

@ -0,0 +1,39 @@
#include "key.h"
#include "menu.h"
#include "SubMenu.h"
@implementation SubMenu
-(id)initWithBounds:(Rect)aRect title:(View *)aTitle menu:(string)name
{
self = [super initWithBounds:aRect];
if (!self)
return self;
title = aTitle;
menu_name = name;
return self;
}
- (int) keyEvent:(int)key unicode:(int)unicode down:(int)down
{
if (key == QFK_RETURN) {
Menu_SelectMenu (menu_name);
return 1;
}
return 0;
}
- (void) draw
{
[title draw];
}
- (void) setBasePosFromView: (View *) aview
{
[super setBasePosFromView:aview];
[title setBasePosFromView:self];
}
@end

View file

@ -41,12 +41,20 @@
rect = "[54, 50, 64, 8]"; rect = "[54, 50, 64, 8]";
}, },
{ {
Class = SubMenu;
Messages = (
(initWithBounds:title:menu:, $rect, $title,
"\"Bindings\""),
);
rect = "[70, 60, 64, 8]";
title = {
Class = Text; Class = Text;
Messages = ( Messages = (
(initWithBounds:, $rect), (initWithBounds:, $rect),
(setText:, "\"Bindings\"") (setText:, "\"Bindings\"")
); );
rect = "[70, 60, 64, 8]"; rect = "[0, 0, 64, 8]";
};
}, },
{ {
Class = CvarToggleView; Class = CvarToggleView;

View file

@ -199,7 +199,7 @@ DRAW_control_options =
[control_options setBasePos:x y:y]; [control_options setBasePos:x y:y];
[control_options draw]; [control_options draw];
return 1; return 0;
}; };
int (int key, int unicode, int down) int (int key, int unicode, int down)
@ -227,8 +227,8 @@ MENU_control_options (PLItem *plist)
control_options = ret.pointer_val; control_options = ret.pointer_val;
} }
MENU_control_binding (); //FIXME how to hook in the bindings menu?
Menu_End (); Menu_End ();
//MENU_control_binding (); FIXME how to hook in the bindings menu?
}; };
/*********************************************** /***********************************************