pub fn add(&self,
		texts: &[impl AsRef<str>],
		icon_index: Option<u32>) -> ListViewItem<'a>
	{
		if texts.is_empty() {
			panic!("No texts passed when adding a ListView item.");
		}

		let mut lvi = LVITEM::default();
		lvi.mask = co::LVIF::TEXT;
		lvi.iItem = 0x0fff_ffff; // insert as the last item

		if let Some(icon_index) = icon_index { // will it have an icon?
			lvi.mask |= co::LVIF::IMAGE;
			lvi.iImage = icon_index as _;
		}

		let mut wtext = WString::from_str(texts[0].as_ref());
		lvi.set_pszText(Some(&mut wtext));

		let new_item = self.get( // retrieve the item newly added
			self.owner.hwnd()
				.SendMessage(lvm::InsertItem { lvitem: &lvi })
				.unwrap(),
		);

		texts.iter()
			.enumerate()
			.skip(1) // iterate over subsequent columns
			.for_each(|(idx, text)|
				new_item.set_text(idx as _, text.as_ref()), // set the text ordinarily
			);

		new_item
	}
/// Appends a new item by sending an
/// [`lvm::InsertItem`](crate::msg::lvm::InsertItem) message, and returns
/// the newly added item.
///
/// The texts are relative to each column.
///
/// # Examples
///
/// ```rust,no_run
/// use winsafe::prelude::*;
/// use winsafe::gui;
///
/// let my_list: gui::ListView; // initialized somewhere
/// # let wnd = gui::WindowMain::new(gui::WindowMainOpts::default());
/// # let my_list = gui::ListView::new(&wnd, gui::ListViewOpts::default());
///
/// let new_item = my_list.items().add(
///     &[
///         "First column text",
///         "Second column text",
///     ],
///     None, // no icon; requires a previous set_image_list()
/// );
/// ```
///
/// # Panics
///
/// Panics if `texts` is empty, or if the number of texts is greater than
/// the number of columns.



The texts are relative to each column.
The texts are relative to each column .
pub fn add(&self,
		texts: &[impl AsRef<str>],
		icon_index: Option<u32>) -> ListViewItem<'a>
	{
		if texts.is_empty() {
			panic!("No texts passed when adding a ListView item.");
		}
		let mut lvi = LVITEM::default();
		lvi.mask = co::LVIF::TEXT;
		lvi.iItem = 0x0fff_ffff; // insert as the last item
		if let Some(icon_index) = icon_index { // will it have an icon?
			lvi.mask |= co::LVIF::IMAGE;
			lvi.iImage = icon_index as _;
		}
		let mut wtext = WString::from_str(texts[0].as_ref());
		lvi.set_pszText(Some(&mut wtext));
		let new_item = self.get( // retrieve the item newly added
			self.owner.hwnd()
				.SendMessage(lvm::InsertItem { lvitem: &lvi })
				.unwrap(),
		);
		texts.iter()
			.enumerate()
			.skip(1) // iterate over subsequent columns
			.for_each(|(idx, text)|
				new_item.set_text(idx as _, text.as_ref()), // set the text ordinarily
			);
		new_item
	}
pub fn add ( & self , texts : & [ impl AsRef < str > ] , icon_index : Option < u32 > ) -> ListViewItem < ' a > { if texts . is_empty ( ) { panic ! ( " " ) ; } let mut lvi = LVITEM :: default ( ) ; lvi . mask = co :: LVIF :: TEXT ; lvi . iItem = 0x0fff_ffff ; // insert as the last item
 if let Some ( icon_index ) = icon_index { // will it have an icon?
 lvi . mask |= co :: LVIF :: IMAGE ; lvi . iImage = icon_index as _ ; } let mut wtext = WString :: from_str ( texts [ 0 ] . as_ref ( ) ) ; lvi . set_pszText ( Some ( & mut wtext ) ) ; let new_item = self . get ( // retrieve the item newly added
 self . owner . hwnd ( ) . SendMessage ( lvm :: InsertItem { lvitem : & lvi } ) . unwrap ( ) , ) ; texts . iter ( ) . enumerate ( ) . skip ( 1 ) // iterate over subsequent columns
 . for_each ( | ( idx , text ) | new_item . set_text ( idx as _ , text . as_ref ( ) ) , // set the text ordinarily
 ) ; new_item }
Appends a new item by sending an
[`lvm::InsertItem`](crate::msg::lvm::InsertItem) message, and returns
the newly added item.
Appends a new item by sending an [ ` lvm :: InsertItem ` ] ( crate :: msg :: lvm :: InsertItem ) message and returns the newly added item .
&self
texts
&[impl AsRef<str>]
icon_index
Option<u32>
&self
texts
&[impl AsRef<str>]
icon_index
Option<u32>
examples

```rust,no_run
use winsafe::prelude::*;
use winsafe::gui.

let my_list: gui::ListView; // initialized somewhere
` ` ` rust no_run use winsafe :: prelude :: * ; use winsafe :: gui . let my_list : gui :: ListView ; // initialized somewhere
let wnd = gui::windowmain::new(gui::windowmainopts::default());

None
let my_list = gui::listview::new(&wnd, gui::listviewopts::default());

let new_item = my_list.items().add(
&[
"First column text",
"Second column text",
],
None, // no icon; requires a previous set_image_list()
);
```
let new_item = my_list . items () . add ( & [ " First column text " " Second column text " ] None // no icon ; requires a previous set_image_list () ) ; ` ` `
panics

Panics if `texts` is empty, or if the number of texts is greater than
the number of columns.
Panics if ` texts ` is empty or if the number of texts is greater than the number of columns .