X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FManaged.Windows.Forms%2FSystem.Windows.Forms%2FListView.cs;h=66c32b3773557fa31670cb369f54fe44ce72e102;hb=ecd61be7b3ef7aa871d3bd7be9669d69dd6812b6;hp=da814a276f3534db33d4a398616024a30239b413;hpb=4ba81c8a7ecf33a2105b7f3a7062d703f9285644;p=mono.git 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 da814a276f3..66c32b37735 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs @@ -376,6 +376,11 @@ namespace System.Windows.Forms get { return focused_item; } +#if NET_2_0 + set { + throw new NotImplementedException (); + } +#endif } public override Color ForeColor { @@ -538,7 +543,9 @@ namespace System.Windows.Forms } } - [LocalizableAttribute(true)] + [LocalizableAttribute (true)] + [MergableProperty (false)] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)] public ListViewGroupCollection Groups { get { return groups; } } @@ -625,6 +632,7 @@ namespace System.Windows.Forms } #if NET_2_0 + [Browsable (true)] public Size TileSize { get { return tile_size; @@ -659,15 +667,22 @@ namespace System.Windows.Forms return null; } } +#if NET_2_0 + set { + throw new NotImplementedException (); + } +#endif } #if NET_2_0 - [MonoTODO("Implement")] + [EditorBrowsable (EditorBrowsableState.Advanced)] + [DefaultValue (true)] + [Browsable (false)] + [MonoInternalNote ("Stub, not implemented")] public bool UseCompatibleStateImageBehavior { get { return false; } - set { } } @@ -760,7 +775,7 @@ namespace System.Windows.Forms Refresh (); } - const int text_padding = 5; + const int text_padding = 15; internal Size GetChildColumnSize (int index) { @@ -1869,14 +1884,19 @@ namespace System.Windows.Forms ThemeEngine.Current.DrawListViewItems (pe.Graphics, pe.ClipRectangle, owner); } - internal override void OnGotFocusInternal (EventArgs e) - { - owner.Select (false, true); - } - - internal override void OnLostFocusInternal (EventArgs e) + protected override void WndProc (ref Message m) { - owner.Select (false, true); + switch ((Msg)m.Msg) { + case Msg.WM_KILLFOCUS: + owner.Select (false, true); + break; + case Msg.WM_SETFOCUS: + owner.Select (false, true); + break; + default: + break; + } + base.WndProc (ref m); } } @@ -2300,6 +2320,24 @@ namespace System.Windows.Forms } } +#if NET_2_0 + public void AutoResizeColumn (int columnIndex, ColumnHeaderAutoResizeStyle headerAutoResize) + { + if (columnIndex < 0 || columnIndex >= columns.Count) + throw new ArgumentOutOfRangeException ("columnIndex"); + + columns [columnIndex].AutoResize (headerAutoResize); + } + + public void AutoResizeColumns (ColumnHeaderAutoResizeStyle headerAutoResize) + { + BeginUpdate (); + foreach (ColumnHeader col in columns) + col.AutoResize (headerAutoResize); + EndUpdate (); + } +#endif + public void BeginUpdate () { // flag to avoid painting @@ -2344,6 +2382,50 @@ namespace System.Windows.Forms else if (bounds.Bottom > view_rect.Bottom) v_scroll.Value += (bounds.Bottom - view_rect.Bottom); } + +#if NET_2_0 + public ListViewItem FindItemWithText (string text) + { + if (items.Count == 0) + return null; + + return FindItemWithText (text, true, 0, true); + } + + public ListViewItem FindItemWithText (string text, bool includeSubItems, int startIndex) + { + return FindItemWithText (text, includeSubItems, startIndex, true); + } + + public ListViewItem FindItemWithText (string text, bool includeSubItems, int startIndex, bool prefixSearch) + { + if (startIndex < 0 || startIndex >= items.Count) + throw new ArgumentOutOfRangeException ("startIndex"); + + if (text == null) + throw new ArgumentNullException ("text"); + + for (int i = startIndex; i < items.Count; i++) { + ListViewItem lvi = items [i]; + + if ((prefixSearch && lvi.Text.StartsWith (text, true, CultureInfo.CurrentCulture)) // prefix search + || String.Compare (lvi.Text, text, true) == 0) // match + return lvi; + } + + if (includeSubItems) { + for (int i = startIndex; i < items.Count; i++) { + ListViewItem lvi = items [i]; + foreach (ListViewItem.ListViewSubItem sub_item in lvi.SubItems) + if ((prefixSearch && sub_item.Text.StartsWith (text, true, CultureInfo.CurrentCulture)) + || String.Compare (sub_item.Text, text, true) == 0) + return lvi; + } + } + + return null; + } +#endif public ListViewItem GetItemAt (int x, int y) {