# listview class

A listview widget class

Inherits
widget
Description

It can display and control a hierarchy of multi-column items, and provides the ability to add new items at any time. The items are added by creating children listviewitem objects: simply allocating them with $new will add the items to the listview and simply deleting them will remove them. Allocating a listviewtitem item2 as a child of item1 will insert it to the same listview creating a subtree of items spannig from item1. The subtree can be opened or closed by a simple click either on the parent item or on the little plus sign on the side of it (when $setrootisdecorated is set to $true. The listview can be in Single, Multi, Extended or NoSelection selection mode. In single selection mode there can be only one selected item at a time and the selected item is also the current item (this mode is the default). In Multi and Extended selection mode there can be multiple selected items and the current item is one of them. The difference between Multi and Extended is in the way that items can be selected by the mouse actions: experiment with the two modes :). The NoSelection mode has obviously no selection at all.

Functions

`$addColumn(<text_label:string>,[<width:integer>])`
Adds a width pixels wide column with the column header label to the list view.
`$setSorting(<column:integer>,<sort_order:string>)`
Sets the list view to be sorted by column in ascending order if sort_order is "ascending" or descending order if it is "descending".
`$setSortingEnabled(<bEnabled:boolean>)`
If <bEnabled> is true, user sorting is enabled for the tree. The default value is false. In order to avoid performance issues, it is recommended that sorting is enabled after inserting the items into the tree.
`$hideListViewHeader()`
Hide the listview column header.
`$showListViewHeader()`
Show the listview column header.
`<boolean> $isListViewHeaderVisible()`
Returns '1' if the listview header is currently visible. Otherwise this function returns '0'.
`$setAllColumnsShowFocus(<bAllColumnsShowFocus:boolean>)`
When the argument is $true, causes the listview to display the focus and selection by highlighting all the columns of the item. When the argument is $false then only the first column is selected/highlighted.
`$setSelectionMode(<mode:string>)`
Sets the selection mode for this listview. <mode> can be one of "Single","NoSelection","Multi" or "Extended".
`<listviewitem> $selectedItems()`
Returns the currently selected listviewitem or $null if no items are selected. This function works only if the list view is in single selection mode.
`<listviewitem:hobject> $itemAt(<x_global_pos:integer>,<y_global_pos:integer>)`
Returns the listviewitem object at the x,y globals coordinates or $null if no item at.
`<listviewitem> $currentItem()`
Returns the current listviewitem or $null if no item is current at the moment.
`<listviewitem> $firstChild()`
Returns the first child listviewitem of this listview or $null if there are no items at all.
`<listviewitem> $topLevelItem(<index:int>)`
Returns the <index> child listviewitem of this listview or $null if it does not exists.
`<int> $topLevelItemCount()`
Returns the number of top level items of this listview.
`setAcceptDrops(<benabled:boolean>)`
If <bEnabled> is true, user can drop files for this listview. The default value is true.
`$clickEvent(<item:object>)`
This function is called when the user clicks in the list view. In its argument the listviewitem object clicked or 0 if the user didn't click on an item. The default implementation emits the $clicked() signal.
`$selectionChangedEvent(<item:object>)`
This event handle whenever the set of selected items has changed. The argument is the newly selected item if the listview is in single selection mode. When the listview is in Multi or Extended selection mode then item is always $null. The default implementation emits the $selectionChanged() signal.
`$currentChangedEvent(<item:object>)`
This event are called whenever the current item has changed. In its argument is the newly selected item or 0 if the change made no item current. The default implementation emits the $currentChanged() signal.
`$itemActivatedEvent(<item:object>)`
This s signal is emitted when the user activates an item by single- or double-clicking or pressing 'Enter'. In its argument the currrent item. The default implementation emits the $itemActivated() signal.
`$spacePressedEvent(<item:object>)`
This function is called by the framework when the space key is pressed. In its arument the currrent item. The default implementation emits the $spacePressed() signal.
`$onItemEvent(<item:object>)`
This event is called by framwork when the user moves the mouse cursor onto item. The default implementation emits the $onItem() signal.
`$itemExpandedEvent(<item:object>)`
This event is called when an item has been expanded, i.e. when the children of item are shown. The default implementation emits the $expanded() signal.
`$itemCollapsedEvent(<item:object>)`
This event is called when an item has been collapsed, i.e. when the children of item are hidden. The default implementation emits the $collapsed() signal.
`$itemChangedEvent(<item:object>,<col:integer>,<text:string>)`
This event is called when the item has been renamed in text, e.g. by in in-place renaming, in column col. The default implementation emits the $itemChanged() signal.

Signals

`$clicked()`
This signal is emitted by the default implementation of $clickEvent().
`$selectionChanged()`
This signal is emitted by the default implementation of $selectionChangedEvent().
`$currentChanged()`
This signal is emitted by the default implementation of $currentChangedEvent().
`$itemActivated()`
This signal is emitted by the default implementation of $itemActivatedEvent().
`$spacePressed()`
This signal is emitted by the default implementation of $spacePressedEvent().
`$onItem()`
This signal is emitted by the default implementation of $onItemEvent().
`$itemExpanded()`
This signal is emitted by the default implementation of $itemExpandedEvent().
`$itemCollapsed()`
This signal is emitted by the default implementation of $itemCollapsedEvent().
`$itemChanged()`
This signal is emitted by the default implementation of $itemChangedEvent().
`$rightButtonClicked()`
This signal is emitted by the default implementation of $rightButtonClickedEvent().

Index, Object Classes

KVIrc 4.2.0.6190 Documentation
Generated by root at Mon Jul 22 18:18:08 2013