using System.ComponentModel;
namespace DevComponents.DotNetBar.Charts.Style
{
    ///
    /// AnnotationVisualStyles
    ///
    [TypeConverter(typeof(VisualStylesConverter))]
    public class AnnotationVisualStyles : VisualStyles
    {
        #region Copy
        /// 
        /// Returns the copy of the style.
        /// 
        /// Copy of the style.
        public AnnotationVisualStyles Copy()
        {
            AnnotationVisualStyles styles = new AnnotationVisualStyles();
            for (int i = 0; i < Styles.Length; i++)
            {
                AnnotationVisualStyle vstyle = Styles[i];
                if (vstyle != null)
                    styles.Styles[i] = vstyle.Copy();
            }
            return (styles);
        }
        #endregion
    }
    /// 
    /// Represents the visual style of a Legend element.
    /// 
    [TypeConverter(typeof(VisualStylesConverter))]
    public class AnnotationVisualStyle : ContainerVisualStyle
    {
        #region Private variables
        private AnnotationShape _AnnotationShape = AnnotationShape.Ellipse;
        private ConnectorShape _ConnectorShape = ConnectorShape.NotSet;
        private Alignment _TextAlignment = Alignment.NotSet;
        #endregion
        #region Public properties
        #region AnnotationShape
        /// 
        /// Gets or sets the shape of the annotation container.
        /// 
        [DefaultValue(AnnotationShape.NotSet), Category("Appearance")]
        [Description("Indicates the shape of the annotation container.")]
        public AnnotationShape AnnotationShape
        {
            get { return (_AnnotationShape); }
            set
            {
                if (_AnnotationShape != value)
                {
                    _AnnotationShape = value;
                    OnPropertyChangedEx("AnnotationShape", VisualChangeType.Render);
                }
            }
        }
        #endregion
        #region ConnectorShape
        /// 
        /// Gets or sets the shape of the annotation connector.
        /// 
        [DefaultValue(ConnectorShape.NotSet), Category("Appearance")]
        [Description("Indicates the shape of the annotation connector.")]
        public ConnectorShape ConnectorShape
        {
            get { return (_ConnectorShape); }
            set
            {
                if (_ConnectorShape != value)
                {
                    _ConnectorShape = value;
                    OnPropertyChangedEx("ConnectorShape", VisualChangeType.Render);
                }
            }
        }
        #endregion
        #region TextAlignment
        /// 
        /// Gets or sets the alignment of the content within the cell
        /// 
        [DefaultValue(Alignment.NotSet), Category("Appearance")]
        [Description("Indicates the alignment of the content within the cell.")]
        public Alignment TextAlignment
        {
            get { return (_TextAlignment); }
            set
            {
                if (_TextAlignment != value)
                {
                    _TextAlignment = value;
                    OnPropertyChangedEx("TextAlignment", VisualChangeType.Layout);
                }
            }
        }
        #endregion
        #region IsEmpty
        /// 
        /// Gets whether the style is logically Empty.
        /// 
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        [Description("Gets whether the style is logically Empty.")]
        public override bool IsEmpty
        {
            get
            {
                return ((_AnnotationShape == AnnotationShape.NotSet) &&
                    (_ConnectorShape == ConnectorShape.NotSet) &&
                    (_TextAlignment == Alignment.NotSet) &&
                    (base.IsEmpty == true));
            }
        }
        #endregion
        #endregion
        #region ApplyStyle
        /// 
        /// Applies the style to instance of this style.
        /// 
        /// Style to apply.
        public void ApplyStyle(AnnotationVisualStyle style)
        {
            if (style != null)
            {
                base.ApplyStyle(style);
                if (style.AnnotationShape != AnnotationShape.NotSet)
                    _AnnotationShape = style.AnnotationShape;
                if (style.ConnectorShape != ConnectorShape.NotSet)
                    _ConnectorShape = style.ConnectorShape;
                if (style.TextAlignment != Alignment.NotSet)
                    _TextAlignment = style.TextAlignment;
            }
        }
        #endregion
        #region Copy
        /// 
        /// Returns the copy of the style.
        /// 
        /// Copy of the style.
        public new AnnotationVisualStyle Copy()
        {
            AnnotationVisualStyle style = new AnnotationVisualStyle();
            CopyTo(style);
            return (style);
        }
        #endregion
        #region CopyTo
        /// 
        /// Returns the copy of the style.
        /// 
        /// Copy of the style.
        public void CopyTo(AnnotationVisualStyle style)
        {
            base.CopyTo(style);
            style.AnnotationShape = _AnnotationShape;
            style.ConnectorShape = _ConnectorShape;
            style.TextAlignment = _TextAlignment;
        }
        #endregion
    }
}