aboutsummaryrefslogtreecommitdiff
path: root/source/ShiftUI/ListView
diff options
context:
space:
mode:
authorMichaelTheShifter <[email protected]>2016-07-20 09:40:36 -0400
committerMichaelTheShifter <[email protected]>2016-07-20 09:40:36 -0400
commitd40fed5ce2bc806a91245adb18039634eac13ed0 (patch)
treef1d7168aee6db109ac2c738ad18c9db667a6ba69 /source/ShiftUI/ListView
parentf1856e8ed30ed882229fd3fa2a4038122a5fb441 (diff)
downloadshiftos-c--d40fed5ce2bc806a91245adb18039634eac13ed0.tar.gz
shiftos-c--d40fed5ce2bc806a91245adb18039634eac13ed0.tar.bz2
shiftos-c--d40fed5ce2bc806a91245adb18039634eac13ed0.zip
Move ShiftUI source code to ShiftOS
This'll be a lot easier to work on.
Diffstat (limited to 'source/ShiftUI/ListView')
-rw-r--r--source/ShiftUI/ListView/ColumnClickEventArgs.cs52
-rw-r--r--source/ShiftUI/ListView/ColumnClickEventHandler.cs29
-rw-r--r--source/ShiftUI/ListView/ColumnHeader.cs398
-rw-r--r--source/ShiftUI/ListView/ColumnHeaderAutoResizeStyle.cs38
-rw-r--r--source/ShiftUI/ListView/ColumnHeaderConverter.cs96
-rw-r--r--source/ShiftUI/ListView/ColumnHeaderStyle.cs36
-rw-r--r--source/ShiftUI/ListView/ColumnReorderedEventArgs.cs64
-rw-r--r--source/ShiftUI/ListView/ColumnReorderedEventHandler.cs32
-rw-r--r--source/ShiftUI/ListView/ColumnStyle.cs72
-rw-r--r--source/ShiftUI/ListView/ColumnWidthChangedEventArgs.cs50
-rw-r--r--source/ShiftUI/ListView/ColumnWidthChangedEventHandler.cs32
-rw-r--r--source/ShiftUI/ListView/ColumnWidthChangingEventArgs.cs61
-rw-r--r--source/ShiftUI/ListView/ColumnWidthChangingEventHandler.cs32
-rw-r--r--source/ShiftUI/ListView/ListViewAlignment.cs36
-rw-r--r--source/ShiftUI/ListView/ListViewGroup.cs265
-rw-r--r--source/ShiftUI/ListView/ListViewGroupCollection.cs332
-rw-r--r--source/ShiftUI/ListView/ListViewHitTestInfo.cs62
-rw-r--r--source/ShiftUI/ListView/ListViewHitTestLocations.cs44
-rw-r--r--source/ShiftUI/ListView/ListViewInsertionMark.cs152
-rw-r--r--source/ShiftUI/ListView/ListViewItemConverter.cs97
-rw-r--r--source/ShiftUI/ListView/ListViewItemMouseHoverEventArgs.cs53
-rw-r--r--source/ShiftUI/ListView/ListViewItemMouseHoverEventHandler.cs32
-rw-r--r--source/ShiftUI/ListView/ListViewItemSelectionChangedEventArgs.cs61
-rw-r--r--source/ShiftUI/ListView/ListViewItemSelectionChangedEventHandler.cs32
-rw-r--r--source/ShiftUI/ListView/ListViewItemStates.cs45
-rw-r--r--source/ShiftUI/ListView/ListViewVirtualItemsSelectionRangeChangedEventArgs.cs61
-rw-r--r--source/ShiftUI/ListView/ListViewVirtualItemsSelectionRangeChangedEventHandler.cs32
27 files changed, 2296 insertions, 0 deletions
diff --git a/source/ShiftUI/ListView/ColumnClickEventArgs.cs b/source/ShiftUI/ListView/ColumnClickEventArgs.cs
new file mode 100644
index 0000000..24e07aa
--- /dev/null
+++ b/source/ShiftUI/ListView/ColumnClickEventArgs.cs
@@ -0,0 +1,52 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2004 Novell, Inc.
+//
+// Authors:
+// Ravindra ([email protected])
+//
+
+
+// COMPLETE
+
+using System;
+
+namespace ShiftUI
+{
+ public class ColumnClickEventArgs : EventArgs
+ {
+ private int column;
+
+ #region Public Constructors
+ public ColumnClickEventArgs (int column)
+ {
+ this.column = column;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public int Column {
+ get {
+ return column;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/source/ShiftUI/ListView/ColumnClickEventHandler.cs b/source/ShiftUI/ListView/ColumnClickEventHandler.cs
new file mode 100644
index 0000000..725e57b
--- /dev/null
+++ b/source/ShiftUI/ListView/ColumnClickEventHandler.cs
@@ -0,0 +1,29 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2004 Novell, Inc.
+//
+// Authors:
+// Ravindra ([email protected])
+//
+
+namespace ShiftUI
+{
+ public delegate void ColumnClickEventHandler (object sender, ColumnClickEventArgs e);
+}
diff --git a/source/ShiftUI/ListView/ColumnHeader.cs b/source/ShiftUI/ListView/ColumnHeader.cs
new file mode 100644
index 0000000..118d9a6
--- /dev/null
+++ b/source/ShiftUI/ListView/ColumnHeader.cs
@@ -0,0 +1,398 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2004 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Ravindra ([email protected])
+//
+
+
+// COMPLETE
+
+
+using System.ComponentModel;
+using System.Drawing;
+using System;
+
+namespace ShiftUI
+{
+ [DefaultProperty ("Text")]
+ [DesignTimeVisible (false)]
+ [ToolboxItem (false)]
+ [TypeConverter (typeof (ColumnHeaderConverter))]
+ public class ColumnHeader : Component, ICloneable
+ {
+ #region Instance Variables
+ private StringFormat format = new StringFormat ();
+ private string text = "ColumnHeader";
+ private HorizontalAlignment text_alignment = HorizontalAlignment.Left;
+ private int width = ThemeEngine.Current.ListViewDefaultColumnWidth;
+ private int image_index = -1;
+ private string image_key = String.Empty;
+ private string name = String.Empty;
+ private object tag;
+ private int display_index = -1;
+
+ // internal variables
+ Rectangle column_rect = Rectangle.Empty;
+ bool pressed = false;
+ ListView owner;
+ #endregion // Instance Variables
+
+ #region Internal Constructor
+ internal ColumnHeader (ListView owner, string text,
+ HorizontalAlignment alignment, int width)
+ {
+ this.owner = owner;
+ this.text = text;
+ this.width = width;
+ this.text_alignment = alignment;
+ CalcColumnHeader ();
+ }
+
+ internal ColumnHeader (string key, string text, int width, HorizontalAlignment textAlign)
+ {
+ Name = key;
+ Text = text;
+ this.width = width;
+ this.text_alignment = textAlign;
+ CalcColumnHeader ();
+ }
+ #endregion // Internal Constructor
+
+ #region Public Constructors
+ public ColumnHeader () { }
+
+ public ColumnHeader (int imageIndex)
+ {
+ ImageIndex = imageIndex;
+ }
+
+ public ColumnHeader (string imageKey)
+ {
+ ImageKey = imageKey;
+ }
+ #endregion // Public Constructors
+
+ #region Private Internal Methods Properties
+ internal bool Pressed {
+ get { return pressed; }
+ set { pressed = value; }
+ }
+
+ internal int X {
+ get { return column_rect.X; }
+ set { column_rect.X = value; }
+ }
+
+ internal int Y {
+ get { return column_rect.Y; }
+ set { column_rect.Y = value; }
+ }
+
+ internal int Wd {
+ get { return column_rect.Width; }
+ set { column_rect.Width = value; }
+ }
+
+ internal int Ht {
+ get { return column_rect.Height; }
+ set { column_rect.Height = value; }
+ }
+
+ internal Rectangle Rect {
+ get { return column_rect; }
+ set { column_rect = value; }
+ }
+
+ internal StringFormat Format {
+ get { return format; }
+ }
+
+ internal int InternalDisplayIndex {
+ get { return display_index; }
+ set { display_index = value; }
+ }
+
+ internal void CalcColumnHeader ()
+ {
+ if (text_alignment == HorizontalAlignment.Center)
+ format.Alignment = StringAlignment.Center;
+ else if (text_alignment == HorizontalAlignment.Right)
+ format.Alignment = StringAlignment.Far;
+ else
+ format.Alignment = StringAlignment.Near;
+ format.LineAlignment = StringAlignment.Center;
+ format.Trimming = StringTrimming.EllipsisCharacter;
+ // text is wrappable only in LargeIcon and SmallIcon views
+ format.FormatFlags = StringFormatFlags.NoWrap;
+
+ if (owner != null)
+ column_rect.Height = ThemeEngine.Current.ListViewGetHeaderHeight (owner, owner.Font);
+ else
+ column_rect.Height = ThemeEngine.Current.ListViewGetHeaderHeight (null, ThemeEngine.Current.DefaultFont);
+
+ column_rect.Width = 0;
+
+ if (width >= 0) // manual width
+ column_rect.Width = width;
+ else if (Index != -1) { // automatic width, either -1 or -2
+ // try to expand if we are the last column
+ bool expand_to_right = Index == owner.Columns.Count - 1 && width == -2;
+ Rectangle visible_area = owner.ClientRectangle;
+
+ column_rect.Width = owner.GetChildColumnSize (Index).Width;
+ width = column_rect.Width;
+
+ // expand only if we have free space to the right
+ if (expand_to_right && column_rect.X + column_rect.Width < visible_area.Width) {
+ width = visible_area.Width - column_rect.X;
+ if (owner.v_scroll.Visible)
+ width -= owner.v_scroll.Width;
+
+ column_rect.Width = width;
+ }
+ }
+ }
+
+ internal void SetListView (ListView list_view)
+ {
+ owner = list_view;
+ }
+
+ #endregion // Private Internal Methods Properties
+
+ #region Public Instance Properties
+
+ [Localizable (true)]
+ [RefreshProperties (RefreshProperties.Repaint)]
+ public int DisplayIndex {
+ get {
+ if (owner == null)
+ return display_index;
+
+ return owner.GetReorderedColumnIndex (this);
+ }
+ set {
+ if (owner == null) {
+ display_index = value;
+ return;
+ }
+ if (value < 0 || value >= owner.Columns.Count)
+ throw new ArgumentOutOfRangeException ("DisplayIndex");
+
+ owner.ReorderColumn (this, value, false);
+ }
+ }
+
+ [DefaultValue (-1)]
+ //[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ //[Editor ("ShiftUI.Design.ImageIndexEditor, " + Consts.AssemblySystem_Design,
+ //"System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
+ [RefreshProperties (RefreshProperties.Repaint)]
+ [TypeConverter (typeof (ImageIndexConverter))]
+ public int ImageIndex {
+ get {
+ return image_index;
+ }
+ set {
+ if (value < -1)
+ throw new ArgumentOutOfRangeException ("ImageIndex");
+
+ image_index = value;
+ image_key = String.Empty;
+
+ if (owner != null)
+ owner.header_control.Invalidate ();
+ }
+ }
+
+ [DefaultValue ("")]
+ //[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ //[Editor ("ShiftUI.Design.ImageIndexEditor, " + Consts.AssemblySystem_Design,
+ //"System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
+ [RefreshProperties (RefreshProperties.Repaint)]
+ [TypeConverter (typeof (ImageKeyConverter))]
+ public string ImageKey {
+ get {
+ return image_key;
+ }
+ set {
+ image_key = value == null ? String.Empty : value;
+ image_index = -1;
+
+ if (owner != null)
+ owner.header_control.Invalidate ();
+ }
+ }
+
+ [Browsable (false)]
+ public ImageList ImageList {
+ get {
+ if (owner == null)
+ return null;
+
+ return owner.SmallImageList;
+ }
+ }
+
+ [Browsable (false)]
+ public int Index {
+ get {
+ if (owner != null)
+ return owner.Columns.IndexOf (this);
+
+ return -1;
+ }
+ }
+
+ [Browsable (false)]
+ public ListView ListView {
+ get { return owner; }
+ }
+
+ [Browsable (false)]
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value == null ? String.Empty : value;
+ }
+ }
+
+ [DefaultValue (null)]
+ [BindableAttribute (true)]
+ [LocalizableAttribute (false)]
+ [TypeConverter (typeof (StringConverter))]
+ public object Tag {
+ get {
+ return tag;
+ }
+ set {
+ tag = value;
+ }
+ }
+
+ [Localizable (true)]
+ public string Text {
+ get { return text; }
+ set {
+ if (text != value) {
+ text = value;
+ if (owner != null)
+ owner.Redraw (true);
+
+ // UIA Framework: Raising Value changed event
+ OnUIATextChanged ();
+ }
+ }
+ }
+
+ [DefaultValue (HorizontalAlignment.Left)]
+ [Localizable (true)]
+ public HorizontalAlignment TextAlign {
+ get { return text_alignment; }
+ set {
+ text_alignment = value;
+ if (owner != null)
+ owner.Redraw (true);
+ }
+ }
+
+ [DefaultValue (60)]
+ [Localizable (true)]
+ public int Width {
+ get { return width; }
+ set {
+ if (width != value) {
+ width = value;
+ if (owner != null) {
+ owner.Redraw (true);
+ owner.RaiseColumnWidthChanged (this);
+ }
+ }
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Methods
+ public void AutoResize (ColumnHeaderAutoResizeStyle headerAutoResize)
+ {
+ switch (headerAutoResize) {
+ case ColumnHeaderAutoResizeStyle.None:
+ break;
+ case ColumnHeaderAutoResizeStyle.ColumnContent:
+ Width = -1;
+ break;
+ case ColumnHeaderAutoResizeStyle.HeaderSize:
+ Width = -2;
+ break;
+ default:
+ throw new InvalidEnumArgumentException ("headerAutoResize", (int) headerAutoResize,
+ typeof (ColumnHeaderAutoResizeStyle));
+ }
+ }
+
+ public object Clone ()
+ {
+ ColumnHeader columnHeader = new ColumnHeader ();
+ columnHeader.text = text;
+ columnHeader.text_alignment = text_alignment;
+ columnHeader.width = width;
+ columnHeader.owner = owner;
+ columnHeader.format = (StringFormat) Format.Clone ();
+ columnHeader.column_rect = Rectangle.Empty;
+ return columnHeader;
+ }
+
+ public override string ToString ()
+ {
+ return string.Format ("ColumnHeader: Text: {0}", text);
+ }
+ #endregion // Public Methods
+
+ #region Protected Methods
+ protected override void Dispose (bool disposing)
+ {
+ base.Dispose (disposing);
+ }
+ #endregion // Protected Methods
+
+
+ #region UIA Framework: Methods, Properties and Events
+
+ static object UIATextChangedEvent = new object ();
+
+ internal event EventHandler UIATextChanged {
+ add { Events.AddHandler (UIATextChangedEvent, value); }
+ remove { Events.RemoveHandler (UIATextChangedEvent, value); }
+ }
+
+ private void OnUIATextChanged ()
+ {
+ EventHandler eh = (EventHandler) Events [UIATextChangedEvent];
+ if (eh != null)
+ eh (this, EventArgs.Empty);
+ }
+
+ #endregion
+ }
+}
diff --git a/source/ShiftUI/ListView/ColumnHeaderAutoResizeStyle.cs b/source/ShiftUI/ListView/ColumnHeaderAutoResizeStyle.cs
new file mode 100644
index 0000000..4856dee
--- /dev/null
+++ b/source/ShiftUI/ListView/ColumnHeaderAutoResizeStyle.cs
@@ -0,0 +1,38 @@
+//
+// ColumnHeaderAutoResizeStyle.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Novell, Inc.
+//
+// Authors:
+// Jonathan Pobst ([email protected])
+//
+
+
+namespace ShiftUI
+{
+ public enum ColumnHeaderAutoResizeStyle
+ {
+ None = 0,
+ HeaderSize = 1,
+ ColumnContent = 2
+ }
+}
diff --git a/source/ShiftUI/ListView/ColumnHeaderConverter.cs b/source/ShiftUI/ListView/ColumnHeaderConverter.cs
new file mode 100644
index 0000000..8334d40
--- /dev/null
+++ b/source/ShiftUI/ListView/ColumnHeaderConverter.cs
@@ -0,0 +1,96 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2007 Novell, Inc.
+//
+// Authors:
+// olivier Dufour [email protected]
+//
+
+
+// COMPLETE
+
+using System.ComponentModel;
+using System.ComponentModel.Design.Serialization;
+using System.Collections;
+using System.Globalization;
+using System.Reflection;
+using System;
+
+namespace ShiftUI
+{
+ public class ColumnHeaderConverter : ExpandableObjectConverter
+ {
+ public ColumnHeaderConverter ()
+ {
+ }
+
+ public override Object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, Object value, Type destinationType)
+ {
+ if (destinationType == typeof (InstanceDescriptor) && value is ColumnHeader)
+ {
+ ConstructorInfo constructor_info;
+ Type[] type;
+ ColumnHeader column_header;
+
+ column_header = (ColumnHeader)value;
+ if (column_header.ImageIndex != -1)
+ {
+ type = new Type[] { typeof (int) };
+ constructor_info = typeof (ColumnHeader).GetConstructor (type);
+ if (constructor_info != null)
+ {
+ object[] arguments = new object[] { column_header.ImageIndex };
+ return new InstanceDescriptor (constructor_info, (ICollection)arguments, false);
+ }
+ }
+ else if (string.IsNullOrEmpty(column_header.ImageKey))
+ {
+ type = new Type[] { typeof (string) };
+ constructor_info = typeof (ColumnHeader).GetConstructor (type);
+ if (constructor_info != null)
+ {
+ object[] arguments = new object[] { column_header.ImageKey };
+ return new InstanceDescriptor (constructor_info, (ICollection)arguments, false);
+ }
+ }
+ else
+ {
+ type = Type.EmptyTypes;
+ constructor_info = typeof (ColumnHeader).GetConstructor (type);
+ if (constructor_info != null)
+ {
+ object[] arguments = new object[0] {};
+ return new InstanceDescriptor (constructor_info, (ICollection)arguments, false);
+ }
+ }
+
+ }
+ return base.ConvertTo (context, culture, value, destinationType);
+ }
+
+ public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+ {
+ if (destinationType == typeof (InstanceDescriptor))
+ return true;
+ else
+ return base.CanConvertTo (context, destinationType);
+ }
+ }
+}
diff --git a/source/ShiftUI/ListView/ColumnHeaderStyle.cs b/source/ShiftUI/ListView/ColumnHeaderStyle.cs
new file mode 100644
index 0000000..ec66f6a
--- /dev/null
+++ b/source/ShiftUI/ListView/ColumnHeaderStyle.cs
@@ -0,0 +1,36 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2004 Novell, Inc.
+//
+// Authors:
+// Ravindra ([email protected])
+//
+// COMPLETE
+//
+
+namespace ShiftUI
+{
+ public enum ColumnHeaderStyle
+ {
+ None = 0,
+ Nonclickable = 1,
+ Clickable = 2
+ }
+}
diff --git a/source/ShiftUI/ListView/ColumnReorderedEventArgs.cs b/source/ShiftUI/ListView/ColumnReorderedEventArgs.cs
new file mode 100644
index 0000000..b9f6fa0
--- /dev/null
+++ b/source/ShiftUI/ListView/ColumnReorderedEventArgs.cs
@@ -0,0 +1,64 @@
+//
+// ColumnReorderedEventArgs.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Novell, Inc.
+//
+// Authors:
+// Jonathan Pobst ([email protected])
+//
+
+
+using System.ComponentModel;
+
+namespace ShiftUI
+{
+ public class ColumnReorderedEventArgs : CancelEventArgs
+ {
+
+ private ColumnHeader header;
+ private int new_display_index;
+ private int old_display_index;
+
+ #region Public Constructors
+ public ColumnReorderedEventArgs(int oldDisplayIndex, int newDisplayIndex, ColumnHeader header) : base ()
+ {
+ this.old_display_index = oldDisplayIndex;
+ this.new_display_index = newDisplayIndex;
+ this.header = header;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public int OldDisplayIndex {
+ get { return this.old_display_index; }
+ }
+
+ public int NewDisplayIndex {
+ get { return this.new_display_index; }
+ }
+
+ public ColumnHeader Header {
+ get { return this.header; }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/source/ShiftUI/ListView/ColumnReorderedEventHandler.cs b/source/ShiftUI/ListView/ColumnReorderedEventHandler.cs
new file mode 100644
index 0000000..2a2daa0
--- /dev/null
+++ b/source/ShiftUI/ListView/ColumnReorderedEventHandler.cs
@@ -0,0 +1,32 @@
+//
+// ColumnReorderedEventHandler.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Novell, Inc.
+//
+// Authors:
+// Jonathan Pobst ([email protected])
+//
+
+namespace ShiftUI
+{
+ public delegate void ColumnReorderedEventHandler(object sender, ColumnReorderedEventArgs e);
+}
diff --git a/source/ShiftUI/ListView/ColumnStyle.cs b/source/ShiftUI/ListView/ColumnStyle.cs
new file mode 100644
index 0000000..430f884
--- /dev/null
+++ b/source/ShiftUI/ListView/ColumnStyle.cs
@@ -0,0 +1,72 @@
+//
+// ColumnStyle.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//
+// Author:
+// Miguel de Icaza ([email protected])
+//
+// (C) 2004 Novell, Inc.
+//
+using System;
+
+
+namespace ShiftUI
+{
+ public class ColumnStyle : TableLayoutStyle
+ {
+ float width;
+
+ public ColumnStyle ()
+ {
+ this.width = 0;
+ }
+
+ public ColumnStyle (SizeType sizeType)
+ {
+ this.width = 0;
+ base.SizeType = sizeType;
+ }
+
+ public ColumnStyle (SizeType sizeType, float width)
+ {
+ if (width < 0)
+ throw new ArgumentOutOfRangeException ("height");
+
+ base.SizeType = sizeType;
+ this.width = width;
+ }
+
+ public float Width {
+ get { return this.width; }
+ set {
+ if (value < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ if (width != value) {
+ width = value;
+ if (base.Owner != null)
+ base.Owner.PerformLayout ();
+ }
+ }
+ }
+ }
+}
diff --git a/source/ShiftUI/ListView/ColumnWidthChangedEventArgs.cs b/source/ShiftUI/ListView/ColumnWidthChangedEventArgs.cs
new file mode 100644
index 0000000..9c412b5
--- /dev/null
+++ b/source/ShiftUI/ListView/ColumnWidthChangedEventArgs.cs
@@ -0,0 +1,50 @@
+//
+// ColumnWidthChangedEventArgs.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Novell, Inc.
+//
+// Authors:
+// Jonathan Pobst ([email protected])
+//
+using System;
+
+namespace ShiftUI
+{
+ public class ColumnWidthChangedEventArgs : EventArgs
+ {
+
+ private int column_index;
+
+ #region Public Constructors
+ public ColumnWidthChangedEventArgs(int columnIndex) : base ()
+ {
+ this.column_index = columnIndex;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public int ColumnIndex {
+ get { return this.column_index; }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/source/ShiftUI/ListView/ColumnWidthChangedEventHandler.cs b/source/ShiftUI/ListView/ColumnWidthChangedEventHandler.cs
new file mode 100644
index 0000000..af566a6
--- /dev/null
+++ b/source/ShiftUI/ListView/ColumnWidthChangedEventHandler.cs
@@ -0,0 +1,32 @@
+//
+// ColumnWidthChangedEventHandler.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Novell, Inc.
+//
+// Authors:
+// Jonathan Pobst ([email protected])
+//
+
+namespace ShiftUI
+{
+ public delegate void ColumnWidthChangedEventHandler (object sender, ColumnWidthChangedEventArgs e);
+}
diff --git a/source/ShiftUI/ListView/ColumnWidthChangingEventArgs.cs b/source/ShiftUI/ListView/ColumnWidthChangingEventArgs.cs
new file mode 100644
index 0000000..94ba54f
--- /dev/null
+++ b/source/ShiftUI/ListView/ColumnWidthChangingEventArgs.cs
@@ -0,0 +1,61 @@
+//
+// ColumnWidthChangingEventArgs.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Novell, Inc.
+//
+// Authors:
+// Jonathan Pobst ([email protected])
+//
+
+using System.ComponentModel;
+
+namespace ShiftUI
+{
+ public class ColumnWidthChangingEventArgs : CancelEventArgs
+ {
+ private int column_index;
+ private int new_width;
+
+ #region Public Constructors
+ public ColumnWidthChangingEventArgs (int columnIndex, int newWidth) : this (columnIndex, newWidth, false)
+ {
+ }
+
+ public ColumnWidthChangingEventArgs (int columnIndex, int newWidth, bool cancel) : base (cancel)
+ {
+ this.column_index = columnIndex;
+ this.new_width = newWidth;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public int ColumnIndex {
+ get { return this.column_index; }
+ }
+
+ public int NewWidth {
+ get { return this.new_width; }
+ set { this.new_width = value; }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/source/ShiftUI/ListView/ColumnWidthChangingEventHandler.cs b/source/ShiftUI/ListView/ColumnWidthChangingEventHandler.cs
new file mode 100644
index 0000000..42a6be7
--- /dev/null
+++ b/source/ShiftUI/ListView/ColumnWidthChangingEventHandler.cs
@@ -0,0 +1,32 @@
+//
+// ColumnWidthChangingEventHandler.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Novell, Inc.
+//
+// Authors:
+// Jonathan Pobst ([email protected])
+//
+
+namespace ShiftUI
+{
+ public delegate void ColumnWidthChangingEventHandler (object sender, ColumnWidthChangingEventArgs e);
+}
diff --git a/source/ShiftUI/ListView/ListViewAlignment.cs b/source/ShiftUI/ListView/ListViewAlignment.cs
new file mode 100644
index 0000000..67d8314
--- /dev/null
+++ b/source/ShiftUI/ListView/ListViewAlignment.cs
@@ -0,0 +1,36 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2004 Novell, Inc.
+//
+// Authors:
+// Ravindra ([email protected])
+//
+
+
+namespace ShiftUI
+{
+ public enum ListViewAlignment
+ {
+ Default = 0,
+ Left = 1,
+ Top = 2,
+ SnapToGrid = 5
+ }
+}
diff --git a/source/ShiftUI/ListView/ListViewGroup.cs b/source/ShiftUI/ListView/ListViewGroup.cs
new file mode 100644
index 0000000..516e045
--- /dev/null
+++ b/source/ShiftUI/ListView/ListViewGroup.cs
@@ -0,0 +1,265 @@
+//
+// ListViewGroup.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Daniel Nauck
+//
+// Author:
+// Daniel Nauck (dna(at)mono-project(dot)de)
+
+using System;
+using System.Text;
+using System.Runtime.Serialization;
+using System.ComponentModel;
+using System.Drawing;
+
+namespace ShiftUI
+{
+ [SerializableAttribute]
+ [ToolboxItem(false)]
+ [DesignTimeVisible(false)]
+ [DefaultProperty("Header")]
+ [TypeConverter (typeof (ListViewGroupConverter))]
+ public sealed class ListViewGroup : ISerializable
+ {
+ internal string header = string.Empty;
+ private string name = null;
+ private HorizontalAlignment header_alignment = HorizontalAlignment.Left;
+ private ListView list_view_owner = null;
+ private ListView.ListViewItemCollection items = null;
+ 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;
+ int item_count; // Used by default group to store item count
+
+ #region ListViewGroup constructors
+
+ public ListViewGroup () : this ("ListViewGroup", HorizontalAlignment.Left)
+ {
+ }
+
+ public ListViewGroup (string header) : this (header, HorizontalAlignment.Left)
+ {
+ }
+
+ public ListViewGroup (string key, string headerText) : this (headerText, HorizontalAlignment.Left)
+ {
+ name = key;
+ }
+
+ 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)
+ {
+ header = info.GetString("Header");
+ name = info.GetString("Name");
+ header_alignment = (HorizontalAlignment)info.GetInt32("HeaderAlignment");
+ tag = info.GetValue("Tag", typeof(object));
+
+ int count = info.GetInt32("ListViewItemCount");
+ if (count > 0) {
+ if(items == null)
+ items = new ListView.ListViewItemCollection(list_view_owner);
+
+ for (int i = 0; i < count; i++)
+ {
+ items.Add((ListViewItem)info.GetValue(string.Format("ListViewItem_{0}", i), typeof(ListViewItem)));
+ }
+ }
+ }
+
+ #endregion
+
+ #region ListViewGroup properties
+
+ public string Header {
+ get { return header; }
+ set {
+ if (!header.Equals(value)) {
+ header = value;
+
+ if (list_view_owner != null)
+ list_view_owner.Redraw(true);
+ }
+ }
+ }
+
+ [DefaultValue (HorizontalAlignment.Left)]
+ public HorizontalAlignment HeaderAlignment {
+ get { return header_alignment; }
+ set {
+ if (!header_alignment.Equals(value)) {
+ if (value != HorizontalAlignment.Left && value != HorizontalAlignment.Right &&
+ value != HorizontalAlignment.Center)
+ throw new InvalidEnumArgumentException("HeaderAlignment", (int)value, typeof(HorizontalAlignment));
+
+ header_alignment = value;
+
+ if (list_view_owner != null)
+ list_view_owner.Redraw(true);
+ }
+ }
+ }
+
+ [Browsable(false)]
+ public ListView.ListViewItemCollection Items {
+ get {
+ return items;
+ }
+ }
+
+ //[DesignerSerializationVisibility(0)]
+ [Browsable(false)]
+ public ListView ListView {
+ get { return list_view_owner; }
+ }
+
+ internal ListView ListViewOwner {
+ get { return list_view_owner; }
+ set {
+ list_view_owner = value;
+ if (!is_default_group)
+ items.Owner = value;
+ }
+ }
+
+ internal Rectangle HeaderBounds {
+ get {
+ Rectangle retval = header_bounds;
+ retval.X -= list_view_owner.h_marker;
+ retval.Y -= list_view_owner.v_marker;
+ return retval;
+ }
+ set {
+ if (list_view_owner != null)
+ list_view_owner.item_control.Invalidate (HeaderBounds);
+
+ header_bounds = value;
+
+ if (list_view_owner != null)
+ list_view_owner.item_control.Invalidate (HeaderBounds);
+
+ }
+ }
+
+ internal bool IsDefault {
+ get {
+ return is_default_group;
+ }
+ set {
+ is_default_group = value;
+ }
+ }
+
+ internal int ItemCount {
+ get {
+ return is_default_group ? item_count : items.Count;
+ }
+ set {
+ if (!is_default_group)
+ throw new InvalidOperationException ("ItemCount cannot be set for non-default groups.");
+
+ item_count = value;
+ }
+ }
+
+ 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 {
+ get { return name; }
+ set { name = value; }
+ }
+
+ [TypeConverter(typeof(StringConverter))]
+ [DefaultValue(null)]
+ [Localizable(false)]
+ [Bindable(true)]
+ public Object Tag {
+ get { return tag; }
+ set { tag = value; }
+ }
+
+ #endregion
+
+ public override string ToString()
+ {
+ return header;
+ }
+
+ #region ISerializable Members
+
+ void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ info.AddValue("Header", header);
+ info.AddValue("Name", name);
+ info.AddValue("HeaderAlignment", header_alignment);
+ info.AddValue("Tag", tag);
+
+ info.AddValue("ListViewItemCount", items.Count);
+
+ int i = 0;
+ foreach (ListViewItem item in items)
+ {
+ info.AddValue(string.Format("ListViewItem_{0}", i), item);
+ i++;
+ }
+ }
+
+ #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 [] {});
+ }
+ }
+}
diff --git a/source/ShiftUI/ListView/ListViewGroupCollection.cs b/source/ShiftUI/ListView/ListViewGroupCollection.cs
new file mode 100644
index 0000000..b2eceb8
--- /dev/null
+++ b/source/ShiftUI/ListView/ListViewGroupCollection.cs
@@ -0,0 +1,332 @@
+//
+// ListViewGroupCollection.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Daniel Nauck
+//
+// Author:
+// Daniel Nauck (dna(at)mono-project(dot)de)
+// Carlos Alberto Cortez <[email protected]>
+
+using System;
+using System.Text;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+
+namespace ShiftUI
+{
+ [ListBindable(false)]
+ public class ListViewGroupCollection : IList, ICollection, IEnumerable
+ {
+ private List<ListViewGroup> list = null;
+ private ListView list_view_owner = null;
+ private ListViewGroup default_group;
+
+ ListViewGroupCollection()
+ {
+ list = new List<ListViewGroup> ();
+
+ default_group = new ListViewGroup ("Default Group");
+ default_group.IsDefault = true;
+ }
+
+ internal ListViewGroupCollection(ListView listViewOwner) : this()
+ {
+ list_view_owner = listViewOwner;
+ default_group.ListViewOwner = listViewOwner;
+ }
+
+ internal ListView ListViewOwner {
+ get { return list_view_owner; }
+ set { list_view_owner = value; }
+ }
+
+ #region IEnumerable Members
+
+ public IEnumerator GetEnumerator()
+ {
+ return list.GetEnumerator();
+ }
+
+ #endregion
+
+ #region ICollection Members
+
+ public void CopyTo(Array array, int index)
+ {
+ ((ICollection) list).CopyTo(array, index);
+ }
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return true; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return this; }
+ }
+
+ #endregion
+
+ #region IList Members
+
+ int IList.Add(object value)
+ {
+ if (!(value is ListViewGroup))
+ throw new ArgumentException("value");
+
+ return Add((ListViewGroup)value);
+ }
+
+ public int Add(ListViewGroup group)
+ {
+ if (Contains(group))
+ return -1;
+
+ AddGroup (group);
+
+ if (this.list_view_owner != null)
+ list_view_owner.Redraw(true);
+
+ return list.Count - 1;
+ }
+
+ public ListViewGroup Add(string key, string headerText)
+ {
+ ListViewGroup newGroup = new ListViewGroup(key, headerText);
+ Add(newGroup);
+
+ return newGroup;
+ }
+
+ public void Clear()
+ {
+ foreach (ListViewGroup group in list)
+ group.ListViewOwner = null;
+
+ list.Clear ();
+
+ if(list_view_owner != null)
+ list_view_owner.Redraw(true);
+ }
+
+ bool IList.Contains(object value)
+ {
+ if (value is ListViewGroup)
+ return Contains((ListViewGroup)value);
+ else
+ return false;
+ }
+
+ public bool Contains(ListViewGroup value)
+ {
+ return list.Contains(value);
+ }
+
+ int IList.IndexOf(object value)
+ {
+ if (value is ListViewGroup)
+ return IndexOf((ListViewGroup)value);
+ else
+ return -1;
+ }
+
+ public int IndexOf(ListViewGroup value)
+ {
+ return list.IndexOf(value);
+ }
+
+ void IList.Insert(int index, object value)
+ {
+ if (value is ListViewGroup)
+ Insert(index, (ListViewGroup)value);
+ }
+
+ public void Insert(int index, ListViewGroup group)
+ {
+ if (Contains(group))
+ return;
+
+ CheckListViewItemsInGroup(group);
+ group.ListViewOwner = list_view_owner;
+ list.Insert(index, group);
+
+ if(list_view_owner != null)
+ list_view_owner.Redraw(true);
+ }
+
+ bool IList.IsFixedSize {
+ get { return false; }
+ }
+
+ bool IList.IsReadOnly {
+ get { return false; }
+ }
+
+ void IList.Remove(object value)
+ {
+ Remove((ListViewGroup)value);
+ }
+
+ public void Remove (ListViewGroup group)
+ {
+ int idx = list.IndexOf (group);
+ if (idx != -1)
+ RemoveAt (idx);
+ }
+
+ public void RemoveAt (int index)
+ {
+ if (list.Count <= index || index < 0)
+ return;
+
+ ListViewGroup group = list [index];
+ group.ListViewOwner = null;
+
+ list.RemoveAt (index);
+ if (list_view_owner != null)
+ list_view_owner.Redraw (true);
+ }
+
+ object IList.this[int index] {
+ get { return this[index]; }
+ set {
+ if (value is ListViewGroup)
+ this[index] = (ListViewGroup)value;
+ }
+ }
+
+ public ListViewGroup this[int index] {
+ get {
+ if (list.Count <= index || index < 0)
+ throw new ArgumentOutOfRangeException("index");
+
+ return list [index];
+ }
+ set {
+ if (list.Count <= index || index < 0)
+ throw new ArgumentOutOfRangeException("index");
+
+ if (Contains (value))
+ return;
+
+ if (value != null)
+ CheckListViewItemsInGroup (value);
+
+ list [index] = value;
+
+ if (list_view_owner != null)
+ list_view_owner.Redraw(true);
+ }
+ }
+
+ public ListViewGroup this [string key] {
+ get {
+ int idx = IndexOfKey (key);
+ if (idx != -1)
+ return this [idx];
+
+ return null;
+ }
+ set {
+ int idx = IndexOfKey (key);
+ if (idx == -1)
+ return;
+
+ this [idx] = value;
+ }
+ }
+
+ int IndexOfKey (string key)
+ {
+ for (int i = 0; i < list.Count; i++)
+ if (list [i].Name == key)
+ return i;
+
+ return -1;
+ }
+
+ #endregion
+
+ public void AddRange(ListViewGroup[] groups)
+ {
+ foreach (ListViewGroup group in groups)
+ AddGroup (group);
+
+ if (list_view_owner != null)
+ list_view_owner.Redraw (true);
+ }
+
+ public void AddRange(ListViewGroupCollection groups)
+ {
+ foreach (ListViewGroup group in groups)
+ AddGroup (group);
+
+ if (list_view_owner != null)
+ list_view_owner.Redraw (true);
+ }
+
+ internal ListViewGroup GetInternalGroup (int index)
+ {
+ if (index == 0)
+ return default_group;
+
+ return list [index - 1];
+ }
+
+ internal int InternalCount {
+ get {
+ return list.Count + 1;
+ }
+ }
+
+ internal ListViewGroup DefaultGroup {
+ get {
+ return default_group;
+ }
+ }
+
+ void AddGroup (ListViewGroup group)
+ {
+ if (Contains (group))
+ return;
+
+ CheckListViewItemsInGroup (group);
+ group.ListViewOwner = list_view_owner;
+ list.Add (group);
+ }
+
+ private void CheckListViewItemsInGroup(ListViewGroup value)
+ {
+ //check for correct ListView
+ foreach (ListViewItem item in value.Items)
+ {
+ if (item.ListView != null && item.ListView != this.list_view_owner)
+ throw new ArgumentException("ListViewItem belongs to a ListView control other than the one that owns this ListViewGroupCollection.",
+ "ListViewGroup");
+ }
+ }
+ }
+}
diff --git a/source/ShiftUI/ListView/ListViewHitTestInfo.cs b/source/ShiftUI/ListView/ListViewHitTestInfo.cs
new file mode 100644
index 0000000..5ec676b
--- /dev/null
+++ b/source/ShiftUI/ListView/ListViewHitTestInfo.cs
@@ -0,0 +1,62 @@
+//
+// ListViewHitTestInfo.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Daniel Nauck
+//
+// Author:
+// Daniel Nauck (dna(at)mono-project(dot)de)
+
+using System;
+using ShiftUI;
+
+namespace ShiftUI
+{
+ public class ListViewHitTestInfo
+ {
+ ListViewItem item = null;
+ ListViewItem.ListViewSubItem subItem = null;
+ ListViewHitTestLocations location = ListViewHitTestLocations.None;
+
+ public ListViewHitTestInfo(ListViewItem hitItem, ListViewItem.ListViewSubItem hitSubItem,
+ ListViewHitTestLocations hitLocation)
+ {
+ item = hitItem;
+ subItem = hitSubItem;
+ location = hitLocation;
+ }
+
+ public ListViewItem Item
+ {
+ get { return item; }
+ }
+
+ public ListViewHitTestLocations Location
+ {
+ get { return location; }
+ }
+
+ public ListViewItem.ListViewSubItem SubItem
+ {
+ get { return subItem; }
+ }
+ }
+}
diff --git a/source/ShiftUI/ListView/ListViewHitTestLocations.cs b/source/ShiftUI/ListView/ListViewHitTestLocations.cs
new file mode 100644
index 0000000..684fbec
--- /dev/null
+++ b/source/ShiftUI/ListView/ListViewHitTestLocations.cs
@@ -0,0 +1,44 @@
+//
+// ListViewHitTestLocations.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Novell, Inc.
+//
+// Authors:
+// Jonathan Pobst ([email protected])
+//
+using System;
+
+namespace ShiftUI
+{
+ [Flags]
+ public enum ListViewHitTestLocations
+ {
+ None = 1,
+ Image = 2,
+ Label = 4,
+ BelowClientArea = 16,
+ RightOfClientArea = 32,
+ LeftOfClientArea = 64,
+ AboveClientArea = 256,
+ StateImage = 512
+ }
+}
diff --git a/source/ShiftUI/ListView/ListViewInsertionMark.cs b/source/ShiftUI/ListView/ListViewInsertionMark.cs
new file mode 100644
index 0000000..9661d42
--- /dev/null
+++ b/source/ShiftUI/ListView/ListViewInsertionMark.cs
@@ -0,0 +1,152 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Carlos Alberto Cortez <[email protected]>
+//
+
+
+using System;
+using System.Drawing;
+
+namespace ShiftUI
+{
+ public sealed class ListViewInsertionMark
+ {
+ ListView listview_owner;
+ bool appears_after_item;
+ Rectangle bounds;
+ Color? color;
+ int index = 0;
+
+ internal ListViewInsertionMark (ListView listview)
+ {
+ listview_owner = listview;
+ }
+
+ public bool AppearsAfterItem {
+ get {
+ 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);
+ }
+ }
+
+ public Rectangle Bounds {
+ get {
+ return bounds;
+ }
+ }
+
+ public Color Color {
+ get {
+ return color == null ? listview_owner.ForeColor : color.Value;
+ }
+ set {
+ color = value;
+ }
+ }
+
+ public int Index {
+ get {
+ 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)
+ {
+ double distance = Double.MaxValue;
+ int nearest = -1;
+
+ for (int i = 0; i < listview_owner.Items.Count; i++) {
+ Point pos = listview_owner.GetItemLocation (i);
+ double d = Math.Pow (pos.X - pt.X, 2) + Math.Pow (pos.Y - pt.Y, 2);
+ if (d < distance) {
+ distance = d;
+ nearest = i;
+ }
+ }
+
+ if (listview_owner.item_control.dragged_item_index == nearest)
+ return -1;
+
+ return nearest;
+ }
+
+ 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);
+ }
+ }
+ }
+}
diff --git a/source/ShiftUI/ListView/ListViewItemConverter.cs b/source/ShiftUI/ListView/ListViewItemConverter.cs
new file mode 100644
index 0000000..bd09096
--- /dev/null
+++ b/source/ShiftUI/ListView/ListViewItemConverter.cs
@@ -0,0 +1,97 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2004 Novell, Inc.
+//
+// Authors:
+// Ravindra ([email protected])
+
+
+// COMPLETE
+
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.ComponentModel.Design.Serialization;
+using System.Drawing;
+using System.Globalization;
+using System.Reflection;
+
+namespace ShiftUI
+{
+ public class ListViewItemConverter : ExpandableObjectConverter
+ {
+ #region Public Constructors
+ public ListViewItemConverter () { }
+ #endregion // Public Constructors
+
+ #region Public Instance Methods
+ public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) {
+ if (destinationType == typeof (string)) {
+ return true;
+ }
+
+ return base.CanConvertTo (context, destinationType);
+ }
+
+ public override object ConvertTo (ITypeDescriptorContext context,
+ CultureInfo culture, object value,
+ Type destinationType)
+ {
+ if (destinationType == typeof (string)) {
+ return value.ToString ();
+ } else {
+ return base.ConvertTo (context, culture, value, destinationType);
+ }
+ }
+ #endregion // Public Instance Methods
+ }
+
+ internal class ListViewSubItemConverter : ExpandableObjectConverter {
+ #region Public Instance Methods
+ public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) {
+ if (destinationType == typeof(InstanceDescriptor)) {
+ return true;
+ } else {
+ return base.CanConvertTo(context, destinationType);
+ }
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) {
+ if (destinationType == typeof(InstanceDescriptor) && value is ListViewItem.ListViewSubItem) {
+ ConstructorInfo constructor_info;
+ Type[] type;
+ ListViewItem.ListViewSubItem sub_item;
+
+ sub_item = (ListViewItem.ListViewSubItem)value;
+ type = new Type[] { typeof(ListViewItem), typeof(string), typeof(Color), typeof(Color), typeof(Font)};
+
+ constructor_info = typeof(ListViewItem.ListViewSubItem).GetConstructor(type);
+ if (constructor_info != null) {
+ object[] arguments = new object[] {sub_item.Text, sub_item.ForeColor, sub_item.BackColor, sub_item.Font};
+ return new InstanceDescriptor(constructor_info, (ICollection) arguments, true);
+ }
+
+ }
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/source/ShiftUI/ListView/ListViewItemMouseHoverEventArgs.cs b/source/ShiftUI/ListView/ListViewItemMouseHoverEventArgs.cs
new file mode 100644
index 0000000..7bb2abe
--- /dev/null
+++ b/source/ShiftUI/ListView/ListViewItemMouseHoverEventArgs.cs
@@ -0,0 +1,53 @@
+//
+// ListViewItemMouseHoverEventArgs.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Novell, Inc.
+//
+// Authors:
+// Jonathan Pobst ([email protected])
+//
+
+
+using System.Runtime.InteropServices;
+using System;
+
+namespace ShiftUI
+{
+ [ComVisible (true)]
+ public class ListViewItemMouseHoverEventArgs : EventArgs
+ {
+ private ListViewItem item;
+
+ #region Public Constructors
+ public ListViewItemMouseHoverEventArgs (ListViewItem item) : base ()
+ {
+ this.item = item;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public ListViewItem Item {
+ get { return this.item; }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/source/ShiftUI/ListView/ListViewItemMouseHoverEventHandler.cs b/source/ShiftUI/ListView/ListViewItemMouseHoverEventHandler.cs
new file mode 100644
index 0000000..b801f62
--- /dev/null
+++ b/source/ShiftUI/ListView/ListViewItemMouseHoverEventHandler.cs
@@ -0,0 +1,32 @@
+//
+// ListViewItemMouseHoverEventHandler.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Novell, Inc.
+//
+// Authors:
+// Jonathan Pobst ([email protected])
+//
+
+namespace ShiftUI
+{
+ public delegate void ListViewItemMouseHoverEventHandler (object sender, ListViewItemMouseHoverEventArgs e);
+}
diff --git a/source/ShiftUI/ListView/ListViewItemSelectionChangedEventArgs.cs b/source/ShiftUI/ListView/ListViewItemSelectionChangedEventArgs.cs
new file mode 100644
index 0000000..27d92b9
--- /dev/null
+++ b/source/ShiftUI/ListView/ListViewItemSelectionChangedEventArgs.cs
@@ -0,0 +1,61 @@
+//
+// ListViewItemSelectionChangedEventArgs.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Novell, Inc.
+//
+// Authors:
+// Jonathan Pobst ([email protected])
+//
+using System;
+
+namespace ShiftUI
+{
+ public class ListViewItemSelectionChangedEventArgs : EventArgs
+ {
+ private bool is_selected;
+ private ListViewItem item;
+ private int item_index;
+
+ #region Public Constructors
+ public ListViewItemSelectionChangedEventArgs (ListViewItem item, int itemIndex, bool isSelected) : base ()
+ {
+ this.item = item;
+ this.item_index = itemIndex;
+ this.is_selected = isSelected;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public ListViewItem Item {
+ get { return this.item; }
+ }
+
+ public bool IsSelected {
+ get { return this.is_selected; }
+ }
+
+ public int ItemIndex {
+ get { return this.item_index; }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/source/ShiftUI/ListView/ListViewItemSelectionChangedEventHandler.cs b/source/ShiftUI/ListView/ListViewItemSelectionChangedEventHandler.cs
new file mode 100644
index 0000000..670fa7d
--- /dev/null
+++ b/source/ShiftUI/ListView/ListViewItemSelectionChangedEventHandler.cs
@@ -0,0 +1,32 @@
+//
+// ListViewItemSelectionChangedEventHandler.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Novell, Inc.
+//
+// Authors:
+// Jonathan Pobst ([email protected])
+//
+
+namespace ShiftUI
+{
+ public delegate void ListViewItemSelectionChangedEventHandler (object sender, ListViewItemSelectionChangedEventArgs e);
+}
diff --git a/source/ShiftUI/ListView/ListViewItemStates.cs b/source/ShiftUI/ListView/ListViewItemStates.cs
new file mode 100644
index 0000000..dc995fd
--- /dev/null
+++ b/source/ShiftUI/ListView/ListViewItemStates.cs
@@ -0,0 +1,45 @@
+//
+// ListViewItemStates.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Novell, Inc.
+//
+// Authors:
+// Jonathan Pobst ([email protected])
+//
+using System;
+
+namespace ShiftUI
+{
+ [Flags]
+ public enum ListViewItemStates
+ {
+ Selected = 1,
+ Grayed = 2,
+ Checked = 8,
+ Focused = 16,
+ Default = 32,
+ Hot = 64,
+ Marked = 128,
+ Indeterminate = 256,
+ ShowKeyboardCues = 512
+ }
+}
diff --git a/source/ShiftUI/ListView/ListViewVirtualItemsSelectionRangeChangedEventArgs.cs b/source/ShiftUI/ListView/ListViewVirtualItemsSelectionRangeChangedEventArgs.cs
new file mode 100644
index 0000000..13c675b
--- /dev/null
+++ b/source/ShiftUI/ListView/ListViewVirtualItemsSelectionRangeChangedEventArgs.cs
@@ -0,0 +1,61 @@
+//
+// ListViewVirtualItemsSelectionRangeChangedEventArgs.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Novell, Inc.
+//
+// Authors:
+// Jonathan Pobst ([email protected])
+//
+using System;
+
+namespace ShiftUI
+{
+ public class ListViewVirtualItemsSelectionRangeChangedEventArgs : EventArgs
+ {
+ private bool is_selected;
+ private int end_index;
+ private int start_index;
+
+ #region Public Constructors
+ public ListViewVirtualItemsSelectionRangeChangedEventArgs (int startIndex, int endIndex, bool isSelected) : base ()
+ {
+ this.start_index = startIndex;
+ this.end_index = endIndex;
+ this.is_selected = isSelected;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public int StartIndex {
+ get { return this.start_index; }
+ }
+
+ public bool IsSelected {
+ get { return this.is_selected; }
+ }
+
+ public int EndIndex {
+ get { return this.end_index; }
+ }
+ #endregion // Public Instance Properties
+ }
+} \ No newline at end of file
diff --git a/source/ShiftUI/ListView/ListViewVirtualItemsSelectionRangeChangedEventHandler.cs b/source/ShiftUI/ListView/ListViewVirtualItemsSelectionRangeChangedEventHandler.cs
new file mode 100644
index 0000000..8b45862
--- /dev/null
+++ b/source/ShiftUI/ListView/ListViewVirtualItemsSelectionRangeChangedEventHandler.cs
@@ -0,0 +1,32 @@
+//
+// ListViewVirtualItemsSelectionRangeChangedEventHandler.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Novell, Inc.
+//
+// Authors:
+// Jonathan Pobst ([email protected])
+//
+
+namespace ShiftUI
+{
+ public delegate void ListViewVirtualItemsSelectionRangeChangedEventHandler (object sender, ListViewVirtualItemsSelectionRangeChangedEventArgs e);
+}