GUIProgressBar.cs 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using System;
  4. using System.Runtime.CompilerServices;
  5. namespace BansheeEngine
  6. {
  7. /** @addtogroup GUI_Engine
  8. * @{
  9. */
  10. /// <summary>
  11. /// GUI element containing a background image and a fill image that is scaled depending on the percentage set by the
  12. /// caller.
  13. /// </summary>
  14. public sealed class GUIProgressBar : GUIElement
  15. {
  16. /// <summary>
  17. /// Value that controls the width of the progress bar fill image. Range [0, 1].
  18. /// </summary>
  19. public float Percent
  20. {
  21. get { return Internal_GetPercent(mCachedPtr); }
  22. set { Internal_SetPercent(mCachedPtr, value); }
  23. }
  24. /// <summary>
  25. /// Creates a new progress bar element.
  26. /// </summary>
  27. /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as
  28. /// default layout options. Style will be retrieved from the active GUISkin. If not specified
  29. /// default element style is used.</param>
  30. /// <param name="options">Options that allow you to control how is the element positioned and sized. This will
  31. /// override any similar options set by style.</param>
  32. public GUIProgressBar(string style, params GUIOption[] options)
  33. {
  34. Internal_CreateInstance(this, style, options);
  35. }
  36. /// <summary>
  37. /// Creates a new progress bar element.
  38. /// </summary>
  39. /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as
  40. /// default layout options. Style will be retrieved from the active GUISkin. If not specified
  41. /// default element style is used.</param>
  42. public GUIProgressBar(string style = "")
  43. {
  44. Internal_CreateInstance(this, style, new GUIOption[0]);
  45. }
  46. /// <summary>
  47. /// Colors the element with a specific tint.
  48. /// </summary>
  49. /// <param name="color">Tint to apply to the element.</param>
  50. public void SetTint(Color color)
  51. {
  52. Internal_SetTint(mCachedPtr, ref color);
  53. }
  54. [MethodImpl(MethodImplOptions.InternalCall)]
  55. private static extern void Internal_CreateInstance(GUIProgressBar instance, string style, GUIOption[] options);
  56. [MethodImpl(MethodImplOptions.InternalCall)]
  57. private static extern float Internal_GetPercent(IntPtr nativeInstance);
  58. [MethodImpl(MethodImplOptions.InternalCall)]
  59. private static extern void Internal_SetPercent(IntPtr nativeInstance, float percent);
  60. [MethodImpl(MethodImplOptions.InternalCall)]
  61. private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
  62. }
  63. /** @} */
  64. }