From Mod Wiki
Revision as of 12:07, 21 November 2007 by JRAD (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Class Tree


The list window type can be used if you want display a list in the GUI. It is the most complex window type in the GUI system. Some of the features of the list type are column headers, drawing of text or materials in headers and items, saving additional data in items, column sorting, variable row height, filling from enumerators, mouse and key events on header columns and items.

This class may be used in the GUIs. It will inherit all properties, flags, functions and events from UIWindow.

Window type:

type list;


windowDef vPlayerList {
	type list;
	properties {
		float 	fontSize 		= 48;
		// Truncate player name to the item rectangle
		float	flags			= immediate( flags ) | WF_TRUNCATE_TEXT;
		rect 	rect 			= 24, 50, 590, 350;
		color	backColor		= 0,0,0,0;
	events {
		onCreate {
			insertColumn( gui.blankWStr, 0, 0 ); // Class icon column.
			insertColumn( gui.blankWStr, 590, 1 ) // Player name column;
	timeLine {
		onTime 250 {
			// Have the gamecode update the list of players in the vehicle every 250 milliseconds.
			fillFromEnumerator( "vehiclePlayerList" );
			resetTime( 0 );


UIList Properties


UIList Flags


General Functions

insertItem                         Insert list item. Calls onItemAdded event.
insertBlankItems                   Insert multiple blank items.
setItemText                        Set item text.
setItemTextFlags                   Set item text flags.
setItemForeColor                   Set item forecolor.
setItemBackColor                   Set item backcolor.
setItemMaterialSize                Set iteam material size.
setItemIcon                        Set icon for item.
transitionItemVec4                 Transition a property for an item.
getItemTransitionVec4Result        Get the items immediate transition value.
transitionColumnVec4               Transition a property for a column.
getColumnTransitionVec4Result      Get the columns immediate transition value.
clearTransitions                   Clear transitions for an item.
setColumnText                      Set column header text.
setColumnWidth                     Set column width.
setColumnTextFlags                 Set column header text flags.
deleteItem                         Delete an item from the list. Calls onItemRemoved event.
insertColumn                       Insert a column.
deleteColumn                       Delete a column. NOT IMPLEMENTED.
clearItems                         Delete all items.
clearColumns                       Delete all columns.
getItemText                        Get item text. Returns header text if row is -1.
getItemRect                        Get item rectangle.
fillFromEnumerator                 Fill list using the specified enumerator.
sort                               Explicitly sort list.
getItemAtPoint                     Get item at position. Often used to get the list item under the cursor.
findItem                           Finds first item in column which matches the search text.
findItemDataInt                    Find the item with the item data.
setItemDataInt                     Set item data.
getItemDataInt                     Get item data.
storeVisualState                   Store the visual state, in essence the scroll amount.
restoreVisualState                 Restore the visual state. Makes the layout dirty.
drawItemMaterial                   Draw a material in the given item.
sizeLastColumn                     Stretch the last column to fill any leftover space, minus the amount passed in.
setItemFlags                       Set item flags.
setColumnFlags                     Set column header flags.
ensureItemIsVisible                Potentially scroll the list to make sure the item is visible.
fillFromFile                       Fill list from file. Supports UTF8 encoding.


onSelectItem                       Called when a list item is selected.
onItemAdded                        Called when an item is inserted into the list.
onItemRemoved                      Called when an item is deleted from the list.
onDrawSelectedBackground           If this event is valid in the GUI it will be called instead of onDrawItemBackGround for the currently selected item.
onDrawItemBackGround               Called when drawing an item background.
onDrawItem                         Called when drawing an item.
onDrawColumn                       Called when drawing a column.
onEnterColumnHeader                Called when the mouse enters a column header.
onExitColumnHeader                 Called when the mouse exits a column header.
onClickColumnHeader                Called when there's a mouse click on the column header.
onEnterItem                        Called when the mouse enters the list item.
onExitItem                         Called when the mouse exits the list item.