Beispiel #1
0
        private void PaintButton(ExplorerBarButton button, Graphics g)
        {
            _renderer.PerformRenderItemBackground(g, button);

            if (button.IsLarge)
            {
                _renderer.PerformRenderItemText(g, button);

                button.ImageBounds = new Rectangle(
                    10,
                    button.Bounds.Y + (int)Math.Floor((_renderer.ButtonHeight / 2.0) - (ImageDimensionLarge / 2.0)),
                    ImageDimensionLarge,
                    ImageDimensionLarge
                    );
            }
            else
            {
                button.ImageBounds = new Rectangle(
                    button.Bounds.X + (int)Math.Floor((button.Bounds.Width / 2.0) - (ImageDimensionSmall / 2.0)),
                    button.Bounds.Y + (int)Math.Floor((button.Bounds.Height / 2.0) - (ImageDimensionSmall / 2.0)),
                    ImageDimensionSmall,
                    ImageDimensionSmall
                    );
            }

            _renderer.PerformRenderItemImage(g, button);
        }
Beispiel #2
0
        protected override void OnMouseLeave(EventArgs e)
        {
            base.OnMouseLeave(e);

            _selectedButton = null;

            Invalidate();
        }
        public ExplorerBarButton Add(ExplorerBarButton item)
        {
            item.Owner = _owner;

            int index = this.List.Add(item);

            return this[index];
        }
        public ExplorerBarButton Add(ExplorerBarButton item)
        {
            item.Owner = _owner;

            int index = this.List.Add(item);

            return(this[index]);
        }
Beispiel #5
0
        public ExplorerBar()
        {
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            SetStyle(ControlStyles.ResizeRedraw, true);

            _dropDownButton       = new ExplorerBarButton();
            _dropDownButton.Owner = this;

            RenderMode = ExplorerBarRenderMode.Themed;

            _buttons = new ExplorerBarButtonCollection(this);
        }
Beispiel #6
0
        public ExplorerBar()
        {
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            SetStyle(ControlStyles.ResizeRedraw, true);

            _dropDownButton = new ExplorerBarButton();
            _dropDownButton.Owner = this;

            RenderMode = ExplorerBarRenderMode.Themed;

            _buttons = new ExplorerBarButtonCollection(this);
        }
Beispiel #7
0
        protected override void OnMouseClick(MouseEventArgs e)
        {
            base.OnMouseClick(e);

            var button = _buttons.GetItemAtPoint(e.Location);

            if (button != null && e.Button == MouseButtons.Left)
            {
                _checkedButton = button;

                _checkedButton.PerformClick();

                Invalidate();
            }
            else if (_dropDownButton.Visible && _dropDownButton.Bounds.Contains(e.Location))
            {
                CreateContextMenu();
            }
        }
Beispiel #8
0
        private void PaintButton(ExplorerBarButton button, Graphics g)
        {
            _renderer.PerformRenderItemBackground(g, button);

            if (button.IsLarge)
            {
                _renderer.PerformRenderItemText(g, button);

                button.ImageBounds = new Rectangle(
                    10,
                    button.Bounds.Y + (int)Math.Floor((_renderer.ButtonHeight / 2.0) - (ImageDimensionLarge / 2.0)),
                    ImageDimensionLarge,
                    ImageDimensionLarge
                );
            }
            else
            {
                button.ImageBounds = new Rectangle(
                    button.Bounds.X + (int)Math.Floor((button.Bounds.Width / 2.0) - (ImageDimensionSmall / 2.0)),
                    button.Bounds.Y + (int)Math.Floor((button.Bounds.Height / 2.0) - (ImageDimensionSmall / 2.0)),
                    ImageDimensionSmall,
                    ImageDimensionSmall
                );
            }

            _renderer.PerformRenderItemImage(g, button);
        }
 public void Remove(ExplorerBarButton item)
 {
     this.List.Remove(item);
 }
Beispiel #10
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            _selectedButton = null;

            int buttonHeight = _renderer.ButtonHeight;

            if (_isResizing)
            {
                if (e.Y < -buttonHeight)
                {
                    if (_canGrow)
                    {
                        this.Height += buttonHeight;
                    }
                }
                else if (e.Y > _renderer.ButtonHeight)
                {
                    if (_canShrink)
                    {
                        this.Height -= buttonHeight;
                    }
                }
            }
            else
            {
                if (GetGripRectangle().Contains(e.Location))
                {
                    this.Cursor = Cursors.SizeNS;
                }
                else if (_dropDownButton.Visible && _dropDownButton.Bounds.Contains(e.Location))
                {
                    this.Cursor = Cursors.Hand;

                    _selectedButton = _dropDownButton;

                    Invalidate();

                    string toolTipTag = _toolTip.Tag as string;

                    if (toolTipTag == null || toolTipTag != "Configure")
                    {
                        _toolTip.Active = true;
                        _toolTip.SetToolTip(this, "Configure buttons");
                        _toolTip.Tag = "Configure";
                    }
                }
                else
                {
                    var button = _buttons.GetItemAtPoint(e.Location);

                    if (button != null)
                    {
                        this.Cursor = Cursors.Hand;

                        _selectedButton = button;

                        Invalidate();

                        if (!button.IsLarge)
                        {
                            if (!button.Equals(_toolTip.Tag))
                            {
                                _toolTip.Active = true;
                                _toolTip.SetToolTip(this, button.Text);
                                _toolTip.Tag = button;
                            }
                        }
                        else
                        {
                            _toolTip.Active = false;
                        }
                    }
                    else
                    {
                        this.Cursor = Cursors.Default;
                    }
                }
            }
        }
 public void Insert(int index, ExplorerBarButton item)
 {
     this.List.Insert(index, item);
 }
Beispiel #12
0
        protected override void OnMouseClick(MouseEventArgs e)
        {
            base.OnMouseClick(e);

            var button = _buttons.GetItemAtPoint(e.Location);

            if (button != null && e.Button == MouseButtons.Left)
            {
                _checkedButton = button;

                _checkedButton.PerformClick();

                Invalidate();
            }
            else if (_dropDownButton.Visible && _dropDownButton.Bounds.Contains(e.Location))
            {
                CreateContextMenu();
            }
        }
Beispiel #13
0
        protected override void OnMouseLeave(EventArgs e)
        {
            base.OnMouseLeave(e);

            _selectedButton = null;

            Invalidate();
        }
 public int IndexOf(ExplorerBarButton item)
 {
     return this.List.IndexOf(item);
 }
 internal ExplorerBarItemRenderEventArgs(Graphics graphics, ExplorerBar explorerBar, ExplorerBarButton item)
 {
     _graphics = graphics;
     _explorerBar = explorerBar;
     _item = item;
 }
 public void Remove(ExplorerBarButton item)
 {
     this.List.Remove(item);
 }
 public bool Contains(ExplorerBarButton item)
 {
     return this.List.Contains(item);
 }
 public void Insert(int index, ExplorerBarButton item)
 {
     this.List.Insert(index, item);
 }
 public int IndexOf(ExplorerBarButton item)
 {
     return(this.List.IndexOf(item));
 }
 internal void PerformRenderItemText(Graphics g, ExplorerBarButton item)
 {
     OnRenderItemText(new ExplorerBarItemRenderEventArgs(g, _explorerBar, item));
 }
Beispiel #21
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            _selectedButton = null;

            int buttonHeight = _renderer.ButtonHeight;

            if (_isResizing)
            {
                if (e.Y < -buttonHeight)
                {
                    if (_canGrow)
                    {
                        this.Height += buttonHeight;
                    }
                }
                else if (e.Y > _renderer.ButtonHeight)
                {
                    if (_canShrink)
                    {
                        this.Height -= buttonHeight;
                    }
                }
            }
            else
            {
                if (GetGripRectangle().Contains(e.Location))
                {
                    this.Cursor = Cursors.SizeNS;
                }
                else if (_dropDownButton.Visible && _dropDownButton.Bounds.Contains(e.Location))
                {
                    this.Cursor = Cursors.Hand;

                    _selectedButton = _dropDownButton;

                    Invalidate();

                    string toolTipTag = _toolTip.Tag as string;

                    if (toolTipTag == null || toolTipTag != "Configure")
                    {
                        _toolTip.Active = true;
                        _toolTip.SetToolTip(this, "Configure buttons");
                        _toolTip.Tag = "Configure";
                    }
                }
                else
                {
                    var button = _buttons.GetItemAtPoint(e.Location);

                    if (button != null)
                    {
                        this.Cursor = Cursors.Hand;

                        _selectedButton = button;

                        Invalidate();

                        if (!button.IsLarge)
                        {
                            if (!button.Equals(_toolTip.Tag))
                            {
                                _toolTip.Active = true;
                                _toolTip.SetToolTip(this, button.Text);
                                _toolTip.Tag = button;
                            }
                        }
                        else
                        {
                            _toolTip.Active = false;
                        }
                    }
                    else
                    {
                        this.Cursor = Cursors.Default;
                    }
                }
            }
        }
 public bool Contains(ExplorerBarButton item)
 {
     return(this.List.Contains(item));
 }
Beispiel #23
0
 internal ExplorerBarItemRenderEventArgs(Graphics graphics, ExplorerBar explorerBar, ExplorerBarButton item)
 {
     _graphics    = graphics;
     _explorerBar = explorerBar;
     _item        = item;
 }
Beispiel #24
0
 internal void PerformRenderItemBackground(Graphics g, ExplorerBarButton item)
 {
     OnRenderItemBackground(new ExplorerBarItemRenderEventArgs(g, _explorerBar, item));
 }