]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/tabcontroller.qc
Merge branch 'master' into TimePath/spawnfunc
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / tabcontroller.qc
1 #ifndef TABCONTROLLER_H
2 #define TABCONTROLLER_H
3 #include "../item/modalcontroller.qc"
4 CLASS(XonoticTabController, ModalController)
5         METHOD(XonoticTabController, configureXonoticTabController, void(entity, float));
6         METHOD(XonoticTabController, makeTabButton_T, entity(entity, string, entity, string));
7         METHOD(XonoticTabController, makeTabButton, entity(entity, string, entity));
8         ATTRIB(XonoticTabController, rows, float, 0)
9         ATTRIB(XonoticTabController, fontSize, float, SKINFONTSIZE_NORMAL)
10         ATTRIB(XonoticTabController, image, string, SKINGFX_BUTTON)
11 ENDCLASS(XonoticTabController)
12 entity makeXonoticTabController(float theRows);
13 #endif
14
15 #ifdef IMPLEMENTATION
16 entity makeXonoticTabController(float theRows)
17 {
18         entity me;
19         me = NEW(XonoticTabController);
20         me.configureXonoticTabController(me, theRows);
21         return me;
22 }
23 void XonoticTabController_configureXonoticTabController(entity me, float theRows)
24 {
25         me.rows = theRows;
26 }
27 entity XonoticTabController_makeTabButton_T(entity me, string theTitle, entity tab, string theTooltip)
28 {
29         entity b;
30         if(me.rows != tab.rows)
31                 error("Tab dialog height mismatch!");
32         b = makeXonoticButton_T(theTitle, '0 0 0', theTooltip);
33                 me.addTab(me, tab, b);
34         // TODO make this real tab buttons (with color parameters, and different gfx)
35         return b;
36 }
37 entity XonoticTabController_makeTabButton(entity me, string theTitle, entity tab)
38 {
39         return XonoticTabController_makeTabButton_T(me, theTitle, tab, string_null);
40 }
41 #endif