Cursor.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // Cursor.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. /// Mouse cursor %UI element.
  21. /// </summary>
  22. public unsafe partial class Cursor : BorderImage
  23. {
  24. unsafe partial void OnCursorCreated ();
  25. [Preserve]
  26. public Cursor (IntPtr handle) : base (handle)
  27. {
  28. OnCursorCreated ();
  29. }
  30. [Preserve]
  31. protected Cursor (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnCursorCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int Cursor_GetType (IntPtr handle);
  37. private StringHash UrhoGetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (Cursor_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr Cursor_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (Cursor_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int Cursor_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(Cursor));
  54. return new StringHash (Cursor_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr Cursor_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(Cursor));
  61. return Marshal.PtrToStringAnsi (Cursor_GetTypeNameStatic ());
  62. }
  63. [Preserve]
  64. public Cursor () : this (Application.CurrentContext)
  65. {
  66. }
  67. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  68. internal static extern IntPtr Cursor_Cursor (IntPtr context);
  69. [Preserve]
  70. public Cursor (Context context) : base (UrhoObjectFlag.Empty)
  71. {
  72. Runtime.Validate (typeof(Cursor));
  73. handle = Cursor_Cursor ((object)context == null ? IntPtr.Zero : context.Handle);
  74. Runtime.RegisterObject (this);
  75. OnCursorCreated ();
  76. }
  77. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  78. internal static extern void Cursor_RegisterObject (IntPtr context);
  79. /// <summary>
  80. /// Register object factory.
  81. /// </summary>
  82. public new static void RegisterObject (Context context)
  83. {
  84. Runtime.Validate (typeof(Cursor));
  85. Cursor_RegisterObject ((object)context == null ? IntPtr.Zero : context.Handle);
  86. }
  87. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  88. internal static extern void Cursor_DefineShape (IntPtr handle, string shape, IntPtr image, ref Urho.IntRect imageRect, ref Urho.IntVector2 hotSpot);
  89. /// <summary>
  90. /// Define a shape.
  91. /// </summary>
  92. public void DefineShape (string shape, Image image, Urho.IntRect imageRect, Urho.IntVector2 hotSpot)
  93. {
  94. Runtime.ValidateRefCounted (this);
  95. Cursor_DefineShape (handle, shape, (object)image == null ? IntPtr.Zero : image.Handle, ref imageRect, ref hotSpot);
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern void Cursor_DefineShape0 (IntPtr handle, CursorShape shape, IntPtr image, ref Urho.IntRect imageRect, ref Urho.IntVector2 hotSpot);
  99. /// <summary>
  100. /// Define a shape.
  101. /// </summary>
  102. public void DefineShape (CursorShape shape, Image image, Urho.IntRect imageRect, Urho.IntVector2 hotSpot)
  103. {
  104. Runtime.ValidateRefCounted (this);
  105. Cursor_DefineShape0 (handle, shape, (object)image == null ? IntPtr.Zero : image.Handle, ref imageRect, ref hotSpot);
  106. }
  107. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  108. internal static extern void Cursor_SetShape (IntPtr handle, string shape);
  109. /// <summary>
  110. /// Set current shape.
  111. /// </summary>
  112. private void SetShape (string shape)
  113. {
  114. Runtime.ValidateRefCounted (this);
  115. Cursor_SetShape (handle, shape);
  116. }
  117. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  118. internal static extern void Cursor_SetShape1 (IntPtr handle, CursorShape shape);
  119. /// <summary>
  120. /// Set current shape.
  121. /// </summary>
  122. public void SetShape (CursorShape shape)
  123. {
  124. Runtime.ValidateRefCounted (this);
  125. Cursor_SetShape1 (handle, shape);
  126. }
  127. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  128. internal static extern void Cursor_SetUseSystemShapes (IntPtr handle, bool enable);
  129. /// <summary>
  130. /// Set whether to use system default shapes. Is only possible when the OS mouse cursor has been set visible from the Input subsystem.
  131. /// </summary>
  132. private void SetUseSystemShapes (bool enable)
  133. {
  134. Runtime.ValidateRefCounted (this);
  135. Cursor_SetUseSystemShapes (handle, enable);
  136. }
  137. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  138. internal static extern IntPtr Cursor_GetShape (IntPtr handle);
  139. /// <summary>
  140. /// Get current shape.
  141. /// </summary>
  142. private string GetShape ()
  143. {
  144. Runtime.ValidateRefCounted (this);
  145. return Marshal.PtrToStringAnsi (Cursor_GetShape (handle));
  146. }
  147. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  148. internal static extern bool Cursor_GetUseSystemShapes (IntPtr handle);
  149. /// <summary>
  150. /// Return whether is using system default shapes.
  151. /// </summary>
  152. private bool GetUseSystemShapes ()
  153. {
  154. Runtime.ValidateRefCounted (this);
  155. return Cursor_GetUseSystemShapes (handle);
  156. }
  157. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  158. internal static extern void Cursor_ApplyOSCursorShape (IntPtr handle);
  159. /// <summary>
  160. /// Apply pending OS cursor shape. Called by UI. No-op when the OS mouse pointer is not used.
  161. /// </summary>
  162. public void ApplyOSCursorShape ()
  163. {
  164. Runtime.ValidateRefCounted (this);
  165. Cursor_ApplyOSCursorShape (handle);
  166. }
  167. public override StringHash Type {
  168. get {
  169. return UrhoGetType ();
  170. }
  171. }
  172. public override string TypeName {
  173. get {
  174. return GetTypeName ();
  175. }
  176. }
  177. [Preserve]
  178. public new static StringHash TypeStatic {
  179. get {
  180. return GetTypeStatic ();
  181. }
  182. }
  183. public new static string TypeNameStatic {
  184. get {
  185. return GetTypeNameStatic ();
  186. }
  187. }
  188. /// <summary>
  189. /// Get current shape.
  190. /// Or
  191. /// Set current shape.
  192. /// </summary>
  193. public string Shape {
  194. get {
  195. return GetShape ();
  196. }
  197. set {
  198. SetShape (value);
  199. }
  200. }
  201. /// <summary>
  202. /// Return whether is using system default shapes.
  203. /// Or
  204. /// Set whether to use system default shapes. Is only possible when the OS mouse cursor has been set visible from the Input subsystem.
  205. /// </summary>
  206. public bool UseSystemShapes {
  207. get {
  208. return GetUseSystemShapes ();
  209. }
  210. set {
  211. SetUseSystemShapes (value);
  212. }
  213. }
  214. }
  215. }