Button.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  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_SetDisabledOffset (IntPtr handle, ref Urho.IntVector2 offset);
  149. /// <summary>
  150. /// Set offset to image rectangle used when disabled.
  151. /// </summary>
  152. private void SetDisabledOffset (Urho.IntVector2 offset)
  153. {
  154. Runtime.ValidateRefCounted (this);
  155. Button_SetDisabledOffset (handle, ref offset);
  156. }
  157. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  158. internal static extern void Button_SetDisabledOffset1 (IntPtr handle, int x, int y);
  159. /// <summary>
  160. /// Set offset to image rectangle used when disabled.
  161. /// </summary>
  162. public void SetDisabledOffset (int x, int y)
  163. {
  164. Runtime.ValidateRefCounted (this);
  165. Button_SetDisabledOffset1 (handle, x, y);
  166. }
  167. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  168. internal static extern void Button_SetPressedChildOffset (IntPtr handle, ref Urho.IntVector2 offset);
  169. /// <summary>
  170. /// Set offset of child elements when pressed.
  171. /// </summary>
  172. private void SetPressedChildOffset (Urho.IntVector2 offset)
  173. {
  174. Runtime.ValidateRefCounted (this);
  175. Button_SetPressedChildOffset (handle, ref offset);
  176. }
  177. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  178. internal static extern void Button_SetPressedChildOffset2 (IntPtr handle, int x, int y);
  179. /// <summary>
  180. /// Set offset of child elements when pressed.
  181. /// </summary>
  182. public void SetPressedChildOffset (int x, int y)
  183. {
  184. Runtime.ValidateRefCounted (this);
  185. Button_SetPressedChildOffset2 (handle, x, y);
  186. }
  187. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  188. internal static extern void Button_SetRepeat (IntPtr handle, float delay, float rate);
  189. /// <summary>
  190. /// Set repeat properties. Rate 0 (default) disables repeat.
  191. /// </summary>
  192. public void SetRepeat (float delay, float rate)
  193. {
  194. Runtime.ValidateRefCounted (this);
  195. Button_SetRepeat (handle, delay, rate);
  196. }
  197. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  198. internal static extern void Button_SetRepeatDelay (IntPtr handle, float delay);
  199. /// <summary>
  200. /// Set repeat delay.
  201. /// </summary>
  202. private void SetRepeatDelay (float delay)
  203. {
  204. Runtime.ValidateRefCounted (this);
  205. Button_SetRepeatDelay (handle, delay);
  206. }
  207. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  208. internal static extern void Button_SetRepeatRate (IntPtr handle, float rate);
  209. /// <summary>
  210. /// Set repeat rate.
  211. /// </summary>
  212. private void SetRepeatRate (float rate)
  213. {
  214. Runtime.ValidateRefCounted (this);
  215. Button_SetRepeatRate (handle, rate);
  216. }
  217. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  218. internal static extern Urho.IntVector2 Button_GetPressedOffset (IntPtr handle);
  219. /// <summary>
  220. /// Return pressed image offset.
  221. /// </summary>
  222. private Urho.IntVector2 GetPressedOffset ()
  223. {
  224. Runtime.ValidateRefCounted (this);
  225. return Button_GetPressedOffset (handle);
  226. }
  227. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  228. internal static extern Urho.IntVector2 Button_GetDisabledOffset (IntPtr handle);
  229. /// <summary>
  230. /// Return disabled image offset.
  231. /// </summary>
  232. private Urho.IntVector2 GetDisabledOffset ()
  233. {
  234. Runtime.ValidateRefCounted (this);
  235. return Button_GetDisabledOffset (handle);
  236. }
  237. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  238. internal static extern Urho.IntVector2 Button_GetPressedChildOffset (IntPtr handle);
  239. /// <summary>
  240. /// Return offset of child elements when pressed.
  241. /// </summary>
  242. private Urho.IntVector2 GetPressedChildOffset ()
  243. {
  244. Runtime.ValidateRefCounted (this);
  245. return Button_GetPressedChildOffset (handle);
  246. }
  247. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  248. internal static extern float Button_GetRepeatDelay (IntPtr handle);
  249. /// <summary>
  250. /// Return repeat delay.
  251. /// </summary>
  252. private float GetRepeatDelay ()
  253. {
  254. Runtime.ValidateRefCounted (this);
  255. return Button_GetRepeatDelay (handle);
  256. }
  257. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  258. internal static extern float Button_GetRepeatRate (IntPtr handle);
  259. /// <summary>
  260. /// Return repeat rate.
  261. /// </summary>
  262. private float GetRepeatRate ()
  263. {
  264. Runtime.ValidateRefCounted (this);
  265. return Button_GetRepeatRate (handle);
  266. }
  267. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  268. internal static extern bool Button_IsPressed (IntPtr handle);
  269. /// <summary>
  270. /// Return whether is currently pressed.
  271. /// </summary>
  272. public bool IsPressed ()
  273. {
  274. Runtime.ValidateRefCounted (this);
  275. return Button_IsPressed (handle);
  276. }
  277. public override StringHash Type {
  278. get {
  279. return UrhoGetType ();
  280. }
  281. }
  282. public override string TypeName {
  283. get {
  284. return GetTypeName ();
  285. }
  286. }
  287. [Preserve]
  288. public new static StringHash TypeStatic {
  289. get {
  290. return GetTypeStatic ();
  291. }
  292. }
  293. public new static string TypeNameStatic {
  294. get {
  295. return GetTypeNameStatic ();
  296. }
  297. }
  298. /// <summary>
  299. /// Return pressed image offset.
  300. /// Or
  301. /// Set offset to image rectangle used when pressed.
  302. /// </summary>
  303. public Urho.IntVector2 PressedOffset {
  304. get {
  305. return GetPressedOffset ();
  306. }
  307. set {
  308. SetPressedOffset (value);
  309. }
  310. }
  311. /// <summary>
  312. /// Return disabled image offset.
  313. /// Or
  314. /// Set offset to image rectangle used when disabled.
  315. /// </summary>
  316. public Urho.IntVector2 DisabledOffset {
  317. get {
  318. return GetDisabledOffset ();
  319. }
  320. set {
  321. SetDisabledOffset (value);
  322. }
  323. }
  324. /// <summary>
  325. /// Return offset of child elements when pressed.
  326. /// Or
  327. /// Set offset of child elements when pressed.
  328. /// </summary>
  329. public Urho.IntVector2 PressedChildOffset {
  330. get {
  331. return GetPressedChildOffset ();
  332. }
  333. set {
  334. SetPressedChildOffset (value);
  335. }
  336. }
  337. /// <summary>
  338. /// Return repeat delay.
  339. /// Or
  340. /// Set repeat delay.
  341. /// </summary>
  342. public float RepeatDelay {
  343. get {
  344. return GetRepeatDelay ();
  345. }
  346. set {
  347. SetRepeatDelay (value);
  348. }
  349. }
  350. /// <summary>
  351. /// Return repeat rate.
  352. /// Or
  353. /// Set repeat rate.
  354. /// </summary>
  355. public float RepeatRate {
  356. get {
  357. return GetRepeatRate ();
  358. }
  359. set {
  360. SetRepeatRate (value);
  361. }
  362. }
  363. }
  364. }