GUISpace.cs 2.0 KB

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