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