Animatable.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // Animatable.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
  18. {
  19. /// <summary>
  20. /// Base class for animatable object, an animatable object can be set animation on it's attributes, or can be set an object animation to it.
  21. /// </summary>
  22. public unsafe partial class Animatable : Serializable
  23. {
  24. unsafe partial void OnAnimatableCreated ();
  25. [Preserve]
  26. public Animatable (IntPtr handle) : base (handle)
  27. {
  28. OnAnimatableCreated ();
  29. }
  30. [Preserve]
  31. protected Animatable (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnAnimatableCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int Animatable_GetType (IntPtr handle);
  37. private StringHash UrhoGetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (Animatable_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr Animatable_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (Animatable_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int Animatable_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(Animatable));
  54. return new StringHash (Animatable_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr Animatable_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(Animatable));
  61. return Marshal.PtrToStringAnsi (Animatable_GetTypeNameStatic ());
  62. }
  63. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  64. internal static extern void Animatable_RegisterObject (IntPtr context);
  65. /// <summary>
  66. /// Register object factory.
  67. /// </summary>
  68. public static void RegisterObject (Context context)
  69. {
  70. Runtime.Validate (typeof(Animatable));
  71. Animatable_RegisterObject ((object)context == null ? IntPtr.Zero : context.Handle);
  72. }
  73. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  74. internal static extern bool Animatable_LoadXML (IntPtr handle, IntPtr source, bool setInstanceDefault);
  75. /// <summary>
  76. /// Load from XML data. When setInstanceDefault is set to true, after setting the attribute value, store the value as instance's default value. Return true if successful.
  77. /// </summary>
  78. public override bool LoadXml (XmlElement source, bool setInstanceDefault = false)
  79. {
  80. Runtime.ValidateRefCounted (this);
  81. return Animatable_LoadXML (handle, (object)source == null ? IntPtr.Zero : source.Handle, setInstanceDefault);
  82. }
  83. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  84. internal static extern bool Animatable_SaveXML (IntPtr handle, IntPtr dest);
  85. /// <summary>
  86. /// Save as XML data. Return true if successful.
  87. /// </summary>
  88. public override bool SaveXml (XmlElement dest)
  89. {
  90. Runtime.ValidateRefCounted (this);
  91. return Animatable_SaveXML (handle, (object)dest == null ? IntPtr.Zero : dest.Handle);
  92. }
  93. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  94. internal static extern void Animatable_SetAnimationEnabled (IntPtr handle, bool enable);
  95. /// <summary>
  96. /// Set automatic update of animation, default true.
  97. /// </summary>
  98. private void SetAnimationEnabled (bool enable)
  99. {
  100. Runtime.ValidateRefCounted (this);
  101. Animatable_SetAnimationEnabled (handle, enable);
  102. }
  103. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  104. internal static extern void Animatable_SetAnimationTime (IntPtr handle, float time);
  105. /// <summary>
  106. /// Set time position of all attribute animations or an object animation manually. Automatic update should be disabled in this case.
  107. /// </summary>
  108. public void SetAnimationTime (float time)
  109. {
  110. Runtime.ValidateRefCounted (this);
  111. Animatable_SetAnimationTime (handle, time);
  112. }
  113. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  114. internal static extern void Animatable_SetObjectAnimation (IntPtr handle, IntPtr objectAnimation);
  115. /// <summary>
  116. /// Set object animation.
  117. /// </summary>
  118. private void SetObjectAnimation (ObjectAnimation objectAnimation)
  119. {
  120. Runtime.ValidateRefCounted (this);
  121. Animatable_SetObjectAnimation (handle, (object)objectAnimation == null ? IntPtr.Zero : objectAnimation.Handle);
  122. }
  123. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  124. internal static extern void Animatable_SetAttributeAnimation (IntPtr handle, string name, IntPtr attributeAnimation, WrapMode wrapMode, float speed);
  125. /// <summary>
  126. /// Set attribute animation.
  127. /// </summary>
  128. public void SetAttributeAnimation (string name, ValueAnimation attributeAnimation, WrapMode wrapMode = WrapMode.Loop, float speed = 1f)
  129. {
  130. Runtime.ValidateRefCounted (this);
  131. Animatable_SetAttributeAnimation (handle, name, (object)attributeAnimation == null ? IntPtr.Zero : attributeAnimation.Handle, wrapMode, speed);
  132. }
  133. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  134. internal static extern void Animatable_SetAttributeAnimationWrapMode (IntPtr handle, string name, WrapMode wrapMode);
  135. /// <summary>
  136. /// Set attribute animation wrap mode.
  137. /// </summary>
  138. public void SetAttributeAnimationWrapMode (string name, WrapMode wrapMode)
  139. {
  140. Runtime.ValidateRefCounted (this);
  141. Animatable_SetAttributeAnimationWrapMode (handle, name, wrapMode);
  142. }
  143. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  144. internal static extern void Animatable_SetAttributeAnimationSpeed (IntPtr handle, string name, float speed);
  145. /// <summary>
  146. /// Set attribute animation speed.
  147. /// </summary>
  148. public void SetAttributeAnimationSpeed (string name, float speed)
  149. {
  150. Runtime.ValidateRefCounted (this);
  151. Animatable_SetAttributeAnimationSpeed (handle, name, speed);
  152. }
  153. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  154. internal static extern void Animatable_SetAttributeAnimationTime (IntPtr handle, string name, float time);
  155. /// <summary>
  156. /// Set attribute animation time position manually. Automatic update should be disabled in this case.
  157. /// </summary>
  158. public void SetAttributeAnimationTime (string name, float time)
  159. {
  160. Runtime.ValidateRefCounted (this);
  161. Animatable_SetAttributeAnimationTime (handle, name, time);
  162. }
  163. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  164. internal static extern void Animatable_RemoveObjectAnimation (IntPtr handle);
  165. /// <summary>
  166. /// Remove object animation. Same as calling SetObjectAnimation with a null pointer.
  167. /// </summary>
  168. public void RemoveObjectAnimation ()
  169. {
  170. Runtime.ValidateRefCounted (this);
  171. Animatable_RemoveObjectAnimation (handle);
  172. }
  173. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  174. internal static extern void Animatable_RemoveAttributeAnimation (IntPtr handle, string name);
  175. /// <summary>
  176. /// Remove attribute animation. Same as calling SetAttributeAnimation with a null pointer.
  177. /// </summary>
  178. public void RemoveAttributeAnimation (string name)
  179. {
  180. Runtime.ValidateRefCounted (this);
  181. Animatable_RemoveAttributeAnimation (handle, name);
  182. }
  183. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  184. internal static extern bool Animatable_GetAnimationEnabled (IntPtr handle);
  185. /// <summary>
  186. /// Return animation enabled.
  187. /// </summary>
  188. private bool GetAnimationEnabled ()
  189. {
  190. Runtime.ValidateRefCounted (this);
  191. return Animatable_GetAnimationEnabled (handle);
  192. }
  193. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  194. internal static extern IntPtr Animatable_GetObjectAnimation (IntPtr handle);
  195. /// <summary>
  196. /// Return object animation.
  197. /// </summary>
  198. private ObjectAnimation GetObjectAnimation ()
  199. {
  200. Runtime.ValidateRefCounted (this);
  201. return Runtime.LookupObject<ObjectAnimation> (Animatable_GetObjectAnimation (handle));
  202. }
  203. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  204. internal static extern IntPtr Animatable_GetAttributeAnimation (IntPtr handle, string name);
  205. /// <summary>
  206. /// Return attribute animation.
  207. /// </summary>
  208. public ValueAnimation GetAttributeAnimation (string name)
  209. {
  210. Runtime.ValidateRefCounted (this);
  211. return Runtime.LookupObject<ValueAnimation> (Animatable_GetAttributeAnimation (handle, name));
  212. }
  213. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  214. internal static extern WrapMode Animatable_GetAttributeAnimationWrapMode (IntPtr handle, string name);
  215. /// <summary>
  216. /// Return attribute animation wrap mode.
  217. /// </summary>
  218. public WrapMode GetAttributeAnimationWrapMode (string name)
  219. {
  220. Runtime.ValidateRefCounted (this);
  221. return Animatable_GetAttributeAnimationWrapMode (handle, name);
  222. }
  223. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  224. internal static extern float Animatable_GetAttributeAnimationSpeed (IntPtr handle, string name);
  225. /// <summary>
  226. /// Return attribute animation speed.
  227. /// </summary>
  228. public float GetAttributeAnimationSpeed (string name)
  229. {
  230. Runtime.ValidateRefCounted (this);
  231. return Animatable_GetAttributeAnimationSpeed (handle, name);
  232. }
  233. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  234. internal static extern float Animatable_GetAttributeAnimationTime (IntPtr handle, string name);
  235. /// <summary>
  236. /// Return attribute animation time position.
  237. /// </summary>
  238. public float GetAttributeAnimationTime (string name)
  239. {
  240. Runtime.ValidateRefCounted (this);
  241. return Animatable_GetAttributeAnimationTime (handle, name);
  242. }
  243. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  244. internal static extern ResourceRef Animatable_GetObjectAnimationAttr (IntPtr handle);
  245. /// <summary>
  246. /// Return object animation attribute.
  247. /// </summary>
  248. private ResourceRef GetObjectAnimationAttr ()
  249. {
  250. Runtime.ValidateRefCounted (this);
  251. return Animatable_GetObjectAnimationAttr (handle);
  252. }
  253. public override StringHash Type {
  254. get {
  255. return UrhoGetType ();
  256. }
  257. }
  258. public override string TypeName {
  259. get {
  260. return GetTypeName ();
  261. }
  262. }
  263. [Preserve]
  264. public new static StringHash TypeStatic {
  265. get {
  266. return GetTypeStatic ();
  267. }
  268. }
  269. public new static string TypeNameStatic {
  270. get {
  271. return GetTypeNameStatic ();
  272. }
  273. }
  274. /// <summary>
  275. /// Return animation enabled.
  276. /// Or
  277. /// Set automatic update of animation, default true.
  278. /// </summary>
  279. public bool AnimationEnabled {
  280. get {
  281. return GetAnimationEnabled ();
  282. }
  283. set {
  284. SetAnimationEnabled (value);
  285. }
  286. }
  287. /// <summary>
  288. /// Return object animation.
  289. /// Or
  290. /// Set object animation.
  291. /// </summary>
  292. public ObjectAnimation ObjectAnimation {
  293. get {
  294. return GetObjectAnimation ();
  295. }
  296. set {
  297. SetObjectAnimation (value);
  298. }
  299. }
  300. /// <summary>
  301. /// Return object animation attribute.
  302. /// </summary>
  303. public ResourceRef ObjectAnimationAttr {
  304. get {
  305. return GetObjectAnimationAttr ();
  306. }
  307. }
  308. }
  309. }