GUISpace.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 that may be inserted into layouts in order to make a space of a fixed size.
  12. /// </summary>
  13. public sealed class GUIFixedSpace : GUIElement
  14. {
  15. /// <summary>
  16. /// Creates a new fixed space.
  17. /// </summary>
  18. /// <param name="size">Size of the space in pixels. This will represent either width or height depending whether the
  19. /// layout is vertical or horizontal.</param>
  20. public GUIFixedSpace(int size)
  21. {
  22. Internal_CreateInstance(this, size);
  23. }
  24. /// <summary>
  25. /// Changes the size of the space.
  26. /// </summary>
  27. /// <param name="size">Size of the space in pixels. This will represent either width or height depending whether the
  28. /// layout is vertical or horizontal.</param>
  29. public void SetSize(int size)
  30. {
  31. Internal_SetSize(mCachedPtr, size);
  32. }
  33. [MethodImpl(MethodImplOptions.InternalCall)]
  34. private static extern void Internal_CreateInstance(GUIFixedSpace instance, int size);
  35. [MethodImpl(MethodImplOptions.InternalCall)]
  36. private static extern void Internal_SetSize(IntPtr nativeInstance, int size);
  37. }
  38. /// <summary>
  39. /// GUI element that may be inserted into layouts to make a space of a flexible size. The space will expand only if there
  40. /// is room. If multiple flexible spaces are in a layout, their sizes will be shared equally.
  41. /// </summary>
  42. public sealed class GUIFlexibleSpace : GUIElement
  43. {
  44. /// <summary>
  45. /// Creates a new flexible space.
  46. /// </summary>
  47. public GUIFlexibleSpace()
  48. {
  49. Internal_CreateInstance(this);
  50. }
  51. [MethodImpl(MethodImplOptions.InternalCall)]
  52. private static extern void Internal_CreateInstance(GUIFlexibleSpace instance);
  53. }
  54. /** @} */
  55. }