Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Alberto Cortez <calberto.cortez@gmail.com>2006-12-19 23:58:52 +0300
committerCarlos Alberto Cortez <calberto.cortez@gmail.com>2006-12-19 23:58:52 +0300
commitbaf40c1325bf9c9bc12704b5b2fc7db3672be515 (patch)
tree0a0078667a8c1b3ced32d3bfbe5a46bbce463529 /mcs/class/Managed.Windows.Forms/System.Windows.Forms
parent602b92bce886a7515400d76826d155978c989897 (diff)
2006-12-19 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* ColumnHeader.cs: Add Tag, Name, ImageKey, ImageIndex, and Image List 2.0 members for ColummnHeader. * ListView.cs: Add key-related 2.0 methods for ColumnHeaderCollection. svn path=/trunk/mcs/; revision=69778
Diffstat (limited to 'mcs/class/Managed.Windows.Forms/System.Windows.Forms')
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog7
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeader.cs85
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs126
3 files changed, 218 insertions, 0 deletions
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
index 9c7906c263a..7d782497e20 100644
--- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
@@ -1,3 +1,10 @@
+2006-12-19 Carlos Alberto Cortez <calberto.cortez@gmail.com>
+
+ * ColumnHeader.cs: Add Tag, Name, ImageKey, ImageIndex,
+ and Image List 2.0 members for ColummnHeader.
+ * ListView.cs: Add key-related 2.0 methods for
+ ColumnHeaderCollection.
+
2006-12-19 Gert Driesen <drieseng@users.sourceforge.net>
* ListViewItem.cs: Changed AddRange overloads to match MS: throw
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeader.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeader.cs
index 16728e8d8cc..e63dbcfca30 100644
--- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeader.cs
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeader.cs
@@ -42,6 +42,12 @@ namespace System.Windows.Forms
private string text = "ColumnHeader";
private HorizontalAlignment text_alignment = HorizontalAlignment.Left;
private int width = ThemeEngine.Current.ListViewDefaultColumnWidth;
+#if NET_2_0
+ private int image_index = -1;
+ private string image_key = String.Empty;
+ private string name = String.Empty;
+ private object tag;
+#endif
// internal variables
internal Rectangle column_rect = Rectangle.Empty;
@@ -59,10 +65,33 @@ namespace System.Windows.Forms
this.text_alignment = alignment;
CalcColumnHeader ();
}
+
+#if NET_2_0
+ internal ColumnHeader (string key, string text, int width, HorizontalAlignment textAlign)
+ {
+ Name = key;
+ Text = text;
+ this.width = width;
+ this.text_alignment = textAlign;
+ CalcColumnHeader ();
+ }
+#endif
#endregion // Internal Constructor
#region Public Constructors
public ColumnHeader () { }
+
+#if NET_2_0
+ public ColumnHeader (int imageIndex)
+ {
+ ImageIndex = imageIndex;
+ }
+
+ public ColumnHeader (string imageKey)
+ {
+ ImageKey = imageKey;
+ }
+#endif
#endregion // Public Constructors
#region Private Internal Methods Properties
@@ -129,6 +158,40 @@ namespace System.Windows.Forms
#endregion // Private Internal Methods Properties
#region Public Instance Properties
+#if NET_2_0
+ public int ImageIndex {
+ get {
+ return image_index;
+ }
+ set {
+ if (value < -1)
+ throw new ArgumentOutOfRangeException ("value");
+
+ image_index = value;
+ image_key = String.Empty;
+ }
+ }
+
+ public string ImageKey {
+ get {
+ return image_key;
+ }
+ set {
+ image_key = value == null ? String.Empty : value;
+ image_index = -1;
+ }
+ }
+
+ public ImageList ImageList {
+ get {
+ if (owner == null)
+ return null;
+
+ return owner.SmallImageList;
+ }
+ }
+#endif
+
[Browsable (false)]
public int Index {
get {
@@ -145,6 +208,28 @@ namespace System.Windows.Forms
get { return owner; }
}
+#if NET_2_0
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value == null ? String.Empty : value;
+ }
+ }
+
+ [LocalizableAttribute (false)]
+ [BindableAttribute (true)]
+ public object Tag {
+ get {
+ return tag;
+ }
+ set {
+ tag = value;
+ }
+ }
+#endif
+
[Localizable (true)]
public string Text {
get { return text; }
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
index 1905aea80fc..991953d29fd 100644
--- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
@@ -2779,6 +2779,18 @@ namespace System.Windows.Forms
}
}
+#if NET_2_0
+ public virtual ColumnHeader this [string key] {
+ get {
+ int idx = IndexOfKey (key);
+ if (idx == -1)
+ return null;
+
+ return (ColumnHeader) list [idx];
+ }
+ }
+#endif
+
bool ICollection.IsSynchronized {
get { return true; }
}
@@ -2816,6 +2828,48 @@ namespace System.Windows.Forms
return colHeader;
}
+#if NET_2_0
+ public virtual ColumnHeader Add (string text)
+ {
+ return Add (String.Empty, text);
+ }
+
+ public virtual ColumnHeader Add (string text, int iwidth)
+ {
+ return Add (String.Empty, text, iwidth);
+ }
+
+ public virtual ColumnHeader Add (string key, string text)
+ {
+ ColumnHeader colHeader = new ColumnHeader ();
+ colHeader.Name = key;
+ colHeader.Text = text;
+ Add (colHeader);
+ return colHeader;
+ }
+
+ public virtual ColumnHeader Add (string key, string text, int iwidth)
+ {
+ return Add (key, text, iwidth, HorizontalAlignment.Left, -1);
+ }
+
+ public virtual ColumnHeader Add (string key, string text, int iwidth, HorizontalAlignment textAlign, int imageIndex)
+ {
+ ColumnHeader colHeader = new ColumnHeader (key, text, iwidth, textAlign);
+ colHeader.ImageIndex = imageIndex;
+ Add (colHeader);
+ return colHeader;
+ }
+
+ public virtual ColumnHeader Add (string key, string text, int iwidth, HorizontalAlignment textAlign, string imageKey)
+ {
+ ColumnHeader colHeader = new ColumnHeader (key, text, iwidth, textAlign);
+ colHeader.ImageKey = imageKey;
+ Add (colHeader);
+ return colHeader;
+ }
+#endif
+
public virtual void AddRange (ColumnHeader [] values)
{
foreach (ColumnHeader colHeader in values) {
@@ -2837,6 +2891,13 @@ namespace System.Windows.Forms
return list.Contains (value);
}
+#if NET_2_0
+ public virtual bool ContainsKey (string key)
+ {
+ return IndexOfKey (key) != -1;
+ }
+#endif
+
public IEnumerator GetEnumerator ()
{
return list.GetEnumerator ();
@@ -2897,6 +2958,22 @@ namespace System.Windows.Forms
return list.IndexOf (value);
}
+#if NET_2_0
+ public virtual int IndexOfKey (string key)
+ {
+ if (key == null || key.Length == 0)
+ return -1;
+
+ for (int i = 0; i < list.Count; i++) {
+ ColumnHeader col = (ColumnHeader) list [i];
+ if (String.Compare (key, col.Name, true) == 0)
+ return i;
+ }
+
+ return -1;
+ }
+#endif
+
public void Insert (int index, ColumnHeader value)
{
// LAMESPEC: MSDOCS say greater than or equal to the value of the Count property
@@ -2909,6 +2986,46 @@ namespace System.Windows.Forms
owner.Redraw (true);
}
+#if NET_2_0
+ public void Insert (int index, string text)
+ {
+ Insert (index, String.Empty, text);
+ }
+
+ public void Insert (int index, string text, int width)
+ {
+ Insert (index, String.Empty, text, width);
+ }
+
+ public void Insert (int index, string key, string text)
+ {
+ ColumnHeader colHeader = new ColumnHeader ();
+ colHeader.Name = key;
+ colHeader.Text = text;
+ Insert (index, colHeader);
+ }
+
+ public void Insert (int index, string key, string text, int width)
+ {
+ ColumnHeader colHeader = new ColumnHeader (key, text, width, HorizontalAlignment.Left);
+ Insert (index, colHeader);
+ }
+
+ public void Insert (int index, string key, string text, int width, HorizontalAlignment textAlign, int imageIndex)
+ {
+ ColumnHeader colHeader = new ColumnHeader (key, text, width, textAlign);
+ colHeader.ImageIndex = imageIndex;
+ Insert (index, colHeader);
+ }
+
+ public void Insert (int index, string key, string text, int width, HorizontalAlignment textAlign, string imageKey)
+ {
+ ColumnHeader colHeader = new ColumnHeader (key, text, width, textAlign);
+ colHeader.ImageKey = imageKey;
+ Insert (index, colHeader);
+ }
+#endif
+
public void Insert (int index, string str, int width, HorizontalAlignment textAlign)
{
ColumnHeader colHeader = new ColumnHeader (this.owner, str, textAlign, width);
@@ -2922,6 +3039,15 @@ namespace System.Windows.Forms
owner.Redraw (true);
}
+#if NET_2_0
+ public virtual void RemoveByKey (string key)
+ {
+ int idx = IndexOfKey (key);
+ if (idx != -1)
+ RemoveAt (idx);
+ }
+#endif
+
public virtual void RemoveAt (int index)
{
if (index < 0 || index >= list.Count)