XIDInterf
Class XIIIMemoControl

source: C:\XIII\XIDInterf\Classes\XIIIMemoControl.uc
Core.Object
   |
   +--GUI.GUI
      |
      +--GUI.GUIComponent
         |
         +--GUI.GUILabel
            |
            +--XIDInterf.XIIIGUIBaseButton
               |
               +--XIDInterf.XIIIMemoControl
Direct Known Subclasses:None

class XIIIMemoControl
extends XIDInterf.XIIIGUIBaseButton


Variables
 color CursorColor
 MaxLines, IndexSlider
 OffsetSlider, Margin
 array MsgArray
 int OffsetY
 SliderWidth, SliderHeight
 string Text
 bool bBold
 tArrowTop, tArrowDown


Function Summary
 void ChangeStep(int IndSlider)
 void Created()
     
//----------------------------------------------
 void Gribouille(Canvas C, string T, optional bool)
 void Paint(Canvas C, float X, float Y)



Source Code


00001	class XIIIMemoControl extends XIIIGUIBaseButton;
00002	
00003	
00004	var string Text;
00005	var int OffsetY;
00006	var array<string> MsgArray;
00007	var float BoxInfoWidth, BoxInfoHeight, BoxSliderWidth, BoxSliderHeight, SliderWidth, SliderHeight;
00008	var float ArrowWidth, OffsetSlider, Margin;
00009	var int MaxLines, IndexSlider;
00010	var color CursorColor;
00011	var texture tArrowTop, tArrowDown;
00012	
00013	VAR bool bBold;
00014	
00015	
00016	//----------------------------------------------
00017	function Created()
00018	{
00019		BoxInfoWidth = WinWidth*640 - BoxSliderWidth - 10;
00020		BoxInfoHeight = WinHeight*480;
00021		BoxSliderHeight = BoxInfoHeight - 2*ArrowWidth - 2*Margin;
00022		SliderWidth = BoxSliderWidth - 2*Margin;
00023	}
00024	
00025	FUNCTION Gribouille( Canvas C, string T, optional bool bFake)
00026	{
00027		LOCAL int i;
00028		LOCAL float mX, mY, W, H;
00029	
00030		i=InStr( T, "\\" );
00031	
00032		if (i!=-1)
00033		{
00034			if (i!=0)
00035				Gribouille( C, Left(T, i), bFake );
00036			switch( Mid(T, i+1,1))
00037			{
00038			case "B":
00039			case "b":
00040				bBold=!bBold;
00041				break;
00042			}
00043			Gribouille( C, Mid( T, i+2 ), bFake );
00044		}
00045		else
00046		{
00047			if ( !bFake )
00048			{
00049				mX = C.CurX;
00050				mY = C.CurY;
00051				C.StrLen( T, W, H );
00052	
00053				C.DrawText( T );
00054				if ( bBold )
00055				{
00056					C.SetPos( mX+1, mY );
00057					C.DrawText( T );
00058				}
00059				C.SetPos( mX+W, mY );
00060			}
00061		}
00062	
00063	}
00064	
00065	function Paint(Canvas C, float X, float Y)
00066	{
00067	    local float W, H;
00068		local int i,j;
00069	
00070		Super.Paint(C,X,Y);
00071		bBold=false;
00072		if ( MsgArray.Length == 0 )
00073		{
00074			C.WrapStringToArray(Text,MsgArray,(BoxInfoWidth - 10)*fRatioX,"|");
00075			OffsetSlider = (BoxSliderHeight - 2*SliderHeight - 2*Margin)/(MsgArray.Length - 1 - MaxLines);
00076		}
00077		
00078		C.bUseBorder = true;
00079		DrawStretchedTexture(C, 0, 0, BoxInfoWidth*fRatioX, BoxInfoHeight*fRatioY, myRoot.FondMenu);
00080		DrawStretchedTexture(C, (BoxInfoWidth + 10)*fRatioX, (ArrowWidth + Margin)*fRatioX, BoxSliderWidth*fRatioX, BoxSliderHeight*fRatioY, myRoot.FondMenu);
00081		C.bUseBorder = false;
00082	    DrawStretchedTexture(C, (BoxInfoWidth + 10 + Margin)*fRatioX, 0, ArrowWidth*fRatioX, ArrowWidth*fRatioY, tArrowTop);
00083	    DrawStretchedTexture(C, (BoxInfoWidth + 10 + Margin)*fRatioX, (ArrowWidth + 2*Margin + BoxSliderHeight)*fRatioY, ArrowWidth*fRatioX, ArrowWidth*fRatioY, tArrowDown);
00084	
00085		C.bUseBorder = true;
00086		C.DrawColor = CursorColor;
00087		DrawStretchedTexture(C, (BoxInfoWidth + 10 + Margin)*fRatioX, (ArrowWidth + Margin + IndexSlider*OffsetSlider + Margin)*fRatioY, (SliderWidth)*fRatioX, SliderHeight*fRatioY, myRoot.FondMenu);
00088		C.bUseBorder = false;
00089	
00090		C.DrawColor = TextColor;
00091		for (i=0;i<IndexSlider;i++)
00092		{
00093			Gribouille( C, MsgArray[i], true );
00094		}
00095		for(i=0;i<MaxLines;i++)
00096		{
00097			C.SetPos(5*fRatioX,i*OffsetY*fRatioY);
00098			if( i + IndexSlider>=MsgArray.Length )
00099				break;
00100			Gribouille( C, MsgArray[i + IndexSlider] );
00101		}
00102		C.DrawColor = BackColor;
00103	}
00104	
00105	
00106	function ChangeStep(int IndSlider)
00107	{
00108		IndexSlider += IndSlider;
00109		IndexSlider = Clamp(IndexSlider,0,MsgArray.Length - MaxLines);
00110	}
00111	
00112	
00113	
00114	
00115	defaultproperties
00116	{
00117	     OffsetY=23
00118	     BoxSliderWidth=20.000000
00119	     SliderHeight=10.000000
00120	     ArrowWidth=16.000000
00121	     Margin=3.000000
00122	     MaxLines=10
00123	     CursorColor=(B=224,G=224,R=224,A=255)
00124	     tArrowTop=Texture'XIIIMenuStart.Control_Console.fleche_top'
00125	     tArrowDown=Texture'XIIIMenuStart.Control_Console.fleche_down'
00126	     bNeverFocus=True
00127	}

End Source Code