GUIListBox.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using System.Runtime.CompilerServices;
  3. namespace BansheeEngine
  4. {
  5. public sealed class GUIListBox : GUIElement
  6. {
  7. public delegate void OnSelectionChangedDelegate(int index);
  8. public event OnSelectionChangedDelegate OnSelectionChanged;
  9. internal GUIListBox(GUILayout parentLayout, LocString[] elements, GUIElementStyle style, params GUIOption[] options)
  10. :base(parentLayout)
  11. {
  12. Internal_CreateInstance(this, parentLayout, elements, style, options);
  13. }
  14. public void SetElements(LocString[] elements)
  15. {
  16. Internal_SetElements(mCachedPtr, elements);
  17. }
  18. private void DoOnSelectionChanged(int index)
  19. {
  20. if (OnSelectionChanged != null)
  21. OnSelectionChanged(index);
  22. }
  23. [MethodImpl(MethodImplOptions.InternalCall)]
  24. private static extern void Internal_CreateInstance(GUIListBox instance, GUILayout parentLayout, LocString[] elements, GUIElementStyle style, params GUIOption[] options);
  25. [MethodImpl(MethodImplOptions.InternalCall)]
  26. private static extern void Internal_SetElements(IntPtr nativeInstance, LocString[] elements);
  27. }
  28. }