// Author:
// Daniel Nauck (dna(at)mono-project(dot)de)
-#if NET_2_0
-
using System;
using System.Text;
using System.Runtime.Serialization;
[ToolboxItem(false)]
[DesignTimeVisible(false)]
[DefaultProperty("Header")]
+ [TypeConverter (typeof (ListViewGroupConverter))]
public sealed class ListViewGroup : ISerializable
{
internal string header = string.Empty;
private object tag = null;
private Rectangle header_bounds = Rectangle.Empty;
internal int starting_row; // At which row the group starts
+ internal int starting_item; // The first display item in group
+ internal int rows;
internal int current_item; // Current item when doing layout
internal Point items_area_location;
bool is_default_group;
#region ListViewGroup constructors
- public ListViewGroup()
+ public ListViewGroup () : this ("ListViewGroup", HorizontalAlignment.Left)
{
- header = "ListViewGroup";
- header_alignment = HorizontalAlignment.Left;
}
- public ListViewGroup(string header)
+ public ListViewGroup (string header) : this (header, HorizontalAlignment.Left)
{
- this.header = header;
- header_alignment = HorizontalAlignment.Left;
}
- public ListViewGroup(string key, string headerText)
+ public ListViewGroup (string key, string headerText) : this (headerText, HorizontalAlignment.Left)
{
- header = headerText;
name = key;
- header_alignment = HorizontalAlignment.Left;
}
- public ListViewGroup(string header, HorizontalAlignment headerAlignment)
+ public ListViewGroup (string header, HorizontalAlignment headerAlignment)
{
this.header = header;
header_alignment = headerAlignment;
+ items = new ListView.ListViewItemCollection (list_view_owner, this);
}
private ListViewGroup(SerializationInfo info, StreamingContext context)
[Browsable(false)]
public ListView.ListViewItemCollection Items {
get {
- if (items == null)
- items = new ListView.ListViewItemCollection (list_view_owner, this);
-
return items;
}
}
}
}
+ internal int GetActualItemCount ()
+ {
+ if (is_default_group)
+ return item_count;
+
+ int count = 0;
+ for (int i = 0; i < items.Count; i++)
+ if (items [i].ListView != null) // Ignore.
+ count++;
+
+ return count;
+ }
+
[Browsable(true)]
[DefaultValue("")]
public string Name {
#endregion
}
+
+ internal class ListViewGroupConverter : TypeConverter
+ {
+ public override bool GetStandardValuesSupported (ITypeDescriptorContext context)
+ {
+ return true;
+ }
+
+ // Weird
+ public override StandardValuesCollection GetStandardValues (ITypeDescriptorContext context)
+ {
+ return new StandardValuesCollection (new object [] {});
+ }
+ }
}
-#endif