[][src]Struct native_windows_gui::ListView

pub struct ListView {
    pub handle: ControlHandle,
    // some fields omitted
}

A list-view control is a window that displays a collection of items. List-view controls provide several ways to arrange and display items and are much more flexible than simple ListBox.

Requires the list-view feature.

Builder parameters:

  • parent: Required. The list view parent container.
  • size: The list view size.
  • position: The list view position.
  • background_color: The list view background color in RGB format
  • text_color: The list view text color in RGB format
  • flags: A combination of the ListViewFlags values.
  • ex_flags: A combination of the ListViewExFlags values.
  • style: One of the value of ListViewStyle
  • item_count: Number of item to preallocate
  • list_style: The default style of the listview
  • focus: The control receive focus after being created

Control events:

  • MousePress(_): Generic mouse press events on the tree view
  • OnMouseMove: Generic mouse mouse event
  • OnMouseWheel: Generic mouse wheel event
  • OnKeyPress: Generic key press event
  • OnKeyRelease: Generic key release event
  • OnListViewClear: When all the items in a list view are destroyed
  • OnListViewItemRemoved: When an item is about to be removed from the list view
  • OnListViewItemInsert: When a new item is inserted in the list view
  • OnListViewItemActivated: When an item in the list view is activated by the user
  • OnListViewClick: When the user has clicked the left mouse button within the control
  • OnListViewRightClick: When the user has clicked the right mouse button within the control
  • OnListViewDoubleClick: When the user has clicked the left mouse button within the control twice rapidly
  • OnListViewColumnClick: When the user has clicked the left mouse button on ListView header column
  • OnListViewItemChanged: When an item is selected/unselected in the listview
  • OnListViewFocus: When the list view has received focus
  • OnListViewFocusLost: When the list view has lost focus

Fields

handle: ControlHandle

Implementations

impl ListView[src]

pub fn builder() -> ListViewBuilder[src]

pub fn set_image_list(
    &self,
    list: Option<&ImageList>,
    list_type: ListViewImageListType
)
[src]

Sets the image list of the listview A listview can accept different kinds of image list. See ListViewImageListType

pub fn image_list(&self, list_type: ListViewImageListType) -> Option<ImageList>[src]

Returns the current image list for the selected type. The returned image list will not be owned. Can return None if there is no assocaited image list

pub fn set_text_color(&self, r: u8, g: u8, b: u8)[src]

Sets the text color of the list view

pub fn text_color(&self) -> [u8; 3][src]

Returns the current text color

pub fn set_background_color(&self, r: u8, g: u8, b: u8)[src]

Sets the background color of the list view

pub fn background_color(&self) -> [u8; 3][src]

Returns the background color of the list view

pub fn selected_column(&self) -> usize[src]

Returns the index of the selected column. Only available if Comclt32.dll version is >= 6.0.

pub fn set_selected_column(&self, index: usize)[src]

Sets the selected column. Only available if Comclt32.dll version is >= 6.0.

pub fn selected_count(&self) -> usize[src]

Returns the number of selected items

pub fn insert_column<I: Into<InsertListViewColumn>>(&self, insert: I)[src]

Inserts a column in the report. Column are only used with the Detailed list view style.

pub fn has_column(&self, index: usize) -> bool[src]

Checks if there is a column at the selected index

pub fn column(
    &self,
    index: usize,
    text_buffer_size: i32
) -> Option<ListViewColumn>
[src]

Returns the information of a column. Because there's no way to fetch the actual text length, it's up to you to set the maximum buffer size

pub fn update_column<I: Into<InsertListViewColumn>>(
    &self,
    index: usize,
    column: I
)
[src]

Sets the information of a column. Does nothing if there is no column at the selected index

pub fn remove_column(&self, column_index: usize)[src]

Deletes a column in a list view. Removing the column at index 0 is only available if ComCtl32.dll is version 6 or later.

pub fn headers_enabled(&self) -> bool[src]

Returns true if list view headers are visible

pub fn set_headers_enabled(&self, enable: bool)[src]

Enable or disable list view headers

pub fn column_sort_arrow(
    &self,
    column_index: usize
) -> Option<ListViewColumnSortArrow>
[src]

Returns column sort indicator

pub fn set_column_sort_arrow(
    &self,
    column_index: usize,
    sort: Option<ListViewColumnSortArrow>
)
[src]

Enable or disable column sort indicator. Draws a up-arrow / down-arrow.

pub fn select_item(&self, row_index: usize, selected: bool)[src]

Select or unselect an item at row_index. Does nothing if the index is out of bounds.

pub fn selected_item(&self) -> Option<usize>[src]

Returns the index of the first selected item. If there's more than one item selected, use selected_items

pub fn selected_items(&self) -> Vec<usize>[src]

Returns the indices of every selected items.

pub fn insert_item<I: Into<InsertListViewItem>>(&self, insert: I)[src]

Inserts a new item into the list view

pub fn item_is_visible(&self, index: usize) -> bool[src]

Checks if the item at the selected row is visible

pub fn has_item(&self, row_index: usize, column_index: usize) -> bool[src]

Returns true if an item exists at the selected index or false otherwise.

pub fn item(
    &self,
    row_index: usize,
    column_index: usize,
    text_buffer_size: usize
) -> Option<ListViewItem>
[src]

Returns data of an item in the list view. Returns None if there is no data at the selected index Because there is no way to fetch the actual text size, text_buffer_size must be set manually

pub fn update_item<I: Into<InsertListViewItem>>(
    &self,
    row_index: usize,
    data: I
)
[src]

Updates the item at the selected position Does nothing if there is no item at the selected position

pub fn remove_item(&self, row_index: usize) -> bool[src]

Remove all items on the seleted row. Returns true if an item was removed or false otherwise. To "remove" an item without deleting the row, use update_item and set the text to "".

pub fn insert_items<I: Clone + Into<InsertListViewItem>>(&self, insert: &[I])[src]

Inserts multiple items into the control. Basically a loop over insert_item.

pub fn insert_items_row<I: Clone + Into<InsertListViewItem>>(
    &self,
    row_index: Option<i32>,
    insert: &[I]
)
[src]

Insert multiple item at the selected row or at the end of the list if None was used. This method overrides the index and the column_index of the items. Useful when inserting strings into a single row. Ex: list.insert_items_row(None, &["Hello", "World"]);

pub fn list_style(&self) -> ListViewStyle[src]

Returns the current style of the list view

pub fn set_list_style(&self, style: ListViewStyle)[src]

Sets the list view style of the control

pub fn len(&self) -> usize[src]

Returns the number of items in the list view

pub fn column_len(&self) -> usize[src]

Returns the number of columns in the list view

pub fn set_item_count(&self, n: u32)[src]

Preallocate space for n number of item in the whole control. For example calling this method with n=1000 while the list has 500 items will add space for 500 new items.

pub fn set_redraw(&self, enabled: bool)[src]

Enable or disable the redrawing of the control when a new item is added. When inserting a large number of items, it's better to disable redraw and reenable it after the items are inserted.

pub fn set_icon_spacing(&self, dx: u16, dy: u16)[src]

Sets the spacing between icons in list-view controls that have the ICON style. dx specifies the distance, in pixels, to set between icons on the x-axis dy specifies the distance, in pixels, to set between icons on the y-axis

pub fn invalidate(&self)[src]

Invalidate the whole drawing region.

pub fn clear(&self)[src]

Removes all item from the listview

pub fn focus(&self) -> bool[src]

Returns true if the control currently has the keyboard focus

pub fn set_focus(&self)[src]

Sets the keyboard focus on the button

pub fn enabled(&self) -> bool[src]

Returns true if the control user can interact with the control, return false otherwise

pub fn set_enabled(&self, v: bool)[src]

Enable or disable the control

pub fn visible(&self) -> bool[src]

Returns true if the control is visible to the user. Will return true even if the control is outside of the parent client view (ex: at the position (10000, 10000))

pub fn set_visible(&self, v: bool)[src]

Show or hide the control to the user

pub fn size(&self) -> (u32, u32)[src]

Returns the size of the button in the parent window

pub fn set_size(&self, x: u32, y: u32)[src]

Sets the size of the button in the parent window

pub fn position(&self) -> (i32, i32)[src]

Returns the position of the button in the parent window

pub fn set_position(&self, x: i32, y: i32)[src]

Sets the position of the button in the parent window

pub fn class_name(&self) -> &'static str[src]

Winapi class name used during control creation

pub fn flags(&self) -> u32[src]

Winapi base flags used during window creation

pub fn forced_flags(&self) -> u32[src]

Winapi flags required by the control

Trait Implementations

impl Default for ListView[src]

impl Drop for ListView[src]

impl<'_> From<&'_ ListView> for ControlHandle[src]

impl PartialEq<ControlHandle> for ListView[src]

impl PartialEq<ListView> for ControlHandle[src]

Auto Trait Implementations

impl !RefUnwindSafe for ListView

impl !Send for ListView

impl !Sync for ListView

impl Unpin for ListView

impl UnwindSafe for ListView

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.