Exemple #1
0
 public ThumbViewPaintEventArgs(ThumbView view, Graphics graphics, ThumbItem item, Font font)
 {
     View     = view;
     Graphics = graphics;
     Item     = item;
     Font     = font;
 }
Exemple #2
0
        void PaintItemCloseButton(PaintEventArgs e, ThumbItem item)
        {
            if (item != HoverObject.Item)
            {
                return;
            }

            Image         image = Properties.Resources.taskbar_close_button;
            UIStatusImage img   = UIStatusImage.FromVertical(image,
                                                             new UIControlStatus[] {
                UIControlStatus.Normal,
                UIControlStatus.Hover,
                UIControlStatus.Selected,
                UIControlStatus.InactivedHover,
                UIControlStatus.Inactived,
                UIControlStatus.Disabled
            });

            var rect = GetItemCloseButtonRectangle(item);
            var bs   = UIControlStatus.Normal;

            if (PressedObject.Item == item && PressedObject.IsCloseButton)
            {
                bs = UIControlStatus.Selected;
            }
            else if (HoverObject.Item == item && HoverObject.IsCloseButton)
            {
                bs = UIControlStatus.Hover;
            }

            img.Draw(e.Graphics, bs, rect);
        }
Exemple #3
0
 public HitResult(int x, int y, ThumbItem item)
 {
     X             = x;
     Y             = y;
     Item          = item;
     IsCloseButton = false;
 }
Exemple #4
0
        void PaintItem(PaintEventArgs e, ThumbItem item)
        {
            ThumbViewPaintEventArgs args = new ThumbViewPaintEventArgs(this, e.Graphics, item, Font);

            if (!item.NotifyPaint(args))
            {
                PaintCellBackground(args, item);

                Color foreColor;
                if (item == HoverObject.Item)
                {
                    foreColor = ActiveCellForeColor;
                }
                else
                {
                    foreColor = CellForeColor;
                }

                if (!string.IsNullOrEmpty(item.Text))
                {
                    Font font = new Font(UITheme.Default.DefaultFont.FontFamily, 16);
                    e.Graphics.DrawString(item.Text, font, new SolidBrush(foreColor), item.Bounds, PaintHelper.SFCenter);
                }
            }

            // close button
            if (item.CanClose)
            {
                PaintItemCloseButton(e, item);
            }
        }
Exemple #5
0
 void Invalidate(ThumbItem item)
 {
     if (item != null)
     {
         Invalidate(item.Bounds);
     }
 }
Exemple #6
0
        protected virtual void OnItemClick(ThumbItem item)
        {
            item.NotifyClick();

            if (ItemClick != null)
            {
                ItemClick(this, new ThumbViewItemEventArgs(item));
            }
        }
Exemple #7
0
        Rectangle GetItemCloseButtonRectangle(ThumbItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException();
            }

            return(new Rectangle(item.Right - 16, item.Top, 16, 16));
        }
Exemple #8
0
        internal void PaintCellBackground(ThumbViewPaintEventArgs e, ThumbItem item)
        {
            Color backColor;

            if (item == HoverObject.Item)
            {
                backColor = ActiveCellBackColor;
            }
            else
            {
                backColor = CellBackColor;
            }

            if (!backColor.IsEmpty)
            {
                e.Graphics.FillRectangle(new SolidBrush(backColor), item.Bounds);
            }
        }
Exemple #9
0
        void OnItemClose(ThumbItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException();
            }

            //
            if (Items.Contains(item))
            {
                var e = new ThumbViewItemCancelEventArgs(item);
                OnItemClosing(e);
                if (e.Cancel)
                {
                    return;
                }

                Items.Remove(item);

                var e2 = new ThumbViewItemEventArgs(item);
                OnItemClosed(e2);
            }
        }
 public ThumbViewItemEventArgs(ThumbItem item)
 {
     Item = item;
 }