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

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;
using System.Data;
using System.Diagnostics;
using System.Drawing.Design;
using System.Drawing.Drawing2D;
using System.Collections.ObjectModel;

namespace EhLib
{
  public class DataVertGridRowCellManager : DataVertGridBaseCellManager
  {

    #region privates
    //private DataGridColumn column;
    #endregion privates

    public DataVertGridRowCellManager()
    {

    }

    #region Methods
    public override string GetDisplayText(int areaColIndex, int areaRowIndex)
    {
      return GetDisplayText(Grid.VisibleRows[areaRowIndex], areaColIndex);
    }

    public virtual string GetDisplayText(DataVertGridRow row, int dataColIndex)
    {
      return "GetDisplayText is not implemented";
    }

    protected internal override bool IsSelected(int areaColIndex, int areaRowIndex)
    {
      return false;
    }

    protected internal virtual int CalcDefaultRowHeight()
    {
      return 0;
    }

    protected internal virtual int CalcRowHeight(DataVertGridRow row, object listItem)
    {
      return CalcDefaultRowHeight();
    }

    protected internal override void OnPaintEmptyArea(BaseGridCellPaintEventArgs e)
    {
      if (e.AreaColIndex >= 0)
      {
        DataVertGridRow gridRowIndex = Grid.VisibleRows[e.AreaRowIndex];
        Color fromColor = gridRowIndex.BackColor;
        //Color toColor = Grid.BackColor;

        EhLibUtils.FillRectangle(e.Graphics, e.CellRect, fromColor);
      }
      else
      {
        base.OnPaintEmptyArea(e);
      }
    }

    #endregion Methods
  }

  public class DataVertGridRowPaintCellParams
  {
    #region properties
    public int ColIndex { get; internal set; }
    public int RowIndex { get; internal set; }

    public int DataCol { get; internal set; }
    public int DataRow { get; internal set; }
    public DataVertGridRow Row { get; internal set; }

    public Rectangle CellRect { get; internal set; }
    public Rectangle ContentRect { get; set; }
    public BasePaintCellStates PaintState { get; internal set; }

    public object FormattedValue { get; set; }

    public CellFillStyle FillStyle { get; set; }
    public Color BackColor { get; set; }
    //public Color FillColor
    public Color SecondFillColor { get; set; }
    public CellInnerBorderStyle InnerBorder { get; set; }
    public Padding Padding { get; set; }

    public Font Font { get; set; }
    public Color ForeColor { get; set; }
    public HorizontalAlignment HorzAlign { get; set; }
    public VerticalAlignment VertAlign { get; set; }
    public bool WordWrap { get; set; }
    public bool EndEllipsis { get; set; }
    #endregion
  }
}
