1 #ifndef COMMANDBUTTON_CLOSE
2 # define COMMANDBUTTON_CLOSE 1
3 # define COMMANDBUTTON_APPLY 2
4 //# define COMMANDBUTTON_REVERT 4
7 #ifndef COMMANDBUTTON_H
8 #define COMMANDBUTTON_H
9 CLASS(XonoticCommandButton, XonoticButton)
10 METHOD(XonoticCommandButton, configureXonoticCommandButton, void(entity, string, vector, string, float))
11 ATTRIB(XonoticCommandButton, onClickCommand, string, string_null)
12 ATTRIB(XonoticCommandButton, flags, float, 0)
13 ENDCLASS(XonoticCommandButton)
14 entity makeXonoticCommandButton(string theText, vector theColor, string theCommand, float closesMenu);
18 entity makeXonoticCommandButton(string theText, vector theColor, string theCommand, float theFlags)
21 me = NEW(XonoticCommandButton);
22 me.configureXonoticCommandButton(me, theText, theColor, theCommand, theFlags);
26 void XonoticCommandButton_Click(entity me, entity other)
28 //if(me.flags & COMMANDBUTTON_APPLY)
29 // saveAllCvars(me.parent);
30 cmd("\n", me.onClickCommand, "\n");
31 //if(me.flags & COMMANDBUTTON_REVERT)
32 // loadAllCvars(me.parent);
33 if(me.flags & COMMANDBUTTON_CLOSE)
37 void XonoticCommandButton_configureXonoticCommandButton(entity me, string theText, vector theColor, string theCommand, float theFlags)
39 me.configureXonoticButton(me, theText, theColor);
40 me.onClickCommand = theCommand;
42 me.onClick = XonoticCommandButton_Click;
43 me.onClickEntity = me;