2 // control/visual/multilabel.qc
11 local float lMaxWidth;
12 local float lLineNumber;
20 lLine = Util_GetEndOfWrappedLine( self.text, lLine, self.wrap );
22 lLine = Util_GetEndOfLine( self.text, lLine );
25 lMaxWidth = max( lMaxWidth, lLine_z );
26 } while( lLine_x != lLine_y );
28 self.size_x = lMaxWidth * self.fontSize_x;
29 self.size_y = lLineNumber * self.fontSize_y;
37 void( vector pPosition, string pText ) _IML_DrawLine =
39 if( self.alignment == ITEM_ALIGN_CENTER )
40 pPosition_x = self.pos_x + (self.size_x - strlen( pText ) * self.fontSize_x) / 2;
41 else if( self.alignment == ITEM_ALIGN_RIGHT )
42 pPosition_x = self.pos_x + self.size_x - strlen( pText ) * self.fontSize_x;
44 pPosition_x = self.pos_x;
46 Menu_DrawString( pPosition, pText, self.fontSize, self.color, self.alpha, self.drawFlag );
54 void() Item_MultiLabel_Draw =
56 local vector lPosition;
59 lPosition_y = self.pos_y;
63 lLine = Util_GetEndOfWrappedLine( self.text, lLine, self.wrap );
65 lLine = Util_GetEndOfLine( self.text, lLine );
67 _IML_DrawLine( lPosition, substring( self.text, lLine_x - lLine_z + 1, lLine_z ) );
68 lPosition_y = lPosition_y + self.fontSize_y;
69 } while( lLine_x != lLine_y );
74 Item_MultiLabel_Update
77 void() Item_MultiLabel_Update =
79 if( self.size == '0 0 0' )
85 Item_MultiLabel_Destroy
88 void() Item_MultiLabel_Destroy =
90 String_EntityFree( self, text );
98 void() Item_MultiLabel_Spawn =
101 self.flag = self.flag | FLAG_DRAWUPDATEONLY;
103 String_EntityZone( self, text );
105 Item_MultiLabel_Update();
107 self._destroy = Item_MultiLabel_Destroy;
108 self._draw = Item_MultiLabel_Draw;
109 self._update = Item_MultiLabel_Update;