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
10 CLASS(XonoticCommandButton, XonoticButton)
11 METHOD(XonoticCommandButton, configureXonoticCommandButton, void(entity, string, vector, string, float));
12 ATTRIB(XonoticCommandButton, onClickCommand, string, string_null)
13 ATTRIB(XonoticCommandButton, flags, float, 0)
14 ENDCLASS(XonoticCommandButton)
15 entity makeXonoticCommandButton(string theText, vector theColor, string theCommand, float closesMenu);
19 entity makeXonoticCommandButton(string theText, vector theColor, string theCommand, float theFlags)
22 me = NEW(XonoticCommandButton);
23 me.configureXonoticCommandButton(me, theText, theColor, theCommand, theFlags);
27 void XonoticCommandButton_Click(entity me, entity other)
29 //if(me.flags & COMMANDBUTTON_APPLY)
30 // saveAllCvars(me.parent);
31 cmd("\n", me.onClickCommand, "\n");
32 //if(me.flags & COMMANDBUTTON_REVERT)
33 // loadAllCvars(me.parent);
34 if(me.flags & COMMANDBUTTON_CLOSE)
38 void XonoticCommandButton_configureXonoticCommandButton(entity me, string theText, vector theColor, string theCommand, float theFlags)
40 me.configureXonoticButton(me, theText, theColor);
41 me.onClickCommand = theCommand;
43 me.onClick = XonoticCommandButton_Click;
44 me.onClickEntity = me;