Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

TribesGUI.LabelElement


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
//================================================================
// Class: LabelElement
//
// A convenience HUDElement for displaying text labels 
//
//================================================================

class LabelElement extends HUDElement
	native;

enum ETextAlignment
{
	ALIGN_Left,
	ALIGN_Center,
	ALIGN_Right
};

var(Label) config private String text		"The text for the label";

var(Label) config bool	bCentered			"Whether the label is centered";
var(Label) config bool	bShadowed			"Whether the text of the label should be shadowed";
var(Label) config bool	bAutoWrapText		"Whether the text in the label should be auto wrapped";
var(Label) config bool	bAutoScrollText		"Whether the text should be scrolled to the left autmatically if it is too long";
var(Label) config int	shadowPixelOffset	"Offset of the shadowed text";
var(Label) config float	textInsetX			"absolute text inset X";
var(Label) config float	textInsetY			"absolute text inset Y";
var(Label) config int	hangingIndent		"Hanging indent value (in pixels)";
var(Label) config bool	bHTMLEncoded		"Whether the string could be HTML encoded";

var(Label) config Color	shadowColor			"Color to use for the shadow text, if shadowed";
var(Label) config ETextAlignment justification	"justification to use";

var bool bAutoSize;

var Array<string>	textLineArray;
var int				firstVisibleLineIndex;

//native function RenderLabel(Canvas c);

cpptext
{
	void DoTextWrap(UCanvas *canvas);
	virtual void ResizeForWidth(UCanvas *canvas, INT pixelWidth);

	// Internal Render function.
	virtual void RenderElement(UCanvas *canvas);

	// native layout function
	virtual void Layout(UCanvas *canvas);
}

///
///
function String GetText()
{
	return text;
}

///
///
function SetText(String newText)
{
	if(text != newText)
	{
		text = newText;
//		if(bAutoWrapText)
			textLineArray.Length = 0;
		if(bAutoSize)
			SetNeedsLayout();
	}
}

defaultproperties
{
	text				= ""
	textFont			= font'Engine_res.SmallFont'
	bShadowed			= false
	shadowPixelOffset	= 1
	bAutoWrapText		= true
	bAutoScrollText		= false
	bAutoSize			= true
	bHTMLEncoded		= false

	textColor			= (R=255,G=255,B=255,A=255)
	shadowColor			= (R=120,G=120,B=120,A=120)
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: st 16.4.2014 10:20:46.000 - Creation time: st 23.5.2018 00:10:44.960 - Created with UnCodeX