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, string));
12 ATTRIB(XonoticCommandButton, onClickCommand, string, string_null)
13 ATTRIB(XonoticCommandButton, flags, float, 0)
14 ENDCLASS(XonoticCommandButton)
15 entity makeXonoticCommandButton_T(string theText, vector theColor, string theCommand, float closesMenu, string theTooltip);
16 entity makeXonoticCommandButton(string theText, vector theColor, string theCommand, float closesMenu);
20 entity makeXonoticCommandButton_T(string theText, vector theColor, string theCommand, float theFlags, string theTooltip)
23 me = NEW(XonoticCommandButton);
24 me.configureXonoticCommandButton(me, theText, theColor, theCommand, theFlags, theTooltip);
27 entity makeXonoticCommandButton(string theText, vector theColor, string theCommand, float theFlags)
29 return makeXonoticCommandButton_T(theText, theColor, theCommand, theFlags, string_null);
32 void XonoticCommandButton_Click(entity me, entity other)
34 //if(me.flags & COMMANDBUTTON_APPLY)
35 // saveAllCvars(me.parent);
36 cmd("\n", me.onClickCommand, "\n");
37 //if(me.flags & COMMANDBUTTON_REVERT)
38 // loadAllCvars(me.parent);
39 if(me.flags & COMMANDBUTTON_CLOSE)
43 void XonoticCommandButton_configureXonoticCommandButton(entity me, string theText, vector theColor, string theCommand, float theFlags, string theTooltip)
45 me.configureXonoticButton(me, theText, theColor, theTooltip);
46 me.onClickCommand = theCommand;
48 me.onClick = XonoticCommandButton_Click;
49 me.onClickEntity = me;