예제 #1
0
        public override void UpdateHScrollbarMaximum()
        {
            int val2 = 0;
            ITraverser <ListViewDataItem> enumerator = (ITraverser <ListViewDataItem>) this.Scroller.Traverser.GetEnumerator();

            enumerator.Reset();
            bool flag = this.Owner.ShowGroups && this.Owner.Groups.Count > 0 && (this.Owner.EnableGrouping || this.Owner.EnableCustomGrouping) && !this.FullRowSelect;

            while (enumerator.MoveNext())
            {
                val2 = Math.Max(enumerator.Current.ActualSize.Width + (enumerator.Current is ListViewDataItemGroup || !flag ? 0 : this.GroupIndent), val2);
            }
            if (this.HScrollBar.Maximum != val2)
            {
                if (this.HScrollBar.Value + this.HScrollBar.LargeChange - 1 > val2)
                {
                    this.HScrollBar.Maximum = val2;
                    this.HScrollBar.Value   = val2 - this.HScrollBar.LargeChange + 1;
                }
                else
                {
                    this.HScrollBar.Maximum = val2;
                }
            }
            this.UpdateHScrollbarVisibility();
        }
예제 #2
0
        internal override void UpdateHScrollbarMaximum()
        {
            int newMaximum = 0;
            ITraverser <ListViewDataItem> enumerator = (ITraverser <ListViewDataItem>) this.Scroller.Traverser.GetEnumerator();

            enumerator.Reset();

            bool calcIndent = this.owner.ShowGroups && this.owner.Groups.Count > 0 &&
                              (this.owner.EnableGrouping || this.owner.EnableCustomGrouping) && !this.FullRowSelect;

            while (enumerator.MoveNext())
            {
                newMaximum = Math.Max(
                    enumerator.Current.ActualSize.Width +
                    ((!(enumerator.Current is ListViewDataItemGroup) && calcIndent) ? this.GroupIndent : 0),
                    newMaximum);
            }

            if (this.HScrollBar.Maximum != newMaximum)
            {
                if (this.HScrollBar.Value + this.HScrollBar.LargeChange - 1 > newMaximum)
                {
                    this.HScrollBar.Maximum = newMaximum;
                    this.HScrollBar.Value   = newMaximum - this.HScrollBar.LargeChange + 1;
                }
                else
                {
                    this.HScrollBar.Maximum = newMaximum;
                }
            }

            UpdateHScrollbarVisibility();
        }
예제 #3
0
        protected virtual bool IsFirstChildRow(IHierarchicalRow parent, GridViewRowInfo row)
        {
            ITraverser <GridViewRowInfo> traverser = this.GetTraverser(parent);

            traverser.Reset();
            traverser.MoveNext();
            return(traverser.Current == row);
        }
예제 #4
0
        /// <summary>
        /// Handles a press of the Home key.
        /// </summary>
        /// <param name="e">The event args.</param>
        protected virtual void HandleHomeKey(KeyEventArgs e)
        {
            ITraverser <ListViewDataItem> enumerator = this.Scroller.Traverser.GetEnumerator() as ITraverser <ListViewDataItem>;

            enumerator.Reset();

            if (enumerator.MoveNext() && enumerator.Current != null)
            {
                this.ProcessSelection(enumerator.Current, Control.ModifierKeys, false);
            }
        }
예제 #5
0
        protected override void HandleRightKey(KeyEventArgs e)
        {
            int num = this.Owner.Columns.IndexOf(this.Owner.CurrentColumn);
            ITraverser <ListViewDetailColumn> enumerator = (ITraverser <ListViewDetailColumn>) this.columnScroller.Traverser.GetEnumerator();

            enumerator.Position = (object)num;
            if (!enumerator.MoveNext())
            {
                return;
            }
            this.Owner.CurrentColumn = enumerator.Current;
        }
예제 #6
0
        protected override void HandleRightKey(System.Windows.Forms.KeyEventArgs e)
        {
            int columnIndex = this.owner.Columns.IndexOf(this.owner.CurrentColumn);

            ITraverser <ListViewDetailColumn> enumerator = (ITraverser <ListViewDetailColumn>) this.columnScroller.Traverser.GetEnumerator();

            enumerator.Position = columnIndex;

            if (enumerator.MoveNext())
            {
                this.owner.CurrentColumn = enumerator.Current;
            }
        }
예제 #7
0
        private bool StepOutOfHierarchy()
        {
            GridViewHierarchyRowInfo hierarchyRow1 = this.hierarchyRow as GridViewHierarchyRowInfo;

            if (this.hierarchyRow is GridViewGroupRowInfo || this.hierarchyRow.HasChildViews || this.processHierarchy && (this.hierarchyRow.Parent != null || this.hierarchyRow is GridViewHierarchyRowInfo))
            {
                IHierarchicalRow hierarchyRow2 = this.hierarchyRow;
                this.oldRowIsGroupRow = hierarchyRow2 is GridViewGroupRowInfo;
                this.hierarchyRow     = this.hierarchyRow.Parent;
                GridViewInfo gridViewInfo = this.Current != null ? this.Current.ViewInfo : (GridViewInfo)null;
                bool         flag         = this.Current is GridViewHierarchyRowInfo;
                if (this.hierarchyRow == null)
                {
                    this.hierarchyRow = this.rootRow;
                }
                if (this.hierarchyTraversers.Count > 0)
                {
                    ITraverser <GridViewRowInfo> traverser = this.hierarchyTraversers.Pop();
                    traverser.MovePrevious();
                    traverser.MovePrevious();
                    for (int index = 0; index < 5; ++index)
                    {
                        traverser.MoveNext();
                        if (traverser.Current == hierarchyRow2)
                        {
                            this.traverser = traverser;
                            return(this.ProcessHierarchy || hierarchyRow1 == null || (hierarchyRow1.ViewTemplate.Templates.Count <= 0 || !hierarchyRow1.ViewTemplate.IsSelfReference) || (gridViewInfo == null || hierarchyRow1.ViewTemplate == gridViewInfo.ViewTemplate) && (flag || hierarchyRow1 != this.rootRow));
                        }
                    }
                }
                this.CreateTraverser();
                while (this.traverser.MoveNext())
                {
                    if (this.traverser.Current == hierarchyRow2)
                    {
                        return(this.ProcessHierarchy || hierarchyRow1 == null || (hierarchyRow1.ViewTemplate.Templates.Count <= 0 || !hierarchyRow1.ViewTemplate.IsSelfReference) || (gridViewInfo == null || hierarchyRow1.ViewTemplate == gridViewInfo.ViewTemplate) && (flag || hierarchyRow1 != this.rootRow));
                    }
                }
            }
            return(false);
        }
예제 #8
0
        protected virtual void HandleDragDrop(RadDropEventArgs e)
        {
            RadElement             hitTarget1    = e.HitTarget as RadElement;
            BaseListViewVisualItem targetElement = e.HitTarget as BaseListViewVisualItem;
            BaseListViewElement    hitTarget2    = e.HitTarget as BaseListViewElement;

            if (hitTarget1 != null)
            {
                targetElement = this.owner.ViewElement.GetVisualItemAt(hitTarget1.PointToControl(e.DropLocation));
            }
            ListViewDataItem listViewDataItem = targetElement?.Data;
            bool             flag             = false;

            if (listViewDataItem != null)
            {
                listViewDataItem.Owner.ListSource.BeginUpdate();
                if (this.owner.ViewElement.ShouldDropAfter(targetElement, e.DropLocation))
                {
                    ITraverser <ListViewDataItem> enumerator = this.owner.ViewElement.Scroller.Traverser.GetEnumerator() as ITraverser <ListViewDataItem>;
                    enumerator.Position = (object)listViewDataItem;
                    flag             = !enumerator.MoveNext();
                    listViewDataItem = enumerator.Current;
                }
                int newIndex = this.owner.ListSource.IndexOf(listViewDataItem);
                if (this.draggedItems != null)
                {
                    foreach (ListViewDataItem draggedItem in this.draggedItems)
                    {
                        int oldIndex = this.owner.ListSource.IndexOf(draggedItem);
                        this.owner.ListSource.Move(oldIndex, newIndex);
                        if (oldIndex > newIndex)
                        {
                            ++newIndex;
                        }
                    }
                }
                else if (this.draggedItem != null)
                {
                    int num1 = this.owner.ListSource.IndexOf(this.draggedItem);
                    if (flag)
                    {
                        int num2 = this.owner.ListSource.Count - 1;
                    }
                    else if (num1 < newIndex)
                    {
                        --newIndex;
                    }
                    this.owner.ListSource.Move(this.owner.ListSource.IndexOf(this.draggedItem), newIndex);
                }
                listViewDataItem.Owner.ListSource.EndUpdate();
                listViewDataItem.Owner.ViewElement.Scroller.UpdateScrollValue();
            }
            else
            {
                if (hitTarget2 == null)
                {
                    return;
                }
                hitTarget2.Owner.ListSource.BeginUpdate();
                if (this.draggedItems != null)
                {
                    foreach (ListViewDataItem draggedItem in this.draggedItems)
                    {
                        hitTarget2.Owner.ListSource.Move(this.owner.ListSource.IndexOf(draggedItem), this.owner.ListSource.Count - 1);
                    }
                }
                else if (this.draggedItem != null)
                {
                    hitTarget2.Owner.ListSource.Move(this.owner.ListSource.IndexOf(this.draggedItem), this.owner.ListSource.Count - 1);
                }
                hitTarget2.Owner.ListSource.EndUpdate();
                hitTarget2.Owner.ViewElement.Scroller.UpdateScrollValue();
            }
        }
예제 #9
0
        protected override bool ProcessDialogKey(Keys keyData)
        {
            if (keyData == Keys.Tab)
            {
                var view        = this.ListViewElement.ViewElement as DetailListViewElement;
                var element     = this.ListViewElement;
                int columnIndex = element.Columns.IndexOf(element.CurrentColumn);

                ITraverser <ListViewDetailColumn> colEnumerator = (ITraverser <ListViewDetailColumn>)view.ColumnScroller.Traverser.GetEnumerator();
                colEnumerator.Position = columnIndex;

                if (colEnumerator.MoveNext())
                {
                    var isEditing = element.IsEditing;

                    element.CurrentColumn = colEnumerator.Current;
                    if (isEditing)
                    {
                        element.BeginEdit();
                    }
                    return(true);
                }
                else
                {
                    ListViewTraverser enumerator = view.Scroller.Traverser.GetEnumerator() as ListViewTraverser;
                    enumerator.Position = element.CurrentItem;

                    if (enumerator.MoveNext())
                    {
                        var isEditing = element.IsEditing;


                        colEnumerator.Reset();
                        colEnumerator.MoveNext();
                        element.CurrentColumn = colEnumerator.Current;
                        element.CurrentItem   = enumerator.Current;
                        element.SelectedItem  = enumerator.Current;

                        if (isEditing)
                        {
                            element.BeginEdit();
                        }

                        return(true);
                    }
                }
            }
            if (keyData == (Keys.Tab | Keys.Shift))
            {
                var view        = this.ListViewElement.ViewElement as DetailListViewElement;
                var element     = this.ListViewElement;
                int columnIndex = element.Columns.IndexOf(element.CurrentColumn);

                ITraverser <ListViewDetailColumn> colEnumerator = (ITraverser <ListViewDetailColumn>)view.ColumnScroller.Traverser.GetEnumerator();
                colEnumerator.Position = columnIndex;

                if (colEnumerator.MovePrevious())
                {
                    var isEditing = element.IsEditing;

                    element.CurrentColumn = colEnumerator.Current;

                    if (isEditing)
                    {
                        element.BeginEdit();
                    }
                    return(true);
                }
                else
                {
                    ListViewTraverser enumerator = view.Scroller.Traverser.GetEnumerator() as ListViewTraverser;
                    enumerator.Position = element.CurrentItem;

                    if (enumerator.MovePrevious())
                    {
                        var isEditing = element.IsEditing;

                        colEnumerator.MoveToEnd();
                        element.CurrentColumn = colEnumerator.Current;
                        element.CurrentItem   = enumerator.Current;
                        element.SelectedItem  = enumerator.Current;

                        if (isEditing)
                        {
                            element.BeginEdit();
                        }

                        return(true);
                    }
                }
            }
            return(base.ProcessDialogKey(keyData));
        }