]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/commandbutton.qc
Merge branch 'master' into terencehill/translated_keys
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / commandbutton.qc
1 #include "commandbutton.qh"
2
3 entity makeXonoticCommandButton_T(string theText, vector theColor, string theCommand, float theFlags, string theTooltip)
4 {
5         entity me;
6         me = NEW(XonoticCommandButton);
7         me.configureXonoticCommandButton(me, theText, theColor, theCommand, theFlags, theTooltip);
8         return me;
9 }
10 entity makeXonoticCommandButton(string theText, vector theColor, string theCommand, float theFlags)
11 {
12         return makeXonoticCommandButton_T(theText, theColor, theCommand, theFlags, string_null);
13 }
14
15 void XonoticCommandButton_Click(entity me, entity other)
16 {
17         //if(me.flags & COMMANDBUTTON_APPLY)
18         //      saveAllCvars(me.parent);
19         cmd("\n", me.onClickCommand, "\n");
20         //if(me.flags & COMMANDBUTTON_REVERT)
21         //      loadAllCvars(me.parent);
22         if(me.flags & COMMANDBUTTON_CLOSE)
23                 m_goto(string_null);
24 }
25
26 void XonoticCommandButton_configureXonoticCommandButton(entity me, string theText, vector theColor, string theCommand, float theFlags, string theTooltip)
27 {
28         me.configureXonoticButton(me, theText, theColor, theTooltip);
29         me.onClickCommand = theCommand;
30         me.flags = theFlags;
31         me.onClick = XonoticCommandButton_Click;
32         me.onClickEntity = me;
33 }