]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/button.qc
Merge branch 'terencehill/slider_anim_improvements' into 'master'
[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, string));
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_T(string theText, vector theColor, string theTooltip);
19 entity makeXonoticButton(string theText, vector theColor);
20 #endif
21
22 #ifdef IMPLEMENTATION
23 entity makeXonoticButton_T(string theText, vector theColor, string theTooltip)
24 {
25         entity me;
26         me = NEW(XonoticButton);
27         me.configureXonoticButton(me, theText, theColor, theTooltip);
28         return me;
29 }
30 entity makeXonoticButton(string theText, vector theColor)
31 {
32         return makeXonoticButton_T(theText, theColor, string_null);
33 }
34
35 void XonoticButton_configureXonoticButton(entity me, string theText, vector theColor, string theTooltip)
36 {
37         if(theColor == '0 0 0')
38         {
39                 me.configureButton(me, theText, me.fontSize, me.image);
40         }
41         else
42         {
43                 me.configureButton(me, theText, me.fontSize, me.grayImage);
44                 me.color = theColor;
45                 me.colorC = theColor;
46                 me.colorF = theColor;
47         }
48         setZonedTooltip(me, theTooltip, string_null);
49 }
50 #endif