1 #include "commandbutton.qh"
2 #ifndef COMMANDBUTTON_CLOSE
3 # define COMMANDBUTTON_CLOSE 1
4 # define COMMANDBUTTON_APPLY 2
5 //# define COMMANDBUTTON_REVERT 4
8 #ifndef COMMANDBUTTON_H
9 #define COMMANDBUTTON_H
11 CLASS(XonoticCommandButton, XonoticButton)
12 METHOD(XonoticCommandButton, configureXonoticCommandButton, void(entity, string, vector, string, float, string));
13 ATTRIB(XonoticCommandButton, onClickCommand, string, string_null)
14 ATTRIB(XonoticCommandButton, flags, float, 0)
15 ENDCLASS(XonoticCommandButton)
16 entity makeXonoticCommandButton_T(string theText, vector theColor, string theCommand, float closesMenu, string theTooltip);
17 entity makeXonoticCommandButton(string theText, vector theColor, string theCommand, float closesMenu);
21 entity makeXonoticCommandButton_T(string theText, vector theColor, string theCommand, float theFlags, string theTooltip)
24 me = NEW(XonoticCommandButton);
25 me.configureXonoticCommandButton(me, theText, theColor, theCommand, theFlags, theTooltip);
28 entity makeXonoticCommandButton(string theText, vector theColor, string theCommand, float theFlags)
30 return makeXonoticCommandButton_T(theText, theColor, theCommand, theFlags, string_null);
33 void XonoticCommandButton_Click(entity me, entity other)
35 //if(me.flags & COMMANDBUTTON_APPLY)
36 // saveAllCvars(me.parent);
37 cmd("\n", me.onClickCommand, "\n");
38 //if(me.flags & COMMANDBUTTON_REVERT)
39 // loadAllCvars(me.parent);
40 if(me.flags & COMMANDBUTTON_CLOSE)
44 void XonoticCommandButton_configureXonoticCommandButton(entity me, string theText, vector theColor, string theCommand, float theFlags, string theTooltip)
46 me.configureXonoticButton(me, theText, theColor, theTooltip);
47 me.onClickCommand = theCommand;
49 me.onClick = XonoticCommandButton_Click;
50 me.onClickEntity = me;