LimitedListDrawer< T > Class Template Referenceabstract

This class contains static function for drawing large lists. Optimized to draw only the part of the list that is being displayed, it does not slow down the system for large lists.

Detailed Description

It has a slider with which the user can select how large (vertically) the list should be when drawn. A scrollable area of this vertical-size is used to display the elements of the list. This abstract base class defines several functions that a descendant class must implement for a specific type of property T. The LimitedListProperty class, for example, implements this base class as a variant for SerializedProperties. A file is created, which includes the scene name, that is used to store the current scroll state of this control when the scene is opened or closed. This feature may be disabled in ProjectSettings, via EditorTools Option ClearObjectCacheOnEditorQuit. Usage Example: ArrayHolderPropertyDrawer.cs, VectorAndRankArrayHolder.cs

Public Member Functions

void InternalDrawLimitedListPropertyLayout (T property, GUIContent label=null, params GUILayoutOption[] options)
 Auto-Layout Version of this function draws the limited list using auto layout.
 

Static Public Member Functions

static void ClearAllPositionAndDrawnElementsFiles ()
 Deletes all files in the current directory that end with fileNameConst. This will remove all saved foldout states.
 
static void ClearCasheNow ()
 Static function that clears the contents of the internal scrollPositionAndDrawSize dictionary.
 

Protected Member Functions

abstract string ArrayName (T listProperty)
 Used to compute the label that will be Displayed for the list
 
abstract int ArraySize (T listProperty)
 Extracts and returns the size of the array provided
 
abstract void DrawElementProperty (Rect r, T property, int index)
 Actual drawing code for an element of the list. The property parameter will provide the data to be drawn.
 
abstract UniqueStringID GenerateListScrollPositionAndDrawSizeKey (T property, string label)
 Creates a new UniqueStringID from the provided property, and optionally, the provided label. Passing the same property to this function, should always yield an equivalent UniqueStringID, even across editor-sessions. UniqueStringID's can be quickly compared with other UniqueStringIDs for equality. Generating the UniqueID can be costly, so it is performed as rarely as possible (once inside the GetScrollPositionAndDrawSizeOfList function).
 
abstract T GetArrayElementAtIndex (T listProperty, int index)
 Used to get the array elements from the list. Which element is returned is defined by the integer parameter, index. Invalid indexes should throw an Exception.
 
abstract bool GetPropertyExpanded (T property)
 Used to lookup the last user-selected expanded state of the specified property.
 
abstract float GetPropertyHeight (T property)
 Computes and returns the height of the specified property.
 
virtual void InternalDrawLimitedListProperty (Rect position, T property, GUIContent _label=null)
 non auto-layout version of this control. Will draw the list in the location and area specified by the position parameter.
 
virtual float InternalGetLimitedListPropertyHeight (T property, GUIContent label)
 Drawn height of limited list. The height of the control is computed once and cashed. It is recomputed as necessary.
 
abstract bool LoadAndGetPropertyExpanded (T property)
 Refreshes any stored expanded state from storage, then assigns the expanded state to the property and returns it
 
abstract void SetAndStorePropertyExpanded (T property, bool expanded)
 Used to set the expanded state of the specified property, and record it in storage.
 
abstract void SetArraySize (T listProperty, int newSize)
 Adjusts the size of the array referenced in the provided property, to the specified size.
 
abstract void SetPropertyExpanded (T property, bool expanded)
 Used to set the expanded state of the specified property.
 
+ Inheritance diagram for LimitedListDrawer< T >: