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

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Windows.Forms;

namespace EhLib
{

  [ListBindable(false)]
  public class DataGridStaticColumnCollection : DataAxisGridStaticPropBarCollection
  {

    #region privates
    #endregion privates

    public DataGridStaticColumnCollection(DataAxisGrid grid) : base(grid)
    {
    }

    #region Properties

    protected new DataGridEh Grid
    {
      get { return (DataGridEh)base.Grid; }
    }

    [Browsable(false)]
    public new DataGridColumn this[int index]
    {
      get { return (DataGridColumn)base[index]; }
      set { throw new NotSupportedException(); }
    }

    [Browsable(false)]
    public new DataGridColumn this[string columnName]
    {
      get
      {
        return (DataGridColumn)base[columnName];
      }
    }
    #endregion Properties

    #region Methods Explicit interfaces
    #endregion

    #region Events
    #endregion

    #region Methods
    public virtual int Add(DataGridColumn column)
    {
      return base.Add(column);
    }

    public virtual void Insert(int columnIndex, DataGridColumn column)
    {
      base.Insert(columnIndex, column);
    }

    public virtual void Move(DataGridColumn column, int newIndex)
    {
      base.Move(column, newIndex);
    }

    public void SetColumnsOrder(ICollection<PropertyAxisBar> orderedColumns)
    {
      base.SetBarsOrder(orderedColumns);
    }

    public virtual bool Contains(DataGridColumn column)
    {
      return base.Contains(column);
    }

    public new virtual bool Contains(string columnName)
    {
      return base.Contains(columnName);
    }

    public void CopyTo(DataGridColumn[] array, int arrayIndex)
    {
      base.CopyTo(array, arrayIndex);
    }

    public int IndexOf(DataGridColumn column)
    {
      return base.IndexOf(column);
    }

    public DataGridColumn FindColumnByDataProperty(string dataPropertyName)
    {
      return (DataGridColumn)base.FindBarByDataProperty(dataPropertyName);
    }

    public virtual void Remove(DataGridColumn column)
    {
      base.Remove(column);
    }

    public bool AllColumnsAutoGenerated()
    {
      return AllBarsAutoGenerated();
    }

    public void RemoveAutoGeneratedColumns()
    {
      RemoveAutoGeneratedBars();
    }
    #endregion Methods

  }

  public class DataGridReadOnlyColumnCollection : DataAxisGridReadOnlyPropBarCollection
  {

    #region privates
    #endregion privates

    public DataGridReadOnlyColumnCollection(DataAxisGrid grid, IList<PropertyAxisBar> list): base(grid, list)
    {
    }

    #region Properties
    protected new DataGridEh Grid
    {
      get { return (DataGridEh)base.Grid; }
    }

    public new DataGridColumn this[int index]
    {
      get
      {
        return (DataGridColumn)base[index];
      }
    }

    [Browsable(false)]
    public new DataGridColumn this[string columnName]
    {
      get
      {
        return (DataGridColumn)base[columnName];
      }
    }
    #endregion


    #region Methods
    public DataGridColumn FindColumnByPropertyName(string dataPropertyName)
    {
      return (DataGridColumn)base.FindBarByPropertyName(dataPropertyName);
    }

    public DataGridColumn FindColumnByName(string barName)
    {
      return (DataGridColumn)base.FindBarByName(barName);
    }

    public void SetDisplayIndexForColumnsRange(Collection<DataGridColumn> columns, int newDisplayIndex)
    {

    }
    #endregion

  }

  public class DataGridMainColumnCollection : DataAxisGridMainPropBarCollection
  {
    public DataGridMainColumnCollection(DataAxisGrid grid, IList<PropertyAxisBar> list) : base(grid, list)
    {
    }

    #region Properties
    protected new DataGridEh Grid
    {
      get { return (DataGridEh)base.Grid; }
    }

    public new DataGridColumn this[int index]
    {
      get
      {
        return (DataGridColumn)base[index];
      }
    }

    [Browsable(false)]
    public new DataGridColumn this[string columnName]
    {
      get
      {
        return (DataGridColumn)base[columnName];
      }
    }
    #endregion


    #region Methods
    public DataGridColumn FindColumnByPropertyName(string dataPropertyName)
    {
      return (DataGridColumn)base.FindBarByPropertyName(dataPropertyName);
    }

    public DataGridColumn FindColumnByName(string barName)
    {
      return (DataGridColumn)base.FindBarByName(barName);
    }

    public void SetDisplayIndexForColumnsRange(Collection<DataGridColumn> columns, int newDisplayIndex)
    {

    }

    internal void OnRollPosChanged()
    {
      foreach (DataGridColumn col in Items)
        col.RollPosChanged();
    }

    #endregion
  }

}
