Author: calberto
Date: 2007-12-07 20:54:36 -0500 (Fri, 07 Dec 2007)
New Revision: 90984
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewInsertionMark.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs
Log:
2007-12-07 Carlos Alberto Cortez <[EMAIL PROTECTED]>
* ListView.cs:
* ListViewInsertionMark.cs:
* ThemeWin32Classic.cs: Implement the drawing side of the
new 2.0 ListView.InsertionMark property.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-12-08 01:53:55 UTC (rev 90983)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-12-08 01:54:36 UTC (rev 90984)
@@ -1,3 +1,10 @@
+2007-12-07 Carlos Alberto Cortez <[EMAIL PROTECTED]>
+
+ * ListView.cs:
+ * ListViewInsertionMark.cs:
+ * ThemeWin32Classic.cs: Implement the drawing side of the
+ new 2.0 ListView.InsertionMark property.
+
2007-12-07 Jonathan Pobst <[EMAIL PROTECTED]>
* CurrencyManager.cs: Silence some debug spew.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
2007-12-08 01:53:55 UTC (rev 90983)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
2007-12-08 01:54:36 UTC (rev 90984)
@@ -105,6 +105,7 @@
private int hot_item_index = -1;
#if NET_2_0
private bool hot_tracking;
+ private ListViewInsertionMark insertion_mark;
private bool show_item_tooltips;
private ToolTip item_tooltip;
private Size tile_size;
@@ -299,6 +300,7 @@
#if NET_2_0
item_tooltip = new ToolTip ();
item_tooltip.Active = false;
+ insertion_mark = new ListViewInsertionMark (this);
#endif
InternalBorderStyle = BorderStyle.Fixed3D;
@@ -678,6 +680,15 @@
}
#if NET_2_0
+ [Browsable (false)]
+ public ListViewInsertionMark InsertionMark {
+ get {
+ return insertion_mark;
+ }
+ }
+#endif
+
+#if NET_2_0
[Editor
("System.Windows.Forms.Design.ListViewItemCollectionEditor, " +
Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
#endif
[DesignerSerializationVisibility
(DesignerSerializationVisibility.Content)]
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewInsertionMark.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewInsertionMark.cs
2007-12-08 01:53:55 UTC (rev 90983)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewInsertionMark.cs
2007-12-08 01:54:36 UTC (rev 90984)
@@ -36,7 +36,7 @@
bool appears_after_item;
Rectangle bounds;
Color? color;
- int index = -1;
+ int index = 0;
internal ListViewInsertionMark (ListView listview)
{
@@ -48,7 +48,14 @@
return appears_after_item;
}
set {
+ if (value == appears_after_item)
+ return;
+
appears_after_item = value;
+
+ listview_owner.item_control.Invalidate (bounds);
+ UpdateBounds ();
+ listview_owner.item_control.Invalidate (bounds);
}
}
@@ -72,14 +79,61 @@
return index;
}
set {
+ if (value == index)
+ return;
+
index = value;
+
+ listview_owner.item_control.Invalidate (bounds);
+ UpdateBounds ();
+ listview_owner.item_control.Invalidate (bounds);
}
}
+ void UpdateBounds ()
+ {
+ if (index < 0 || index >= listview_owner.Items.Count) {
+ bounds = Rectangle.Empty;
+ return;
+ }
+
+ Rectangle item_bounds = listview_owner.Items
[index].Bounds;
+ int x_origin = (appears_after_item ? item_bounds.Right
: item_bounds.Left) - 2;
+ int height = item_bounds.Height +
ThemeEngine.Current.ListViewVerticalSpacing;
+
+ bounds = new Rectangle (x_origin, item_bounds.Top, 7,
height);
+ }
+
public int NearestIndex (Point pt)
{
throw new NotImplementedException ();
}
+
+ internal PointF [] TopTriangle {
+ get {
+ PointF p1 = new PointF (bounds.X, bounds.Y);
+ PointF p2 = new PointF (bounds.Right, bounds.Y);
+ PointF p3 = new PointF (bounds.X +
(bounds.Right - bounds.X) / 2, bounds.Y + 5);
+
+ return new PointF [] {p1, p2, p3};
+ }
+ }
+
+ internal PointF [] BottomTriangle {
+ get {
+ PointF p1 = new PointF (bounds.X,
bounds.Bottom);
+ PointF p2 = new PointF (bounds.Right,
bounds.Bottom);
+ PointF p3 = new PointF (bounds.X +
(bounds.Right - bounds.X) / 2, bounds.Bottom - 5);
+
+ return new PointF [] {p1, p2, p3};
+ }
+ }
+
+ internal Rectangle Line {
+ get {
+ return new Rectangle (bounds.X + 2, bounds.Y +
2, 2, bounds.Height - 5);
+ }
+ }
}
}
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs
2007-12-08 01:53:55 UTC (rev 90983)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs
2007-12-08 01:54:36 UTC (rev 90984)
@@ -2472,6 +2472,18 @@
DrawListViewGroupHeader (dc,
control, group);
}
}
+
+ ListViewInsertionMark insertion_mark =
control.InsertionMark;
+ int insertion_mark_index = insertion_mark.Index;
+ if (insertion_mark.Bounds != Rectangle.Empty &&
+ (control.View != View.Details &&
control.View != View.List) &&
+ insertion_mark_index > -1 &&
insertion_mark_index < control.Items.Count) {
+
+ Brush brush = ResPool.GetSolidBrush
(insertion_mark.Color);
+ dc.FillRectangle (brush, insertion_mark.Line);
+ dc.FillPolygon (brush,
insertion_mark.TopTriangle);
+ dc.FillPolygon (brush,
insertion_mark.BottomTriangle);
+ }
#endif
// draw the gridlines
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches