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

using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;

namespace EhLib
{
  public class DataAxisGridDataCellPaintEventArgs : BaseGridCellPaintEventArgs
  {
    private readonly PropertyAxisBar propAxisBar;
    private readonly object listItemBar;

    public DataAxisGridDataCellPaintEventArgs(BaseGridCellManager cellManager, Graphics graphics, int colIndex, int rowIndex,
      Rectangle cellRect, BasePaintCellStates state, int areaColIndex, int areaRowIndex, Point inCellMousePos,
      PropertyAxisBar propAxisBar, object listItemBar)
      : base(cellManager, graphics, colIndex, rowIndex, cellRect, state, areaColIndex, areaRowIndex, inCellMousePos)
    {
      this.propAxisBar = propAxisBar;
      this.listItemBar = listItemBar;
      this.IsPaintBackground = true;
      this.IsPaintForeground = true;
    }

    public PropertyAxisBar PropAxisBar
    {
      get { return this.propAxisBar; }
    }

    public object ListItemBar
    {
      get { return this.listItemBar; }
    }

    public int DataColIndex
    {
      get { return this.AreaColIndex; }
    }

    public int DataRowIndex
    {
      get { return this.AreaRowIndex; }
    }

    public HorizontalAlignment HorzAlign { get; set; }

    public VerticalAlignment VertAlign { get; set; }

    public Font Font { get; set; }

    public Color BackColor { get; set; }

    public Color ForeColor { get; set; }

    public Padding Padding { get; set; }

    public Color BackFilledColor { get; set; }

    public bool IsPaintBackground { get; set; }

    public bool IsPaintForeground { get; set; }
  }

  public class DataAxisGridDataCellMouseEventArgs : BaseGridCellMouseEventArgs
  {
    private PropertyAxisBar propAxisBar;
    private object listItemBar;

    public DataAxisGridDataCellMouseEventArgs(
      BaseGridCellManager cellManager,
      int colIndex, int rowIndex,
      int areaColIndex, int areaRowIndex,
      PropertyAxisBar propAxisBar, object listItemBar,
      int inCellX, int inCellY,
      Rectangle cellRect,
      MouseEventArgs e) : base(cellManager, colIndex, rowIndex, areaColIndex, areaRowIndex, inCellX, inCellY, cellRect, e)
    {
      this.propAxisBar = propAxisBar;
      this.listItemBar = listItemBar;
    }

    public DataAxisGridDataCellMouseEventArgs(
      BaseGridCellManager cellManager,
      BaseGridCellMouseEventArgs baseArgs,
      int areaColIndex, int areaRowIndex,
      PropertyAxisBar propAxisBar, object listItemBar) :
        base(cellManager, baseArgs.ColIndex, baseArgs.RowIndex, baseArgs.AreaColIndex, baseArgs.AreaRowIndex,
             baseArgs.InCellX, baseArgs.InCellY, baseArgs.CellRect, baseArgs.GridMouseArgs)
    {
      this.propAxisBar = propAxisBar;
      this.listItemBar = listItemBar;
    }

    public PropertyAxisBar PropAxisBar
    {
      get { return this.propAxisBar; }
    }

    public object ListItemBar
    {
      get { return this.listItemBar; }
    }

    public DataAxisGridDataCellMan Cell
    {
      get { return (DataAxisGridDataCellMan)base.CellManager; }
    }
  }

  public class DataAxisGridDataCellEnterEventArgs : BaseGridCellEnterEventArgs
  {
    private PropertyAxisBar propAxisBar;
    private object listItemBar;
    private readonly DataAxisGridDataCellMan cell;

    public DataAxisGridDataCellEnterEventArgs(
      int colIndex, int rowIndex, int areaColIndex, int areaRowIndex, Rectangle cellRect, int leaveColIndex, int leaveRowIndex, 
      PropertyAxisBar propAxisBar, object listItemBar, DataAxisGridDataCellMan cell)
      : base(colIndex, rowIndex, areaColIndex, areaRowIndex, cellRect, leaveColIndex, leaveRowIndex)
    {
      this.propAxisBar = propAxisBar;
      this.listItemBar = listItemBar;
      this.cell = cell;
    }

    public PropertyAxisBar PropAxisBar
    {
      get { return propAxisBar; }
    }

    public object ListItemBar
    {
      get { return listItemBar; }
    }

    public DataAxisGridDataCellMan Cell
    {
      get { return this.cell; }
    }
  }

  public class DataAxisGridDataCellLeaveEventArgs : BaseGridCellLeaveEventArgs
  {
    private PropertyAxisBar propAxisBar;
    private object listItemBar;
    private readonly DataAxisGridDataCellMan cell;

    public DataAxisGridDataCellLeaveEventArgs(
      int colIndex, int rowIndex, int areaColIndex, int areaRowIndex, Rectangle cellRect, int enterColIndex, int enterRowIndex,
      PropertyAxisBar propAxisBar, object listItemBar, DataAxisGridDataCellMan cell)
      : base(colIndex, rowIndex, areaColIndex, areaRowIndex, cellRect, enterColIndex, enterRowIndex)
    {
      this.propAxisBar = propAxisBar;
      this.listItemBar = listItemBar;
      this.cell = cell;
    }

    public PropertyAxisBar PropAxisBar
    {
      get { return propAxisBar; }
    }

    public object ListItemBar
    {
      get { return listItemBar; }
    }

    public DataAxisGridDataCellMan Cell
    {
      get { return this.cell; }
    }
  }

  public class DataAxisGridDataCellContentPaintEventArgs : EventArgs
  {
    private readonly DataAxisGridDataCellPaintEventArgs dataCellPaintEventArgs;
    private readonly Rectangle cellContentRect;

    public DataAxisGridDataCellContentPaintEventArgs(DataAxisGridDataCellPaintEventArgs dataCellPaintEventArgs, Rectangle cellContentRect)
    {
      this.dataCellPaintEventArgs = dataCellPaintEventArgs;
      this.cellContentRect = cellContentRect;
    }

    public DataAxisGridDataCellPaintEventArgs DataCellPaintEventArgs
    {
      get { return this.dataCellPaintEventArgs; }
    }

    public Rectangle CellContentRect
    {
      get { return this.cellContentRect; }
    }

    public PropertyAxisBar PropAxisBar
    {
      get { return dataCellPaintEventArgs.PropAxisBar; }
    }

    public object ListItemBar
    {
      get { return dataCellPaintEventArgs.ListItemBar; }
    }

    public BasePaintCellStates State
    {
      get { return dataCellPaintEventArgs.State; }
    }

    public Graphics Graphics
    {
      get { return dataCellPaintEventArgs.Graphics; }
    }

    public int DataColIndex
    {
      get { return dataCellPaintEventArgs.DataColIndex; }
    }

    public int DataRowIndex
    {
      get { return dataCellPaintEventArgs.DataRowIndex; }
    }
  }

  public class DataAxisGridDataCellEventArgs : BaseGridCellEventArgs
  {
    private PropertyAxisBar propAxisBar;
    private object listItemBar;
    private readonly DataAxisGridDataCellMan cell;

    public DataAxisGridDataCellEventArgs(int colIndex, int rowIndex, int areaColIndex, int areaRowIndex, Rectangle cellRect,
      PropertyAxisBar propAxisBar, object listItemBar, DataAxisGridDataCellMan cell) :
      base(colIndex, rowIndex, areaColIndex, areaRowIndex, cellRect)
    {
      this.propAxisBar = propAxisBar;
      this.listItemBar = listItemBar;
      this.cell = cell;
      this.Processed = false;
    }

    public PropertyAxisBar PropAxisBar
    {
      get { return propAxisBar; }
    }

    public object ListItemBar
    {
      get { return listItemBar; }
    }

    public DataAxisGridDataCellMan Cell
    {
      get { return this.cell; }
    }

    public bool Processed { get; set; }
  }

  public class DataAxisGridDataBarCellEventArgs : EventArgs
  {
    private PropertyAxisBar propAxisBar;
    private object listItemBar;
    private readonly DataAxisGridDataCellMan cellMan;

    public DataAxisGridDataBarCellEventArgs(PropertyAxisBar propAxisBar, object listItemBar, DataAxisGridDataCellMan cellMan)
    {
      this.propAxisBar = propAxisBar;
      this.listItemBar = listItemBar;
      this.cellMan = cellMan;
      this.Handled = false;
    }

    public PropertyAxisBar PropAxisBar
    {
      get { return propAxisBar; }
    }

    public object ListItemBar
    {
      get { return listItemBar; }
    }

    public DataAxisGridDataCellMan CellMan
    {
      get { return this.cellMan; }
    }

    public bool Handled { get; set; }
  }

  public class DataAxisGridCheckBoxQueryDataCellCheckStateEventArgs : HandledEventArgs
  {
    private object listItemBar;
    private CheckState checkState;

    public DataAxisGridCheckBoxQueryDataCellCheckStateEventArgs(object listItemBar)
    {
      this.listItemBar = listItemBar;
    }

    public object ListItemBar
    {
      get { return this.listItemBar; }
      internal set { this.listItemBar = value; }
    }

    public CheckState CheckState
    {
      get { return this.checkState; }
      set { this.checkState = value; }
    }

  }

  public class DataAxisGridDataCellFormatParamsEventArgs : DataAxisGridDataCellEventArgs
  {
    public DataAxisGridDataCellFormatParamsEventArgs(int colIndex, int rowIndex, int areaColIndex, int areaRowIndex, Rectangle cellRect,
      PropertyAxisBar propAxisBar, object listItemBar, DataAxisGridDataCellMan cell,
      DataAxisGridDataCellFormatApplying formatApplying) 
      : base(colIndex, rowIndex, areaColIndex, areaRowIndex, cellRect, propAxisBar, listItemBar, cell)
    {
      this.FormatApplying = formatApplying;
    }

    public HorizontalAlignment HorzAlign { get; set; }
    public VerticalAlignment VertAlign { get; set; }
    public Font Font { get; set; }
    public Color BackColor { get; set; }
    public Color ForeColor { get; set; }
    public Padding Padding { get; set; }
    public DataAxisGridDataCellFormatApplying FormatApplying { get; protected set; }
  }

  public class DataAxisGridDataCellPullValueEventArgs : DataAxisGridDataBarCellEventArgs
  {

    public DataAxisGridDataCellPullValueEventArgs(PropertyAxisBar propAxisBar, object listItemBar, DataAxisGridDataCellMan cellMan) 
      : base(propAxisBar, listItemBar, cellMan)
    {

    }

    public object Value { get; set; }
  }

  public class DataAxisGridDataCellPushValueEventArgs : DataAxisGridDataBarCellEventArgs
  {

    public DataAxisGridDataCellPushValueEventArgs(PropertyAxisBar propAxisBar, object listItemBar, DataAxisGridDataCellMan cellMan)
      : base(propAxisBar, listItemBar, cellMan)
    {

    }

    public object Value { get; set; }
  }

  public class DataAxisGridDataCellParseValueEventArgs : DataAxisGridDataBarCellEventArgs
  {

    public DataAxisGridDataCellParseValueEventArgs(PropertyAxisBar propAxisBar, object listItemBar, DataAxisGridDataCellMan cellMan, object inValue)
      : base(propAxisBar, listItemBar, cellMan)
    {
      InValue = inValue;
    }

    public object InValue { get; internal set; }

    public object OutValue { get; set; }
  }

  public class DataAxisCreatingDynamicColumnsForDataPropertyEventArgs : HandledEventArgs
  {
    private readonly PropertyDescriptor propertyDescriptor;
    private readonly bool inStaticPropBars;

    public DataAxisCreatingDynamicColumnsForDataPropertyEventArgs(DataAxisGrid grid, PropertyDescriptor propertyDescriptor, bool inStaticPropBars)
    {
      this.propertyDescriptor = propertyDescriptor;
      this.inStaticPropBars = inStaticPropBars;
    }

    public PropertyDescriptor PropertyDescriptor
    {
      get { return this.propertyDescriptor; }
    }

    protected internal bool InStaticPropBars
    {
      get { return this.inStaticPropBars; }
    }

    protected internal PropertyAxisBar[] PropertyBars { get; set; }
  }

  public class DataAxisGridDataCellToolTipInfoEventArgs : DataAxisGridDataBarCellEventArgs
  {
    private string toolTipText;

    public DataAxisGridDataCellToolTipInfoEventArgs(PropertyAxisBar propAxisBar, object listItemBar, DataAxisGridDataCellMan cellMan)
      : base(propAxisBar, listItemBar, cellMan)
    {

    }

    public string ToolTipText
    {
      get { return this.toolTipText; }
      set { this.toolTipText = value; }
    }
  }

  public class DataAxisGridDataCellContextMenuStripNeededEventArgs : BaseGridCellContextMenuStripNeededEventArgs
  {
    private PropertyAxisBar propAxisBar;
    private object listItemBar;

    public DataAxisGridDataCellContextMenuStripNeededEventArgs(
      BaseGridCellManager cellManager, int colIndex, int rowIndex, int areaColIndex, int areaRowIndex,
      int inCellX, int inCellY, Rectangle cellRect, int MousePosX, int MousePosY,
      PropertyAxisBar propAxisBar, object listItemBar)
      : base (cellManager, colIndex, rowIndex, areaColIndex, areaRowIndex, inCellX, inCellY, cellRect, MousePosX, MousePosY)

    {
      this.propAxisBar = propAxisBar;
      this.listItemBar = listItemBar;
    }

    public PropertyAxisBar PropAxisBar
    {
      get { return this.propAxisBar; }
    }

    public object ListItemBar
    {
      get { return this.listItemBar; }
    }

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

  }

  public class DataAxisGridDataCellClientAreaNeededEventArgs : EventArgs
  {
    private PropertyAxisBar propAxisBar;
    private object listItemBar;
    private readonly DataAxisGridDataCellMan cell;

    private readonly Rectangle cellRect;
    private Rectangle cellClientRect;

    public DataAxisGridDataCellClientAreaNeededEventArgs(PropertyAxisBar propAxisBar, object listItemBar, Rectangle cellRect, DataAxisGridDataCellMan cell)
    {
      this.propAxisBar = propAxisBar;
      this.listItemBar = listItemBar;
      this.cellRect = cellRect;
      this.cellClientRect = cellRect;
      this.cell = cell;
    }

    public PropertyAxisBar PropAxisBar
    {
      get { return propAxisBar; }
    }

    public object ListItemBar
    {
      get { return listItemBar; }
    }

    public Rectangle CellRect
    {
      get { return cellRect; }
    }

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

    public DataAxisGridDataCellMan Cell
    {
      get { return this.cell; }
    }
  }

  public class DataAxisGridDataCellOptimalWidthNeededEventArgs : EventArgs
  {
    private PropertyAxisBar propAxisBar;
    private object listItemBar;
    private readonly DataAxisGridDataCellMan cell;

    private int optimalWidth;

    public DataAxisGridDataCellOptimalWidthNeededEventArgs(PropertyAxisBar propAxisBar, object listItemBar, DataAxisGridDataCellMan cell)
    {
      this.propAxisBar = propAxisBar;
      this.listItemBar = listItemBar;
      this.cell = cell;
    }

    public PropertyAxisBar PropAxisBar
    {
      get { return propAxisBar; }
    }

    public object ListItemBar
    {
      get { return listItemBar; }
    }

    public int OptimalWidth
    {
      get { return optimalWidth; }
      set { optimalWidth = value; }
    }

    public DataAxisGridDataCellMan Cell
    {
      get { return this.cell; }
    }
  }

}
