GUISpace.cs 2.0 KB

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