Handle.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Collections.Generic;
  2. using BansheeEngine;
  3. namespace BansheeEditor
  4. {
  5. /// <summary>
  6. /// Base class for handle implementations. Handles provide tools that the user can interact with in the scene view.
  7. /// This includes traditional handles like move, rotate or scale, but also custom user defined handles. Custom handles
  8. /// need to implement this class and also specify a <see cref="CustomHandle"/> attribute.
  9. /// </summary>
  10. public abstract class Handle
  11. {
  12. private List<HandleSlider> sliders = new List<HandleSlider>();
  13. protected internal abstract void PreInput();
  14. protected internal abstract void PostInput();
  15. protected internal abstract void Draw();
  16. /// <summary>
  17. /// Registers a new handle slider used by this handle.
  18. /// </summary>
  19. /// <param name="slider">Slider used by the handle.</param>
  20. internal void RegisterSlider(HandleSlider slider)
  21. {
  22. sliders.Add(slider);
  23. }
  24. /// <summary>
  25. /// Destroys the handle, removing it from the scene.
  26. /// </summary>
  27. public void Destroy()
  28. {
  29. foreach (var slider in sliders)
  30. slider.Destroy();
  31. }
  32. }
  33. }