]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/dialog_settings_input_userbind.qc
menu: #undef IMPLEMENTATION
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / dialog_settings_input_userbind.qc
1 #include "dialog_settings_input_userbind.qh"
2
3 #include "keybinder.qh"
4 #include "textlabel.qh"
5 #include "inputbox.qh"
6 #include "button.qh"
7
8 void XonoticUserbindEditDialog_Save(entity btn, entity me)
9 {
10         me.keybindBox.editUserbind(me.keybindBox, me.nameBox.text, me.commandPressBox.text, me.commandReleaseBox.text);
11         Dialog_Close(btn, me);
12 }
13
14 void XonoticUserbindEditDialog_loadUserBind(entity me, string theName, string theCommandPress, string theCommandRelease)
15 {
16         me.nameBox.setText(me.nameBox, theName);
17                 me.nameBox.keyDown(me.nameBox, K_END, 0, 0);
18         me.commandPressBox.setText(me.commandPressBox, theCommandPress);
19                 me.nameBox.keyDown(me.commandPressBox, K_END, 0, 0);
20         me.commandReleaseBox.setText(me.commandReleaseBox, theCommandRelease);
21                 me.nameBox.keyDown(me.commandReleaseBox, K_END, 0, 0);
22 }
23
24 void XonoticUserbindEditDialog_fill(entity me)
25 {
26         entity e;
27         me.TR(me);
28                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Name:")));
29                 me.TD(me, 1, me.columns - 1, me.nameBox = makeXonoticInputBox(0, string_null));
30         me.TR(me);
31                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Command when pressed:")));
32                 me.TD(me, 1, me.columns - 1, me.commandPressBox = makeXonoticInputBox(0, string_null));
33         me.TR(me);
34                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Command when released:")));
35                 me.TD(me, 1, me.columns - 1, me.commandReleaseBox = makeXonoticInputBox(0, string_null));
36         me.TR(me);
37                 me.TD(me, 1, me.columns / 2, e = makeXonoticButton(_("Save"), '0 0 0'));
38                         e.onClick = XonoticUserbindEditDialog_Save;
39                         e.onClickEntity = me;
40                 me.TD(me, 1, me.columns / 2, e = makeXonoticButton(_("Cancel"), '0 0 0'));
41                         e.onClick = Dialog_Close;
42                         e.onClickEntity = me;
43 }