Menu.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // Menu.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. /// %Menu %UI element that optionally shows a popup.
  21. /// </summary>
  22. public unsafe partial class Menu : Button
  23. {
  24. unsafe partial void OnMenuCreated ();
  25. [Preserve]
  26. public Menu (IntPtr handle) : base (handle)
  27. {
  28. OnMenuCreated ();
  29. }
  30. [Preserve]
  31. protected Menu (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnMenuCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int Menu_GetType (IntPtr handle);
  37. private StringHash UrhoGetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (Menu_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr Menu_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (Menu_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int Menu_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(Menu));
  54. return new StringHash (Menu_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr Menu_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(Menu));
  61. return Marshal.PtrToStringAnsi (Menu_GetTypeNameStatic ());
  62. }
  63. [Preserve]
  64. public Menu () : this (Application.CurrentContext)
  65. {
  66. }
  67. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  68. internal static extern IntPtr Menu_Menu (IntPtr context);
  69. [Preserve]
  70. public Menu (Context context) : base (UrhoObjectFlag.Empty)
  71. {
  72. Runtime.Validate (typeof(Menu));
  73. handle = Menu_Menu ((object)context == null ? IntPtr.Zero : context.Handle);
  74. Runtime.RegisterObject (this);
  75. OnMenuCreated ();
  76. }
  77. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  78. internal static extern void Menu_RegisterObject (IntPtr context);
  79. /// <summary>
  80. /// Register object factory.
  81. /// </summary>
  82. public new static void RegisterObject (Context context)
  83. {
  84. Runtime.Validate (typeof(Menu));
  85. Menu_RegisterObject ((object)context == null ? IntPtr.Zero : context.Handle);
  86. }
  87. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  88. internal static extern bool Menu_LoadXML (IntPtr handle, IntPtr source, IntPtr styleFile, bool setInstanceDefault);
  89. /// <summary>
  90. /// Load from XML data with style. Return true if successful.
  91. /// </summary>
  92. public override bool LoadXml (XmlElement source, Urho.Resources.XmlFile styleFile, bool setInstanceDefault = false)
  93. {
  94. Runtime.ValidateRefCounted (this);
  95. return Menu_LoadXML (handle, (object)source == null ? IntPtr.Zero : source.Handle, (object)styleFile == null ? IntPtr.Zero : styleFile.Handle, setInstanceDefault);
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern bool Menu_SaveXML (IntPtr handle, IntPtr dest);
  99. /// <summary>
  100. /// Save as XML data. Return true if successful.
  101. /// </summary>
  102. public override bool SaveXml (XmlElement dest)
  103. {
  104. Runtime.ValidateRefCounted (this);
  105. return Menu_SaveXML (handle, (object)dest == null ? IntPtr.Zero : dest.Handle);
  106. }
  107. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  108. internal static extern void Menu_Update (IntPtr handle, float timeStep);
  109. /// <summary>
  110. /// Perform UI element update.
  111. /// </summary>
  112. public override void Update (float timeStep)
  113. {
  114. Runtime.ValidateRefCounted (this);
  115. Menu_Update (handle, timeStep);
  116. }
  117. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  118. internal static extern void Menu_OnHover (IntPtr handle, ref Urho.IntVector2 position, ref Urho.IntVector2 screenPosition, int buttons, int qualifiers, IntPtr cursor);
  119. /// <summary>
  120. /// React to mouse hover.
  121. /// </summary>
  122. public override void OnHover (Urho.IntVector2 position, Urho.IntVector2 screenPosition, int buttons, int qualifiers, Cursor cursor)
  123. {
  124. Runtime.ValidateRefCounted (this);
  125. Menu_OnHover (handle, ref position, ref screenPosition, buttons, qualifiers, (object)cursor == null ? IntPtr.Zero : cursor.Handle);
  126. }
  127. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  128. internal static extern void Menu_OnShowPopup (IntPtr handle);
  129. /// <summary>
  130. /// React to the popup being shown.
  131. /// </summary>
  132. public virtual void OnShowPopup ()
  133. {
  134. Runtime.ValidateRefCounted (this);
  135. Menu_OnShowPopup (handle);
  136. }
  137. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  138. internal static extern void Menu_OnHidePopup (IntPtr handle);
  139. /// <summary>
  140. /// React to the popup being hidden.
  141. /// </summary>
  142. public virtual void OnHidePopup ()
  143. {
  144. Runtime.ValidateRefCounted (this);
  145. Menu_OnHidePopup (handle);
  146. }
  147. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  148. internal static extern void Menu_SetPopup (IntPtr handle, IntPtr element);
  149. /// <summary>
  150. /// Set popup element to show on selection.
  151. /// </summary>
  152. private void SetPopup (UIElement element)
  153. {
  154. Runtime.ValidateRefCounted (this);
  155. Menu_SetPopup (handle, (object)element == null ? IntPtr.Zero : element.Handle);
  156. }
  157. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  158. internal static extern void Menu_SetPopupOffset (IntPtr handle, ref Urho.IntVector2 offset);
  159. /// <summary>
  160. /// Set popup element offset.
  161. /// </summary>
  162. private void SetPopupOffset (Urho.IntVector2 offset)
  163. {
  164. Runtime.ValidateRefCounted (this);
  165. Menu_SetPopupOffset (handle, ref offset);
  166. }
  167. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  168. internal static extern void Menu_SetPopupOffset0 (IntPtr handle, int x, int y);
  169. /// <summary>
  170. /// Set popup element offset.
  171. /// </summary>
  172. public void SetPopupOffset (int x, int y)
  173. {
  174. Runtime.ValidateRefCounted (this);
  175. Menu_SetPopupOffset0 (handle, x, y);
  176. }
  177. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  178. internal static extern void Menu_ShowPopup (IntPtr handle, bool enable);
  179. /// <summary>
  180. /// Force the popup to show or hide.
  181. /// </summary>
  182. public void ShowPopup (bool enable)
  183. {
  184. Runtime.ValidateRefCounted (this);
  185. Menu_ShowPopup (handle, enable);
  186. }
  187. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  188. internal static extern void Menu_SetAccelerator (IntPtr handle, int key, int qualifiers);
  189. /// <summary>
  190. /// Set accelerator key (set zero key code to disable.)
  191. /// </summary>
  192. public void SetAccelerator (int key, int qualifiers)
  193. {
  194. Runtime.ValidateRefCounted (this);
  195. Menu_SetAccelerator (handle, key, qualifiers);
  196. }
  197. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  198. internal static extern IntPtr Menu_GetPopup (IntPtr handle);
  199. /// <summary>
  200. /// Return popup element.
  201. /// </summary>
  202. private UIElement GetPopup ()
  203. {
  204. Runtime.ValidateRefCounted (this);
  205. return Runtime.LookupObject<UIElement> (Menu_GetPopup (handle));
  206. }
  207. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  208. internal static extern Urho.IntVector2 Menu_GetPopupOffset (IntPtr handle);
  209. /// <summary>
  210. /// Return popup element offset.
  211. /// </summary>
  212. private Urho.IntVector2 GetPopupOffset ()
  213. {
  214. Runtime.ValidateRefCounted (this);
  215. return Menu_GetPopupOffset (handle);
  216. }
  217. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  218. internal static extern bool Menu_GetShowPopup (IntPtr handle);
  219. /// <summary>
  220. /// Return whether popup is open.
  221. /// </summary>
  222. private bool GetShowPopup ()
  223. {
  224. Runtime.ValidateRefCounted (this);
  225. return Menu_GetShowPopup (handle);
  226. }
  227. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  228. internal static extern int Menu_GetAcceleratorKey (IntPtr handle);
  229. /// <summary>
  230. /// Return accelerator key code, 0 if disabled.
  231. /// </summary>
  232. private int GetAcceleratorKey ()
  233. {
  234. Runtime.ValidateRefCounted (this);
  235. return Menu_GetAcceleratorKey (handle);
  236. }
  237. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  238. internal static extern int Menu_GetAcceleratorQualifiers (IntPtr handle);
  239. /// <summary>
  240. /// Return accelerator qualifiers.
  241. /// </summary>
  242. private int GetAcceleratorQualifiers ()
  243. {
  244. Runtime.ValidateRefCounted (this);
  245. return Menu_GetAcceleratorQualifiers (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 popup element.
  270. /// Or
  271. /// Set popup element to show on selection.
  272. /// </summary>
  273. public UIElement Popup {
  274. get {
  275. return GetPopup ();
  276. }
  277. set {
  278. SetPopup (value);
  279. }
  280. }
  281. /// <summary>
  282. /// Return popup element offset.
  283. /// Or
  284. /// Set popup element offset.
  285. /// </summary>
  286. public Urho.IntVector2 PopupOffset {
  287. get {
  288. return GetPopupOffset ();
  289. }
  290. set {
  291. SetPopupOffset (value);
  292. }
  293. }
  294. /// <summary>
  295. /// Return whether popup is open.
  296. /// </summary>
  297. public bool IsPopupShown {
  298. get {
  299. return GetShowPopup ();
  300. }
  301. }
  302. /// <summary>
  303. /// Return accelerator key code, 0 if disabled.
  304. /// </summary>
  305. public int AcceleratorKey {
  306. get {
  307. return GetAcceleratorKey ();
  308. }
  309. }
  310. /// <summary>
  311. /// Return accelerator qualifiers.
  312. /// </summary>
  313. public int AcceleratorQualifiers {
  314. get {
  315. return GetAcceleratorQualifiers ();
  316. }
  317. }
  318. }
  319. }