UnityEditor.WebTemplateManagerBase.ThumbnailListItem C# (CSharp) Method

ThumbnailListItem() private static method

private static ThumbnailListItem ( Rect rect, bool selected, GUIContent content ) : bool
rect UnityEngine.Rect
selected bool
content UnityEngine.GUIContent
return bool
        private static bool ThumbnailListItem(Rect rect, bool selected, GUIContent content)
        {
            EventType type = Event.current.type;
            if (type != EventType.MouseDown)
            {
                if (type != EventType.Repaint)
                {
                    return selected;
                }
            }
            else
            {
                if (rect.Contains(Event.current.mousePosition))
                {
                    if (!selected)
                    {
                        GUI.changed = true;
                    }
                    selected = true;
                    Event.current.Use();
                }
                return selected;
            }
            Rect position = new Rect(rect.x + 5f, rect.y + 5f, rect.width - 10f, (rect.height - 20f) - 10f);
            s_Styles.thumbnail.Draw(position, content.image, false, false, selected, selected);
            s_Styles.thumbnailLabel.Draw(new Rect(rect.x, (rect.y + rect.height) - 20f, rect.width, 20f), content.text, false, false, selected, selected);
            return selected;
        }

Usage Example

        private static int ThumbnailList(Rect rect, int selection, GUIContent[] thumbnails, int maxRowItems)
        {
            int num    = 0;
            int index1 = 0;

            while (index1 < thumbnails.Length)
            {
                for (int index2 = 0; index2 < maxRowItems && index1 < thumbnails.Length; ++index1)
                {
                    if (WebTemplateManagerBase.ThumbnailListItem(new Rect(rect.x + (float)index2 * 80f, rect.y + (float)num * 100f, 80f, 100f), index1 == selection, thumbnails[index1]))
                    {
                        selection = index1;
                    }
                    ++index2;
                }
                ++num;
            }
            return(selection);
        }
All Usage Examples Of UnityEditor.WebTemplateManagerBase::ThumbnailListItem