JD2022-TU1/main/extern/ITNetwork/gear/private/tools/Ubi.Tools.GearConfigTool/GEARRow.cs

151 lines
No EOL
3.6 KiB
C#

using System;
using System.Collections.Generic;
namespace Ubi.Tools.GearConfigTool
{
public enum RowType
{
RowSubSystem = 0,
RowModule = 1,
RowConfiguration = 2,
}
/**
* Class that fake an indexed property in the CheckboxStyles class.
* This object is just an interface to a List of CheckboxStyles.
*/
public class CheckboxStylesIndexer
{
//private List<CheckboxStyles> m_CheckStyle = new List<CheckboxStyles>();
private Dictionary<String, CheckboxStyles> m_CheckStyle = new Dictionary<string, CheckboxStyles>();
/**
* Return or set a CheckStyle at all cost... Grow the List if we need to!
* index can be any positive value, we never fail.
*/
public CheckboxStyles this[string key]
{
get {
if (!m_CheckStyle.ContainsKey(key))
m_CheckStyle.Add(key, CheckboxStyles.NotChecked);
return m_CheckStyle[key];
}
set {
if (m_CheckStyle.ContainsKey(key))
m_CheckStyle[key] = value;
else
m_CheckStyle.Add(key, value);
}
}
/**
* Empty the List.
*/
public void Reset()
{
m_CheckStyle.Clear();
}
}
/**
* Class that's used as a cache for GEARDataGridView.
*
* Contain all the needed properties needed to speed data lookup
* in the grid.
*/
public class GEARRow
{
private int m_SubSystemIndex;
private int m_ModuleIndex;
private int m_ConfigurationIndex;
private CheckboxStylesIndexer m_CheckStyle = new CheckboxStylesIndexer();
private String m_DisplayName;
private bool m_Hidden;
private bool m_Displayable;
private int m_NumChildren;
private RowType m_Type;
public GEARRow(int SubsystemIndex, int ModuleIndex, int ConfigurationIndex, String Displayname, bool Displayable, RowType Type)
{
m_SubSystemIndex = SubsystemIndex;
m_ModuleIndex = ModuleIndex;
m_ConfigurationIndex = ConfigurationIndex;
m_DisplayName = Displayname;
m_Type = Type;
m_Displayable = Displayable;
// By default every row is shown and not editable...
m_Hidden = false;
}
public override String ToString()
{
return "" + m_SubSystemIndex + "." + m_ModuleIndex + "." + m_ConfigurationIndex;
}
public int SubSystemIndex
{
get { return m_SubSystemIndex; }
}
public int ModuleIndex
{
get { return m_ModuleIndex; }
}
public int ConfigurationIndex
{
get { return m_ConfigurationIndex; }
}
public CheckboxStylesIndexer CheckStyle
{
get
{
return m_CheckStyle;
}
private set
{
}
}
public RowType Type
{
get { return m_Type; }
}
public String DisplayName
{
get { return m_DisplayName; }
}
public int NumChildren
{
get { return m_NumChildren; }
set { m_NumChildren = value; }
}
public bool Hidden
{
get { return m_Hidden; }
set { m_Hidden = value; }
}
public bool Displayable
{
get { return m_Displayable; }
set { m_Displayable = value; }
}
}
}