public Rectangle CalculateItemBounds(OLVListItem item, OLVListSubItem si)
 {
     if (item == null)
     {
         return(Rectangle.Empty);
     }
     if (si == null)
     {
         return(item.Bounds);
     }
     return(item.GetSubItemBounds(item.SubItems.IndexOf(si)));
 }
示例#2
0
        /// <summary>
        /// Return bounds of the given subitem
        /// </summary>
        /// <remarks>This correctly calculates the bounds even for column 0.</remarks>
        public virtual Rectangle GetSubItemBounds(int subItemIndex)
        {
            if (subItemIndex == 0)
            {
                Rectangle r     = this.Bounds;
                Point     sides = NativeMethods.GetScrolledColumnSides(this.ListView, subItemIndex);
                r.X     = sides.X + 1;
                r.Width = sides.Y - sides.X;
                return(r);
            }

            OLVListSubItem subItem = this.GetSubItem(subItemIndex);

            return(subItem == null ? new Rectangle() : subItem.Bounds);
        }
        public virtual Rectangle GetSubItemBounds(int subItemIndex)
        {
            if (subItemIndex == 0)
            {
                Rectangle bounds = this.Bounds;
                Point     scrolledColumnSides = BrightIdeasSoftware.NativeMethods.GetScrolledColumnSides(base.ListView, subItemIndex);
                bounds.X     = scrolledColumnSides.X + 1;
                bounds.Width = scrolledColumnSides.Y - scrolledColumnSides.X;
                return(bounds);
            }
            OLVListSubItem subItem = this.GetSubItem(subItemIndex);

            if (subItem == null)
            {
                return(new Rectangle());
            }
            return(subItem.Bounds);
        }
 protected void OnTimerInThread()
 {
     if (!base.ListView.IsDisposed)
     {
         if ((base.ListView.View != View.Details) || (base.Column.Index < 0))
         {
             this.tickler.Change(0x3e8, -1);
         }
         else
         {
             long      elapsedMilliseconds = this.stopwatch.ElapsedMilliseconds;
             int       index = base.Column.Index;
             long      num3  = elapsedMilliseconds + 0x3e8L;
             Rectangle a     = new Rectangle();
             foreach (OLVListItem item in base.ListView.Items)
             {
                 OLVListSubItem subItem        = item.GetSubItem(index);
                 AnimationState animationState = subItem.AnimationState;
                 if ((animationState != null) && animationState.IsValid)
                 {
                     if (elapsedMilliseconds >= animationState.currentFrameExpiresAt)
                     {
                         animationState.AdvanceFrame(elapsedMilliseconds);
                         if (a.IsEmpty)
                         {
                             a = subItem.Bounds;
                         }
                         else
                         {
                             a = Rectangle.Union(a, subItem.Bounds);
                         }
                     }
                     num3 = Math.Min(num3, animationState.currentFrameExpiresAt);
                 }
             }
             if (!a.IsEmpty)
             {
                 base.ListView.Invalidate(a);
             }
             this.tickler.Change((long)(num3 - elapsedMilliseconds), (long)(-1L));
         }
     }
 }
        public OlvListViewHitTestInfo(ListViewHitTestInfo hti)
        {
            this.item     = (OLVListItem)hti.Item;
            this.subItem  = (OLVListSubItem)hti.SubItem;
            this.location = hti.Location;
            switch (hti.Location)
            {
            case ListViewHitTestLocations.Image:
                this.HitTestLocation = BrightIdeasSoftware.HitTestLocation.Image;
                return;

            case ListViewHitTestLocations.Label:
                this.HitTestLocation = BrightIdeasSoftware.HitTestLocation.Text;
                return;

            case ListViewHitTestLocations.StateImage:
                this.HitTestLocation = BrightIdeasSoftware.HitTestLocation.CheckBox;
                return;
            }
            this.HitTestLocation = BrightIdeasSoftware.HitTestLocation.Nothing;
        }
        /// <summary>
        /// Create a OlvListViewHitTestInfo
        /// </summary>
        public OlvListViewHitTestInfo(OLVListItem olvListItem, OLVListSubItem subItem, int flags, OLVGroup group, int iColumn)
        {
            this.item              = olvListItem;
            this.subItem           = subItem;
            this.location          = ConvertNativeFlagsToDotNetLocation(olvListItem, flags);
            this.HitTestLocationEx = (HitTestLocationEx)flags;
            this.Group             = group;
            this.ColumnIndex       = iColumn;
            this.ListView          = olvListItem == null ? null : (ObjectListView)olvListItem.ListView;

            switch (location)
            {
            case ListViewHitTestLocations.StateImage:
                this.HitTestLocation = HitTestLocation.CheckBox;
                break;

            case ListViewHitTestLocations.Image:
                this.HitTestLocation = HitTestLocation.Image;
                break;

            case ListViewHitTestLocations.Label:
                this.HitTestLocation = HitTestLocation.Text;
                break;

            default:
                if ((this.HitTestLocationEx & HitTestLocationEx.LVHT_EX_GROUP_COLLAPSE) == HitTestLocationEx.LVHT_EX_GROUP_COLLAPSE)
                {
                    this.HitTestLocation = HitTestLocation.GroupExpander;
                }
                else if ((this.HitTestLocationEx & HitTestLocationEx.LVHT_EX_GROUP_MINUS_FOOTER_AND_BKGRD) != 0)
                {
                    this.HitTestLocation = HitTestLocation.Group;
                }
                else
                {
                    this.HitTestLocation = HitTestLocation.Nothing;
                }
                break;
            }
        }
示例#7
0
 /// <summary>
 /// Return bounds of the given subitem
 /// </summary>
 /// <remarks>This correctly calculates the bounds even for column 0.</remarks>
 public virtual Rectangle GetSubItemBounds(int subItemIndex)
 {
     if (subItemIndex == 0)
     {
         Rectangle r     = Bounds;
         Point     sides = NativeMethods.GetScrolledColumnSides(ListView, subItemIndex);
         r.X     = sides.X + 1;
         r.Width = sides.Y - sides.X;
         return(r);
     }
     else
     {
         OLVListSubItem subItem = GetSubItem(subItemIndex);
         if (subItem == null)
         {
             return(new Rectangle());
         }
         else
         {
             return(subItem.Bounds);
         }
     }
 }
示例#8
0
        private OLVListSubItem MakeSubItem(object rowObject, OLVColumn column)
        {
            object cellValue = column.GetValue(rowObject);
            OLVListSubItem subItem = new OLVListSubItem(cellValue,
                                                        column.ValueToString(cellValue),
                                                        column.GetImage(rowObject));
            if (this.UseHyperlinks && column.Hyperlink) {
                IsHyperlinkEventArgs args = new IsHyperlinkEventArgs();
                args.ListView = this;
                args.Model = rowObject;
                args.Column = column;
                args.Text = subItem.Text;
                args.Url = subItem.Text;
                this.OnIsHyperlink(args);
                subItem.Url = args.Url;
            }

            return subItem;
        }
示例#9
0
 /// <summary>
 /// Set the subitem image natively
 /// </summary>
 /// <param name="rowIndex"></param>
 /// <param name="subItemIndex"></param>
 /// <param name="subItem"></param>
 /// <param name="shouldClearImages"></param>
 public virtual void SetSubItemImage(int rowIndex, int subItemIndex, OLVListSubItem subItem, bool shouldClearImages)
 {
     int imageIndex = this.GetActualImageIndex(subItem.ImageSelector);
     if (shouldClearImages || imageIndex != -1)
         NativeMethods.SetSubItemImage(this, rowIndex, subItemIndex, imageIndex);
 }
示例#10
0
文件: Adornments.cs 项目: VicBoss/KR
        /// <summary>
        /// Given the item and the subitem, calculate its bounds.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="subItem"></param>
        /// <returns></returns>
        public Rectangle CalculateItemBounds(OLVListItem item, OLVListSubItem subItem) {
            if (item == null)
                return Rectangle.Empty;

            if (subItem == null)
                return item.Bounds;
            else
                return item.GetSubItemBounds(item.SubItems.IndexOf(subItem));
        }
 /// <summary>
 /// Create a decoration that will draw an animation around a cell of the given model
 /// </summary>
 /// <param name="ModelObject"></param>
 public AnimatedDecoration(ObjectListView olv, OLVListItem item, OLVListSubItem subItem)
     : this(olv) {
     this.ModelObject = item.RowObject;
     this.Column = olv.GetColumn(item.SubItems.IndexOf(subItem));
 }
示例#12
0
 /// <summary>
 /// Create a OLVListItem for the given row object
 /// </summary>
 public OLVListItem(object rowObject, OLVListSubItem[] subItems, int imageIndex)
     : base(subItems, imageIndex)
 {
     this.RowObject = null;
 }
示例#13
0
        /// <summary>
        /// Create a OlvListViewHitTestInfo
        /// </summary>
        public OlvListViewHitTestInfo(OLVListItem olvListItem, OLVListSubItem subItem, int flags, OLVGroup group) {
            this.item = olvListItem;
            this.subItem = subItem;
            this.location = ConvertNativeFlagsToDotNetLocation(olvListItem, flags);
            this.HitTestLocationEx = (HitTestLocationEx)flags;
            this.Group = group;

            switch (location) {
                case ListViewHitTestLocations.StateImage:
                    this.HitTestLocation = HitTestLocation.CheckBox;
                    break;
                case ListViewHitTestLocations.Image:
                    this.HitTestLocation = HitTestLocation.Image;
                    break;
                case ListViewHitTestLocations.Label:
                    this.HitTestLocation = HitTestLocation.Text;
                    break;
                default:
                    if ((this.HitTestLocationEx & HitTestLocationEx.LVHT_EX_GROUP_COLLAPSE) == HitTestLocationEx.LVHT_EX_GROUP_COLLAPSE)
                        this.HitTestLocation = HitTestLocation.GroupExpander;
                    else if ((this.HitTestLocationEx & HitTestLocationEx.LVHT_EX_GROUP_MINUS_FOOTER_AND_BKGRD) != 0)
                        this.HitTestLocation = HitTestLocation.Group;
                    else
                        this.HitTestLocation = HitTestLocation.Nothing;
                    break;
            }
        }
 /// <summary>
 /// Create a decoration that will draw an animation around a cell of the given model
 /// </summary>
 /// <param name="ModelObject"></param>
 public AnimatedDecoration(ObjectListView olv, OLVListItem item, OLVListSubItem subItem)
     : this(olv) {
     this.ModelObject = item.RowObject;
     this.Column      = olv.GetColumn(item.SubItems.IndexOf(subItem));
 }
示例#15
0
 public ForwardingDecoration(OLVListItem item, OLVListSubItem subitem, ImageDecoration decoration) {
     this.item = item;
     this.subitem = subitem;
     this.decoration = decoration;
 }