Component.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // Component.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 components. Components can be created to scene nodes.
  21. /// </summary>
  22. public unsafe partial class Component : Animatable
  23. {
  24. unsafe partial void OnComponentCreated ();
  25. [Preserve]
  26. public Component (IntPtr handle) : base (handle)
  27. {
  28. OnComponentCreated ();
  29. }
  30. [Preserve]
  31. protected Component (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnComponentCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int Component_GetType (IntPtr handle);
  37. private StringHash UrhoGetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (Component_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr Component_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (Component_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int Component_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(Component));
  54. return new StringHash (Component_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr Component_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(Component));
  61. return Marshal.PtrToStringAnsi (Component_GetTypeNameStatic ());
  62. }
  63. [Preserve]
  64. public Component () : this (Application.CurrentContext)
  65. {
  66. }
  67. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  68. internal static extern IntPtr Component_Component (IntPtr context);
  69. [Preserve]
  70. public Component (Context context) : base (UrhoObjectFlag.Empty)
  71. {
  72. Runtime.Validate (typeof(Component));
  73. handle = Component_Component ((object)context == null ? IntPtr.Zero : context.Handle);
  74. Runtime.RegisterObject (this);
  75. OnComponentCreated ();
  76. }
  77. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  78. internal static extern void Component_OnSetEnabled (IntPtr handle);
  79. /// <summary>
  80. /// Handle enabled/disabled state change.
  81. /// </summary>
  82. public virtual void OnSetEnabled ()
  83. {
  84. Runtime.ValidateRefCounted (this);
  85. Component_OnSetEnabled (handle);
  86. }
  87. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  88. internal static extern bool Component_Save_File (IntPtr handle, IntPtr dest);
  89. /// <summary>
  90. /// Save as binary data. Return true if successful.
  91. /// </summary>
  92. public override bool Save (File dest)
  93. {
  94. Runtime.ValidateRefCounted (this);
  95. return Component_Save_File (handle, (object)dest == null ? IntPtr.Zero : dest.Handle);
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern bool Component_Save_MemoryBuffer (IntPtr handle, IntPtr dest);
  99. /// <summary>
  100. /// Save as binary data. Return true if successful.
  101. /// </summary>
  102. public override bool Save (MemoryBuffer dest)
  103. {
  104. Runtime.ValidateRefCounted (this);
  105. return Component_Save_MemoryBuffer (handle, (object)dest == null ? IntPtr.Zero : dest.Handle);
  106. }
  107. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  108. internal static extern bool Component_SaveXML (IntPtr handle, IntPtr dest);
  109. /// <summary>
  110. /// Save as XML data. Return true if successful.
  111. /// </summary>
  112. public override bool SaveXml (XmlElement dest)
  113. {
  114. Runtime.ValidateRefCounted (this);
  115. return Component_SaveXML (handle, (object)dest == null ? IntPtr.Zero : dest.Handle);
  116. }
  117. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  118. internal static extern void Component_MarkNetworkUpdate (IntPtr handle);
  119. /// <summary>
  120. /// Mark for attribute check on the next network update.
  121. /// </summary>
  122. public override void MarkNetworkUpdate ()
  123. {
  124. Runtime.ValidateRefCounted (this);
  125. Component_MarkNetworkUpdate (handle);
  126. }
  127. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  128. internal static extern void Component_DrawDebugGeometry (IntPtr handle, IntPtr debug, bool depthTest);
  129. /// <summary>
  130. /// Visualize the component as debug geometry.
  131. /// </summary>
  132. public virtual void DrawDebugGeometry (DebugRenderer debug, bool depthTest)
  133. {
  134. Runtime.ValidateRefCounted (this);
  135. Component_DrawDebugGeometry (handle, (object)debug == null ? IntPtr.Zero : debug.Handle, depthTest);
  136. }
  137. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  138. internal static extern void Component_SetEnabled (IntPtr handle, bool enable);
  139. /// <summary>
  140. /// Set enabled/disabled state.
  141. /// </summary>
  142. private void SetEnabled (bool enable)
  143. {
  144. Runtime.ValidateRefCounted (this);
  145. Component_SetEnabled (handle, enable);
  146. }
  147. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  148. internal static extern void Component_Remove (IntPtr handle);
  149. /// <summary>
  150. /// Remove from the scene node. If no other shared pointer references exist, causes immediate deletion.
  151. /// </summary>
  152. public void Remove ()
  153. {
  154. Runtime.ValidateRefCounted (this);
  155. Component_Remove (handle);
  156. }
  157. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  158. internal static extern uint Component_GetID (IntPtr handle);
  159. /// <summary>
  160. /// Return ID.
  161. /// </summary>
  162. private uint GetID ()
  163. {
  164. Runtime.ValidateRefCounted (this);
  165. return Component_GetID (handle);
  166. }
  167. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  168. internal static extern IntPtr Component_GetNode (IntPtr handle);
  169. /// <summary>
  170. /// Return scene node.
  171. /// </summary>
  172. private Node GetNode ()
  173. {
  174. Runtime.ValidateRefCounted (this);
  175. return Runtime.LookupObject<Node> (Component_GetNode (handle));
  176. }
  177. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  178. internal static extern IntPtr Component_GetScene (IntPtr handle);
  179. /// <summary>
  180. /// Return the scene the node belongs to.
  181. /// </summary>
  182. private Scene GetScene ()
  183. {
  184. Runtime.ValidateRefCounted (this);
  185. return Runtime.LookupObject<Scene> (Component_GetScene (handle));
  186. }
  187. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  188. internal static extern bool Component_IsEnabled (IntPtr handle);
  189. /// <summary>
  190. /// Return whether is enabled.
  191. /// </summary>
  192. private bool IsEnabled ()
  193. {
  194. Runtime.ValidateRefCounted (this);
  195. return Component_IsEnabled (handle);
  196. }
  197. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  198. internal static extern bool Component_IsEnabledEffective (IntPtr handle);
  199. /// <summary>
  200. /// Return whether is effectively enabled (node is also enabled.)
  201. /// </summary>
  202. private bool IsEnabledEffective ()
  203. {
  204. Runtime.ValidateRefCounted (this);
  205. return Component_IsEnabledEffective (handle);
  206. }
  207. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  208. internal static extern IntPtr Component_GetComponent (IntPtr handle, int type);
  209. /// <summary>
  210. /// Return component in the same scene node by type. If there are several, returns the first.
  211. /// </summary>
  212. public Component GetComponent (StringHash type)
  213. {
  214. Runtime.ValidateRefCounted (this);
  215. return Runtime.LookupObject<Component> (Component_GetComponent (handle, type.Code));
  216. }
  217. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  218. internal static extern void Component_AddReplicationState (IntPtr handle, ComponentReplicationState* state);
  219. /// <summary>
  220. /// Add a replication state that is tracking this component.
  221. /// </summary>
  222. public void AddReplicationState (ComponentReplicationState* state)
  223. {
  224. Runtime.ValidateRefCounted (this);
  225. Component_AddReplicationState (handle, state);
  226. }
  227. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  228. internal static extern void Component_PrepareNetworkUpdate (IntPtr handle);
  229. /// <summary>
  230. /// Prepare network update by comparing attributes and marking replication states dirty as necessary.
  231. /// </summary>
  232. public void PrepareNetworkUpdate ()
  233. {
  234. Runtime.ValidateRefCounted (this);
  235. Component_PrepareNetworkUpdate (handle);
  236. }
  237. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  238. internal static extern void Component_CleanupConnection (IntPtr handle, IntPtr connection);
  239. /// <summary>
  240. /// Clean up all references to a network connection that is about to be removed.
  241. /// </summary>
  242. public void CleanupConnection (Connection connection)
  243. {
  244. Runtime.ValidateRefCounted (this);
  245. Component_CleanupConnection (handle, (object)connection == null ? IntPtr.Zero : connection.Handle);
  246. }
  247. public override StringHash Type {
  248. get {
  249. return UrhoGetType ();
  250. }
  251. }
  252. public override string TypeName {
  253. get {
  254. return GetTypeName ();
  255. }
  256. }
  257. [Preserve]
  258. public new static StringHash TypeStatic {
  259. get {
  260. return GetTypeStatic ();
  261. }
  262. }
  263. public new static string TypeNameStatic {
  264. get {
  265. return GetTypeNameStatic ();
  266. }
  267. }
  268. /// <summary>
  269. /// Return whether is enabled.
  270. /// Or
  271. /// Set enabled/disabled state.
  272. /// </summary>
  273. public bool Enabled {
  274. get {
  275. return IsEnabled ();
  276. }
  277. set {
  278. SetEnabled (value);
  279. }
  280. }
  281. /// <summary>
  282. /// Return ID.
  283. /// </summary>
  284. public uint ID {
  285. get {
  286. return GetID ();
  287. }
  288. }
  289. /// <summary>
  290. /// Return scene node.
  291. /// </summary>
  292. public Node Node {
  293. get {
  294. return GetNode ();
  295. }
  296. }
  297. /// <summary>
  298. /// Return the scene the node belongs to.
  299. /// </summary>
  300. public Scene Scene {
  301. get {
  302. return GetScene ();
  303. }
  304. }
  305. /// <summary>
  306. /// Return whether is effectively enabled (node is also enabled.)
  307. /// </summary>
  308. public bool EnabledEffective {
  309. get {
  310. return IsEnabledEffective ();
  311. }
  312. }
  313. }
  314. }