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