]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/listbox.qc
Merge branch 'master' into Mario/monsters_broken
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / listbox.qc
1 #ifndef LISTBOX_H
2 #define LISTBOX_H
3 #include "../item/listbox.qc"
4 CLASS(XonoticListBox, ListBox)
5         METHOD(XonoticListBox, configureXonoticListBox, void(entity));
6         ATTRIB(XonoticListBox, fontSize, float, SKINFONTSIZE_NORMAL)
7         ATTRIB(XonoticListBox, scrollbarWidth, float, SKINWIDTH_SCROLLBAR)
8         ATTRIB(XonoticListBox, src, string, SKINGFX_SCROLLBAR)
9         ATTRIB(XonoticListBox, tolerance, vector, SKINTOLERANCE_SLIDER)
10         ATTRIB(XonoticListBox, rowsPerItem, float, 1)
11         METHOD(XonoticListBox, resizeNotify, void(entity, vector, vector, vector, vector));
12         ATTRIB(XonoticListBox, color, vector, SKINCOLOR_SCROLLBAR_N)
13         ATTRIB(XonoticListBox, colorF, vector, SKINCOLOR_SCROLLBAR_F)
14         ATTRIB(XonoticListBox, color2, vector, SKINCOLOR_SCROLLBAR_S)
15         ATTRIB(XonoticListBox, colorC, vector, SKINCOLOR_SCROLLBAR_C)
16         ATTRIB(XonoticListBox, colorBG, vector, SKINCOLOR_LISTBOX_BACKGROUND)
17         ATTRIB(XonoticListBox, alphaBG, float, SKINALPHA_LISTBOX_BACKGROUND)
18 ENDCLASS(XonoticListBox)
19 entity makeXonoticListBox();
20 #endif
21
22 #ifdef IMPLEMENTATION
23 entity makeXonoticListBox()
24 {
25         entity me;
26         me = NEW(XonoticListBox);
27         me.configureXonoticListBox(me);
28         return me;
29 }
30 void XonoticListBox_configureXonoticListBox(entity me)
31 {
32         me.configureListBox(me, me.scrollbarWidth, 1); // item height gets set up later
33 }
34 void XonoticListBox_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
35 {
36         me.itemHeight = me.rowsPerItem * me.fontSize / absSize.y;
37         SUPER(XonoticListBox).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
38 }
39 #endif