JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_TextInputTarget.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
39class JUCE_API TextInputTarget
40{
41public:
42 //==============================================================================
44 TextInputTarget() = default;
45
47 virtual ~TextInputTarget() = default;
48
52 virtual bool isTextInputActive() const = 0;
53
57 virtual Range<int> getHighlightedRegion() const = 0;
58
60 virtual void setHighlightedRegion (const Range<int>& newRange) = 0;
61
65 virtual void setTemporaryUnderlining (const Array<Range<int>>& underlinedRegions) = 0;
66
68 virtual String getTextInRange (const Range<int>& range) const = 0;
69
71 virtual void insertTextAtCaret (const String& textToInsert) = 0;
72
74 virtual int getCaretPosition() const = 0;
75
77 Rectangle<int> getCaretRectangle() const { return getCaretRectangleForCharIndex (getCaretPosition()); }
78
80 virtual Rectangle<int> getCaretRectangleForCharIndex (int characterIndex) const = 0;
81
83 virtual int getTotalNumChars() const = 0;
84
90 virtual int getCharIndexForPoint (Point<int> point) const = 0;
91
98 virtual RectangleList<int> getTextBounds (Range<int> textRange) const = 0;
99
104 {
105 textKeyboard = 0,
106 numericKeyboard,
107 decimalKeyboard,
108 urlKeyboard,
109 emailAddressKeyboard,
110 phoneNumberKeyboard,
111 passwordKeyboard
112 };
113
117 virtual VirtualKeyboardType getKeyboardType() { return textKeyboard; }
118};
119
120} // namespace juce
Holds a resizable array of primitive or copy-by-value objects.
Definition juce_Array.h:56
A pair of (x, y) coordinates.
Definition juce_Point.h:42
A general-purpose range object, that simply represents any linear range with a start and end point.
Definition juce_Range.h:40
Maintains a set of rectangles as a complex region.
Manages a rectangle and allows geometric operations to be performed on it.
The JUCE String class!
Definition juce_String.h:53
An abstract base class which can be implemented by components that function as text editors.
virtual ~TextInputTarget()=default
Destructor.
virtual void insertTextAtCaret(const String &textToInsert)=0
Inserts some text, overwriting the selected text region, if there is one.
virtual int getTotalNumChars() const =0
Returns the total number of codepoints in the string.
VirtualKeyboardType
A set of possible on-screen keyboard types, for use in the getKeyboardType() method.
virtual RectangleList< int > getTextBounds(Range< int > textRange) const =0
Returns the bounding box for a range of text in the editor.
virtual void setHighlightedRegion(const Range< int > &newRange)=0
Sets the currently-selected text region.
Rectangle< int > getCaretRectangle() const
Returns the position of the caret, relative to the component's origin.
virtual String getTextInRange(const Range< int > &range) const =0
Returns a specified sub-section of the text.
virtual Range< int > getHighlightedRegion() const =0
Returns the extents of the selected text region, or an empty range if nothing is selected,...
virtual int getCaretPosition() const =0
Returns the current index of the caret.
virtual void setTemporaryUnderlining(const Array< Range< int > > &underlinedRegions)=0
Sets a number of temporarily underlined sections.
virtual bool isTextInputActive() const =0
Returns true if this input target is currently accepting input.
virtual int getCharIndexForPoint(Point< int > point) const =0
Returns the index closest to the given point.
virtual Rectangle< int > getCaretRectangleForCharIndex(int characterIndex) const =0
Returns the bounding box of the character at the given index.
virtual VirtualKeyboardType getKeyboardType()
Returns the target's preference for the type of keyboard that would be most appropriate.
JUCE Namespace.