//------------------------------------------------------------------------------
// <copyright file=”*.cs” company=”EhLib Team”>
//     Copyright (c) 2017 Dmitry V. Bolshakov   
// </copyright>
//------------------------------------------------------------------------------

using System.ComponentModel;
using System.Drawing;

namespace EhLib
{

  [DataAxisGridPropBarDesignTimeVisibleAttribute(true)]
  public class DataGridProgressBarColumn : DataGridMonoCellColumn
  {

    #region privates
    #endregion

    #region constructor
    public DataGridProgressBarColumn()
    {

    }
    #endregion

    #region design-time properties
    [DefaultValue(0)]
    public double MinValue
    {
      get
      {
        return DataCell.MinValue;
      }

      set
      {
        DataCell.MinValue = value;
        Invalidate();
      }
    }

    [DefaultValue(100)]
    public double MaxValue
    {
      get
      {
        return DataCell.MaxValue;
      }

      set
      {
        DataCell.MaxValue = value;
        Invalidate();
      }
    }

    //[DefaultValue(Color.Empty)]
    public new Color BackColor
    {
      get
      {
        return DataCell.BackColor;
      }

      set
      {
        DataCell.BackColor = value;
        Invalidate();
      }
    }

    public new Color ForeColor
    {
      get
      {
        return DataCell.ForeColor;
      }

      set
      {
        DataCell.ForeColor = value;
        Invalidate();
      }
    }

    public Color FrameColor
    {
      get
      {
        return DataCell.FrameColor;
      }

      set
      {
        DataCell.FrameColor = value;
        Invalidate();
      }
    }

    public Color TextColor
    {
      get
      {
        return DataCell.TextColor;
      }

      set
      {
        DataCell.TextColor = value;
        Invalidate();
      }
    }

    [DefaultValue(true)]
    public bool ShowText
    {
      get
      {
        return DataCell.ShowText;
      }

      set
      {
        DataCell.ShowText = value;
        Invalidate();
      }
    }

    [DefaultValue(ProgressBarTextType.AsPercent)]
    public ProgressBarTextType TextType
    {
      get
      {
        return DataCell.TextType;
      }

      set
      {
        DataCell.TextType = value;
        Invalidate();
      }
    }

    [DefaultValue(0)]
    public int TextDecimalPlaces
    {
      get
      {
        return DataCell.TextDecimalPlaces;
      }

      set
      {
        DataCell.TextDecimalPlaces = value;
        Invalidate();
      }
    }
    #endregion

    #region run-time properties
    public new DataAxisGridProgressBarDataCell DataCell
    {
      get { return (DataAxisGridProgressBarDataCell)base.DataCell; }
    }
    #endregion

    #region public methods
    #endregion

    #region internal methods
    protected override DataAxisGridDataCellMan CreateTemplateCell()
    {
      return new DataAxisGridProgressBarDataCell();
    }

    //FrameColor
    protected internal virtual Color DefaultFrameColor()
    {
      return DataCell.DefaultFrameColor();
    }

    protected internal virtual bool ShouldSerializeFrameColor()
    {
      return DataCell.ShouldSerializeFrameColor();
    }

    public virtual void ResetFrameColor()
    {
      DataCell.ResetFrameColor();
    }

    protected internal void FrameColorChanged()
    {
      if (Grid != null)
        Grid.Invalidate();
    }

    //TextColor
    public virtual Color DefaultTextColor()
    {
      return DataCell.DefaultTextColor();
    }

    protected internal virtual bool ShouldSerializeTextColor()
    {
      return DataCell.ShouldSerializeTextColor();
    }

    public virtual void ResetTextColor()
    {
      DataCell.ResetTextColor();
    }

    protected internal void TextColorChanged()
    {
      if (Grid != null)
        Grid.Invalidate();
    }
    #endregion
  }
}
