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