1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

iOS: Add proper UITextInput implementation

This provides an improved user experience, allowing cursor movement
directly from the keyboard.
This commit is contained in:
reuk 2022-07-05 20:13:07 +01:00
parent 09c107698b
commit 5cf1a964fc
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
8 changed files with 1022 additions and 255 deletions

View file

@ -71,8 +71,32 @@ public:
/** Inserts some text, overwriting the selected text region, if there is one. */
virtual void insertTextAtCaret (const String& textToInsert) = 0;
/** Returns the current index of the caret. */
virtual int getCaretPosition() const = 0;
/** Returns the position of the caret, relative to the component's origin. */
virtual Rectangle<int> getCaretRectangle() = 0;
Rectangle<int> getCaretRectangle() const { return getCaretRectangleForCharIndex (getCaretPosition()); }
/** Returns the bounding box of the character at the given index. */
virtual Rectangle<int> getCaretRectangleForCharIndex (int characterIndex) const = 0;
/** Returns the total number of codepoints in the string. */
virtual int getTotalNumChars() const = 0;
/** Returns the index closest to the given point.
This is the location where the cursor might be placed after clicking at the given
point in a text field.
*/
virtual int getCharIndexForPoint (Point<int> point) const = 0;
/** Returns the bounding box for a range of text in the editor. As the range may span
multiple lines, this method returns a RectangleList.
The bounds are relative to the component's top-left and may extend beyond the bounds
of the component if the text is long and word wrapping is disabled.
*/
virtual RectangleList<int> getTextBounds (Range<int> textRange) const = 0;
/** A set of possible on-screen keyboard types, for use in the
getKeyboardType() method.