Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

juce_TextInputTarget.h 3.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2017 - ROLI Ltd.
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 5 End-User License
  8. Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
  9. 27th April 2017).
  10. End User License Agreement: www.juce.com/juce-5-licence
  11. Privacy Policy: www.juce.com/juce-5-privacy-policy
  12. Or: You may also use this code under the terms of the GPL v3 (see
  13. www.gnu.org/licenses).
  14. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  15. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  16. DISCLAIMED.
  17. ==============================================================================
  18. */
  19. namespace juce
  20. {
  21. //==============================================================================
  22. /**
  23. An abstract base class which can be implemented by components that function as
  24. text editors.
  25. This class allows different types of text editor component to provide a uniform
  26. interface, which can be used by things like OS-specific input methods, on-screen
  27. keyboards, etc.
  28. */
  29. class JUCE_API TextInputTarget
  30. {
  31. public:
  32. //==============================================================================
  33. /** */
  34. TextInputTarget() {}
  35. /** Destructor. */
  36. virtual ~TextInputTarget() {}
  37. /** Returns true if this input target is currently accepting input.
  38. For example, a text editor might return false if it's in read-only mode.
  39. */
  40. virtual bool isTextInputActive() const = 0;
  41. /** Returns the extents of the selected text region, or an empty range if
  42. nothing is selected,
  43. */
  44. virtual Range<int> getHighlightedRegion() const = 0;
  45. /** Sets the currently-selected text region. */
  46. virtual void setHighlightedRegion (const Range<int>& newRange) = 0;
  47. /** Sets a number of temporarily underlined sections.
  48. This is needed by MS Windows input method UI.
  49. */
  50. virtual void setTemporaryUnderlining (const Array <Range<int> >& underlinedRegions) = 0;
  51. /** Returns a specified sub-section of the text. */
  52. virtual String getTextInRange (const Range<int>& range) const = 0;
  53. /** Inserts some text, overwriting the selected text region, if there is one. */
  54. virtual void insertTextAtCaret (const String& textToInsert) = 0;
  55. /** Returns the position of the caret, relative to the component's origin. */
  56. virtual Rectangle<int> getCaretRectangle() = 0;
  57. /** A set of possible on-screen keyboard types, for use in the
  58. getKeyboardType() method.
  59. */
  60. enum VirtualKeyboardType
  61. {
  62. textKeyboard = 0,
  63. numericKeyboard,
  64. decimalKeyboard,
  65. urlKeyboard,
  66. emailAddressKeyboard,
  67. phoneNumberKeyboard
  68. };
  69. /** Returns the target's preference for the type of keyboard that would be most appropriate.
  70. This may be ignored, depending on the capabilities of the OS.
  71. */
  72. virtual VirtualKeyboardType getKeyboardType() { return textKeyboard; }
  73. };
  74. } // namespace juce