C# Class Smrf.AppLib.ListViewPlus

Represents a ListView with additional features.
This ListView-derived object supports sorting by a column that contains data of an arbitrary type. To enable sorting, populate the ListView.Columns collection, then call the EnableSorting method. You can then call the Sort method to sort by a specified column. Sorting also occurs automatically when the user clicks a column header.

By default, right-clicking an item in the ListView shows a context menu with a set of standard menu items supported by this base class. If the derived class needs a custom context menu, it should set UseStandardContextMenu to false and override OnMouseUp(). The derived OnMouseUp() should create and show a custom context menu, then call the base-class method. If the custom context menu should contain the standard menu items in addition to the custom items, should be called to add those items to the menu.

Leave the ListView.Sorting property set to its default value of SortOrder.None.

Inheritance: System.Windows.Forms.ListView, IComparer
Show file Open project: 2014-sed-team3/term-project

Public Properties

Property Type Description
NoColumn System.Int32

Protected Properties

Property Type Description
m_aeColumnTypes ColumnType[]
m_bSortAscending System.Boolean
m_bUseStandardContextMenu System.Boolean
m_iColumnToCopy System.Int32
m_iSortColumn System.Int32
m_oRightClickedItem System.Windows.Forms.ListViewItem

Private Properties

Property Type Description
AssertValid void

Public Methods

Method Description
AddStandardContextMenuItems ( ContextMenu oContextMenu, System.Boolean bAddSeparator ) : void
BeginUpdate ( ) : void
Compare ( Object oObject1, Object oObject2 ) : Int32
DeselectAllItems ( ) : void
EnableSorting ( ) : void
EndUpdate ( ) : void
GetItemByTag ( Int32 iTag ) : System.Windows.Forms.ListViewItem
GetItemByTag ( Object oTag ) : System.Windows.Forms.ListViewItem
GetRightClickedItem ( MouseEventArgs oMouseEventArgs ) : System.Windows.Forms.ListViewItem
ListViewPlus ( ) : System

Initializes a new instance of the ListViewPlus class.

Sort ( Int32 iColumn, System.Boolean bSortAscending ) : void

Protected Methods

Method Description
ColumnToColumnType ( Int32 iColumn ) : ColumnType
CopyAll_Click ( object sender, System e ) : void
CopyColumn_Click ( object sender, System e ) : void
CopyRow_Click ( object sender, System e ) : void
ItemToClipboardString ( System.Windows.Forms.ListViewItem oListViewItem ) : String
ItemToClipboardString ( System.Windows.Forms.ListViewItem oListViewItem, StringBuilder oStringBuilder ) : void
OnColumnClick ( object sender, System.Windows.Forms.ColumnClickEventArgs e ) : void
OnMouseUp ( MouseEventArgs e ) : void
TypeToColumnType ( Type oType ) : ColumnType

Private Methods

Method Description
AssertValid ( ) : void

Method Details

AddStandardContextMenuItems() public method

public AddStandardContextMenuItems ( ContextMenu oContextMenu, System.Boolean bAddSeparator ) : void
oContextMenu System.Windows.Forms.ContextMenu
bAddSeparator System.Boolean
return void

BeginUpdate() public method

public BeginUpdate ( ) : void
return void

ColumnToColumnType() protected method

protected ColumnToColumnType ( Int32 iColumn ) : ColumnType
iColumn System.Int32
return ColumnType

Compare() public method

public Compare ( Object oObject1, Object oObject2 ) : Int32
oObject1 Object
oObject2 Object
return System.Int32

CopyAll_Click() protected method

protected CopyAll_Click ( object sender, System e ) : void
sender object
e System
return void

CopyColumn_Click() protected method

protected CopyColumn_Click ( object sender, System e ) : void
sender object
e System
return void

CopyRow_Click() protected method

protected CopyRow_Click ( object sender, System e ) : void
sender object
e System
return void

DeselectAllItems() public method

public DeselectAllItems ( ) : void
return void

EnableSorting() public method

public EnableSorting ( ) : void
return void

EndUpdate() public method

public EndUpdate ( ) : void
return void

GetItemByTag() public method

public GetItemByTag ( Int32 iTag ) : System.Windows.Forms.ListViewItem
iTag System.Int32
return System.Windows.Forms.ListViewItem

GetItemByTag() public method

public GetItemByTag ( Object oTag ) : System.Windows.Forms.ListViewItem
oTag Object
return System.Windows.Forms.ListViewItem

GetRightClickedItem() public method

public GetRightClickedItem ( MouseEventArgs oMouseEventArgs ) : System.Windows.Forms.ListViewItem
oMouseEventArgs System.Windows.Forms.MouseEventArgs
return System.Windows.Forms.ListViewItem

ItemToClipboardString() protected method

protected ItemToClipboardString ( System.Windows.Forms.ListViewItem oListViewItem ) : String
oListViewItem System.Windows.Forms.ListViewItem
return String

ItemToClipboardString() protected method

protected ItemToClipboardString ( System.Windows.Forms.ListViewItem oListViewItem, StringBuilder oStringBuilder ) : void
oListViewItem System.Windows.Forms.ListViewItem
oStringBuilder StringBuilder
return void

ListViewPlus() public method

Initializes a new instance of the ListViewPlus class.
public ListViewPlus ( ) : System
return System

OnColumnClick() protected method

protected OnColumnClick ( object sender, System.Windows.Forms.ColumnClickEventArgs e ) : void
sender object
e System.Windows.Forms.ColumnClickEventArgs
return void

OnMouseUp() protected method

protected OnMouseUp ( MouseEventArgs e ) : void
e System.Windows.Forms.MouseEventArgs
return void

Sort() public method

public Sort ( Int32 iColumn, System.Boolean bSortAscending ) : void
iColumn System.Int32
bSortAscending System.Boolean
return void

TypeToColumnType() protected method

protected TypeToColumnType ( Type oType ) : ColumnType
oType System.Type
return ColumnType

Property Details

NoColumn public static property

public static Int32,System NoColumn
return System.Int32

m_aeColumnTypes protected property

protected ColumnType[] m_aeColumnTypes
return ColumnType[]

m_bSortAscending protected property

protected Boolean,System m_bSortAscending
return System.Boolean

m_bUseStandardContextMenu protected property

protected Boolean,System m_bUseStandardContextMenu
return System.Boolean

m_iColumnToCopy protected property

protected Int32,System m_iColumnToCopy
return System.Int32

m_iSortColumn protected property

protected Int32,System m_iSortColumn
return System.Int32

m_oRightClickedItem protected property

protected ListViewItem,System.Windows.Forms m_oRightClickedItem
return System.Windows.Forms.ListViewItem