Text.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // Text.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. /// %Text %UI element.
  21. /// </summary>
  22. public unsafe partial class Text : UIElement
  23. {
  24. unsafe partial void OnTextCreated ();
  25. [Preserve]
  26. public Text (IntPtr handle) : base (handle)
  27. {
  28. OnTextCreated ();
  29. }
  30. [Preserve]
  31. protected Text (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnTextCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int Text_GetType (IntPtr handle);
  37. private StringHash UrhoGetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (Text_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr Text_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (Text_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int Text_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(Text));
  54. return new StringHash (Text_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr Text_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(Text));
  61. return Marshal.PtrToStringAnsi (Text_GetTypeNameStatic ());
  62. }
  63. [Preserve]
  64. public Text () : this (Application.CurrentContext)
  65. {
  66. }
  67. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  68. internal static extern IntPtr Text_Text (IntPtr context);
  69. [Preserve]
  70. public Text (Context context) : base (UrhoObjectFlag.Empty)
  71. {
  72. Runtime.Validate (typeof(Text));
  73. handle = Text_Text ((object)context == null ? IntPtr.Zero : context.Handle);
  74. Runtime.RegisterObject (this);
  75. OnTextCreated ();
  76. }
  77. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  78. internal static extern void Text_RegisterObject (IntPtr context);
  79. /// <summary>
  80. /// Register object factory.
  81. /// </summary>
  82. public new static void RegisterObject (Context context)
  83. {
  84. Runtime.Validate (typeof(Text));
  85. Text_RegisterObject ((object)context == null ? IntPtr.Zero : context.Handle);
  86. }
  87. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  88. internal static extern void Text_ApplyAttributes (IntPtr handle);
  89. /// <summary>
  90. /// Apply attribute changes that can not be applied immediately.
  91. /// </summary>
  92. public override void ApplyAttributes ()
  93. {
  94. Runtime.ValidateRefCounted (this);
  95. Text_ApplyAttributes (handle);
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern void Text_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. Text_OnResize (handle, ref newSize, ref delta);
  106. }
  107. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  108. internal static extern void Text_OnIndentSet (IntPtr handle);
  109. /// <summary>
  110. /// React to indent change.
  111. /// </summary>
  112. public override void OnIndentSet ()
  113. {
  114. Runtime.ValidateRefCounted (this);
  115. Text_OnIndentSet (handle);
  116. }
  117. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  118. internal static extern bool Text_SetFont (IntPtr handle, string fontName, float size);
  119. /// <summary>
  120. /// Set font by looking from resource cache by name and font size. Return true if successful.
  121. /// </summary>
  122. public bool SetFont (string fontName, float size)
  123. {
  124. Runtime.ValidateRefCounted (this);
  125. return Text_SetFont (handle, fontName, size);
  126. }
  127. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  128. internal static extern bool Text_SetFont0 (IntPtr handle, IntPtr font, float size);
  129. /// <summary>
  130. /// Set font and font size. Return true if successful.
  131. /// </summary>
  132. public bool SetFont (Font font, float size)
  133. {
  134. Runtime.ValidateRefCounted (this);
  135. return Text_SetFont0 (handle, (object)font == null ? IntPtr.Zero : font.Handle, size);
  136. }
  137. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  138. internal static extern bool Text_SetFontSize (IntPtr handle, float size);
  139. /// <summary>
  140. /// Set font size only while retaining the existing font. Return true if successful.
  141. /// </summary>
  142. public bool SetFontSize (float size)
  143. {
  144. Runtime.ValidateRefCounted (this);
  145. return Text_SetFontSize (handle, size);
  146. }
  147. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  148. internal static extern void Text_SetText (IntPtr handle, string text);
  149. /// <summary>
  150. /// Set text. Text is assumed to be either ASCII or UTF8-encoded.
  151. /// </summary>
  152. private void SetText (string text)
  153. {
  154. Runtime.ValidateRefCounted (this);
  155. Text_SetText (handle, text);
  156. }
  157. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  158. internal static extern void Text_SetTextAlignment (IntPtr handle, HorizontalAlignment align);
  159. /// <summary>
  160. /// Set row alignment.
  161. /// </summary>
  162. private void SetTextAlignment (HorizontalAlignment align)
  163. {
  164. Runtime.ValidateRefCounted (this);
  165. Text_SetTextAlignment (handle, align);
  166. }
  167. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  168. internal static extern void Text_SetRowSpacing (IntPtr handle, float spacing);
  169. /// <summary>
  170. /// Set row spacing, 1.0 for original font spacing.
  171. /// </summary>
  172. private void SetRowSpacing (float spacing)
  173. {
  174. Runtime.ValidateRefCounted (this);
  175. Text_SetRowSpacing (handle, spacing);
  176. }
  177. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  178. internal static extern void Text_SetWordwrap (IntPtr handle, bool enable);
  179. /// <summary>
  180. /// Set wordwrap. In wordwrap mode the text element will respect its current width. Otherwise it resizes itself freely.
  181. /// </summary>
  182. private void SetWordwrap (bool enable)
  183. {
  184. Runtime.ValidateRefCounted (this);
  185. Text_SetWordwrap (handle, enable);
  186. }
  187. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  188. internal static extern void Text_SetAutoLocalizable (IntPtr handle, bool enable);
  189. /// <summary>
  190. /// The text will be automatically translated. The text value used as string identifier.
  191. /// </summary>
  192. private void SetAutoLocalizable (bool enable)
  193. {
  194. Runtime.ValidateRefCounted (this);
  195. Text_SetAutoLocalizable (handle, enable);
  196. }
  197. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  198. internal static extern void Text_SetSelection (IntPtr handle, uint start, uint length);
  199. /// <summary>
  200. /// Set selection. When length is not provided, select until the text ends.
  201. /// </summary>
  202. public void SetSelection (uint start, uint length = uint.MaxValue)
  203. {
  204. Runtime.ValidateRefCounted (this);
  205. Text_SetSelection (handle, start, length);
  206. }
  207. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  208. internal static extern void Text_ClearSelection (IntPtr handle);
  209. /// <summary>
  210. /// Clear selection.
  211. /// </summary>
  212. public void ClearSelection ()
  213. {
  214. Runtime.ValidateRefCounted (this);
  215. Text_ClearSelection (handle);
  216. }
  217. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  218. internal static extern void Text_SetSelectionColor (IntPtr handle, ref Urho.Color color);
  219. /// <summary>
  220. /// Set selection background color. Color with 0 alpha (default) disables.
  221. /// </summary>
  222. private void SetSelectionColor (Urho.Color color)
  223. {
  224. Runtime.ValidateRefCounted (this);
  225. Text_SetSelectionColor (handle, ref color);
  226. }
  227. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  228. internal static extern void Text_SetHoverColor (IntPtr handle, ref Urho.Color color);
  229. /// <summary>
  230. /// Set hover background color. Color with 0 alpha (default) disables.
  231. /// </summary>
  232. private void SetHoverColor (Urho.Color color)
  233. {
  234. Runtime.ValidateRefCounted (this);
  235. Text_SetHoverColor (handle, ref color);
  236. }
  237. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  238. internal static extern void Text_SetTextEffect (IntPtr handle, TextEffect textEffect);
  239. /// <summary>
  240. /// Set text effect.
  241. /// </summary>
  242. private void SetTextEffect (TextEffect textEffect)
  243. {
  244. Runtime.ValidateRefCounted (this);
  245. Text_SetTextEffect (handle, textEffect);
  246. }
  247. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  248. internal static extern void Text_SetEffectShadowOffset (IntPtr handle, ref Urho.IntVector2 offset);
  249. /// <summary>
  250. /// Set shadow offset.
  251. /// </summary>
  252. private void SetEffectShadowOffset (Urho.IntVector2 offset)
  253. {
  254. Runtime.ValidateRefCounted (this);
  255. Text_SetEffectShadowOffset (handle, ref offset);
  256. }
  257. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  258. internal static extern void Text_SetEffectStrokeThickness (IntPtr handle, int thickness);
  259. /// <summary>
  260. /// Set stroke thickness.
  261. /// </summary>
  262. private void SetEffectStrokeThickness (int thickness)
  263. {
  264. Runtime.ValidateRefCounted (this);
  265. Text_SetEffectStrokeThickness (handle, thickness);
  266. }
  267. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  268. internal static extern void Text_SetEffectRoundStroke (IntPtr handle, bool roundStroke);
  269. /// <summary>
  270. /// Set stroke rounding. Corners of the font will be rounded off in the stroke so the stroke won't have corners.
  271. /// </summary>
  272. private void SetEffectRoundStroke (bool roundStroke)
  273. {
  274. Runtime.ValidateRefCounted (this);
  275. Text_SetEffectRoundStroke (handle, roundStroke);
  276. }
  277. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  278. internal static extern void Text_SetEffectColor (IntPtr handle, ref Urho.Color effectColor);
  279. /// <summary>
  280. /// Set effect color.
  281. /// </summary>
  282. private void SetEffectColor (Urho.Color effectColor)
  283. {
  284. Runtime.ValidateRefCounted (this);
  285. Text_SetEffectColor (handle, ref effectColor);
  286. }
  287. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  288. internal static extern IntPtr Text_GetFont (IntPtr handle);
  289. /// <summary>
  290. /// Return font.
  291. /// </summary>
  292. private Font GetFont ()
  293. {
  294. Runtime.ValidateRefCounted (this);
  295. return Runtime.LookupObject<Font> (Text_GetFont (handle));
  296. }
  297. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  298. internal static extern float Text_GetFontSize (IntPtr handle);
  299. /// <summary>
  300. /// Return font size.
  301. /// </summary>
  302. private float GetFontSize ()
  303. {
  304. Runtime.ValidateRefCounted (this);
  305. return Text_GetFontSize (handle);
  306. }
  307. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  308. internal static extern IntPtr Text_GetText (IntPtr handle);
  309. /// <summary>
  310. /// Return text.
  311. /// </summary>
  312. private string GetText ()
  313. {
  314. Runtime.ValidateRefCounted (this);
  315. return Marshal.PtrToStringAnsi (Text_GetText (handle));
  316. }
  317. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  318. internal static extern HorizontalAlignment Text_GetTextAlignment (IntPtr handle);
  319. /// <summary>
  320. /// Return row alignment.
  321. /// </summary>
  322. private HorizontalAlignment GetTextAlignment ()
  323. {
  324. Runtime.ValidateRefCounted (this);
  325. return Text_GetTextAlignment (handle);
  326. }
  327. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  328. internal static extern float Text_GetRowSpacing (IntPtr handle);
  329. /// <summary>
  330. /// Return row spacing.
  331. /// </summary>
  332. private float GetRowSpacing ()
  333. {
  334. Runtime.ValidateRefCounted (this);
  335. return Text_GetRowSpacing (handle);
  336. }
  337. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  338. internal static extern bool Text_GetWordwrap (IntPtr handle);
  339. /// <summary>
  340. /// Return wordwrap mode.
  341. /// </summary>
  342. private bool GetWordwrap ()
  343. {
  344. Runtime.ValidateRefCounted (this);
  345. return Text_GetWordwrap (handle);
  346. }
  347. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  348. internal static extern bool Text_GetAutoLocalizable (IntPtr handle);
  349. /// <summary>
  350. /// Return auto localizable mode.
  351. /// </summary>
  352. private bool GetAutoLocalizable ()
  353. {
  354. Runtime.ValidateRefCounted (this);
  355. return Text_GetAutoLocalizable (handle);
  356. }
  357. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  358. internal static extern uint Text_GetSelectionStart (IntPtr handle);
  359. /// <summary>
  360. /// Return selection start.
  361. /// </summary>
  362. private uint GetSelectionStart ()
  363. {
  364. Runtime.ValidateRefCounted (this);
  365. return Text_GetSelectionStart (handle);
  366. }
  367. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  368. internal static extern uint Text_GetSelectionLength (IntPtr handle);
  369. /// <summary>
  370. /// Return selection length.
  371. /// </summary>
  372. private uint GetSelectionLength ()
  373. {
  374. Runtime.ValidateRefCounted (this);
  375. return Text_GetSelectionLength (handle);
  376. }
  377. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  378. internal static extern Urho.Color Text_GetSelectionColor (IntPtr handle);
  379. /// <summary>
  380. /// Return selection background color.
  381. /// </summary>
  382. private Urho.Color GetSelectionColor ()
  383. {
  384. Runtime.ValidateRefCounted (this);
  385. return Text_GetSelectionColor (handle);
  386. }
  387. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  388. internal static extern Urho.Color Text_GetHoverColor (IntPtr handle);
  389. /// <summary>
  390. /// Return hover background color.
  391. /// </summary>
  392. private Urho.Color GetHoverColor ()
  393. {
  394. Runtime.ValidateRefCounted (this);
  395. return Text_GetHoverColor (handle);
  396. }
  397. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  398. internal static extern TextEffect Text_GetTextEffect (IntPtr handle);
  399. /// <summary>
  400. /// Return text effect.
  401. /// </summary>
  402. private TextEffect GetTextEffect ()
  403. {
  404. Runtime.ValidateRefCounted (this);
  405. return Text_GetTextEffect (handle);
  406. }
  407. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  408. internal static extern Urho.IntVector2 Text_GetEffectShadowOffset (IntPtr handle);
  409. /// <summary>
  410. /// Return effect shadow offset.
  411. /// </summary>
  412. private Urho.IntVector2 GetEffectShadowOffset ()
  413. {
  414. Runtime.ValidateRefCounted (this);
  415. return Text_GetEffectShadowOffset (handle);
  416. }
  417. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  418. internal static extern int Text_GetEffectStrokeThickness (IntPtr handle);
  419. /// <summary>
  420. /// Return effect stroke thickness.
  421. /// </summary>
  422. private int GetEffectStrokeThickness ()
  423. {
  424. Runtime.ValidateRefCounted (this);
  425. return Text_GetEffectStrokeThickness (handle);
  426. }
  427. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  428. internal static extern bool Text_GetEffectRoundStroke (IntPtr handle);
  429. /// <summary>
  430. /// Return effect round stroke.
  431. /// </summary>
  432. private bool GetEffectRoundStroke ()
  433. {
  434. Runtime.ValidateRefCounted (this);
  435. return Text_GetEffectRoundStroke (handle);
  436. }
  437. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  438. internal static extern Urho.Color Text_GetEffectColor (IntPtr handle);
  439. /// <summary>
  440. /// Return effect color.
  441. /// </summary>
  442. private Urho.Color GetEffectColor ()
  443. {
  444. Runtime.ValidateRefCounted (this);
  445. return Text_GetEffectColor (handle);
  446. }
  447. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  448. internal static extern float Text_GetRowHeight (IntPtr handle);
  449. /// <summary>
  450. /// Return row height.
  451. /// </summary>
  452. private float GetRowHeight ()
  453. {
  454. Runtime.ValidateRefCounted (this);
  455. return Text_GetRowHeight (handle);
  456. }
  457. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  458. internal static extern uint Text_GetNumRows (IntPtr handle);
  459. /// <summary>
  460. /// Return number of rows.
  461. /// </summary>
  462. private uint GetNumRows ()
  463. {
  464. Runtime.ValidateRefCounted (this);
  465. return Text_GetNumRows (handle);
  466. }
  467. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  468. internal static extern uint Text_GetNumChars (IntPtr handle);
  469. /// <summary>
  470. /// Return number of characters.
  471. /// </summary>
  472. private uint GetNumChars ()
  473. {
  474. Runtime.ValidateRefCounted (this);
  475. return Text_GetNumChars (handle);
  476. }
  477. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  478. internal static extern float Text_GetRowWidth (IntPtr handle, uint index);
  479. /// <summary>
  480. /// Return width of row by index.
  481. /// </summary>
  482. public float GetRowWidth (uint index)
  483. {
  484. Runtime.ValidateRefCounted (this);
  485. return Text_GetRowWidth (handle, index);
  486. }
  487. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  488. internal static extern Vector2 Text_GetCharPosition (IntPtr handle, uint index);
  489. /// <summary>
  490. /// Return position of character by index relative to the text element origin.
  491. /// </summary>
  492. public Vector2 GetCharPosition (uint index)
  493. {
  494. Runtime.ValidateRefCounted (this);
  495. return Text_GetCharPosition (handle, index);
  496. }
  497. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  498. internal static extern Vector2 Text_GetCharSize (IntPtr handle, uint index);
  499. /// <summary>
  500. /// Return size of character by index.
  501. /// </summary>
  502. public Vector2 GetCharSize (uint index)
  503. {
  504. Runtime.ValidateRefCounted (this);
  505. return Text_GetCharSize (handle, index);
  506. }
  507. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  508. internal static extern void Text_SetEffectDepthBias (IntPtr handle, float bias);
  509. /// <summary>
  510. /// Set text effect Z bias. Zero by default, adjusted only in 3D mode.
  511. /// </summary>
  512. private void SetEffectDepthBias (float bias)
  513. {
  514. Runtime.ValidateRefCounted (this);
  515. Text_SetEffectDepthBias (handle, bias);
  516. }
  517. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  518. internal static extern float Text_GetEffectDepthBias (IntPtr handle);
  519. /// <summary>
  520. /// Return effect Z bias.
  521. /// </summary>
  522. private float GetEffectDepthBias ()
  523. {
  524. Runtime.ValidateRefCounted (this);
  525. return Text_GetEffectDepthBias (handle);
  526. }
  527. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  528. internal static extern ResourceRef Text_GetFontAttr (IntPtr handle);
  529. /// <summary>
  530. /// Return font attribute.
  531. /// </summary>
  532. private ResourceRef GetFontAttr ()
  533. {
  534. Runtime.ValidateRefCounted (this);
  535. return Text_GetFontAttr (handle);
  536. }
  537. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  538. internal static extern void Text_SetTextAttr (IntPtr handle, string value);
  539. /// <summary>
  540. /// Set text attribute.
  541. /// </summary>
  542. public void SetTextAttr (string value)
  543. {
  544. Runtime.ValidateRefCounted (this);
  545. Text_SetTextAttr (handle, value);
  546. }
  547. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  548. internal static extern IntPtr Text_GetTextAttr (IntPtr handle);
  549. /// <summary>
  550. /// Return text attribute.
  551. /// </summary>
  552. private string GetTextAttr ()
  553. {
  554. Runtime.ValidateRefCounted (this);
  555. return Marshal.PtrToStringAnsi (Text_GetTextAttr (handle));
  556. }
  557. public override StringHash Type {
  558. get {
  559. return UrhoGetType ();
  560. }
  561. }
  562. public override string TypeName {
  563. get {
  564. return GetTypeName ();
  565. }
  566. }
  567. [Preserve]
  568. public new static StringHash TypeStatic {
  569. get {
  570. return GetTypeStatic ();
  571. }
  572. }
  573. public new static string TypeNameStatic {
  574. get {
  575. return GetTypeNameStatic ();
  576. }
  577. }
  578. /// <summary>
  579. /// Return font size.
  580. /// Or
  581. /// Set font size only while retaining the existing font. Return true if successful.
  582. /// </summary>
  583. public float FontSize {
  584. get {
  585. return GetFontSize ();
  586. }
  587. set {
  588. SetFontSize (value);
  589. }
  590. }
  591. /// <summary>
  592. /// Return text.
  593. /// Or
  594. /// Set text. Text is assumed to be either ASCII or UTF8-encoded.
  595. /// </summary>
  596. public string Value {
  597. get {
  598. return GetText ();
  599. }
  600. set {
  601. SetText (value);
  602. }
  603. }
  604. /// <summary>
  605. /// Return row alignment.
  606. /// Or
  607. /// Set row alignment.
  608. /// </summary>
  609. public HorizontalAlignment TextAlignment {
  610. get {
  611. return GetTextAlignment ();
  612. }
  613. set {
  614. SetTextAlignment (value);
  615. }
  616. }
  617. /// <summary>
  618. /// Return row spacing.
  619. /// Or
  620. /// Set row spacing, 1.0 for original font spacing.
  621. /// </summary>
  622. public float RowSpacing {
  623. get {
  624. return GetRowSpacing ();
  625. }
  626. set {
  627. SetRowSpacing (value);
  628. }
  629. }
  630. /// <summary>
  631. /// Return wordwrap mode.
  632. /// Or
  633. /// Set wordwrap. In wordwrap mode the text element will respect its current width. Otherwise it resizes itself freely.
  634. /// </summary>
  635. public bool Wordwrap {
  636. get {
  637. return GetWordwrap ();
  638. }
  639. set {
  640. SetWordwrap (value);
  641. }
  642. }
  643. /// <summary>
  644. /// Return auto localizable mode.
  645. /// Or
  646. /// The text will be automatically translated. The text value used as string identifier.
  647. /// </summary>
  648. public bool AutoLocalizable {
  649. get {
  650. return GetAutoLocalizable ();
  651. }
  652. set {
  653. SetAutoLocalizable (value);
  654. }
  655. }
  656. /// <summary>
  657. /// Return selection background color.
  658. /// Or
  659. /// Set selection background color. Color with 0 alpha (default) disables.
  660. /// </summary>
  661. public Urho.Color SelectionColor {
  662. get {
  663. return GetSelectionColor ();
  664. }
  665. set {
  666. SetSelectionColor (value);
  667. }
  668. }
  669. /// <summary>
  670. /// Return hover background color.
  671. /// Or
  672. /// Set hover background color. Color with 0 alpha (default) disables.
  673. /// </summary>
  674. public Urho.Color HoverColor {
  675. get {
  676. return GetHoverColor ();
  677. }
  678. set {
  679. SetHoverColor (value);
  680. }
  681. }
  682. /// <summary>
  683. /// Return text effect.
  684. /// Or
  685. /// Set text effect.
  686. /// </summary>
  687. public TextEffect TextEffect {
  688. get {
  689. return GetTextEffect ();
  690. }
  691. set {
  692. SetTextEffect (value);
  693. }
  694. }
  695. /// <summary>
  696. /// Return effect shadow offset.
  697. /// Or
  698. /// Set shadow offset.
  699. /// </summary>
  700. public Urho.IntVector2 EffectShadowOffset {
  701. get {
  702. return GetEffectShadowOffset ();
  703. }
  704. set {
  705. SetEffectShadowOffset (value);
  706. }
  707. }
  708. /// <summary>
  709. /// Return effect stroke thickness.
  710. /// Or
  711. /// Set stroke thickness.
  712. /// </summary>
  713. public int EffectStrokeThickness {
  714. get {
  715. return GetEffectStrokeThickness ();
  716. }
  717. set {
  718. SetEffectStrokeThickness (value);
  719. }
  720. }
  721. /// <summary>
  722. /// Return effect round stroke.
  723. /// Or
  724. /// Set stroke rounding. Corners of the font will be rounded off in the stroke so the stroke won't have corners.
  725. /// </summary>
  726. public bool EffectRoundStroke {
  727. get {
  728. return GetEffectRoundStroke ();
  729. }
  730. set {
  731. SetEffectRoundStroke (value);
  732. }
  733. }
  734. /// <summary>
  735. /// Return effect color.
  736. /// Or
  737. /// Set effect color.
  738. /// </summary>
  739. public Urho.Color EffectColor {
  740. get {
  741. return GetEffectColor ();
  742. }
  743. set {
  744. SetEffectColor (value);
  745. }
  746. }
  747. /// <summary>
  748. /// Return font.
  749. /// </summary>
  750. public Font Font {
  751. get {
  752. return GetFont ();
  753. }
  754. }
  755. /// <summary>
  756. /// Return selection start.
  757. /// </summary>
  758. public uint SelectionStart {
  759. get {
  760. return GetSelectionStart ();
  761. }
  762. }
  763. /// <summary>
  764. /// Return selection length.
  765. /// </summary>
  766. public uint SelectionLength {
  767. get {
  768. return GetSelectionLength ();
  769. }
  770. }
  771. /// <summary>
  772. /// Return row height.
  773. /// </summary>
  774. public float RowHeight {
  775. get {
  776. return GetRowHeight ();
  777. }
  778. }
  779. /// <summary>
  780. /// Return number of rows.
  781. /// </summary>
  782. public uint NumRows {
  783. get {
  784. return GetNumRows ();
  785. }
  786. }
  787. /// <summary>
  788. /// Return number of characters.
  789. /// </summary>
  790. public uint NumChars {
  791. get {
  792. return GetNumChars ();
  793. }
  794. }
  795. /// <summary>
  796. /// Return effect Z bias.
  797. /// Or
  798. /// Set text effect Z bias. Zero by default, adjusted only in 3D mode.
  799. /// </summary>
  800. public float EffectDepthBias {
  801. get {
  802. return GetEffectDepthBias ();
  803. }
  804. set {
  805. SetEffectDepthBias (value);
  806. }
  807. }
  808. /// <summary>
  809. /// Return font attribute.
  810. /// </summary>
  811. public ResourceRef FontAttr {
  812. get {
  813. return GetFontAttr ();
  814. }
  815. }
  816. /// <summary>
  817. /// Return text attribute.
  818. /// </summary>
  819. public string TextAttr {
  820. get {
  821. return GetTextAttr ();
  822. }
  823. }
  824. }
  825. }