Esempio n. 1
0
        static Rect DrawIconLeft(
            Rect rect,
            float rowHeight,
            Texture icon,
            GetOverlayIcon.Data overlayIconData)
        {
            if (icon == null)
            {
                return(rect);
            }

            float iconWidth = rowHeight * ((float)icon.width / icon.height);

            Rect iconRect = new Rect(rect.x, rect.y, iconWidth, rowHeight);

            EditorGUI.LabelField(iconRect, new GUIContent(icon), UnityStyles.Tree.IconStyle);

            if (overlayIconData != null && overlayIconData.Texture != null)
            {
                Rect overlayIconRect = new Rect(
                    iconRect.x + overlayIconData.XOffset,
                    iconRect.y + overlayIconData.YOffset,
                    overlayIconData.Size, overlayIconData.Size);

                GUI.DrawTexture(
                    overlayIconRect, overlayIconData.Texture,
                    ScaleMode.ScaleToFit);
            }

            rect.x     += iconRect.width;
            rect.width -= iconRect.width;

            return(rect);
        }
Esempio n. 2
0
        internal static void ForItemCell(
            Rect rect,
            float rowHeight,
            int depth,
            Texture icon,
            GetOverlayIcon.Data overlayIconData,
            string label,
            bool isSelected,
            bool isFocused,
            bool isBoldText)
        {
            float indent = GetIndent(depth);

            rect.x     += indent;
            rect.width -= indent;

            rect = DrawIconLeft(
                rect, rowHeight, icon, overlayIconData);

            if (isBoldText)
            {
                TreeView.DefaultGUI.BoldLabel(rect, label, isSelected, isFocused);
            }
            else
            {
                TreeView.DefaultGUI.Label(rect, label, isSelected, isFocused);
            }
        }
Esempio n. 3
0
        internal static bool ForCheckableItemCell(
            Rect rect,
            float rowHeight,
            int depth,
            Texture icon,
            GetOverlayIcon.Data overlayIconData,
            string label,
            bool isSelected,
            bool isFocused,
            bool isHighlighted,
            bool wasChecked)
        {
            float indent = GetIndent(depth);

            rect.x     += indent;
            rect.width -= indent;

            Rect checkRect = GetCheckboxRect(rect, rowHeight);

            bool isChecked = EditorGUI.Toggle(checkRect, wasChecked);

            rect.x      = checkRect.xMax;
            rect.width -= checkRect.width;

            rect = DrawIconLeft(
                rect, rowHeight, icon, overlayIconData);

            if (isHighlighted)
            {
                TreeView.DefaultGUI.BoldLabel(rect, label, isSelected, isFocused);
            }
            else
            {
                TreeView.DefaultGUI.Label(rect, label, isSelected, isFocused);
            }

            return(isChecked);
        }