Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the HitInfo class.
        /// </summary>
        /// <param name="itemIndex">Index of the item.</param>
        /// <param name="checkBoxHit">if set to true the mouse cursor is over a checkbox.</param>
        /// <param name="group">The group header hit.</param>
        /// <param name="column">The column header hit</param>
        /// <param name="columnSeparator">The column separator.</param>
        /// <param name="subItemIndex">Index of the sub item.</param>
        /// <param name="paneBorder">if set to true the mouse cursor is over the left-pane border.</param>
        /// <param name="inItemArea">if set to true the mouse is in the item area.</param>
        /// <param name="inHeaderArea">if set to true the mouse cursor is in the column header area.</param>
        /// <param name="inPaneArea">if set to true the mouse cursor is in the left-pane area.</param>
        private HitInfo(int itemIndex, bool checkBoxHit, ImageListViewGroup group, ImageListViewColumnHeader column,
                        ImageListViewColumnHeader columnSeparator, int subItemIndex,
                        bool paneBorder, bool inItemArea, bool inHeaderArea, bool inPaneArea)
        {
            ItemIndex       = itemIndex;
            CheckBoxHit     = checkBoxHit;
            Group           = group;
            Column          = column;
            ColumnSeparator = columnSeparator;
            SubItemIndex    = subItemIndex;

            InItemArea   = inItemArea;
            InHeaderArea = inHeaderArea;

            InPaneArea = inPaneArea;
            PaneBorder = paneBorder;
        }
 /// <summary>
 /// Compares the current object with another object of the same type.
 /// </summary>
 /// <param name="other">An object to compare with this object.</param>
 /// <returns>
 /// A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has the following meanings:
 /// Value
 /// Meaning
 /// Less than zero
 /// This object is less than the <paramref name="other"/> parameter.
 /// Zero
 /// This object is equal to <paramref name="other"/>.
 /// Greater than zero
 /// This object is greater than <paramref name="other"/>.
 /// </returns>
 public int CompareTo(ImageListViewGroup other)
 {
     return(string.Compare(Name, other.Name));
 }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the HitInfo class.
 /// Used when the control registered a column hit.
 /// </summary>
 /// <param name="group">The group header hit.</param>
 internal HitInfo(ImageListViewGroup group)
     : this(-1, false, group, null, null, -1, false, false, true, false)
 {
     ;
 }
Beispiel #4
0
        /// <summary>
        /// Updates groups after adding or removing an item. This just updates
        /// the count of items in groups, it DOES NOT re-sort the items.
        /// </summary>
        /// <param name="index">The index of the new or removed item.</param>
        /// <param name="add">true to add an item; false to remove a item.</param>
        private void AddRemoveGroupItem(int index, bool add)
        {
            if (mImageListView == null || !mImageListView.GroupsVisible)
            {
                return;
            }
            if (mImageListView.groups.Count == 0)
            {
                Sort();
                return;
            }

            // Special case of adding an item to the end
            ImageListViewGroup lastGroup = mImageListView.groups[mImageListView.groups.Count - 1];

            if (add && index == lastGroup.LastItemIndex + 1)
            {
                lastGroup.LastItemIndex++;
                return;
            }

            // Insert into a group
            List <ImageListViewGroup> emptyGroups = new List <ImageListViewGroup>();

            foreach (ImageListViewGroup group in mImageListView.groups)
            {
                if (group.LastItemIndex < index)
                {
                    continue;
                }
                else if (group.FirstItemIndex <= index && group.LastItemIndex >= index)
                {
                    if (add)
                    {
                        group.LastItemIndex++;
                    }
                    else
                    {
                        group.LastItemIndex--;
                    }
                }
                else // if (group.FirstItemIndex > index)
                {
                    if (add)
                    {
                        group.FirstItemIndex++;
                        group.LastItemIndex++;
                    }
                    else
                    {
                        group.FirstItemIndex--;
                        group.LastItemIndex--;
                    }
                }

                if (group.ItemCount == 0)
                {
                    emptyGroups.Add(group);
                }
            }

            // Purge empty groups
            foreach (ImageListViewGroup group in emptyGroups)
            {
                mImageListView.groups.Remove(group);
            }
        }