1 #ifndef ITEM_BORDERIMAGE_H
2 #define ITEM_BORDERIMAGE_H
4 CLASS(BorderImage, Label)
5 METHOD(BorderImage, configureBorderImage, void(entity, string, float, vector, string, float))
6 METHOD(BorderImage, resizeNotify, void(entity, vector, vector, vector, vector))
7 METHOD(BorderImage, recalcPositionWithText, void(entity, string))
8 ATTRIB(BorderImage, isBold, float, 1)
9 METHOD(BorderImage, draw, void(entity))
10 ATTRIB(BorderImage, src, string, string_null)
11 ATTRIB(BorderImage, borderHeight, float, 0)
12 ATTRIB(BorderImage, borderVec, vector, '0 0 0')
13 ATTRIB(BorderImage, color, vector, '1 1 1')
14 ATTRIB(BorderImage, closeButton, entity, NULL)
15 ATTRIB(BorderImage, realFontSize_Nexposeed, vector, '0 0 0')
16 ATTRIB(BorderImage, realOrigin_Nexposeed, vector, '0 0 0')
17 ATTRIB(BorderImage, isNexposeeTitleBar, float, 0)
18 ATTRIB(BorderImage, zoomedOutTitleBarPosition, float, 0)
19 ATTRIB(BorderImage, zoomedOutTitleBar, float, 0)
20 ATTRIB(BorderImage, overrideRealOrigin, vector, '0 1 0')
21 ATTRIB(BorderImage, saveRelOrigin, vector, '0 0 0')
22 ATTRIB(BorderImage, saveRelSize, vector, '0 0 0')
27 void BorderImage_recalcPositionWithText(entity me, string t)
29 if(me.isNexposeeTitleBar)
32 scrs = eX * conwidth + eY * conheight;
33 me.resizeNotify(me, me.saveRelOrigin, me.saveRelSize, boxToGlobal(me.parent.Nexposee_smallOrigin, '0 0 0', scrs), boxToGlobalSize(me.parent.Nexposee_smallSize, scrs));
34 SUPER(BorderImage).recalcPositionWithText(me, t);
35 me.realOrigin_y = me.realFontSize.y * me.zoomedOutTitleBarPosition;
36 me.realOrigin_Nexposeed = me.realOrigin;
37 me.realFontSize_Nexposeed = me.realFontSize;
38 me.resizeNotify(me, me.saveRelOrigin, me.saveRelSize, boxToGlobal(me.parent.Nexposee_initialOrigin, '0 0 0', scrs), boxToGlobalSize(me.parent.Nexposee_initialSize, scrs));
40 SUPER(BorderImage).recalcPositionWithText(me, t);
42 void BorderImage_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
44 me.isNexposeeTitleBar = 0;
45 if(me.zoomedOutTitleBar)
46 if(me.parent.parent.instanceOfNexposee)
47 if(me.parent.instanceOfDialog)
48 if(me == me.parent.frame)
49 me.isNexposeeTitleBar = 1;
50 me.saveRelOrigin = relOrigin;
51 me.saveRelSize = relSize;
52 SUPER(BorderImage).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
53 me.borderVec_x = me.borderHeight / absSize.x;
54 me.borderVec_y = me.borderHeight / absSize.y;
55 me.realOrigin_y = 0.5 * (me.borderVec.y - me.realFontSize.y);
58 // move the close button to the right place
59 me.closeButton.Container_origin = '1 0 0' * (1 - me.borderVec.x);
60 me.closeButton.Container_size = me.borderVec;
61 me.closeButton.color = me.color;
62 me.closeButton.colorC = me.color;
63 me.closeButton.colorF = me.color;
66 void BorderImage_configureBorderImage(entity me, string theTitle, float sz, vector theColor, string path, float theBorderHeight)
68 me.configureLabel(me, theTitle, sz, 0.5);
71 me.borderHeight = theBorderHeight;
73 void BorderImage_draw(entity me)
76 draw_BorderPicture('0 0 0', me.src, '1 1 0', me.color, 1, me.borderVec);
81 me.recalcPositionWithText(me, me.text);
83 if(me.isNexposeeTitleBar)
87 // me.parent.Nexposee_animationFactor 0 (small) or 1 (full)
88 // default values are for 1
92 me.realOrigin = ro * me.parent.Nexposee_animationFactor + me.realOrigin_Nexposeed * (1 - me.parent.Nexposee_animationFactor);
93 me.realFontSize = rf * me.parent.Nexposee_animationFactor + me.realFontSize_Nexposeed * (1 - me.parent.Nexposee_animationFactor);
94 draw_fontscale = globalToBoxSize(boxToGlobalSize(df, me.realFontSize), rf);
96 SUPER(BorderImage).draw(me);
98 // me.Nexposee_animationState 0 (small) or 1 (full)
99 // default values are for 1
101 me.realFontSize = rf;
105 SUPER(BorderImage).draw(me);
109 SUPER(BorderImage).draw(me);