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

using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Windows.Forms.VisualStyles;
using System.Diagnostics;
using System.ComponentModel.Design;

namespace EhLib
{
  public class DataGridTitleCellPaintEventArgs : BaseGridCellPaintEventArgs
  {

    public DataGridTitleCellPaintEventArgs(BaseGridCellManager cellManager, Graphics graphics, int colIndex, int rowIndex,
      Rectangle cellRect, BasePaintCellStates state, int areaColIndex, int areaRowIndex, Point inCellMousePos, 
      DataGridColumn column)
      : base (cellManager, graphics, colIndex, rowIndex, cellRect, state, areaColIndex, areaRowIndex, inCellMousePos)
    {
      Column = column;
    }

    public DataGridColumn Column { get; internal set; }
    public new DataGridTitleCellMan CellManager
    {
      get { return (DataGridTitleCellMan)base.CellManager; }
    }

    public Rectangle ContentRect { get; internal set; }
    public TextFormatFlags AlignFlags { get; set; }
    public Color BackColor { get; set; }
    public bool EndEllipsis { get; set; }
    public Font Font { get; set; }
    public Color ForeColor { get; set; }
    public Padding Padding { get; set; }
    public Orientation TextOrientation { get; set; }
    public DataGridTextWrapMode WrapMode { get; set; }

    public virtual void Paint(DataGridTitleCellPaintEventArgs e)
    {
      CellManager.OnPaint(e);
    }

    public virtual void PaintBackground(DataGridTitleCellPaintEventArgs e)
    {
      CellManager.OnPaintBackground(e);
    }

    public virtual void PaintForeground(DataGridTitleCellPaintEventArgs e)
    {
      CellManager.OnPaintForeground(e);
    }
  }

  //public class DataGridTitleCellCustomAreaMeasuresNeededEventArgs : EventArgs
  //{
  //  private readonly CellCustomAreaMeasures areaMeasures;
  //  private readonly DataGridColumnTitle columnTitle;

  //  public DataGridTitleCellCustomAreaMeasuresNeededEventArgs(
  //    CellCustomAreaMeasures areaMeasures, DataGridColumnTitle columnTitle)
  //  {
  //    this.areaMeasures = areaMeasures;
  //    this.columnTitle = columnTitle;
  //  }

  //  public CellCustomAreaMeasures AreaMeasures
  //  {
  //    get { return areaMeasures; }
  //  }

  //  public DataGridColumnTitle ColumnTitle
  //  {
  //    get { return this.columnTitle; }
  //  }
  //}

  public class DataGridTitleCellContextMenuStripNeededEventArgs : BaseGridCellContextMenuStripNeededEventArgs
  {
    private DataGridColumn column;

    public DataGridTitleCellContextMenuStripNeededEventArgs(
      BaseGridCellManager cellManager, int colIndex, int rowIndex, int areaColIndex, int areaRowIndex,
      int inCellX, int inCellY, Rectangle cellRect, int MousePosX, int MousePosY,
      DataGridColumn column)
      : base(cellManager, colIndex, rowIndex, areaColIndex, areaRowIndex, inCellX, inCellY, cellRect, MousePosX, MousePosY)

    {
      this.column = column;
    }

    public DataGridColumn Column
    {
      get { return this.column; }
    }

    public DataGridTitleCellMan CellMan
    {
      get { return (DataGridTitleCellMan)base.CellManager; }
    }

    public new virtual void SetContextMenuStrip(DataGridTitleCellContextMenuStripNeededEventArgs e)
    {
      e.CellMan.OnTitleContextMenuStripNeeded(e);
    }
  }

  public class DataGridTitleCellClientAreaNeededEventArgs : EventArgs
  {
    private readonly Rectangle cellRect;
    private readonly DataGridColumnTitle columnTitle;
    private Rectangle cellClientRect;

    public DataGridTitleCellClientAreaNeededEventArgs(
      DataGridColumnTitle columnTitle, Rectangle cellRect)
    {
      this.cellRect = cellRect;
      this.cellClientRect = cellRect;
      this.columnTitle = columnTitle;
    }

    public DataGridColumnTitle ColumnTitle
    {
      get { return this.columnTitle; }
    }

    public Rectangle CellRect
    {
      get { return cellRect; }
    }

    public Rectangle CellClientRect
    {
      get { return cellClientRect; }
      set { cellClientRect = value; }
    }
  }

  public class DataGridMultiTitleCellContextMenuStripNeededProvideEventArgs : BaseGridCellContextMenuStripNeededEventArgs
  {
    private DataGridTitleCellContextMenuStripNeededEventArgs titleEventArgs;
    private DataGridSuperTitleCellContextMenuStripNeededEventArgs superTitleEventArgs;

    public DataGridMultiTitleCellContextMenuStripNeededProvideEventArgs(
      BaseGridCellManager cellManager, int colIndex, int rowIndex, int areaColIndex, int areaRowIndex,
      int inCellX, int inCellY, Rectangle cellRect, int MousePosX, int MousePosY,
      DataGridTitleCellContextMenuStripNeededEventArgs titleEventArgs,
      DataGridSuperTitleCellContextMenuStripNeededEventArgs superTitleEventArgs)
      : base(cellManager, colIndex, rowIndex, areaColIndex, areaRowIndex, inCellX, inCellY, cellRect, MousePosX, MousePosY)

    {
      this.titleEventArgs = titleEventArgs;
      this.superTitleEventArgs = superTitleEventArgs;
    }

    public DataGridTitleCellContextMenuStripNeededEventArgs TitleEventArgs
    {
      get { return this.titleEventArgs; }
    }

    public DataGridSuperTitleCellContextMenuStripNeededEventArgs SuperTitleEventArgs
    {
      get { return this.superTitleEventArgs; }
    }
  }



  //public class DataGridColumnTitleContextMenuStripNeededEventArgs : EventArgs
  //{
  //  private ContextMenuStrip contextMenuStrip;
  //  private readonly DataGridColumn column;
  //  private readonly DataGridColumnTitle columnTitle;
  //  private readonly DataGridSuperTitle superTitle;

  //  public DataGridColumnTitleContextMenuStripNeededEventArgs(DataGridColumn column,
  //    DataGridColumnTitle columnTitle, DataGridSuperTitle superTitle)
  //  {
  //    this.column = column;
  //    this.columnTitle = columnTitle;
  //    this.superTitle = superTitle;
  //  }

  //  internal DataGridColumnTitleContextMenuStripNeededEventArgs(
  //      DataGridColumn column, ContextMenuStrip contextMenuStrip,
  //      DataGridColumnTitle columnTitle, DataGridSuperTitle superTitle
  //      )
  //  {
  //    this.contextMenuStrip = contextMenuStrip;
  //    this.column = column;
  //    this.columnTitle = columnTitle;
  //    this.superTitle = superTitle;
  //  }

  //  public ContextMenuStrip ContextMenuStrip
  //  {
  //    get { return this.contextMenuStrip; }
  //    set { this.contextMenuStrip = value; }
  //  }

  //  public DataGridColumn Column
  //  {
  //    get { return this.column; }
  //  }

  //  public DataGridColumnTitle ColumnTitle
  //  {
  //    get { return this.columnTitle; }
  //  }

  //  public DataGridSuperTitle SuperTitle
  //  {
  //    get { return this.superTitle; }
  //  }
  //}

}