119 lines
2.9 KiB
C#
119 lines
2.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
|
|
namespace MLV;
|
|
|
|
[Serializable]
|
|
[DefaultProperty("Text")]
|
|
[ToolboxItem(false)]
|
|
[DesignTimeVisible(false)]
|
|
public class ManagedListViewItem : IManagedListViewItem
|
|
{
|
|
private List<ManagedListViewSubItem> subItems = new List<ManagedListViewSubItem>();
|
|
|
|
private bool selected;
|
|
|
|
private bool specialItem;
|
|
|
|
[Description("The subitems collection. You must add subitems in order to display this item with details view.")]
|
|
[Category("Items")]
|
|
public List<ManagedListViewSubItem> SubItems
|
|
{
|
|
get
|
|
{
|
|
return subItems;
|
|
}
|
|
set
|
|
{
|
|
subItems = value;
|
|
}
|
|
}
|
|
|
|
[Browsable(false)]
|
|
public bool Selected
|
|
{
|
|
get
|
|
{
|
|
return selected;
|
|
}
|
|
set
|
|
{
|
|
selected = value;
|
|
}
|
|
}
|
|
|
|
[Browsable(false)]
|
|
public bool IsSubitemsReady { get; set; }
|
|
|
|
[Browsable(false)]
|
|
public bool UseSubitemsReady { get; set; }
|
|
|
|
[Description("If set, the control will consider this item as special item and will get highlighted with special color")]
|
|
[Category("Style")]
|
|
public bool IsSpecialItem
|
|
{
|
|
get
|
|
{
|
|
return specialItem;
|
|
}
|
|
set
|
|
{
|
|
specialItem = value;
|
|
}
|
|
}
|
|
|
|
[Description("Get or set a value indicate if this item is a child item (i.e X coordinate if this item is shifted to the right). WARNING: IsParentItem and IsChildItem cannot be enabled at the same time.")]
|
|
[Category("Items")]
|
|
public bool IsChildItem { get; set; }
|
|
|
|
[Description("Indicates if this rom is a parent item. If set, this rom can minimize it's children. WARNING: IsParentItem and IsChildItem cannot be enabled at the same time.")]
|
|
[Category("Items")]
|
|
public bool IsParentItem { get; set; }
|
|
|
|
[Description("Indicates if this rom is a parent item. If set, this rom can minimize it's children")]
|
|
[Category("Items")]
|
|
public bool IsParentCollapsed { get; set; }
|
|
|
|
public ManagedListViewSubItem GetSubItemByID(string id)
|
|
{
|
|
foreach (ManagedListViewSubItem subItem in subItems)
|
|
{
|
|
if (subItem.ColumnID == id)
|
|
{
|
|
return subItem;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public override void OnMouseLeave()
|
|
{
|
|
base.OnMouseLeave();
|
|
foreach (ManagedListViewSubItem subItem in subItems)
|
|
{
|
|
subItem.OnMouseLeave();
|
|
}
|
|
}
|
|
|
|
public ManagedListViewItem Clone()
|
|
{
|
|
ManagedListViewItem managedListViewItem = new ManagedListViewItem();
|
|
managedListViewItem.Color = Color;
|
|
managedListViewItem.CustomFont = base.CustomFont;
|
|
managedListViewItem.CustomFontEnabled = base.CustomFontEnabled;
|
|
managedListViewItem.DrawMode = base.DrawMode;
|
|
managedListViewItem.ImageIndex = ImageIndex;
|
|
managedListViewItem.IsSpecialItem = IsSpecialItem;
|
|
managedListViewItem.Selected = Selected;
|
|
managedListViewItem.Tag = base.Tag;
|
|
managedListViewItem.Text = Text;
|
|
managedListViewItem.SubItems = new List<ManagedListViewSubItem>();
|
|
foreach (ManagedListViewSubItem subItem in SubItems)
|
|
{
|
|
managedListViewItem.SubItems.Add(subItem.Clone());
|
|
}
|
|
return managedListViewItem;
|
|
}
|
|
}
|