]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/menu/nexuiz/dialog_settings_input_userbind.c
add a multi-cvar single-value tgo the text slider
[divverent/nexuiz.git] / data / qcsrc / menu / nexuiz / dialog_settings_input_userbind.c
1 #ifdef INTERFACE
2 CLASS(NexuizUserbindEditDialog) EXTENDS(NexuizDialog)
3         METHOD(NexuizUserbindEditDialog, loadUserBind, void(entity, string, string, string))
4         METHOD(NexuizUserbindEditDialog, fill, void(entity))
5         ATTRIB(NexuizUserbindEditDialog, title, string, "User defined key bind")
6         ATTRIB(NexuizUserbindEditDialog, color, vector, SKINCOLOR_DIALOG_USERBIND)
7         ATTRIB(NexuizUserbindEditDialog, intendedWidth, float, 0.7)
8         ATTRIB(NexuizUserbindEditDialog, rows, float, 4)
9         ATTRIB(NexuizUserbindEditDialog, columns, float, 3)
10         ATTRIB(NexuizUserbindEditDialog, keybindBox, entity, NULL)
11
12         ATTRIB(NexuizUserbindEditDialog, nameBox, entity, NULL)
13         ATTRIB(NexuizUserbindEditDialog, commandPressBox, entity, NULL)
14         ATTRIB(NexuizUserbindEditDialog, commandReleaseBox, entity, NULL)
15 ENDCLASS(NexuizUserbindEditDialog)
16 #endif
17
18 #ifdef IMPLEMENTATION
19 void NexuizUserbindEditDialog_Save(entity btn, entity me)
20 {
21         me.keybindBox.editUserbind(me.keybindBox, me.nameBox.text, me.commandPressBox.text, me.commandReleaseBox.text);
22         Dialog_Close(btn, me);
23 }
24
25 void loadUserBindNexuizUserbindEditDialog(entity me, string theName, string theCommandPress, string theCommandRelease)
26 {
27         me.nameBox.setText(me.nameBox, theName);
28                 me.nameBox.keyDown(me.nameBox, K_END, 0, 0);
29         me.commandPressBox.setText(me.commandPressBox, theCommandPress);
30                 me.nameBox.keyDown(me.commandPressBox, K_END, 0, 0);
31         me.commandReleaseBox.setText(me.commandReleaseBox, theCommandRelease);
32                 me.nameBox.keyDown(me.commandReleaseBox, K_END, 0, 0);
33 }
34
35 void fillNexuizUserbindEditDialog(entity me)
36 {
37         entity e;
38         me.TR(me);
39                 me.TD(me, 1, 1, e = makeNexuizTextLabel(0, "Name:"));
40                 me.TD(me, 1, me.columns - 1, me.nameBox = makeNexuizInputBox(0, string_null));
41         me.TR(me);
42                 me.TD(me, 1, 1, e = makeNexuizTextLabel(0, "Command when pressed:"));
43                 me.TD(me, 1, me.columns - 1, me.commandPressBox = makeNexuizInputBox(0, string_null));
44         me.TR(me);
45                 me.TD(me, 1, 1, e = makeNexuizTextLabel(0, "Command when released:"));
46                 me.TD(me, 1, me.columns - 1, me.commandReleaseBox = makeNexuizInputBox(0, string_null));
47         me.TR(me);
48                 me.TD(me, 1, me.columns / 2, e = makeNexuizButton("Save", '0 0 0'));
49                         e.onClick = NexuizUserbindEditDialog_Save;
50                         e.onClickEntity = me;
51                 me.TD(me, 1, me.columns / 2, e = makeNexuizButton("Cancel", '0 0 0'));
52                         e.onClick = Dialog_Close;
53                         e.onClickEntity = me;
54 }
55 #endif