コード例 #1
0
        static void RegenerateRows(
            ListViewItemIds <object> listViewItemIds,
            List <object> objectInfos,
            TreeViewItem rootItem,
            List <TreeViewItem> rows)
        {
            ClearRows(rootItem, rows);

            if (objectInfos.Count == 0)
            {
                return;
            }

            foreach (object objectInfo in objectInfos)
            {
                int objectId;
                if (!listViewItemIds.TryGetInfoItemId(objectInfo, out objectId))
                {
                    objectId = listViewItemIds.AddInfoItem(objectInfo);
                }

                BranchListViewItem branchListViewItem =
                    new BranchListViewItem(objectId, objectInfo);

                rootItem.AddChild(branchListViewItem);
                rows.Add(branchListViewItem);
            }
        }
コード例 #2
0
        static void BranchesListViewItemGUI(
            ViewQueryResult queryResult,
            float rowHeight,
            BranchListViewItem item,
            RowGUIArgs args,
            bool isBoldText,
            Action avatarLoadedAction)
        {
            for (int visibleColumnIdx = 0; visibleColumnIdx < args.GetNumVisibleColumns(); visibleColumnIdx++)
            {
                Rect cellRect = args.GetCellRect(visibleColumnIdx);

                if (visibleColumnIdx == 0)
                {
                    cellRect.x     += UnityConstants.FIRST_COLUMN_WITHOUT_ICON_INDENT;
                    cellRect.width -= UnityConstants.FIRST_COLUMN_WITHOUT_ICON_INDENT;
                }

                BranchesListColumn column =
                    (BranchesListColumn)args.GetColumn(visibleColumnIdx);

                BranchesListViewItemCellGUI(
                    cellRect,
                    rowHeight,
                    queryResult,
                    item,
                    column,
                    avatarLoadedAction,
                    args.selected,
                    args.focused,
                    isBoldText);
            }
        }
コード例 #3
0
        static void BranchesListViewItemCellGUI(
            Rect rect,
            float rowHeight,
            ViewQueryResult queryResult,
            BranchListViewItem item,
            BranchesListColumn column,
            Action avatarLoadedAction,
            bool isSelected,
            bool isFocused,
            bool isBoldText)
        {
            string columnText = RepObjectInfoView.GetColumnText(
                queryResult.GetRepositorySpec(item.ObjectInfo),
                queryResult.GetRepObjectInfo(item.ObjectInfo),
                BranchesListHeaderState.GetColumnName(column));

            if (column == BranchesListColumn.CreatedBy)
            {
                DrawTreeViewItem.ForItemCell(
                    rect,
                    rowHeight,
                    -1,
                    GetAvatar.ForEmail(columnText, avatarLoadedAction),
                    null,
                    columnText,
                    isSelected,
                    isFocused,
                    isBoldText,
                    false);
                return;
            }

            if (column == BranchesListColumn.Branch ||
                column == BranchesListColumn.Repository ||
                column == BranchesListColumn.Guid)
            {
                DrawTreeViewItem.ForSecondaryLabel(
                    rect, columnText, isSelected, isFocused, isBoldText);
                return;
            }

            DrawTreeViewItem.ForLabel(
                rect, columnText, isSelected, isFocused, isBoldText);
        }
コード例 #4
0
        protected override void RowGUI(RowGUIArgs args)
        {
            if (args.item is BranchListViewItem)
            {
                BranchListViewItem branchListViewItem = (BranchListViewItem)args.item;
                BranchInfo         branchInfo         = (BranchInfo)branchListViewItem.ObjectInfo;

                BranchesListViewItemGUI(
                    mQueryResult,
                    rowHeight,
                    branchListViewItem,
                    args,
                    branchInfo.BranchId == mLoadedBranchId,
                    Repaint);
                return;
            }

            base.RowGUI(args);
        }