UI.cs 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // UI.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. /// %UI subsystem. Manages the graphical user interface.
  21. /// </summary>
  22. public unsafe partial class UI : UrhoObject
  23. {
  24. unsafe partial void OnUICreated ();
  25. [Preserve]
  26. public UI (IntPtr handle) : base (handle)
  27. {
  28. OnUICreated ();
  29. }
  30. [Preserve]
  31. protected UI (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnUICreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int UI_GetType (IntPtr handle);
  37. private StringHash UrhoGetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (UI_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr UI_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (UI_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int UI_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(UI));
  54. return new StringHash (UI_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr UI_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(UI));
  61. return Marshal.PtrToStringAnsi (UI_GetTypeNameStatic ());
  62. }
  63. [Preserve]
  64. public UI () : this (Application.CurrentContext)
  65. {
  66. }
  67. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  68. internal static extern IntPtr UI_UI (IntPtr context);
  69. [Preserve]
  70. public UI (Context context) : base (UrhoObjectFlag.Empty)
  71. {
  72. Runtime.Validate (typeof(UI));
  73. handle = UI_UI ((object)context == null ? IntPtr.Zero : context.Handle);
  74. Runtime.RegisterObject (this);
  75. OnUICreated ();
  76. }
  77. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  78. internal static extern void UI_SetCursor (IntPtr handle, IntPtr cursor);
  79. /// <summary>
  80. /// Set cursor UI element.
  81. /// </summary>
  82. private void SetCursor (Cursor cursor)
  83. {
  84. Runtime.ValidateRefCounted (this);
  85. UI_SetCursor (handle, (object)cursor == null ? IntPtr.Zero : cursor.Handle);
  86. }
  87. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  88. internal static extern void UI_SetFocusElement (IntPtr handle, IntPtr element, bool byKey);
  89. /// <summary>
  90. /// Set focused UI element.
  91. /// </summary>
  92. public void SetFocusElement (UIElement element, bool byKey = false)
  93. {
  94. Runtime.ValidateRefCounted (this);
  95. UI_SetFocusElement (handle, (object)element == null ? IntPtr.Zero : element.Handle, byKey);
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern bool UI_SetModalElement (IntPtr handle, IntPtr modalElement, bool enable);
  99. /// <summary>
  100. /// Set modal element. Until all the modal elements are dismissed, all the inputs and events are only sent to them. Return true when successful.
  101. /// Only the modal element can clear its modal status or when it is being destructed.
  102. /// </summary>
  103. public bool SetModalElement (UIElement modalElement, bool enable)
  104. {
  105. Runtime.ValidateRefCounted (this);
  106. return UI_SetModalElement (handle, (object)modalElement == null ? IntPtr.Zero : modalElement.Handle, enable);
  107. }
  108. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  109. internal static extern void UI_Clear (IntPtr handle);
  110. /// <summary>
  111. /// Clear the UI (excluding the cursor.)
  112. /// </summary>
  113. public void Clear ()
  114. {
  115. Runtime.ValidateRefCounted (this);
  116. UI_Clear (handle);
  117. }
  118. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  119. internal static extern void UI_Update (IntPtr handle, float timeStep);
  120. /// <summary>
  121. /// Update the UI logic. Called by HandlePostUpdate().
  122. /// </summary>
  123. public void Update (float timeStep)
  124. {
  125. Runtime.ValidateRefCounted (this);
  126. UI_Update (handle, timeStep);
  127. }
  128. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  129. internal static extern void UI_RenderUpdate (IntPtr handle);
  130. /// <summary>
  131. /// Update the UI for rendering. Called by HandleRenderUpdate().
  132. /// </summary>
  133. public void RenderUpdate ()
  134. {
  135. Runtime.ValidateRefCounted (this);
  136. UI_RenderUpdate (handle);
  137. }
  138. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  139. internal static extern void UI_Render (IntPtr handle, bool renderUICommand);
  140. /// <summary>
  141. /// Render the UI. If renderUICommand is false (default), is assumed to be the default UI render to backbuffer called by Engine, and will be performed only once. Additional UI renders to a different rendertarget may be triggered from the renderpath.
  142. /// </summary>
  143. public void Render (bool renderUICommand = false)
  144. {
  145. Runtime.ValidateRefCounted (this);
  146. UI_Render (handle, renderUICommand);
  147. }
  148. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  149. internal static extern void UI_DebugDraw (IntPtr handle, IntPtr element);
  150. /// <summary>
  151. /// Debug draw a UI element.
  152. /// </summary>
  153. public void DebugDraw (UIElement element)
  154. {
  155. Runtime.ValidateRefCounted (this);
  156. UI_DebugDraw (handle, (object)element == null ? IntPtr.Zero : element.Handle);
  157. }
  158. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  159. internal static extern IntPtr UI_LoadLayout_File (IntPtr handle, IntPtr source, IntPtr styleFile);
  160. /// <summary>
  161. /// Load a UI layout from an XML file. Optionally specify another XML file for element style. Return the root element.
  162. /// </summary>
  163. public UIElement LoadLayout (File source, Urho.Resources.XmlFile styleFile = null)
  164. {
  165. Runtime.ValidateRefCounted (this);
  166. return Runtime.LookupRefCounted<UIElement> (UI_LoadLayout_File (handle, (object)source == null ? IntPtr.Zero : source.Handle, (object)styleFile == null ? IntPtr.Zero : styleFile.Handle));
  167. }
  168. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  169. internal static extern IntPtr UI_LoadLayout_MemoryBuffer (IntPtr handle, IntPtr source, IntPtr styleFile);
  170. /// <summary>
  171. /// Load a UI layout from an XML file. Optionally specify another XML file for element style. Return the root element.
  172. /// </summary>
  173. public UIElement LoadLayout (MemoryBuffer source, Urho.Resources.XmlFile styleFile = null)
  174. {
  175. Runtime.ValidateRefCounted (this);
  176. return Runtime.LookupRefCounted<UIElement> (UI_LoadLayout_MemoryBuffer (handle, (object)source == null ? IntPtr.Zero : source.Handle, (object)styleFile == null ? IntPtr.Zero : styleFile.Handle));
  177. }
  178. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  179. internal static extern IntPtr UI_LoadLayout0 (IntPtr handle, IntPtr file, IntPtr styleFile);
  180. /// <summary>
  181. /// Load a UI layout from an XML file. Optionally specify another XML file for element style. Return the root element.
  182. /// </summary>
  183. public UIElement LoadLayout (Urho.Resources.XmlFile file, Urho.Resources.XmlFile styleFile = null)
  184. {
  185. Runtime.ValidateRefCounted (this);
  186. return Runtime.LookupRefCounted<UIElement> (UI_LoadLayout0 (handle, (object)file == null ? IntPtr.Zero : file.Handle, (object)styleFile == null ? IntPtr.Zero : styleFile.Handle));
  187. }
  188. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  189. internal static extern bool UI_SaveLayout_File (IntPtr handle, IntPtr dest, IntPtr element);
  190. /// <summary>
  191. /// Save a UI layout to an XML file. Return true if successful.
  192. /// </summary>
  193. public bool SaveLayout (File dest, UIElement element)
  194. {
  195. Runtime.ValidateRefCounted (this);
  196. return UI_SaveLayout_File (handle, (object)dest == null ? IntPtr.Zero : dest.Handle, (object)element == null ? IntPtr.Zero : element.Handle);
  197. }
  198. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  199. internal static extern bool UI_SaveLayout_MemoryBuffer (IntPtr handle, IntPtr dest, IntPtr element);
  200. /// <summary>
  201. /// Save a UI layout to an XML file. Return true if successful.
  202. /// </summary>
  203. public bool SaveLayout (MemoryBuffer dest, UIElement element)
  204. {
  205. Runtime.ValidateRefCounted (this);
  206. return UI_SaveLayout_MemoryBuffer (handle, (object)dest == null ? IntPtr.Zero : dest.Handle, (object)element == null ? IntPtr.Zero : element.Handle);
  207. }
  208. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  209. internal static extern void UI_SetClipboardText (IntPtr handle, string text);
  210. /// <summary>
  211. /// Set clipboard text.
  212. /// </summary>
  213. private void SetClipboardText (string text)
  214. {
  215. Runtime.ValidateRefCounted (this);
  216. UI_SetClipboardText (handle, text);
  217. }
  218. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  219. internal static extern void UI_SetDoubleClickInterval (IntPtr handle, float interval);
  220. /// <summary>
  221. /// Set UI element double click interval in seconds.
  222. /// </summary>
  223. private void SetDoubleClickInterval (float interval)
  224. {
  225. Runtime.ValidateRefCounted (this);
  226. UI_SetDoubleClickInterval (handle, interval);
  227. }
  228. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  229. internal static extern void UI_SetDragBeginInterval (IntPtr handle, float interval);
  230. /// <summary>
  231. /// Set UI drag event start interval in seconds.
  232. /// </summary>
  233. private void SetDragBeginInterval (float interval)
  234. {
  235. Runtime.ValidateRefCounted (this);
  236. UI_SetDragBeginInterval (handle, interval);
  237. }
  238. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  239. internal static extern void UI_SetDragBeginDistance (IntPtr handle, int pixels);
  240. /// <summary>
  241. /// Set UI drag event start distance threshold in pixels.
  242. /// </summary>
  243. private void SetDragBeginDistance (int pixels)
  244. {
  245. Runtime.ValidateRefCounted (this);
  246. UI_SetDragBeginDistance (handle, pixels);
  247. }
  248. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  249. internal static extern void UI_SetDefaultToolTipDelay (IntPtr handle, float delay);
  250. /// <summary>
  251. /// Set tooltip default display delay in seconds.
  252. /// </summary>
  253. private void SetDefaultToolTipDelay (float delay)
  254. {
  255. Runtime.ValidateRefCounted (this);
  256. UI_SetDefaultToolTipDelay (handle, delay);
  257. }
  258. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  259. internal static extern void UI_SetMaxFontTextureSize (IntPtr handle, int size);
  260. /// <summary>
  261. /// Set maximum font face texture size. Must be a power of two. Default is 2048.
  262. /// </summary>
  263. private void SetMaxFontTextureSize (int size)
  264. {
  265. Runtime.ValidateRefCounted (this);
  266. UI_SetMaxFontTextureSize (handle, size);
  267. }
  268. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  269. internal static extern void UI_SetNonFocusedMouseWheel (IntPtr handle, bool nonFocusedMouseWheel);
  270. /// <summary>
  271. /// Set whether mouse wheel can control also a non-focused element.
  272. /// </summary>
  273. private void SetNonFocusedMouseWheel (bool nonFocusedMouseWheel)
  274. {
  275. Runtime.ValidateRefCounted (this);
  276. UI_SetNonFocusedMouseWheel (handle, nonFocusedMouseWheel);
  277. }
  278. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  279. internal static extern void UI_SetUseSystemClipboard (IntPtr handle, bool enable);
  280. /// <summary>
  281. /// Set whether to use system clipboard. Default false.
  282. /// </summary>
  283. private void SetUseSystemClipboard (bool enable)
  284. {
  285. Runtime.ValidateRefCounted (this);
  286. UI_SetUseSystemClipboard (handle, enable);
  287. }
  288. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  289. internal static extern void UI_SetUseScreenKeyboard (IntPtr handle, bool enable);
  290. /// <summary>
  291. /// Set whether to show the on-screen keyboard (if supported) when a %LineEdit is focused. Default true on mobile devices.
  292. /// </summary>
  293. private void SetUseScreenKeyboard (bool enable)
  294. {
  295. Runtime.ValidateRefCounted (this);
  296. UI_SetUseScreenKeyboard (handle, enable);
  297. }
  298. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  299. internal static extern void UI_SetUseMutableGlyphs (IntPtr handle, bool enable);
  300. /// <summary>
  301. /// Set whether to use mutable (eraseable) glyphs to ensure a font face never expands to more than one texture. Default false.
  302. /// </summary>
  303. private void SetUseMutableGlyphs (bool enable)
  304. {
  305. Runtime.ValidateRefCounted (this);
  306. UI_SetUseMutableGlyphs (handle, enable);
  307. }
  308. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  309. internal static extern void UI_SetForceAutoHint (IntPtr handle, bool enable);
  310. /// <summary>
  311. /// Set whether to force font autohinting instead of using FreeType's TTF bytecode interpreter.
  312. /// </summary>
  313. private void SetForceAutoHint (bool enable)
  314. {
  315. Runtime.ValidateRefCounted (this);
  316. UI_SetForceAutoHint (handle, enable);
  317. }
  318. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  319. internal static extern void UI_SetFontHintLevel (IntPtr handle, FontHintLevel level);
  320. /// <summary>
  321. /// Set the hinting level used by FreeType fonts.
  322. /// </summary>
  323. private void SetFontHintLevel (FontHintLevel level)
  324. {
  325. Runtime.ValidateRefCounted (this);
  326. UI_SetFontHintLevel (handle, level);
  327. }
  328. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  329. internal static extern void UI_SetFontSubpixelThreshold (IntPtr handle, float threshold);
  330. /// <summary>
  331. /// Set the font subpixel threshold. Below this size, if the hint level is LIGHT or NONE, fonts will use subpixel positioning plus oversampling for higher-quality rendering. Has no effect at hint level NORMAL.
  332. /// </summary>
  333. private void SetFontSubpixelThreshold (float threshold)
  334. {
  335. Runtime.ValidateRefCounted (this);
  336. UI_SetFontSubpixelThreshold (handle, threshold);
  337. }
  338. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  339. internal static extern void UI_SetFontOversampling (IntPtr handle, int oversampling);
  340. /// <summary>
  341. /// Set the oversampling (horizonal stretching) used to improve subpixel font rendering. Only affects fonts smaller than the subpixel limit.
  342. /// </summary>
  343. private void SetFontOversampling (int oversampling)
  344. {
  345. Runtime.ValidateRefCounted (this);
  346. UI_SetFontOversampling (handle, oversampling);
  347. }
  348. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  349. internal static extern void UI_SetScale (IntPtr handle, float scale);
  350. /// <summary>
  351. /// Set %UI scale. 1.0 is default (pixel perfect). Resize the root element to match.
  352. /// </summary>
  353. private void SetScale (float scale)
  354. {
  355. Runtime.ValidateRefCounted (this);
  356. UI_SetScale (handle, scale);
  357. }
  358. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  359. internal static extern void UI_SetWidth (IntPtr handle, float width);
  360. /// <summary>
  361. /// Scale %UI to the specified width in pixels.
  362. /// </summary>
  363. public void SetWidth (float width)
  364. {
  365. Runtime.ValidateRefCounted (this);
  366. UI_SetWidth (handle, width);
  367. }
  368. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  369. internal static extern void UI_SetHeight (IntPtr handle, float height);
  370. /// <summary>
  371. /// Scale %UI to the specified height in pixels.
  372. /// </summary>
  373. public void SetHeight (float height)
  374. {
  375. Runtime.ValidateRefCounted (this);
  376. UI_SetHeight (handle, height);
  377. }
  378. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  379. internal static extern void UI_SetCustomSize (IntPtr handle, ref Urho.IntVector2 size);
  380. /// <summary>
  381. /// Set custom size of the root element. This disables automatic resizing of the root element according to window size. Set custom size 0,0 to return to automatic resizing.
  382. /// </summary>
  383. private void SetCustomSize (Urho.IntVector2 size)
  384. {
  385. Runtime.ValidateRefCounted (this);
  386. UI_SetCustomSize (handle, ref size);
  387. }
  388. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  389. internal static extern void UI_SetCustomSize1 (IntPtr handle, int width, int height);
  390. /// <summary>
  391. /// Set custom size of the root element.
  392. /// </summary>
  393. public void SetCustomSize (int width, int height)
  394. {
  395. Runtime.ValidateRefCounted (this);
  396. UI_SetCustomSize1 (handle, width, height);
  397. }
  398. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  399. internal static extern IntPtr UI_GetRoot (IntPtr handle);
  400. /// <summary>
  401. /// Return root UI element.
  402. /// </summary>
  403. private UIElement GetRoot ()
  404. {
  405. Runtime.ValidateRefCounted (this);
  406. return Runtime.LookupObject<UIElement> (UI_GetRoot (handle));
  407. }
  408. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  409. internal static extern IntPtr UI_GetRootModalElement (IntPtr handle);
  410. /// <summary>
  411. /// Return root modal element.
  412. /// </summary>
  413. private UIElement GetRootModalElement ()
  414. {
  415. Runtime.ValidateRefCounted (this);
  416. return Runtime.LookupObject<UIElement> (UI_GetRootModalElement (handle));
  417. }
  418. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  419. internal static extern IntPtr UI_GetCursor (IntPtr handle);
  420. /// <summary>
  421. /// Return cursor.
  422. /// </summary>
  423. private Cursor GetCursor ()
  424. {
  425. Runtime.ValidateRefCounted (this);
  426. return Runtime.LookupObject<Cursor> (UI_GetCursor (handle));
  427. }
  428. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  429. internal static extern Urho.IntVector2 UI_GetCursorPosition (IntPtr handle);
  430. /// <summary>
  431. /// Return cursor position.
  432. /// </summary>
  433. private Urho.IntVector2 GetCursorPosition ()
  434. {
  435. Runtime.ValidateRefCounted (this);
  436. return UI_GetCursorPosition (handle);
  437. }
  438. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  439. internal static extern IntPtr UI_GetElementAt (IntPtr handle, ref Urho.IntVector2 position, bool enabledOnly);
  440. /// <summary>
  441. /// Return UI element at global screen coordinates. By default returns only input-enabled elements.
  442. /// </summary>
  443. public UIElement GetElementAt (Urho.IntVector2 position, bool enabledOnly = true)
  444. {
  445. Runtime.ValidateRefCounted (this);
  446. return Runtime.LookupObject<UIElement> (UI_GetElementAt (handle, ref position, enabledOnly));
  447. }
  448. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  449. internal static extern IntPtr UI_GetElementAt2 (IntPtr handle, int x, int y, bool enabledOnly);
  450. /// <summary>
  451. /// Return UI element at global screen coordinates. By default returns only input-enabled elements.
  452. /// </summary>
  453. public UIElement GetElementAt (int x, int y, bool enabledOnly = true)
  454. {
  455. Runtime.ValidateRefCounted (this);
  456. return Runtime.LookupObject<UIElement> (UI_GetElementAt2 (handle, x, y, enabledOnly));
  457. }
  458. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  459. internal static extern IntPtr UI_GetElementAt3 (IntPtr handle, IntPtr root, ref Urho.IntVector2 position, bool enabledOnly);
  460. /// <summary>
  461. /// Get a child element at element's screen position relative to specified root element.
  462. /// </summary>
  463. public UIElement GetElementAt (UIElement root, Urho.IntVector2 position, bool enabledOnly = true)
  464. {
  465. Runtime.ValidateRefCounted (this);
  466. return Runtime.LookupObject<UIElement> (UI_GetElementAt3 (handle, (object)root == null ? IntPtr.Zero : root.Handle, ref position, enabledOnly));
  467. }
  468. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  469. internal static extern IntPtr UI_GetFocusElement (IntPtr handle);
  470. /// <summary>
  471. /// Return focused element.
  472. /// </summary>
  473. private UIElement GetFocusElement ()
  474. {
  475. Runtime.ValidateRefCounted (this);
  476. return Runtime.LookupObject<UIElement> (UI_GetFocusElement (handle));
  477. }
  478. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  479. internal static extern IntPtr UI_GetFrontElement (IntPtr handle);
  480. /// <summary>
  481. /// Return topmost enabled root-level non-modal element.
  482. /// </summary>
  483. private UIElement GetFrontElement ()
  484. {
  485. Runtime.ValidateRefCounted (this);
  486. return Runtime.LookupObject<UIElement> (UI_GetFrontElement (handle));
  487. }
  488. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  489. internal static extern uint UI_GetNumDragElements (IntPtr handle);
  490. /// <summary>
  491. /// Return the number of currently dragged elements.
  492. /// </summary>
  493. private uint GetNumDragElements ()
  494. {
  495. Runtime.ValidateRefCounted (this);
  496. return UI_GetNumDragElements (handle);
  497. }
  498. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  499. internal static extern IntPtr UI_GetDragElement (IntPtr handle, uint index);
  500. /// <summary>
  501. /// Return the drag element at index.
  502. /// </summary>
  503. public UIElement GetDragElement (uint index)
  504. {
  505. Runtime.ValidateRefCounted (this);
  506. return Runtime.LookupObject<UIElement> (UI_GetDragElement (handle, index));
  507. }
  508. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  509. internal static extern IntPtr UI_GetClipboardText (IntPtr handle);
  510. /// <summary>
  511. /// Return clipboard text.
  512. /// </summary>
  513. private string GetClipboardText ()
  514. {
  515. Runtime.ValidateRefCounted (this);
  516. return Marshal.PtrToStringAnsi (UI_GetClipboardText (handle));
  517. }
  518. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  519. internal static extern float UI_GetDoubleClickInterval (IntPtr handle);
  520. /// <summary>
  521. /// Return UI element double click interval in seconds.
  522. /// </summary>
  523. private float GetDoubleClickInterval ()
  524. {
  525. Runtime.ValidateRefCounted (this);
  526. return UI_GetDoubleClickInterval (handle);
  527. }
  528. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  529. internal static extern float UI_GetDragBeginInterval (IntPtr handle);
  530. /// <summary>
  531. /// Return UI drag start event interval in seconds.
  532. /// </summary>
  533. private float GetDragBeginInterval ()
  534. {
  535. Runtime.ValidateRefCounted (this);
  536. return UI_GetDragBeginInterval (handle);
  537. }
  538. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  539. internal static extern int UI_GetDragBeginDistance (IntPtr handle);
  540. /// <summary>
  541. /// Return UI drag start event distance threshold in pixels.
  542. /// </summary>
  543. private int GetDragBeginDistance ()
  544. {
  545. Runtime.ValidateRefCounted (this);
  546. return UI_GetDragBeginDistance (handle);
  547. }
  548. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  549. internal static extern float UI_GetDefaultToolTipDelay (IntPtr handle);
  550. /// <summary>
  551. /// Return tooltip default display delay in seconds.
  552. /// </summary>
  553. private float GetDefaultToolTipDelay ()
  554. {
  555. Runtime.ValidateRefCounted (this);
  556. return UI_GetDefaultToolTipDelay (handle);
  557. }
  558. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  559. internal static extern int UI_GetMaxFontTextureSize (IntPtr handle);
  560. /// <summary>
  561. /// Return font texture maximum size.
  562. /// </summary>
  563. private int GetMaxFontTextureSize ()
  564. {
  565. Runtime.ValidateRefCounted (this);
  566. return UI_GetMaxFontTextureSize (handle);
  567. }
  568. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  569. internal static extern bool UI_IsNonFocusedMouseWheel (IntPtr handle);
  570. /// <summary>
  571. /// Return whether mouse wheel can control also a non-focused element.
  572. /// </summary>
  573. private bool IsNonFocusedMouseWheel ()
  574. {
  575. Runtime.ValidateRefCounted (this);
  576. return UI_IsNonFocusedMouseWheel (handle);
  577. }
  578. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  579. internal static extern bool UI_GetUseSystemClipboard (IntPtr handle);
  580. /// <summary>
  581. /// Return whether is using the system clipboard.
  582. /// </summary>
  583. private bool GetUseSystemClipboard ()
  584. {
  585. Runtime.ValidateRefCounted (this);
  586. return UI_GetUseSystemClipboard (handle);
  587. }
  588. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  589. internal static extern bool UI_GetUseScreenKeyboard (IntPtr handle);
  590. /// <summary>
  591. /// Return whether focusing a %LineEdit will show the on-screen keyboard.
  592. /// </summary>
  593. private bool GetUseScreenKeyboard ()
  594. {
  595. Runtime.ValidateRefCounted (this);
  596. return UI_GetUseScreenKeyboard (handle);
  597. }
  598. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  599. internal static extern bool UI_GetUseMutableGlyphs (IntPtr handle);
  600. /// <summary>
  601. /// Return whether is using mutable (eraseable) glyphs for fonts.
  602. /// </summary>
  603. private bool GetUseMutableGlyphs ()
  604. {
  605. Runtime.ValidateRefCounted (this);
  606. return UI_GetUseMutableGlyphs (handle);
  607. }
  608. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  609. internal static extern bool UI_GetForceAutoHint (IntPtr handle);
  610. /// <summary>
  611. /// Return whether is using forced autohinting.
  612. /// </summary>
  613. private bool GetForceAutoHint ()
  614. {
  615. Runtime.ValidateRefCounted (this);
  616. return UI_GetForceAutoHint (handle);
  617. }
  618. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  619. internal static extern FontHintLevel UI_GetFontHintLevel (IntPtr handle);
  620. /// <summary>
  621. /// Return the current FreeType font hinting level.
  622. /// </summary>
  623. private FontHintLevel GetFontHintLevel ()
  624. {
  625. Runtime.ValidateRefCounted (this);
  626. return UI_GetFontHintLevel (handle);
  627. }
  628. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  629. internal static extern float UI_GetFontSubpixelThreshold (IntPtr handle);
  630. /// <summary>
  631. /// Get the font subpixel threshold. Below this size, if the hint level is LIGHT or NONE, fonts will use subpixel positioning plus oversampling for higher-quality rendering. Has no effect at hint level NORMAL.
  632. /// </summary>
  633. private float GetFontSubpixelThreshold ()
  634. {
  635. Runtime.ValidateRefCounted (this);
  636. return UI_GetFontSubpixelThreshold (handle);
  637. }
  638. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  639. internal static extern int UI_GetFontOversampling (IntPtr handle);
  640. /// <summary>
  641. /// Get the oversampling (horizonal stretching) used to improve subpixel font rendering. Only affects fonts smaller than the subpixel limit.
  642. /// </summary>
  643. private int GetFontOversampling ()
  644. {
  645. Runtime.ValidateRefCounted (this);
  646. return UI_GetFontOversampling (handle);
  647. }
  648. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  649. internal static extern bool UI_HasModalElement (IntPtr handle);
  650. /// <summary>
  651. /// Return true when UI has modal element(s).
  652. /// </summary>
  653. public bool HasModalElement ()
  654. {
  655. Runtime.ValidateRefCounted (this);
  656. return UI_HasModalElement (handle);
  657. }
  658. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  659. internal static extern bool UI_IsDragging (IntPtr handle);
  660. /// <summary>
  661. /// Return whether a drag is in progress.
  662. /// </summary>
  663. private bool IsDragging ()
  664. {
  665. Runtime.ValidateRefCounted (this);
  666. return UI_IsDragging (handle);
  667. }
  668. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  669. internal static extern float UI_GetScale (IntPtr handle);
  670. /// <summary>
  671. /// Return current UI scale.
  672. /// </summary>
  673. private float GetScale ()
  674. {
  675. Runtime.ValidateRefCounted (this);
  676. return UI_GetScale (handle);
  677. }
  678. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  679. internal static extern Urho.IntVector2 UI_GetCustomSize (IntPtr handle);
  680. /// <summary>
  681. /// Return root element custom size. Returns 0,0 when custom size is not being used and automatic resizing according to window size is in use instead (default.)
  682. /// </summary>
  683. private Urho.IntVector2 GetCustomSize ()
  684. {
  685. Runtime.ValidateRefCounted (this);
  686. return UI_GetCustomSize (handle);
  687. }
  688. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  689. internal static extern void UI_SetRenderToTexture (IntPtr handle, IntPtr component, bool enable);
  690. /// <summary>
  691. /// Register UIElement for being rendered into a texture.
  692. /// </summary>
  693. public void SetRenderToTexture (UIComponent component, bool enable)
  694. {
  695. Runtime.ValidateRefCounted (this);
  696. UI_SetRenderToTexture (handle, (object)component == null ? IntPtr.Zero : component.Handle, enable);
  697. }
  698. public override StringHash Type {
  699. get {
  700. return UrhoGetType ();
  701. }
  702. }
  703. public override string TypeName {
  704. get {
  705. return GetTypeName ();
  706. }
  707. }
  708. [Preserve]
  709. public static StringHash TypeStatic {
  710. get {
  711. return GetTypeStatic ();
  712. }
  713. }
  714. public static string TypeNameStatic {
  715. get {
  716. return GetTypeNameStatic ();
  717. }
  718. }
  719. /// <summary>
  720. /// Return cursor.
  721. /// Or
  722. /// Set cursor UI element.
  723. /// </summary>
  724. public Cursor Cursor {
  725. get {
  726. return GetCursor ();
  727. }
  728. set {
  729. SetCursor (value);
  730. }
  731. }
  732. /// <summary>
  733. /// Return clipboard text.
  734. /// Or
  735. /// Set clipboard text.
  736. /// </summary>
  737. public string ClipboardText {
  738. get {
  739. return GetClipboardText ();
  740. }
  741. set {
  742. SetClipboardText (value);
  743. }
  744. }
  745. /// <summary>
  746. /// Return UI element double click interval in seconds.
  747. /// Or
  748. /// Set UI element double click interval in seconds.
  749. /// </summary>
  750. public float DoubleClickInterval {
  751. get {
  752. return GetDoubleClickInterval ();
  753. }
  754. set {
  755. SetDoubleClickInterval (value);
  756. }
  757. }
  758. /// <summary>
  759. /// Return UI drag start event interval in seconds.
  760. /// Or
  761. /// Set UI drag event start interval in seconds.
  762. /// </summary>
  763. public float DragBeginInterval {
  764. get {
  765. return GetDragBeginInterval ();
  766. }
  767. set {
  768. SetDragBeginInterval (value);
  769. }
  770. }
  771. /// <summary>
  772. /// Return UI drag start event distance threshold in pixels.
  773. /// Or
  774. /// Set UI drag event start distance threshold in pixels.
  775. /// </summary>
  776. public int DragBeginDistance {
  777. get {
  778. return GetDragBeginDistance ();
  779. }
  780. set {
  781. SetDragBeginDistance (value);
  782. }
  783. }
  784. /// <summary>
  785. /// Return tooltip default display delay in seconds.
  786. /// Or
  787. /// Set tooltip default display delay in seconds.
  788. /// </summary>
  789. public float DefaultToolTipDelay {
  790. get {
  791. return GetDefaultToolTipDelay ();
  792. }
  793. set {
  794. SetDefaultToolTipDelay (value);
  795. }
  796. }
  797. /// <summary>
  798. /// Return font texture maximum size.
  799. /// Or
  800. /// Set maximum font face texture size. Must be a power of two. Default is 2048.
  801. /// </summary>
  802. public int MaxFontTextureSize {
  803. get {
  804. return GetMaxFontTextureSize ();
  805. }
  806. set {
  807. SetMaxFontTextureSize (value);
  808. }
  809. }
  810. /// <summary>
  811. /// Return whether mouse wheel can control also a non-focused element.
  812. /// Or
  813. /// Set whether mouse wheel can control also a non-focused element.
  814. /// </summary>
  815. public bool NonFocusedMouseWheel {
  816. get {
  817. return IsNonFocusedMouseWheel ();
  818. }
  819. set {
  820. SetNonFocusedMouseWheel (value);
  821. }
  822. }
  823. /// <summary>
  824. /// Return whether is using the system clipboard.
  825. /// Or
  826. /// Set whether to use system clipboard. Default false.
  827. /// </summary>
  828. public bool UseSystemClipboard {
  829. get {
  830. return GetUseSystemClipboard ();
  831. }
  832. set {
  833. SetUseSystemClipboard (value);
  834. }
  835. }
  836. /// <summary>
  837. /// Return whether focusing a %LineEdit will show the on-screen keyboard.
  838. /// Or
  839. /// Set whether to show the on-screen keyboard (if supported) when a %LineEdit is focused. Default true on mobile devices.
  840. /// </summary>
  841. public bool UseScreenKeyboard {
  842. get {
  843. return GetUseScreenKeyboard ();
  844. }
  845. set {
  846. SetUseScreenKeyboard (value);
  847. }
  848. }
  849. /// <summary>
  850. /// Return whether is using mutable (eraseable) glyphs for fonts.
  851. /// Or
  852. /// Set whether to use mutable (eraseable) glyphs to ensure a font face never expands to more than one texture. Default false.
  853. /// </summary>
  854. public bool UseMutableGlyphs {
  855. get {
  856. return GetUseMutableGlyphs ();
  857. }
  858. set {
  859. SetUseMutableGlyphs (value);
  860. }
  861. }
  862. /// <summary>
  863. /// Return whether is using forced autohinting.
  864. /// Or
  865. /// Set whether to force font autohinting instead of using FreeType's TTF bytecode interpreter.
  866. /// </summary>
  867. public bool ForceAutoHint {
  868. get {
  869. return GetForceAutoHint ();
  870. }
  871. set {
  872. SetForceAutoHint (value);
  873. }
  874. }
  875. /// <summary>
  876. /// Return the current FreeType font hinting level.
  877. /// Or
  878. /// Set the hinting level used by FreeType fonts.
  879. /// </summary>
  880. public FontHintLevel FontHintLevel {
  881. get {
  882. return GetFontHintLevel ();
  883. }
  884. set {
  885. SetFontHintLevel (value);
  886. }
  887. }
  888. /// <summary>
  889. /// Get the font subpixel threshold. Below this size, if the hint level is LIGHT or NONE, fonts will use subpixel positioning plus oversampling for higher-quality rendering. Has no effect at hint level NORMAL.
  890. /// Or
  891. /// Set the font subpixel threshold. Below this size, if the hint level is LIGHT or NONE, fonts will use subpixel positioning plus oversampling for higher-quality rendering. Has no effect at hint level NORMAL.
  892. /// </summary>
  893. public float FontSubpixelThreshold {
  894. get {
  895. return GetFontSubpixelThreshold ();
  896. }
  897. set {
  898. SetFontSubpixelThreshold (value);
  899. }
  900. }
  901. /// <summary>
  902. /// Get the oversampling (horizonal stretching) used to improve subpixel font rendering. Only affects fonts smaller than the subpixel limit.
  903. /// Or
  904. /// Set the oversampling (horizonal stretching) used to improve subpixel font rendering. Only affects fonts smaller than the subpixel limit.
  905. /// </summary>
  906. public int FontOversampling {
  907. get {
  908. return GetFontOversampling ();
  909. }
  910. set {
  911. SetFontOversampling (value);
  912. }
  913. }
  914. /// <summary>
  915. /// Return current UI scale.
  916. /// Or
  917. /// Set %UI scale. 1.0 is default (pixel perfect). Resize the root element to match.
  918. /// </summary>
  919. public float Scale {
  920. get {
  921. return GetScale ();
  922. }
  923. set {
  924. SetScale (value);
  925. }
  926. }
  927. /// <summary>
  928. /// Return root element custom size. Returns 0,0 when custom size is not being used and automatic resizing according to window size is in use instead (default.)
  929. /// Or
  930. /// Set custom size of the root element. This disables automatic resizing of the root element according to window size. Set custom size 0,0 to return to automatic resizing.
  931. /// </summary>
  932. public Urho.IntVector2 CustomSize {
  933. get {
  934. return GetCustomSize ();
  935. }
  936. set {
  937. SetCustomSize (value);
  938. }
  939. }
  940. /// <summary>
  941. /// Return root UI element.
  942. /// </summary>
  943. public UIElement Root {
  944. get {
  945. return GetRoot ();
  946. }
  947. }
  948. /// <summary>
  949. /// Return root modal element.
  950. /// </summary>
  951. public UIElement RootModalElement {
  952. get {
  953. return GetRootModalElement ();
  954. }
  955. }
  956. /// <summary>
  957. /// Return cursor position.
  958. /// </summary>
  959. public Urho.IntVector2 CursorPosition {
  960. get {
  961. return GetCursorPosition ();
  962. }
  963. }
  964. /// <summary>
  965. /// Return focused element.
  966. /// </summary>
  967. public UIElement FocusElement {
  968. get {
  969. return GetFocusElement ();
  970. }
  971. }
  972. /// <summary>
  973. /// Return topmost enabled root-level non-modal element.
  974. /// </summary>
  975. public UIElement FrontElement {
  976. get {
  977. return GetFrontElement ();
  978. }
  979. }
  980. /// <summary>
  981. /// Return the number of currently dragged elements.
  982. /// </summary>
  983. public uint NumDragElements {
  984. get {
  985. return GetNumDragElements ();
  986. }
  987. }
  988. /// <summary>
  989. /// Return whether a drag is in progress.
  990. /// </summary>
  991. public bool Dragging {
  992. get {
  993. return IsDragging ();
  994. }
  995. }
  996. }
  997. }