]> de.git.xonotic.org Git - voretournament/voretournament.git/blob - data/qcsrc/menu/voret/listbox.c
Initial checkout of Vore Tournament 0.1.alpha.
[voretournament/voretournament.git] / data / qcsrc / menu / voret / listbox.c
1 #ifdef INTERFACE\r
2 CLASS(VoretListBox) EXTENDS(ListBox)\r
3         METHOD(VoretListBox, configureVoretListBox, void(entity))\r
4         ATTRIB(VoretListBox, fontSize, float, SKINFONTSIZE_NORMAL)\r
5         ATTRIB(VoretListBox, scrollbarWidth, float, SKINWIDTH_SCROLLBAR)\r
6         ATTRIB(VoretListBox, src, string, SKINGFX_SCROLLBAR)\r
7         ATTRIB(VoretListBox, tolerance, vector, SKINTOLERANCE_SLIDER)\r
8         ATTRIB(VoretListBox, rowsPerItem, float, 1)\r
9         METHOD(VoretListBox, resizeNotify, void(entity, vector, vector, vector, vector))\r
10         ATTRIB(VoretListBox, color, vector, SKINCOLOR_SCROLLBAR_N)\r
11         ATTRIB(VoretListBox, colorF, vector, SKINCOLOR_SCROLLBAR_F)\r
12         ATTRIB(VoretListBox, color2, vector, SKINCOLOR_SCROLLBAR_S)\r
13         ATTRIB(VoretListBox, colorC, vector, SKINCOLOR_SCROLLBAR_C)\r
14         ATTRIB(VoretListBox, colorBG, vector, SKINCOLOR_LISTBOX_BACKGROUND)\r
15         ATTRIB(VoretListBox, alphaBG, float, SKINALPHA_LISTBOX_BACKGROUND)\r
16 ENDCLASS(VoretListBox)\r
17 entity makeVoretListBox();\r
18 #endif\r
19 \r
20 #ifdef IMPLEMENTATION\r
21 entity makeVoretListBox()\r
22 {\r
23         entity me;\r
24         me = spawnVoretListBox();\r
25         me.configureVoretListBox(me);\r
26         return me;\r
27 }\r
28 void configureVoretListBoxVoretListBox(entity me)\r
29 {\r
30         me.configureListBox(me, me.scrollbarWidth, 1); // item height gets set up later\r
31 }\r
32 void resizeNotifyVoretListBox(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)\r
33 {\r
34         me.itemHeight = me.rowsPerItem * me.fontSize / absSize_y;\r
35         resizeNotifyListBox(me, relOrigin, relSize, absOrigin, absSize);\r
36 }\r
37 #endif\r