GUIFoldout.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System;
  2. using System.Runtime.CompilerServices;
  3. using BansheeEngine;
  4. namespace BansheeEditor
  5. {
  6. public sealed class GUIFoldout : GUIElement
  7. {
  8. public delegate void OnToggledDelegate(bool expanded);
  9. public event OnToggledDelegate OnToggled;
  10. public GUIFoldout(GUIContent content, string style, params GUIOption[] options)
  11. {
  12. Internal_CreateInstance(this, content, style, options);
  13. }
  14. public GUIFoldout(GUIContent content, string style)
  15. {
  16. Internal_CreateInstance(this, content, style, new GUIOption[0]);
  17. }
  18. public GUIFoldout(GUIContent content, params GUIOption[] options)
  19. {
  20. Internal_CreateInstance(this, content, "", options);
  21. }
  22. public void SetContent(GUIContent content)
  23. {
  24. Internal_SetContent(mCachedPtr, content);
  25. }
  26. private void DoOnToggled(bool expanded)
  27. {
  28. if (OnToggled != null)
  29. OnToggled(expanded);
  30. }
  31. [MethodImpl(MethodImplOptions.InternalCall)]
  32. private static extern void Internal_CreateInstance(GUIFoldout instance, GUIContent content, string style, GUIOption[] options);
  33. [MethodImpl(MethodImplOptions.InternalCall)]
  34. private static extern void Internal_SetContent(IntPtr nativeInstance, GUIContent content);
  35. }
  36. }