Exemplo n.º 1
0
 private void InitPrev()
 {
     _prevShownEdges  = shownEdges;
     _prevBorderSize  = borderSize;
     _prevDependant   = dependant;
     _prevBorderColor = borderColor;
     //_prevSize = rectTransform.rect.size;
 }
Exemplo n.º 2
0
        public static BorderEdge ToBorderEdge(this BorderEdgeStyle style)
        {
            var res = new BorderEdge {
                Style = GetBorderStyle(style)
            };

            if (style.Color != null)
            {
                res.Color = style.Color.ToColor();
            }
            return(res);
        }
Exemplo n.º 3
0
        private CT_BorderPr ConvertBorderPr(BorderEdge e)
        {
            if (e == null)
            {
                return(new CT_BorderPr());
            }

            return(new CT_BorderPr
            {
                style = (ST_BorderStyle)e.Style,
                color = ConvertColor(e.Color)
            });
        }
Exemplo n.º 4
0
        private BorderEdge ConvertBorderEdge(CT_BorderPr e)
        {
            if (e == null)
                return null;

            BorderEdge edge = new BorderEdge
            {
                Style = (BorderStyle)e.style,
                Color = ConvertColor(e.color)
            };

            return edge;
        }
Exemplo n.º 5
0
        public void SetShownEdges(BorderEdge value)
        {
            shownEdges = value;

            if (shownEdges != _prevShownEdges)
            {
                onEdgesShownChanged?.Invoke();

                ResetBorders();

                _prevShownEdges = shownEdges;
            }
        }
 /// <summary>
 /// Sets the inheritence parent.
 /// </summary>
 /// <param name="inheritNavigator">Source for inheriting.</param>
 public void SetInherit(PaletteNavigator inheritNavigator)
 {
     // Setup inheritance references for storage objects
     base.SetInherit(inheritNavigator);
     PalettePage.SetInherit(inheritNavigator.PalettePage);
     HeaderGroup.SetInherit(inheritNavigator.HeaderGroup);
     CheckButton.SetInherit(inheritNavigator.CheckButton);
     OverflowButton.SetInherit(inheritNavigator.OverflowButton);
     MiniButton.SetInherit(inheritNavigator.MiniButton);
     BorderEdge.SetInherit(inheritNavigator.BorderEdge);
     Separator.SetInherit(inheritNavigator.Separator);
     Tab.SetInherit(inheritNavigator.Tab);
     RibbonTab.SetInherit(inheritNavigator.RibbonTab.TabDraw, inheritNavigator.RibbonTab.TabDraw, inheritNavigator.RibbonTab.Content);
 }
Exemplo n.º 7
0
        /// <summary>Initializes a new instance of the <see cref="VisualGroupBox" /> class.</summary>
        public VisualGroupBox()
        {
            _boxStyle          = GroupBoxStyle.Default;
            _titleBoxHeight    = 25;
            _borderEdge        = new BorderEdge();
            _textImageRelation = TextImageRelation.ImageBeforeText;
            _textAlignment     = StringAlignment.Center;
            _textLineAlignment = StringAlignment.Center;
            Size    = new Size(220, 180);
            _border = new Border();
            Padding = new Padding(5, _titleBoxHeight + _border.Thickness, 5, 5);
            Controls.Add(_borderEdge);

            UpdateTheme(ThemeManager.Theme);
        }
        private BorderEdge ConvertBorderEdge(CT_BorderPr e)
        {
            if (e == null)
            {
                return(null);
            }

            BorderEdge edge = new BorderEdge
            {
                Style = (BorderStyle)e.style,
                Color = ConvertColor(e.color)
            };

            return(edge);
        }
Exemplo n.º 9
0
        /// <inheritdoc />
        /// <summary>Initializes a new instance of the <see cref="T:VisualPlus.Toolkit.Controls.Layout.VisualGroupBox" /> class.</summary>
        public VisualGroupBox()
        {
            _boxStyle        = GroupBoxStyle.Default;
            _stringAlignment = StringAlignment.Center;
            _titleAlignment  = TitleAlignments.Top;
            _titleBoxVisible = Settings.DefaultValue.TitleBoxVisible;
            _titleBoxHeight  = 25;
            _borderEdge      = new BorderEdge();

            Size    = new Size(220, 180);
            _border = new Border();
            Padding = new Padding(5, _titleBoxHeight + _border.Thickness, 5, 5);

            Controls.Add(_borderEdge);

            UpdateTheme(Settings.DefaultValue.DefaultStyle);
        }
Exemplo n.º 10
0
        /// <summary>Initializes a new instance of the <see cref="VisualComboBox" /> class.</summary>
        public VisualComboBox()
        {
            SetStyle(
                ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw |
                ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor,
                true);

            SetStyle((ControlStyles)139286, true);
            SetStyle(ControlStyles.Selectable, false);

            _styleManager      = new StyleManager(Settings.DefaultValue.DefaultStyle);
            _textImageRelation = TextImageRelation.ImageBeforeText;
            _textAlignment     = StringAlignment.Center;
            _textLineAlignment = StringAlignment.Center;
            _itemImageVisible  = true;
            _imageVisible      = false;
            _buttonWidth       = 30;
            _buttonStyle       = ButtonStyles.Arrow;
            _buttonVisible     = Settings.DefaultValue.TextVisible;
            _watermark         = new Watermark();
            _mouseState        = MouseStates.Normal;
            _textStyle         = new TextStyle();
            DrawMode           = DrawMode.OwnerDrawVariable;
            DropDownStyle      = ComboBoxStyle.DropDownList;

            _borderEdge = new BorderEdge();

            Size       = new Size(135, 26);
            ItemHeight = 24;
            UpdateStyles();
            DropDownHeight = 100;

            // BackColor = SystemColors.Control;
            _border = new Border();

            _textRendererHint = Settings.DefaultValue.TextRenderingHint;

            Controls.Add(_borderEdge);
            UpdateTheme(_styleManager.Theme);
        }
Exemplo n.º 11
0
        /// <inheritdoc />
        /// <summary>
        ///     Initializes a new instance of the <see cref="T:VisualPlus.Toolkit.Controls.Interactivity.VisualComboBox" />
        ///     class.
        /// </summary>
        public VisualComboBox()
        {
            SetStyle(
                ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw |
                ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor,
                true);

            SetStyle((ControlStyles)139286, true);
            SetStyle(ControlStyles.Selectable, false);

            _styleManager = new VisualStyleManager(Settings.DefaultValue.DefaultStyle);

            _buttonWidth      = 30;
            _buttonHorizontal = Alignment.Horizontal.Right;
            _buttonStyles     = DropDownButtons.Arrow;
            _buttonVisible    = Settings.DefaultValue.TextVisible;
            _textAlignment    = StringAlignment.Center;
            _watermark        = new Watermark();
            _backColorState   = new ColorState();
            _mouseState       = MouseStates.Normal;
            DrawMode          = DrawMode.OwnerDrawFixed;
            DropDownStyle     = ComboBoxStyle.DropDownList;

            _borderEdge = new BorderEdge();

            Size       = new Size(135, 26);
            ItemHeight = 20;
            UpdateStyles();
            DropDownHeight = 100;

            BackColor = SystemColors.Control;

            _border = new Border();

            _textRendererHint = Settings.DefaultValue.TextRenderingHint;

            Controls.Add(_borderEdge);

            UpdateTheme(Settings.DefaultValue.DefaultStyle);
        }
Exemplo n.º 12
0
        /// <summary>Initializes a new instance of the <see cref="VisualNumericUpDown" /> class.</summary>
        public VisualNumericUpDown()
        {
            _decrementButtonPoints = new Point[2];
            _incrementButtonPoints = new Point[2];
            _buttonWidth           = 50;

            _borderEdge    = new BorderEdge();
            _borderButtons = new BorderEdge();

            _minimumValue      = 0;
            _maximumValue      = 100;
            Size               = new Size(125, 25);
            MinimumSize        = new Size(0, 0);
            _buttonOrientation = Orientation.Horizontal;

            _border = new Border();

            Controls.Add(_borderEdge);
            Controls.Add(_borderButtons);

            UpdateTheme(ThemeManager.Theme);
        }
Exemplo n.º 13
0
        /// <inheritdoc />
        /// <summary>
        ///     Initializes a new instance of the
        ///     <see cref="T:VisualPlus.Toolkit.Controls.Interactivity.VisualNumericUpDown" /> class.
        /// </summary>
        public VisualNumericUpDown()
        {
            _decrementButtonPoints = new Point[2];
            _incrementButtonPoints = new Point[2];
            _buttonWidth           = 50;

            _borderEdge    = new BorderEdge();
            _borderButtons = new BorderEdge();

            _minimumValue      = 0;
            _maximumValue      = 100;
            Size               = new Size(125, 25);
            MinimumSize        = new Size(0, 0);
            _colorState        = new ColorState();
            _buttonOrientation = Orientation.Horizontal;

            _border = new Border();

            Controls.Add(_borderEdge);
            Controls.Add(_borderButtons);

            UpdateTheme(Settings.DefaultValue.DefaultStyle);
        }
Exemplo n.º 14
0
        public void ResetBorders()
        {
            float calculatedSize = dependant ? borderSize * Mathf.Min(rectTransform.rect.width, rectTransform.rect.height) : borderSize;
            float longWidth = rectTransform.rect.width - (calculatedSize * 2), longHeight = rectTransform.rect.height - (calculatedSize * 2);

            for (int i = 0; i < borderImages.Length; i++)
            {
                Image borderImage = borderImages[i];
                if (!borderImage)
                {
                    continue;
                }

                BorderEdge borderPosition = (BorderEdge)Mathf.RoundToInt(Mathf.Pow(2, i));
                bool       isVisible      = (shownEdges & borderPosition) != 0;
                borderImage.gameObject.SetActive(isVisible);

                Vector2 currentSize;
                if (borderPosition == BorderEdge.left || borderPosition == BorderEdge.right)
                {
                    currentSize = new Vector2(calculatedSize, longHeight);
                }
                else if (borderPosition == BorderEdge.top || borderPosition == BorderEdge.bottom)
                {
                    currentSize = new Vector2(longWidth, calculatedSize);
                }
                else
                {
                    currentSize = new Vector2(calculatedSize, calculatedSize);
                }

                borderImage.rectTransform.sizeDelta = currentSize;

                Vector2 borderPivot = pivots[i];
                borderImage.rectTransform.localPosition = new Vector2(borderPivot.x * rectTransform.rect.width / 2f - borderPivot.x * currentSize.x / 2f, borderPivot.y * rectTransform.rect.height / 2f - borderPivot.y * currentSize.y / 2f);
            }
        }
Exemplo n.º 15
0
        /// <summary>Initializes a new instance of the <see cref="VisualTextBox" /> class.</summary>
        public VisualTextBox()
        {
            SetStyle(ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor, true);

            // Contains another control
            SetStyle(ControlStyles.ContainerControl, true);

            // Cannot select this control, only the child and does not generate a click event
            SetStyle(ControlStyles.Selectable | ControlStyles.StandardClick, false);

            _borderButton = new BorderEdge {
                Visible = false
            };

            _borderImage = new BorderEdge {
                Visible = false
            };

            _textWidth = GetTextBoxWidth();
            _border    = new Border();

            ThemeManager = new StyleManager(Settings.DefaultValue.DefaultStyle);

            _backColorState = new ColorState {
                Enabled = ThemeManager.Theme.ColorPalette.ControlEnabled
            };

            _textBox = new TextBoxExtended
            {
                Size        = new Size(125, 25),
                Location    = new Point(_border.BorderCurve, _border.BorderCurve),
                Text        = string.Empty,
                BorderStyle = BorderStyle.None,
                TextAlign   = HorizontalAlignment.Left,
                Font        = Font,
                ForeColor   = ForeColor,
                BackColor   = _backColorState.Enabled,
                Multiline   = false
            };

            _imageWidth   = 35;
            _buttonFont   = Font;
            _buttonIndent = 3;
            _buttontext   = "visualButton";

            _image     = null;
            _imageSize = new Size(16, 16);

            _watermark    = new Watermark();
            _buttonBorder = new Border();

            _textBox.KeyDown     += TextBox_KeyDown;
            _textBox.Leave       += OnLeave;
            _textBox.Enter       += OnEnter;
            _textBox.GotFocus    += OnEnter;
            _textBox.LostFocus   += OnLeave;
            _textBox.MouseLeave  += OnLeave;
            _textBox.TextChanged += TextBox_TextChanged;
            _textBox.SizeChanged += TextBox_SizeChanged;

            Controls.Add(_textBox);
            Controls.Add(_borderButton);
            Controls.Add(_borderImage);

            _waterMarkContainer = null;

            Size = new Size(135, 25);

            if (_watermark.Visible)
            {
                DrawWaterMark();
            }

            UpdateTheme(ThemeManager.Theme);
        }
Exemplo n.º 16
0
        public async Task DrawBorderAsync(int width = 32, int height = 32, int thickness = 2, PaletteType palette = PaletteType.GammaGreen, Gamma background = Gamma.StandardDim, Gamma border = Gamma.Max, BorderEdge edge = BorderEdge.Outside, BorderAllow allow = BorderAllow.All)
        {
            /*
             * var width = Context.GetOptionOrDefault("width", 32);
             * var height = Context.GetOptionOrDefault("height", 32);
             * var thickness = Context.GetOptionOrDefault("thickness", 2);
             * var color = Context.GetOptionOrDefault("color", ImmutableColor.GammaGreen);
             * var edge = Context.GetOptionOrDefault("edge", BorderEdge.Outside);
             * var allow = Context.GetOptionOrDefault("allow", BorderAllow.All);
             */

            using (var tmp = ImageHelper.CreateSolid(GraphicsService.GetPalette(palette)[background], width, height))
                using (Bitmap b = ImageHelper.SetBorder(tmp, GraphicsService.GetPalette(palette)[border], thickness, edge, allow))
                    await Context.Channel.SendImageAsync(b, "../tmp/border.png");
        }