ListView.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // ListView.cs
  6. //
  7. // Copyright 2015 Xamarin Inc. All rights reserved.
  8. using System;
  9. using System.Runtime.InteropServices;
  10. using System.Collections.Generic;
  11. using Urho.Urho2D;
  12. using Urho.Gui;
  13. using Urho.Resources;
  14. using Urho.IO;
  15. using Urho.Navigation;
  16. using Urho.Network;
  17. namespace Urho.Gui
  18. {
  19. /// <summary>
  20. /// Scrollable list %UI element.
  21. /// </summary>
  22. public unsafe partial class ListView : ScrollView
  23. {
  24. unsafe partial void OnListViewCreated ();
  25. [Preserve]
  26. public ListView (IntPtr handle) : base (handle)
  27. {
  28. OnListViewCreated ();
  29. }
  30. [Preserve]
  31. protected ListView (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnListViewCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int ListView_GetType (IntPtr handle);
  37. private StringHash UrhoGetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (ListView_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr ListView_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (ListView_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int ListView_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(ListView));
  54. return new StringHash (ListView_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr ListView_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(ListView));
  61. return Marshal.PtrToStringAnsi (ListView_GetTypeNameStatic ());
  62. }
  63. [Preserve]
  64. public ListView () : this (Application.CurrentContext)
  65. {
  66. }
  67. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  68. internal static extern IntPtr ListView_ListView (IntPtr context);
  69. [Preserve]
  70. public ListView (Context context) : base (UrhoObjectFlag.Empty)
  71. {
  72. Runtime.Validate (typeof(ListView));
  73. handle = ListView_ListView ((object)context == null ? IntPtr.Zero : context.Handle);
  74. Runtime.RegisterObject (this);
  75. OnListViewCreated ();
  76. }
  77. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  78. internal static extern void ListView_RegisterObject (IntPtr context);
  79. /// <summary>
  80. /// Register object factory.
  81. /// </summary>
  82. public new static void RegisterObject (Context context)
  83. {
  84. Runtime.Validate (typeof(ListView));
  85. ListView_RegisterObject ((object)context == null ? IntPtr.Zero : context.Handle);
  86. }
  87. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  88. internal static extern void ListView_OnKey (IntPtr handle, int key, int buttons, int qualifiers);
  89. /// <summary>
  90. /// React to a key press.
  91. /// </summary>
  92. public override void OnKey (int key, int buttons, int qualifiers)
  93. {
  94. Runtime.ValidateRefCounted (this);
  95. ListView_OnKey (handle, key, buttons, qualifiers);
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern void ListView_OnResize (IntPtr handle, ref Urho.IntVector2 newSize, ref Urho.IntVector2 delta);
  99. /// <summary>
  100. /// React to resize.
  101. /// </summary>
  102. public override void OnResize (Urho.IntVector2 newSize, Urho.IntVector2 delta)
  103. {
  104. Runtime.ValidateRefCounted (this);
  105. ListView_OnResize (handle, ref newSize, ref delta);
  106. }
  107. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  108. internal static extern void ListView_UpdateInternalLayout (IntPtr handle);
  109. /// <summary>
  110. /// Manually update layout on internal elements.
  111. /// </summary>
  112. public void UpdateInternalLayout ()
  113. {
  114. Runtime.ValidateRefCounted (this);
  115. ListView_UpdateInternalLayout (handle);
  116. }
  117. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  118. internal static extern void ListView_DisableInternalLayoutUpdate (IntPtr handle);
  119. /// <summary>
  120. /// Disable automatic layout update for internal elements.
  121. /// </summary>
  122. public void DisableInternalLayoutUpdate ()
  123. {
  124. Runtime.ValidateRefCounted (this);
  125. ListView_DisableInternalLayoutUpdate (handle);
  126. }
  127. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  128. internal static extern void ListView_EnableInternalLayoutUpdate (IntPtr handle);
  129. /// <summary>
  130. /// Enable automatic layout update for internal elements.
  131. /// </summary>
  132. public void EnableInternalLayoutUpdate ()
  133. {
  134. Runtime.ValidateRefCounted (this);
  135. ListView_EnableInternalLayoutUpdate (handle);
  136. }
  137. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  138. internal static extern void ListView_AddItem (IntPtr handle, IntPtr item);
  139. /// <summary>
  140. /// Add item to the end of the list.
  141. /// </summary>
  142. public void AddItem (UIElement item)
  143. {
  144. Runtime.ValidateRefCounted (this);
  145. ListView_AddItem (handle, (object)item == null ? IntPtr.Zero : item.Handle);
  146. }
  147. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  148. internal static extern void ListView_InsertItem (IntPtr handle, uint index, IntPtr item, IntPtr parentItem);
  149. /// <summary>
  150. ///
  151. /// Insert item at a specific index. In hierarchy mode, the optional parameter will be used to determine the child's indent level in respect to its parent.
  152. /// If index is greater than the total items then the new item is inserted at the end of the list.
  153. /// In hierarchy mode, if index is greater than the index of last children of the specified parent item then the new item is inserted next to the last children.
  154. /// And if the index is lesser than the index of the parent item itself then the new item is inserted before the first child item.
  155. /// </summary>
  156. public void InsertItem (uint index, UIElement item, UIElement parentItem = null)
  157. {
  158. Runtime.ValidateRefCounted (this);
  159. ListView_InsertItem (handle, index, (object)item == null ? IntPtr.Zero : item.Handle, (object)parentItem == null ? IntPtr.Zero : parentItem.Handle);
  160. }
  161. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  162. internal static extern void ListView_RemoveItem (IntPtr handle, IntPtr item, uint index);
  163. /// <summary>
  164. /// Remove specific item, starting search at the specified index if provided. In hierarchy mode will also remove any children.
  165. /// </summary>
  166. public void RemoveItem (UIElement item, uint index = 0)
  167. {
  168. Runtime.ValidateRefCounted (this);
  169. ListView_RemoveItem (handle, (object)item == null ? IntPtr.Zero : item.Handle, index);
  170. }
  171. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  172. internal static extern void ListView_RemoveItem0 (IntPtr handle, uint index);
  173. /// <summary>
  174. /// Remove item at index. In hierarchy mode will also remove any children.
  175. /// </summary>
  176. public void RemoveItem (uint index)
  177. {
  178. Runtime.ValidateRefCounted (this);
  179. ListView_RemoveItem0 (handle, index);
  180. }
  181. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  182. internal static extern void ListView_RemoveAllItems (IntPtr handle);
  183. /// <summary>
  184. /// Remove all items.
  185. /// </summary>
  186. public void RemoveAllItems ()
  187. {
  188. Runtime.ValidateRefCounted (this);
  189. ListView_RemoveAllItems (handle);
  190. }
  191. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  192. internal static extern void ListView_SetSelection (IntPtr handle, uint index);
  193. /// <summary>
  194. /// Set selection.
  195. /// </summary>
  196. private void SetSelection (uint index)
  197. {
  198. Runtime.ValidateRefCounted (this);
  199. ListView_SetSelection (handle, index);
  200. }
  201. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  202. internal static extern void ListView_AddSelection (IntPtr handle, uint index);
  203. /// <summary>
  204. /// Add item to the selection, multiselect mode only.
  205. /// </summary>
  206. public void AddSelection (uint index)
  207. {
  208. Runtime.ValidateRefCounted (this);
  209. ListView_AddSelection (handle, index);
  210. }
  211. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  212. internal static extern void ListView_RemoveSelection (IntPtr handle, uint index);
  213. /// <summary>
  214. /// Remove item from the selection.
  215. /// </summary>
  216. public void RemoveSelection (uint index)
  217. {
  218. Runtime.ValidateRefCounted (this);
  219. ListView_RemoveSelection (handle, index);
  220. }
  221. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  222. internal static extern void ListView_ToggleSelection (IntPtr handle, uint index);
  223. /// <summary>
  224. /// Toggle selection of an item.
  225. /// </summary>
  226. public void ToggleSelection (uint index)
  227. {
  228. Runtime.ValidateRefCounted (this);
  229. ListView_ToggleSelection (handle, index);
  230. }
  231. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  232. internal static extern void ListView_ChangeSelection (IntPtr handle, int delta, bool additive);
  233. /// <summary>
  234. /// Move selection by a delta and clamp at list ends. If additive (multiselect only), will add to the existing selection.
  235. /// </summary>
  236. public void ChangeSelection (int delta, bool additive = false)
  237. {
  238. Runtime.ValidateRefCounted (this);
  239. ListView_ChangeSelection (handle, delta, additive);
  240. }
  241. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  242. internal static extern void ListView_ClearSelection (IntPtr handle);
  243. /// <summary>
  244. /// Clear selection.
  245. /// </summary>
  246. public void ClearSelection ()
  247. {
  248. Runtime.ValidateRefCounted (this);
  249. ListView_ClearSelection (handle);
  250. }
  251. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  252. internal static extern void ListView_SetHighlightMode (IntPtr handle, HighlightMode mode);
  253. /// <summary>
  254. /// Set selected items' highlight mode.
  255. /// </summary>
  256. private void SetHighlightMode (HighlightMode mode)
  257. {
  258. Runtime.ValidateRefCounted (this);
  259. ListView_SetHighlightMode (handle, mode);
  260. }
  261. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  262. internal static extern void ListView_SetMultiselect (IntPtr handle, bool enable);
  263. /// <summary>
  264. /// Enable multiselect.
  265. /// </summary>
  266. private void SetMultiselect (bool enable)
  267. {
  268. Runtime.ValidateRefCounted (this);
  269. ListView_SetMultiselect (handle, enable);
  270. }
  271. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  272. internal static extern void ListView_SetHierarchyMode (IntPtr handle, bool enable);
  273. /// <summary>
  274. ///
  275. /// Enable hierarchy mode. Allows items to have parent-child relationship at different indent level and the ability to expand/collapse child items.
  276. /// All items in the list will be lost during mode change.
  277. /// </summary>
  278. private void SetHierarchyMode (bool enable)
  279. {
  280. Runtime.ValidateRefCounted (this);
  281. ListView_SetHierarchyMode (handle, enable);
  282. }
  283. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  284. internal static extern void ListView_SetBaseIndent (IntPtr handle, int baseIndent);
  285. /// <summary>
  286. /// Set base indent, i.e. the indent level of the ultimate parent item.
  287. /// </summary>
  288. private void SetBaseIndent (int baseIndent)
  289. {
  290. Runtime.ValidateRefCounted (this);
  291. ListView_SetBaseIndent (handle, baseIndent);
  292. }
  293. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  294. internal static extern void ListView_SetClearSelectionOnDefocus (IntPtr handle, bool enable);
  295. /// <summary>
  296. /// Enable clearing of selection on defocus.
  297. /// </summary>
  298. private void SetClearSelectionOnDefocus (bool enable)
  299. {
  300. Runtime.ValidateRefCounted (this);
  301. ListView_SetClearSelectionOnDefocus (handle, enable);
  302. }
  303. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  304. internal static extern void ListView_SetSelectOnClickEnd (IntPtr handle, bool enable);
  305. /// <summary>
  306. /// Enable reacting to click end instead of click start for item selection. Default false.
  307. /// </summary>
  308. private void SetSelectOnClickEnd (bool enable)
  309. {
  310. Runtime.ValidateRefCounted (this);
  311. ListView_SetSelectOnClickEnd (handle, enable);
  312. }
  313. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  314. internal static extern void ListView_Expand (IntPtr handle, uint index, bool enable, bool recursive);
  315. /// <summary>
  316. /// Expand item at index. Only has effect in hierarchy mode.
  317. /// </summary>
  318. public void Expand (uint index, bool enable, bool recursive = false)
  319. {
  320. Runtime.ValidateRefCounted (this);
  321. ListView_Expand (handle, index, enable, recursive);
  322. }
  323. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  324. internal static extern void ListView_ToggleExpand (IntPtr handle, uint index, bool recursive);
  325. /// <summary>
  326. /// Toggle item's expanded flag at index. Only has effect in hierarchy mode.
  327. /// </summary>
  328. public void ToggleExpand (uint index, bool recursive = false)
  329. {
  330. Runtime.ValidateRefCounted (this);
  331. ListView_ToggleExpand (handle, index, recursive);
  332. }
  333. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  334. internal static extern uint ListView_GetNumItems (IntPtr handle);
  335. /// <summary>
  336. /// Return number of items.
  337. /// </summary>
  338. private uint GetNumItems ()
  339. {
  340. Runtime.ValidateRefCounted (this);
  341. return ListView_GetNumItems (handle);
  342. }
  343. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  344. internal static extern IntPtr ListView_GetItem (IntPtr handle, uint index);
  345. /// <summary>
  346. /// Return item at index.
  347. /// </summary>
  348. public UIElement GetItem (uint index)
  349. {
  350. Runtime.ValidateRefCounted (this);
  351. return Runtime.LookupObject<UIElement> (ListView_GetItem (handle, index));
  352. }
  353. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  354. internal static extern uint ListView_FindItem (IntPtr handle, IntPtr item);
  355. /// <summary>
  356. /// Return index of item, or M_MAX_UNSIGNED If not found.
  357. /// </summary>
  358. public uint FindItem (UIElement item)
  359. {
  360. Runtime.ValidateRefCounted (this);
  361. return ListView_FindItem (handle, (object)item == null ? IntPtr.Zero : item.Handle);
  362. }
  363. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  364. internal static extern uint ListView_GetSelection (IntPtr handle);
  365. /// <summary>
  366. /// Return first selected index, or M_MAX_UNSIGNED if none selected.
  367. /// </summary>
  368. private uint GetSelection ()
  369. {
  370. Runtime.ValidateRefCounted (this);
  371. return ListView_GetSelection (handle);
  372. }
  373. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  374. internal static extern void ListView_CopySelectedItemsToClipboard (IntPtr handle);
  375. /// <summary>
  376. /// Copy selected items to system clipboard. Currently only applicable to Text items.
  377. /// </summary>
  378. public void CopySelectedItemsToClipboard ()
  379. {
  380. Runtime.ValidateRefCounted (this);
  381. ListView_CopySelectedItemsToClipboard (handle);
  382. }
  383. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  384. internal static extern IntPtr ListView_GetSelectedItem (IntPtr handle);
  385. /// <summary>
  386. /// Return first selected item, or null if none selected.
  387. /// </summary>
  388. private UIElement GetSelectedItem ()
  389. {
  390. Runtime.ValidateRefCounted (this);
  391. return Runtime.LookupObject<UIElement> (ListView_GetSelectedItem (handle));
  392. }
  393. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  394. internal static extern bool ListView_IsSelected (IntPtr handle, uint index);
  395. /// <summary>
  396. /// Return whether an item at index is seleccted.
  397. /// </summary>
  398. public bool IsSelected (uint index)
  399. {
  400. Runtime.ValidateRefCounted (this);
  401. return ListView_IsSelected (handle, index);
  402. }
  403. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  404. internal static extern bool ListView_IsExpanded (IntPtr handle, uint index);
  405. /// <summary>
  406. /// Return whether an item at index has its children expanded (in hierarchy mode only).
  407. /// </summary>
  408. public bool IsExpanded (uint index)
  409. {
  410. Runtime.ValidateRefCounted (this);
  411. return ListView_IsExpanded (handle, index);
  412. }
  413. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  414. internal static extern HighlightMode ListView_GetHighlightMode (IntPtr handle);
  415. /// <summary>
  416. /// Return highlight mode.
  417. /// </summary>
  418. private HighlightMode GetHighlightMode ()
  419. {
  420. Runtime.ValidateRefCounted (this);
  421. return ListView_GetHighlightMode (handle);
  422. }
  423. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  424. internal static extern bool ListView_GetMultiselect (IntPtr handle);
  425. /// <summary>
  426. /// Return whether multiselect enabled.
  427. /// </summary>
  428. private bool GetMultiselect ()
  429. {
  430. Runtime.ValidateRefCounted (this);
  431. return ListView_GetMultiselect (handle);
  432. }
  433. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  434. internal static extern bool ListView_GetClearSelectionOnDefocus (IntPtr handle);
  435. /// <summary>
  436. /// Return whether selection is cleared on defocus.
  437. /// </summary>
  438. private bool GetClearSelectionOnDefocus ()
  439. {
  440. Runtime.ValidateRefCounted (this);
  441. return ListView_GetClearSelectionOnDefocus (handle);
  442. }
  443. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  444. internal static extern bool ListView_GetSelectOnClickEnd (IntPtr handle);
  445. /// <summary>
  446. /// Return whether reacts to click end instead of click start for item selection.
  447. /// </summary>
  448. private bool GetSelectOnClickEnd ()
  449. {
  450. Runtime.ValidateRefCounted (this);
  451. return ListView_GetSelectOnClickEnd (handle);
  452. }
  453. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  454. internal static extern bool ListView_GetHierarchyMode (IntPtr handle);
  455. /// <summary>
  456. /// Return whether hierarchy mode enabled.
  457. /// </summary>
  458. private bool GetHierarchyMode ()
  459. {
  460. Runtime.ValidateRefCounted (this);
  461. return ListView_GetHierarchyMode (handle);
  462. }
  463. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  464. internal static extern int ListView_GetBaseIndent (IntPtr handle);
  465. /// <summary>
  466. /// Return base indent.
  467. /// </summary>
  468. private int GetBaseIndent ()
  469. {
  470. Runtime.ValidateRefCounted (this);
  471. return ListView_GetBaseIndent (handle);
  472. }
  473. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  474. internal static extern void ListView_EnsureItemVisibility (IntPtr handle, uint index);
  475. /// <summary>
  476. /// Ensure full visibility of the item.
  477. /// </summary>
  478. public void EnsureItemVisibility (uint index)
  479. {
  480. Runtime.ValidateRefCounted (this);
  481. ListView_EnsureItemVisibility (handle, index);
  482. }
  483. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  484. internal static extern void ListView_EnsureItemVisibility1 (IntPtr handle, IntPtr item);
  485. /// <summary>
  486. /// Ensure full visibility of the item.
  487. /// </summary>
  488. public void EnsureItemVisibility (UIElement item)
  489. {
  490. Runtime.ValidateRefCounted (this);
  491. ListView_EnsureItemVisibility1 (handle, (object)item == null ? IntPtr.Zero : item.Handle);
  492. }
  493. public override StringHash Type {
  494. get {
  495. return UrhoGetType ();
  496. }
  497. }
  498. public override string TypeName {
  499. get {
  500. return GetTypeName ();
  501. }
  502. }
  503. [Preserve]
  504. public new static StringHash TypeStatic {
  505. get {
  506. return GetTypeStatic ();
  507. }
  508. }
  509. public new static string TypeNameStatic {
  510. get {
  511. return GetTypeNameStatic ();
  512. }
  513. }
  514. /// <summary>
  515. /// Return first selected index, or M_MAX_UNSIGNED if none selected.
  516. /// Or
  517. /// Set selection.
  518. /// </summary>
  519. public uint Selection {
  520. get {
  521. return GetSelection ();
  522. }
  523. set {
  524. SetSelection (value);
  525. }
  526. }
  527. /// <summary>
  528. /// Return highlight mode.
  529. /// Or
  530. /// Set selected items' highlight mode.
  531. /// </summary>
  532. public HighlightMode HighlightMode {
  533. get {
  534. return GetHighlightMode ();
  535. }
  536. set {
  537. SetHighlightMode (value);
  538. }
  539. }
  540. /// <summary>
  541. /// Return whether multiselect enabled.
  542. /// Or
  543. /// Enable multiselect.
  544. /// </summary>
  545. public bool Multiselect {
  546. get {
  547. return GetMultiselect ();
  548. }
  549. set {
  550. SetMultiselect (value);
  551. }
  552. }
  553. /// <summary>
  554. /// Return whether hierarchy mode enabled.
  555. /// Or
  556. ///
  557. /// Enable hierarchy mode. Allows items to have parent-child relationship at different indent level and the ability to expand/collapse child items.
  558. /// All items in the list will be lost during mode change.
  559. /// </summary>
  560. public bool HierarchyMode {
  561. get {
  562. return GetHierarchyMode ();
  563. }
  564. set {
  565. SetHierarchyMode (value);
  566. }
  567. }
  568. /// <summary>
  569. /// Return base indent.
  570. /// Or
  571. /// Set base indent, i.e. the indent level of the ultimate parent item.
  572. /// </summary>
  573. public int BaseIndent {
  574. get {
  575. return GetBaseIndent ();
  576. }
  577. set {
  578. SetBaseIndent (value);
  579. }
  580. }
  581. /// <summary>
  582. /// Return whether selection is cleared on defocus.
  583. /// Or
  584. /// Enable clearing of selection on defocus.
  585. /// </summary>
  586. public bool ClearSelectionOnDefocus {
  587. get {
  588. return GetClearSelectionOnDefocus ();
  589. }
  590. set {
  591. SetClearSelectionOnDefocus (value);
  592. }
  593. }
  594. /// <summary>
  595. /// Return whether reacts to click end instead of click start for item selection.
  596. /// Or
  597. /// Enable reacting to click end instead of click start for item selection. Default false.
  598. /// </summary>
  599. public bool SelectOnClickEnd {
  600. get {
  601. return GetSelectOnClickEnd ();
  602. }
  603. set {
  604. SetSelectOnClickEnd (value);
  605. }
  606. }
  607. /// <summary>
  608. /// Return number of items.
  609. /// </summary>
  610. public uint NumItems {
  611. get {
  612. return GetNumItems ();
  613. }
  614. }
  615. /// <summary>
  616. /// Return first selected item, or null if none selected.
  617. /// </summary>
  618. public UIElement SelectedItem {
  619. get {
  620. return GetSelectedItem ();
  621. }
  622. }
  623. }
  624. }