]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/menu-div0test/nexuiz/commandbutton.c
tabbed dialog
[divverent/nexuiz.git] / data / qcsrc / menu-div0test / nexuiz / commandbutton.c
1 #ifdef INTERFACE
2 CLASS(NexuizCommandButton) EXTENDS(NexuizButton)
3         METHOD(NexuizCommandButton, configureNexuizCommandButton, void(entity, string, vector, string, float))
4         ATTRIB(NexuizCommandButton, onClickCommand, string, "")
5         ATTRIB(NexuizCommandButton, closes, float, 0)
6 ENDCLASS(NexuizCommandButton)
7 entity makeNexuizCommandButton(string theText, vector theColor, string theCommand, float closesMenu);
8 #endif
9
10 #ifdef IMPLEMENTATION
11 entity makeNexuizCommandButton(string theText, vector theColor, string theCommand, float closesMenu)
12 {
13         entity me;
14         me = spawnNexuizCommandButton();
15         me.configureNexuizCommandButton(me, theText, theColor, theCommand, closesMenu);
16         return me;
17 }
18
19 void NexuizCommandButton_Click(entity me, entity other)
20 {
21         cmd("\n", me.onClickCommand, "\n");
22         if(me.closes)
23         {
24                 m_goto("");
25         }
26 }
27
28 void configureNexuizCommandButtonNexuizCommandButton(entity me, string theText, vector theColor, string theCommand, float closesMenu)
29 {
30         me.configureNexuizButton(me, theText, theColor);
31         me.onClickCommand = theCommand;
32         me.closes = closesMenu;
33         me.onClick = NexuizCommandButton_Click;
34         me.onClickEntity = me;
35 }
36 #endif