GUISpace.cs 2.2 KB

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