## GUI
Class GUIMultiList

source: C:\XIII\GUI\Classes\GUIMultiList.uc

    Core.Object
       |
       +--GUI.GUI
          |
          +--GUI.GUIComponent
             |
             +--GUI.GUIListBase
                |
                +--GUI.GUIVertList
                   |
                   +--GUI.GUIList
                      |
                      +--GUI.GUIMultiList

Direct Known Subclasses:None

class GUIMultiList
extends GUI.GUIList

    // ====================================================================
    //  SouthEnd Multi column listbox with image support
    // ====================================================================

Variables
`int` | `columnAlignment[10]` GUIMultiListBoxLine
`float` | `columnOffset[10]` GUIMultiListBoxLine
`int` | `numberOfColumns`

Function Summary
`void` | `InitComponent(GUIController MyController, GUIComponent MyOwner)`
`void` | `InternalOnDrawItem(Canvas Canvas, int Item, float X, float Y, float W, float H, bool bSelected)`
    //}
`bool` | `SetColumnAlignment(int colIdx, int align)`
`bool` | `SetColumnOffset(int colIdx, int xOffs)`
`bool` | `SetNumberOfColumns(int nrCols)`

Source Code

    00001	// ====================================================================
    00002	//  SouthEnd Multi column listbox with image support
    00003	// ====================================================================
    00004
    00005
    00006
    00007	class GUIMultiList extends GUIList;
    00008
    00009	#exec OBJ LOAD FILE=GUIContent.utx
    00010
    00011	var int numberOfColumns;
    00012	var float columnOffset[10]; // GUIMultiListBoxLine
    00013	var int columnAlignment[10]; // GUIMultiListBoxLine
    00014
    00015
    00016
    00017
    00018	function bool SetColumnAlignment(int colIdx, int align) // 0 == left 1 == center 2 == right
    00019	{
    00020	  if (numberOfColumns <= colIdx)
    00021	    return false;
    00022	  columnAlignment[colIdx] = align;
    00023	  return true;
    00024	}
    00025
    00026	function bool SetNumberOfColumns(int nrCols)
    00027	{
    00028	  if (nrCols > 10 || nrCols < 0)
    00029	  {
    00030	    numberOfColumns = 0;
    00031	    return false;
    00032	  }
    00033
    00034	  numberOfColumns = nrCols;
    00035	  return true;
    00036	}
    00037
    00038	function bool SetColumnOffset(int colIdx, int xOffs)
    00039	{
    00040	  if (numberOfColumns <= colIdx)
    00041	    return false;
    00042	  columnOffset[colIdx] = xOffs;
    00043	  return true;
    00044	}
    00045
    00046	//function bool InternalOnPreDrawItem(Canvas canvas)
    00047	//{
    00048	//  UserDefinedItemHeight = 55;
    00049	//  //canvas.Font = font'XIIIFonts.PoliceF20';
    00050	//  return true;
    00051
    00052	//}
    00053
    00054	function InternalOnDrawItem(Canvas Canvas, int Item, float X, float Y, float W, float H, bool bSelected)
    00055	{
    00056	  local int q;
    00057	  local GUIMultiListBoxLine line;
    00058	  local texture tex;
    00059	  local texture tt;
    00060	  local float dW, dH, dY;
    00061	  local float availableWidth;
    00062	  local float alignX;
    00063
    00064	  if (bSelected)
    00065	  {
    00066	    canvas.DrawColor.R = 255;
    00067	    canvas.DrawColor.G = 255;
    00068	    canvas.DrawColor.B = 255;
    00069	    canvas.DrawColor.A = 255;
    00070
    00071	    tt = texture'GUIContent.Menu.MN_cadre01';//MN_cadre01';  //MN_glowvalid
    00072	    canvas.SetPos(X, Y);
    00073	    Canvas.DrawTileStretched(tt, W, H);
    00074
    00075	    canvas.DrawColor.R = 0;
    00076	    canvas.DrawColor.G = 0;
    00077	    canvas.DrawColor.B = 0;
    00078	  }
    00079	  else
    00080	  {
    00081	    canvas.DrawColor.R = 0;
    00082	    canvas.DrawColor.G = 0;
    00083	    canvas.DrawColor.B = 0;
    00084	  }
    00085	  canvas.DrawColor.A = 255;
    00086
    00087
    00088	  canvas.TextSize(Elements[item].Item, dW, dH);
    00089	  if (numberOfColumns == 1)
    00090	    availableWidth = W-20;
    00091	  else
    00092	    availableWidth = columnOffset[1]-10;
    00093	  dY = 0;
    00094	  if (dW > availableWidth)
    00095	  {
    00096	    canvas.Font = font'XIIIFonts.XIIISmallFont';
    00097
    00098	    alignX = 2;
    00099	    canvas.TextSize(Elements[item].Item, dW, dH);
    00100	    if (columnAlignment[0] == 1)
    00101	    {
    00102	      alignX = (availableWidth - dW)*0.5;
    00103	    }
    00104	    else if (columnAlignment[0] == 2)
    00105	    {
    00106	      alignX = (availableWidth - dW);
    00107	    }
    00108
    00109	    dY = 5;
    00110	  }
    00111	  else
    00112	  {
    00113	    if (columnAlignment[0] == 0)
    00114	      alignX = 0;
    00115	    else if (columnAlignment[0] == 1)
    00116	      alignX = (availableWidth - dW)*0.5;
    00117	    else
    00118	      alignX = (availableWidth - dW) - 2;
    00119
    00120	    canvas.Font = font'XIIIFonts.PoliceF16';
    00121	  }
    00122
    00123
    00124	  canvas.SetPos(alignX+X+columnOffset[0]+10, Y+dY+(H-16.0)*0.5-2);
    00125	  canvas.DrawText(Elements[item].Item, false);
    00126
    00127	  canvas.Font = font'XIIIFonts.PoliceF16';
    00128
    00129	  line = GUIMultiListBoxLine(Elements[item].ExtraData);
    00130	  for (q=0; q<numberOfColumns-1; q++)
    00131	  {
    00132	    dY = 0;
    00133
    00134	    if (line.items[q].tex == none)
    00135	    {
    00136
    00137	      if (numberOfColumns-2 == q)
    00138	      {
    00139	        availableWidth = W - 10 - columnOffset[q+1];
    00140	      }
    00141	      else
    00142	        availableWidth = columnOffset[q+2]-columnOffset[q+1];
    00143	      canvas.TextSize(line.items[q].str, dW, dH);
    00144
    00145
    00146	      if (dW > availableWidth)
    00147	      {
    00148	        canvas.Font = font'XIIIFonts.XIIISmallFont';
    00149
    00150	        alignX = 2;
    00151	        canvas.TextSize(line.items[q].str, dW, dH);
    00152	        if (columnAlignment[q+1] == 1)
    00153	        {
    00154	          alignX = (availableWidth - dW)*0.5;
    00155	        }
    00156	        else if (columnAlignment[q+1] == 2)
    00157	        {
    00158	          alignX = (availableWidth - dW);
    00159	        }
    00160	        dY = 5;
    00161	      }
    00162	      else
    00163	      {
    00164	        canvas.Font = font'XIIIFonts.PoliceF16';
    00165
    00166	        if (columnAlignment[q+1] == 0)
    00167	          alignX = 2;
    00168	        else if (columnAlignment[q+1] == 1)
    00169	          alignX = (availableWidth - dW)*0.5;
    00170	        else
    00171	          alignX = (availableWidth - dW) - 2;
    00172	      }
    00173
    00174	      canvas.SetPos(alignX+X+columnOffset[q+1], Y+dY+(H-16.0)*0.5-2);
    00175	      canvas.DrawColor.R = 0;
    00176	      canvas.DrawColor.G = 0;
    00177	      canvas.DrawColor.B = 0;
    00178	      canvas.DrawText(line.items[q].str, false);
    00179	      canvas.Font = font'XIIIFonts.PoliceF16';
    00180	    }
    00181	    else
    00182	    {
    00183	      tex = line.items[q].tex;
    00184
    00185	      canvas.SetPos(X+columnOffset[q+1], Y+ (H - tex.VSize)*0.5 );
    00186	      if (bSelected)
    00187	      {
    00188	        canvas.DrawColor.R = 255;
    00189	        canvas.DrawColor.G = 255;
    00190	        canvas.DrawColor.B = 255;
    00191	      }
    00192	      else
    00193	      {
    00194	        canvas.DrawColor.R = 225;
    00195	        canvas.DrawColor.G = 225;
    00196	        canvas.DrawColor.B = 225;
    00197	      }
    00198	      Canvas.SetDrawColor( 255,255,255,255  );
    00199
    00200	      canvas.Style = 5;  // ERenderStyle.STY_Alpha;     Defined in XIIIMPBotInteraction !!!!  HUUUUUUH!!!!!!!!!
    00201	      canvas.DrawTile(tex, tex.USize, tex.VSize, 0, 0, tex.USize, tex.VSize);
    00202	      canvas.Style = 1;// ERenderStyle.STY_Normal;
    00203	    }
    00204	  }
    00205
    00206	  //
    00207	}
    00208
    00209
    00210	function InitComponent(GUIController MyController, GUIComponent MyOwner)
    00211	{
    00212	  Super.Initcomponent(MyController, MyOwner);
    00213	  OnDrawItem=InternalOnDrawItem;
    00214	//  OnPreDraw=InternalOnPreDrawItem;
    00215	}
    00216
    00217
    00218
    00219
    00220
    00221
    00222	defaultproperties
    00223	{
    00224	     numberOfColumns=1
    00225	}

End Source Code