Exemplo n.º 1
0
        public ContextMenuItem(ContextMenuItemEntry entry)
        {
            CanCloseWithRightClick = false;
            _entry = entry;

            _label = new Label(entry.Text, true, 1150, 0, style: FontStyle.BlackBorder)
            {
                X = 10,
            };
            Add(_label);

            if (entry.CanBeSelected)
            {
                _selectedPic           = new GumpPic(0, 0, 0x838, 0);
                _selectedPic.IsVisible = entry.IsSelected;
                Add(_selectedPic);
            }

            Height = 25;


            _label.Y = (Height >> 1) - (_label.Height >> 1);

            if (_selectedPic != null)
            {
                _label.X       = _selectedPic.X + _selectedPic.Width + 6;
                _selectedPic.Y = (Height >> 1) - (_selectedPic.Height >> 1);
            }
            Width = _label.X + _label.Width + 3;

            WantUpdateSize = false;
        }
Exemplo n.º 2
0
        public ClickableColorBox
        (
            int x,
            int y,
            int w,
            int h,
            ushort hue,
            uint color
        )
        {
            X = x;
            Y = y;
            WantUpdateSize = false;

            GumpPic background = new GumpPic(0, 0, 0x00D4, 0);

            Add(background);
            _colorBox   = new ColorBox(w, h, hue, color);
            _colorBox.X = 3;
            _colorBox.Y = 3;
            Add(_colorBox);

            Width  = background.Width;
            Height = background.Height;
        }
Exemplo n.º 3
0
        private MultiSelectionShrinkbox(int x, int y, int width, string indextext, ushort hue, bool unicode, byte font, int group, ushort button, bool userArrow2 = false)
        {
            WantUpdateSize = false;
            X            = x;
            Y            = y;
            _buttonimg   = button;
            _buttongroup = group;
            Width        = width;
            _useArrow2   = userArrow2;

            Add(_label = new Label(indextext, unicode, hue, font: font, align: TEXT_ALIGN_TYPE.TS_LEFT)
            {
                X = 18
            });
            Height = _label.Height;

            Add(_arrow = new GumpPic(1, 1, (ushort)(userArrow2 ? 0x0827 : 0x15E1), 0));

            _arrow.MouseUp += (sender, state) =>
            {
                if (state.Button == MouseButtonType.Left)
                {
                    Opened = !_opened;
                }
            };
        }
Exemplo n.º 4
0
            public ContextMenuItem(ContextMenuShowMenu parent, ContextMenuItemEntry entry)
            {
                CanCloseWithRightClick = false;
                _entry = entry;

                _label = new Label(entry.Text, true, 1150, 0, style: FontStyle.BlackBorder)
                {
                    X = 25
                };

                Add(_label);


                if (entry.CanBeSelected)
                {
                    _selectedPic = new GumpPic(3, 0, 0x838, 0)
                    {
                        IsVisible = entry.IsSelected,
                        IsEnabled = false
                    };

                    Add(_selectedPic);
                }

                Height = 25;


                _label.Y = (Height >> 1) - (_label.Height >> 1);

                if (_selectedPic != null)
                {
                    //_label.X = _selectedPic.X + _selectedPic.Width + 6;
                    _selectedPic.Y = (Height >> 1) - (_selectedPic.Height >> 1);
                }

                Width = _label.X + _label.Width + 20;

                if (Width < 100)
                {
                    Width = 100;
                }

                // it is a bit tricky, but works :D
                if (_entry.Items != null && _entry.Items.Count != 0)
                {
                    _subMenu = new ContextMenuShowMenu(_entry.Items);
                    parent.Add(_subMenu);

                    if (parent._subMenus == null)
                    {
                        parent._subMenus = new List <ContextMenuShowMenu>();
                    }

                    parent._subMenus.Add(_subMenu);
                }

                WantUpdateSize = false;
            }
Exemplo n.º 5
0
        protected override void OnInitialize()
        {
            Add(_gumpTop    = new GumpPic(0, 0, 0x0820, 0));
            Add(_gumpMiddle = new GumpPicTiled(0, 0, 0, 0, 0x0822));
            Add(_gumpBottom = new GumpPic(0, 0, 0x0823, 0));

            if (_isResizable)
            {
                Add(_gumpExpander = new Button(c_GumplingExpander_ButtonID, 0x082E, 0x82F)
                {
                    ButtonAction = ButtonAction.Activate, X = 0, Y = 0
                });
                _gumpExpander.MouseDown += expander_OnMouseDown;
                _gumpExpander.MouseUp   += expander_OnMouseUp;
                _gumpExpander.MouseOver += expander_OnMouseOver;
            }

            WantUpdateSize = true;
        }
Exemplo n.º 6
0
        public ClickableColorBox
        (
            int x,
            int y,
            int w,
            int h,
            ushort hue
        ) : base(w, h, hue)
        {
            X = x;
            Y = y;
            WantUpdateSize = false;

            GumpPic background = new GumpPic(0, 0, 0x00D4, 0);

            Add(background);

            Width  = background.Width;
            Height = background.Height;
        }
        private MultiSelectionShrinkbox(int x, int y, int width, string indextext, ushort hue, bool unicode, byte font, int group, ushort button, bool userArrow2)
        {
            WantUpdateSize = false;
            X            = x;
            Y            = y;
            _buttonimg   = button;
            _buttongroup = group;
            Width        = width;
            _useArrow2   = userArrow2;


            //_label = new Label(indextext, unicode, hue, font: font, align: TEXT_ALIGN_TYPE.TS_LEFT)
            //{
            //    X = 18,
            //    Y = 0
            //};


            //_label = new TextBox(font, 32, maxWidth: width, width: width, isunicode: unicode, hue: hue)
            //{
            //    X = 18,
            //    Y = 0,
            //    Width = tw,
            //    Height = th,
            //    IsEditable = false,
            //    Text = indextext
            //};

            _label = new EditableLabel(indextext, font, hue, unicode, width, FontStyle.None)
            {
                X = 18
            };

            _label.MouseUp += (senderr, e) =>
            {
                if (!IsEditable)
                {
                    return;
                }

                EditStateStart.Raise(_label);

                _label.SetEditable(true);
            };

            int xx       = _label.X + _label.Width + 5;
            int hh       = GumpsLoader.Instance.GetTexture(0x0835)?.Height ?? 0;
            int decWidth = width - xx - 10;

            if (decWidth < 0)
            {
                decWidth = 0;
            }
            _decoration = new GumpPicTiled(xx, (_label.Height >> 1) - (hh >> 1), decWidth, hh, 0x0835);

            Add(_decoration);
            Add(_label);
            Height = _label.Height;


            Add(_arrow = new GumpPic(1, 1, (ushort)(userArrow2 ? 0x0827 : 0x15E1), 0)
            {
                ContainsByBounds = true
            });

            _arrow.MouseUp += (sender, state) =>
            {
                if (state.Button == MouseButtonType.Left)
                {
                    Opened = !_opened;
                }
            };
        }
Exemplo n.º 8
0
        public ExpandableScroll(int x, int y, int height, ushort graphic, bool isResizable = true)
        {
            X                = x;
            Y                = y;
            SpecialHeight    = height;
            _isResizable     = isResizable;
            CanMove          = true;
            AcceptMouseInput = true;

            var textures = new SpriteTexture[4];

            for (int i = 0; i < 4; i++)
            {
                var t = FileManager.Gumps.GetTexture((ushort)(graphic + i));

                if (t == null)
                {
                    Dispose();

                    return;
                }

                if (t.Width > _maxWidth)
                {
                    _maxWidth = t.Width;
                }

                textures[i] = t;
            }


            Add(_gumpTop    = new GumpPic(0, 0, graphic, 0));
            Add(_gumpRight  = new GumpPicTiled(0, 0, 0, 0, (ushort)(graphic + 1)));
            Add(_gumpMiddle = new GumpPicTiled(0, 0, 0, 0, (ushort)(graphic + 2)));
            Add(_gumpBottom = new GumpPic(0, 0, (ushort)(graphic + 3), 0));

            if (_isResizable)
            {
                Add(_gumpExpander = new Button(c_GumplingExpander_ButtonID, 0x082E, 0x82F)
                {
                    ButtonAction = ButtonAction.Activate,
                    X            = 0,
                    Y            = 0
                });
                _gumpExpander.MouseDown += expander_OnMouseDown;
                _gumpExpander.MouseUp   += expander_OnMouseUp;
                _gumpExpander.MouseOver += expander_OnMouseOver;
            }

            int off = textures[0].Width - textures[3].Width;

            _maxWidth = textures[1].Width;

            _gumpRight.X              = _gumpMiddle.X = 17;
            _gumpRight.X              = _gumpMiddle.Y = _gumplingMidY;
            _gumpRight.Width          = _gumpMiddle.Width = _maxWidth;
            _gumpRight.Height         = _gumpMiddle.Height = _gumplingMidHeight;
            _gumpRight.WantUpdateSize = _gumpMiddle.WantUpdateSize = true;

            Width = _gumpMiddle.Width;


            WantUpdateSize = true;
        }
Exemplo n.º 9
0
        public override void Update(double totalMS, double frameMS)
        {
            if (SpecialHeight < c_ExpandableScrollHeight_Min)
            {
                SpecialHeight = c_ExpandableScrollHeight_Min;
            }

            if (SpecialHeight > c_ExpandableScrollHeight_Max)
            {
                SpecialHeight = c_ExpandableScrollHeight_Max;
            }

            if (_gumplingTitleGumpIDDelta)
            {
                _gumplingTitleGumpIDDelta = false;

                _gumplingTitle?.Dispose();
                Add(_gumplingTitle = new GumpPic(0, 0, (Graphic)_gumplingTitleGumpID, 0));
            }

            if (!_gumpTop.IsInitialized)
            {
                IsVisible = false;
            }
            else
            {
                if (!IsVisible)
                {
                    IsVisible = true;
                }
                //TOP
                _gumpTop.X = 0;
                _gumpTop.Y = 0;
                _gumpTop.WantUpdateSize = true;
                //MIDDLE
                _gumpRight.X              = _gumpMiddle.X = 17;
                _gumpRight.Y              = _gumpMiddle.Y = _gumplingMidY;
                _gumpRight.Width          = _gumpMiddle.Width = _maxWidth;
                _gumpRight.Height         = _gumpMiddle.Height = _gumplingMidHeight;
                _gumpRight.WantUpdateSize = _gumpMiddle.WantUpdateSize = true;
                //BOTTOM
                _gumpBottom.X = 17;
                _gumpBottom.Y = _gumplingBottomY;
                _gumpBottom.WantUpdateSize = true;

                if (_isResizable)
                {
                    _gumpExpander.X = _gumplingExpanderX;
                    _gumpExpander.Y = _gumplingExpanderY;
                    _gumpExpander.WantUpdateSize = true;
                }

                if (_gumplingTitle != null && _gumplingTitle.IsInitialized)
                {
                    _gumplingTitle.X = (_gumpTop.Width - _gumplingTitle.Width) >> 1;
                    _gumplingTitle.Y = (_gumpTop.Height - _gumplingTitle.Height) >> 1;
                    _gumplingTitle.WantUpdateSize = true;
                }

                WantUpdateSize = true;
                Parent?.OnPageChanged();
            }

            base.Update(totalMS, frameMS);
        }
Exemplo n.º 10
0
        public ExpandableScroll(int x, int y, int height, ushort graphic, bool isResizable = true)
        {
            X                = x;
            Y                = y;
            SpecialHeight    = height;
            _isResizable     = isResizable;
            CanMove          = true;
            AcceptMouseInput = true;

            int width = 0;

            int w0 = 0, w1 = 0, w3 = 0;

            for (int i = 0; i < 4; i++)
            {
                var texture = GumpsLoader.Instance.GetGumpTexture((ushort)(graphic + i), out var bounds);

                if (texture == null)
                {
                    Dispose();

                    return;
                }

                if (bounds.Width > width)
                {
                    width = bounds.Width;
                }

                if (i == 0)
                {
                    w0 = bounds.Width;
                }
                else if (i == 1)
                {
                    w1 = bounds.Width;
                }
                else if (i == 3)
                {
                    w3 = bounds.Width;
                }
            }


            Add(_gumpTop = new GumpPic(0, 0, graphic, 0));

            Add
            (
                _gumpRight = new GumpPicTiled
                             (
                    0,
                    0,
                    0,
                    0,
                    (ushort)(graphic + 1)
                             )
            );

            Add
            (
                _gumpMiddle = new GumpPicTiled
                              (
                    0,
                    0,
                    0,
                    0,
                    (ushort)(graphic + 2)
                              )
            );

            Add(_gumpBottom = new GumpPic(0, 0, (ushort)(graphic + 3), 0));

            if (_isResizable)
            {
                Add
                (
                    _gumpExpander = new Button(c_GumplingExpander_ButtonID, 0x082E, 0x82F)
                {
                    ButtonAction = ButtonAction.Activate,
                    X            = 0,
                    Y            = 0
                }
                );

                _gumpExpander.MouseDown += expander_OnMouseDown;
                _gumpExpander.MouseUp   += expander_OnMouseUp;
                _gumpExpander.MouseOver += expander_OnMouseOver;
            }

            int off = w0 - w3;

            _gumpRight.X              = _gumpMiddle.X = (width - w1) / 2;
            _gumpRight.Y              = _gumpMiddle.Y = _gumplingMidY;
            _gumpRight.Height         = _gumpMiddle.Height = _gumplingMidHeight;
            _gumpRight.WantUpdateSize = _gumpMiddle.WantUpdateSize = true;
            _gumpBottom.X             = (off / 2) + (off / 4);

            Width = _gumpMiddle.Width;


            WantUpdateSize = true;
        }
Exemplo n.º 11
0
        public ExpandableScroll(int x, int y, int height, ushort graphic, bool isResizable = true)
        {
            X                = x;
            Y                = y;
            SpecialHeight    = height;
            _isResizable     = isResizable;
            CanMove          = true;
            AcceptMouseInput = true;

            UOTexture[] textures = new UOTexture[4];
            int         width    = 0;

            for (int i = 0; i < 4; i++)
            {
                UOTexture t = GumpsLoader.Instance.GetTexture((ushort)(graphic + i));

                if (t == null)
                {
                    Dispose();

                    return;
                }

                if (t.Width > width)
                {
                    width = t.Width;
                }

                textures[i] = t;
            }


            Add(_gumpTop = new GumpPic(0, 0, graphic, 0));

            Add
            (
                _gumpRight = new GumpPicTiled
                             (
                    0,
                    0,
                    0,
                    0,
                    (ushort)(graphic + 1)
                             )
            );

            Add
            (
                _gumpMiddle = new GumpPicTiled
                              (
                    0,
                    0,
                    0,
                    0,
                    (ushort)(graphic + 2)
                              )
            );

            Add(_gumpBottom = new GumpPic(0, 0, (ushort)(graphic + 3), 0));

            if (_isResizable)
            {
                Add
                (
                    _gumpExpander = new Button(c_GumplingExpander_ButtonID, 0x89, 0x8A)
                {
                    ButtonAction = ButtonAction.Activate,
                    X            = 0,
                    Y            = 0
                }
                );

                _gumpExpander.MouseDown += expander_OnMouseDown;
                _gumpExpander.MouseUp   += expander_OnMouseUp;
                _gumpExpander.MouseOver += expander_OnMouseOver;
            }

            int off = textures[0].Width - textures[3].Width;

            _gumpRight.X              = _gumpMiddle.X = (width - textures[1].Width) / 2;
            _gumpRight.Y              = _gumpMiddle.Y = _gumplingMidY;
            _gumpRight.Height         = _gumpMiddle.Height = _gumplingMidHeight;
            _gumpRight.WantUpdateSize = _gumpMiddle.WantUpdateSize = true;
            _gumpBottom.X             = (off / 2) + (off / 4);

            Width = _gumpMiddle.Width;


            WantUpdateSize = true;
        }