Button.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // Button.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. /// Push button %UI element.
  21. /// </summary>
  22. public unsafe partial class Button : BorderImage
  23. {
  24. unsafe partial void OnButtonCreated ();
  25. [Preserve]
  26. public Button (IntPtr handle) : base (handle)
  27. {
  28. OnButtonCreated ();
  29. }
  30. [Preserve]
  31. protected Button (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnButtonCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int Button_GetType (IntPtr handle);
  37. private StringHash UrhoGetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (Button_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr Button_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (Button_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int Button_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(Button));
  54. return new StringHash (Button_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr Button_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(Button));
  61. return Marshal.PtrToStringAnsi (Button_GetTypeNameStatic ());
  62. }
  63. [Preserve]
  64. public Button () : this (Application.CurrentContext)
  65. {
  66. }
  67. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  68. internal static extern IntPtr Button_Button (IntPtr context);
  69. [Preserve]
  70. public Button (Context context) : base (UrhoObjectFlag.Empty)
  71. {
  72. Runtime.Validate (typeof(Button));
  73. handle = Button_Button ((object)context == null ? IntPtr.Zero : context.Handle);
  74. Runtime.RegisterObject (this);
  75. OnButtonCreated ();
  76. }
  77. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  78. internal static extern void Button_RegisterObject (IntPtr context);
  79. /// <summary>
  80. /// Register object factory.
  81. /// </summary>
  82. public new static void RegisterObject (Context context)
  83. {
  84. Runtime.Validate (typeof(Button));
  85. Button_RegisterObject ((object)context == null ? IntPtr.Zero : context.Handle);
  86. }
  87. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  88. internal static extern void Button_Update (IntPtr handle, float timeStep);
  89. /// <summary>
  90. /// Perform UI element update.
  91. /// </summary>
  92. public override void Update (float timeStep)
  93. {
  94. Runtime.ValidateRefCounted (this);
  95. Button_Update (handle, timeStep);
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern void Button_OnClickBegin (IntPtr handle, ref Urho.IntVector2 position, ref Urho.IntVector2 screenPosition, int button, int buttons, int qualifiers, IntPtr cursor);
  99. /// <summary>
  100. /// React to mouse click begin.
  101. /// </summary>
  102. public override void OnClickBegin (Urho.IntVector2 position, Urho.IntVector2 screenPosition, int button, int buttons, int qualifiers, Cursor cursor)
  103. {
  104. Runtime.ValidateRefCounted (this);
  105. Button_OnClickBegin (handle, ref position, ref screenPosition, button, buttons, qualifiers, (object)cursor == null ? IntPtr.Zero : cursor.Handle);
  106. }
  107. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  108. internal static extern void Button_OnClickEnd (IntPtr handle, ref Urho.IntVector2 position, ref Urho.IntVector2 screenPosition, int button, int buttons, int qualifiers, IntPtr cursor, IntPtr beginElement);
  109. /// <summary>
  110. /// React to mouse click end.
  111. /// </summary>
  112. public override void OnClickEnd (Urho.IntVector2 position, Urho.IntVector2 screenPosition, int button, int buttons, int qualifiers, Cursor cursor, UIElement beginElement)
  113. {
  114. Runtime.ValidateRefCounted (this);
  115. Button_OnClickEnd (handle, ref position, ref screenPosition, button, buttons, qualifiers, (object)cursor == null ? IntPtr.Zero : cursor.Handle, (object)beginElement == null ? IntPtr.Zero : beginElement.Handle);
  116. }
  117. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  118. internal static extern void Button_OnKey (IntPtr handle, int key, int buttons, int qualifiers);
  119. /// <summary>
  120. /// React to a key press.
  121. /// </summary>
  122. public override void OnKey (int key, int buttons, int qualifiers)
  123. {
  124. Runtime.ValidateRefCounted (this);
  125. Button_OnKey (handle, key, buttons, qualifiers);
  126. }
  127. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  128. internal static extern void Button_SetPressedOffset (IntPtr handle, ref Urho.IntVector2 offset);
  129. /// <summary>
  130. /// Set offset to image rectangle used when pressed.
  131. /// </summary>
  132. private void SetPressedOffset (Urho.IntVector2 offset)
  133. {
  134. Runtime.ValidateRefCounted (this);
  135. Button_SetPressedOffset (handle, ref offset);
  136. }
  137. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  138. internal static extern void Button_SetPressedOffset0 (IntPtr handle, int x, int y);
  139. /// <summary>
  140. /// Set offset to image rectangle used when pressed.
  141. /// </summary>
  142. public void SetPressedOffset (int x, int y)
  143. {
  144. Runtime.ValidateRefCounted (this);
  145. Button_SetPressedOffset0 (handle, x, y);
  146. }
  147. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  148. internal static extern void Button_SetPressedChildOffset (IntPtr handle, ref Urho.IntVector2 offset);
  149. /// <summary>
  150. /// Set offset of child elements when pressed.
  151. /// </summary>
  152. private void SetPressedChildOffset (Urho.IntVector2 offset)
  153. {
  154. Runtime.ValidateRefCounted (this);
  155. Button_SetPressedChildOffset (handle, ref offset);
  156. }
  157. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  158. internal static extern void Button_SetPressedChildOffset1 (IntPtr handle, int x, int y);
  159. /// <summary>
  160. /// Set offset of child elements when pressed.
  161. /// </summary>
  162. public void SetPressedChildOffset (int x, int y)
  163. {
  164. Runtime.ValidateRefCounted (this);
  165. Button_SetPressedChildOffset1 (handle, x, y);
  166. }
  167. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  168. internal static extern void Button_SetRepeat (IntPtr handle, float delay, float rate);
  169. /// <summary>
  170. /// Set repeat properties. Rate 0 (default) disables repeat.
  171. /// </summary>
  172. public void SetRepeat (float delay, float rate)
  173. {
  174. Runtime.ValidateRefCounted (this);
  175. Button_SetRepeat (handle, delay, rate);
  176. }
  177. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  178. internal static extern void Button_SetRepeatDelay (IntPtr handle, float delay);
  179. /// <summary>
  180. /// Set repeat delay.
  181. /// </summary>
  182. private void SetRepeatDelay (float delay)
  183. {
  184. Runtime.ValidateRefCounted (this);
  185. Button_SetRepeatDelay (handle, delay);
  186. }
  187. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  188. internal static extern void Button_SetRepeatRate (IntPtr handle, float rate);
  189. /// <summary>
  190. /// Set repeat rate.
  191. /// </summary>
  192. private void SetRepeatRate (float rate)
  193. {
  194. Runtime.ValidateRefCounted (this);
  195. Button_SetRepeatRate (handle, rate);
  196. }
  197. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  198. internal static extern Urho.IntVector2 Button_GetPressedOffset (IntPtr handle);
  199. /// <summary>
  200. /// Return pressed image offset.
  201. /// </summary>
  202. private Urho.IntVector2 GetPressedOffset ()
  203. {
  204. Runtime.ValidateRefCounted (this);
  205. return Button_GetPressedOffset (handle);
  206. }
  207. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  208. internal static extern Urho.IntVector2 Button_GetPressedChildOffset (IntPtr handle);
  209. /// <summary>
  210. /// Return offset of child elements when pressed.
  211. /// </summary>
  212. private Urho.IntVector2 GetPressedChildOffset ()
  213. {
  214. Runtime.ValidateRefCounted (this);
  215. return Button_GetPressedChildOffset (handle);
  216. }
  217. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  218. internal static extern float Button_GetRepeatDelay (IntPtr handle);
  219. /// <summary>
  220. /// Return repeat delay.
  221. /// </summary>
  222. private float GetRepeatDelay ()
  223. {
  224. Runtime.ValidateRefCounted (this);
  225. return Button_GetRepeatDelay (handle);
  226. }
  227. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  228. internal static extern float Button_GetRepeatRate (IntPtr handle);
  229. /// <summary>
  230. /// Return repeat rate.
  231. /// </summary>
  232. private float GetRepeatRate ()
  233. {
  234. Runtime.ValidateRefCounted (this);
  235. return Button_GetRepeatRate (handle);
  236. }
  237. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  238. internal static extern bool Button_IsPressed (IntPtr handle);
  239. /// <summary>
  240. /// Return whether is currently pressed.
  241. /// </summary>
  242. public bool IsPressed ()
  243. {
  244. Runtime.ValidateRefCounted (this);
  245. return Button_IsPressed (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 pressed image offset.
  270. /// Or
  271. /// Set offset to image rectangle used when pressed.
  272. /// </summary>
  273. public Urho.IntVector2 PressedOffset {
  274. get {
  275. return GetPressedOffset ();
  276. }
  277. set {
  278. SetPressedOffset (value);
  279. }
  280. }
  281. /// <summary>
  282. /// Return offset of child elements when pressed.
  283. /// Or
  284. /// Set offset of child elements when pressed.
  285. /// </summary>
  286. public Urho.IntVector2 PressedChildOffset {
  287. get {
  288. return GetPressedChildOffset ();
  289. }
  290. set {
  291. SetPressedChildOffset (value);
  292. }
  293. }
  294. /// <summary>
  295. /// Return repeat delay.
  296. /// Or
  297. /// Set repeat delay.
  298. /// </summary>
  299. public float RepeatDelay {
  300. get {
  301. return GetRepeatDelay ();
  302. }
  303. set {
  304. SetRepeatDelay (value);
  305. }
  306. }
  307. /// <summary>
  308. /// Return repeat rate.
  309. /// Or
  310. /// Set repeat rate.
  311. /// </summary>
  312. public float RepeatRate {
  313. get {
  314. return GetRepeatRate ();
  315. }
  316. set {
  317. SetRepeatRate (value);
  318. }
  319. }
  320. }
  321. }