Exemplo n.º 1
0
        static void CategoryTreeViewItemGUI(
            Rect rowRect,
            float rowHeight,
            ChangeCategoryTreeViewItem item,
            bool isSelected,
            bool isFocused)
        {
            Texture icon  = GetCategoryIcon(item.Category);
            string  label = item.Category.GetHeaderText();

            bool wasChecked         = item.Category.IsChecked();
            bool hadCheckedChildren = item.Category.GetCheckedChangesCount() > 0;

            bool isChecked = DrawTreeViewItem.ForCheckableCategoryItem(
                rowRect, rowHeight, item.depth, icon, label,
                isSelected, isFocused, wasChecked, hadCheckedChildren);

            if (!wasChecked && isChecked)
            {
                item.Category.UpdateCheckedState(true);
                return;
            }

            if (wasChecked && !isChecked)
            {
                item.Category.UpdateCheckedState(false);
                return;
            }
        }
Exemplo n.º 2
0
        static void CategoryTreeViewItemGUI(
            PendingChangesTreeView treeView,
            Rect rowRect,
            float rowHeight,
            ChangeCategoryTreeViewItem item,
            bool isSelected,
            bool isFocused)
        {
            Texture icon           = GetCategoryIcon(item.Category);
            string  label          = item.Category.CategoryName;
            string  secondaryLabel = item.Category.GetCheckedChangesText();

            bool wasChecked         = item.Category.IsChecked();
            bool hadCheckedChildren = item.Category.GetCheckedChangesCount() > 0;

            bool isChecked = DrawTreeViewItem.ForCheckableCategoryItem(
                rowRect,
                rowHeight,
                item.depth,
                icon,
                label,
                secondaryLabel,
                isSelected,
                isFocused,
                wasChecked,
                hadCheckedChildren);

            if (wasChecked != isChecked)
            {
                item.Category.UpdateCheckedState(isChecked);
                treeView.SelectionChanged();
            }
        }
        static void CategoryTreeViewItemGUI(
            Rect rowRect,
            float rowHeight,
            ChangeCategoryTreeViewItem item,
            Action onCheckedNodeChanged,
            int solvedConflictsCount,
            bool isSelected,
            bool isFocused)
        {
            Texture icon      = GetCategoryIcon(item.Category.CategoryType);
            string  label     = item.Category.CategoryName;
            string  infoLabel = item.Category.GetCheckedChangesText();

            bool wasChecked         = item.Category.IsChecked();
            bool hadCheckedChildren = item.Category.GetCheckedChangesCount() > 0;

            DefaultStyles.label = GetCategoryStyle(
                item.Category, solvedConflictsCount, isSelected);

            bool isChecked = DrawTreeViewItem.ForCheckableCategoryItem(
                rowRect,
                rowHeight,
                item.depth,
                icon,
                label,
                infoLabel,
                isSelected,
                isFocused,
                wasChecked,
                hadCheckedChildren);

            DefaultStyles.label = UnityStyles.Tree.Label;

            if (!wasChecked && isChecked)
            {
                item.Category.UpdateCheckedState(true);
                onCheckedNodeChanged();
                return;
            }

            if (wasChecked && !isChecked)
            {
                item.Category.UpdateCheckedState(false);
                onCheckedNodeChanged();
                return;
            }
        }