]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/button.qc
Merge branch 'master' into Mario/minigames_merge
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / button.qc
1 #ifndef BUTTON_H
2 #define BUTTON_H
3 #include "../item/button.qc"
4 CLASS(XonoticButton, Button)
5         METHOD(XonoticButton, configureXonoticButton, void(entity, string, vector));
6         ATTRIB(XonoticButton, fontSize, float, SKINFONTSIZE_NORMAL)
7         ATTRIB(XonoticButton, image, string, SKINGFX_BUTTON)
8         ATTRIB(XonoticButton, grayImage, string, SKINGFX_BUTTON_GRAY)
9         ATTRIB(XonoticButton, color, vector, SKINCOLOR_BUTTON_N)
10         ATTRIB(XonoticButton, colorC, vector, SKINCOLOR_BUTTON_C)
11         ATTRIB(XonoticButton, colorF, vector, SKINCOLOR_BUTTON_F)
12         ATTRIB(XonoticButton, colorD, vector, SKINCOLOR_BUTTON_D)
13         ATTRIB(XonoticButton, alpha, float, SKINALPHA_TEXT)
14         ATTRIB(XonoticButton, disabledAlpha, float, SKINALPHA_DISABLED)
15         ATTRIB(XonoticButton, marginLeft, float, SKINMARGIN_BUTTON) // chars
16         ATTRIB(XonoticButton, marginRight, float, SKINMARGIN_BUTTON) // chars
17 ENDCLASS(XonoticButton)
18 entity makeXonoticButton(string theText, vector theColor);
19 #endif
20
21 #ifdef IMPLEMENTATION
22 entity makeXonoticButton(string theText, vector theColor)
23 {
24         entity me;
25         me = NEW(XonoticButton);
26         me.configureXonoticButton(me, theText, theColor);
27         return me;
28 }
29
30 void XonoticButton_configureXonoticButton(entity me, string theText, vector theColor)
31 {
32         if(theColor == '0 0 0')
33         {
34                 me.configureButton(me, theText, me.fontSize, me.image);
35         }
36         else
37         {
38                 me.configureButton(me, theText, me.fontSize, me.grayImage);
39                 me.color = theColor;
40                 me.colorC = theColor;
41                 me.colorF = theColor;
42         }
43         me.tooltip = getZonedTooltipForIdentifier(strcat(currentDialog.classname, "/", me.text));
44 }
45 #endif