ITextInputReceiver.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. namespace UnityEngine.InputSystem.LowLevel
  2. {
  3. /// <summary>
  4. /// Interface for <see cref="InputDevice"/> classes that can receive text input events.
  5. /// </summary>
  6. /// <remarks>
  7. /// This interface should be implemented by devices that are meant to receive text
  8. /// input through <see cref="TextEvent"/>.
  9. /// </remarks>
  10. /// <seealso cref="TextEvent"/>
  11. /// <seealso cref="IMECompositionEvent"/>
  12. public interface ITextInputReceiver
  13. {
  14. /// <summary>
  15. /// A single, fully-formed Unicode character has been typed on the device.
  16. /// </summary>
  17. /// <param name="character">Character that was typed. Note that in case the character is part of
  18. /// a surrogate pair, this method is called first with the high surrogate and then with the
  19. /// low surrogate character.</param>
  20. /// <remarks>
  21. /// This method is called on a device when a <see cref="TextEvent"/> is received
  22. /// for the device. <paramref name="character"/> is the <see cref="TextEvent.character"/>
  23. /// from the event.
  24. ///
  25. /// Note that this method will be called *twice* for a single <see cref="TextEvent"/>
  26. /// in case the given UTF-32 (encoding in the event) needs to be represented as UTF-16
  27. /// (encoding of <c>char</c> in C#) surrogate.
  28. /// </remarks>
  29. void OnTextInput(char character);
  30. /// <summary>
  31. /// Called when an IME composition is in-progress or finished.
  32. /// </summary>
  33. /// <param name="compositionString">The current composition.</param>
  34. /// <seealso cref="IMECompositionEvent"/>
  35. /// <seealso cref="Keyboard.onIMECompositionChange"/>
  36. /// <remarks>
  37. /// The method will be repeatedly called with the current string while composition is in progress.
  38. /// Once composition finishes, the method will be called one more time with a blank composition
  39. /// string.
  40. /// </remarks>
  41. void OnIMECompositionChanged(IMECompositionString compositionString);
  42. }
  43. }