UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ITextInputMethodContext Class Referenceabstract

#include <ITextInputMethodSystem.h>

Public Types

enum class  ECaretPosition { Beginning , Ending }
 

Public Member Functions

virtual ~ITextInputMethodContext ()
 
virtual bool IsComposing ()=0
 
virtual bool IsReadOnly ()=0
 
virtual uint32 GetTextLength ()=0
 
virtual void GetSelectionRange (uint32 &OutBeginIndex, uint32 &OutLength, ECaretPosition &OutCaretPosition)=0
 
virtual void SetSelectionRange (const uint32 InBeginIndex, const uint32 InLength, const ECaretPosition InCaretPosition)=0
 
virtual void GetTextInRange (const uint32 InBeginIndex, const uint32 InLength, FString &OutString)=0
 
virtual void SetTextInRange (const uint32 InBeginIndex, const uint32 InLength, const FString &InString)=0
 
virtual int32 GetCharacterIndexFromPoint (const FVector2D &InPoint)=0
 
virtual bool GetTextBounds (const uint32 InBeginIndex, const uint32 InLength, FVector2D &OutPosition, FVector2D &OutSize)=0
 
virtual void GetScreenBounds (FVector2D &OutPosition, FVector2D &OutSize)=0
 
virtual TSharedPtr< FGenericWindowGetWindow ()=0
 
virtual void BeginComposition ()=0
 
virtual void UpdateCompositionRange (const int32 InBeginIndex, const uint32 InLength)=0
 
virtual void EndComposition ()=0
 

Detailed Description

Editable texts should implement this class and maintain an object of this type after registering it. Methods of this class are called by the system to query contextual information about the state of the editable text. This information is used by the text input method system to provide appropriate processed input. Methods of this class are also called by the system to provide processed text input.

Member Enumeration Documentation

◆ ECaretPosition

Enumerator
Beginning 
Ending 

Constructor & Destructor Documentation

◆ ~ITextInputMethodContext()

virtual ITextInputMethodContext::~ITextInputMethodContext ( )
inlinevirtual

Member Function Documentation

◆ BeginComposition()

virtual void ITextInputMethodContext::BeginComposition ( )
pure virtual

Begins composition.

◆ EndComposition()

virtual void ITextInputMethodContext::EndComposition ( )
pure virtual

Ends composition. May or may not mean the composition was committed.

◆ GetCharacterIndexFromPoint()

virtual int32 ITextInputMethodContext::GetCharacterIndexFromPoint ( const FVector2D InPoint)
pure virtual

Gets the index of the code point at the point on the screen.

Parameters
InPointThe 2D point on the screen to test for a code point.
Returns
The index of the code point at the point on the screen. INDEX_NONE if none was found.

◆ GetScreenBounds()

virtual void ITextInputMethodContext::GetScreenBounds ( FVector2D OutPosition,
FVector2D OutSize 
)
pure virtual

Measures the screen-space bounds of the display area available for text.

Parameters
OutPositionThe screen-space position of the top-left bound of the display area.
OutSizeThe screen-space size of the of the display area.

◆ GetSelectionRange()

virtual void ITextInputMethodContext::GetSelectionRange ( uint32 OutBeginIndex,
uint32 OutLength,
ECaretPosition OutCaretPosition 
)
pure virtual

Gets the range of code point indices that are selected and which end of the selection the caret is at.

Parameters
OutBeginIndexThe code point index at the beginning of the selection range.
OutLengthThe number of code points selected after the beginning index.
OutCaretPositionA flag indicating whether the caret is at the beginning or ending of the range. Irrelevant if the Length is zero.

◆ GetTextBounds()

virtual bool ITextInputMethodContext::GetTextBounds ( const uint32  InBeginIndex,
const uint32  InLength,
FVector2D OutPosition,
FVector2D OutSize 
)
pure virtual

Measures the screen-space bounds of the text in the specified range of code points.

Parameters
InBeginIndexThe code point index at the beginning of the range to measure.
InLengthThe number of code points to measure after the beginning index.
OutPositionThe screen-space position of the top-left bound of the specified range of code points.
OutSizeThe screen-space size of the of the specified range of code points.
Returns
True if the specified range of code points is drawn clipped. False otherwise.

◆ GetTextInRange()

virtual void ITextInputMethodContext::GetTextInRange ( const uint32  InBeginIndex,
const uint32  InLength,
FString &  OutString 
)
pure virtual

Gets the code points in a range of indices.

Parameters
InBeginIndexThe code point index at the beginning of the range to get.
InLengthThe number of code points to get after the beginning index.
OutStringA string to store the code points being returned.

◆ GetTextLength()

virtual uint32 ITextInputMethodContext::GetTextLength ( )
pure virtual

Returns the number of code points in the text.

Returns
The number of code points in the text.

◆ GetWindow()

virtual TSharedPtr< FGenericWindow > ITextInputMethodContext::GetWindow ( )
pure virtual

Returns the window in which the text is displayed.

Returns
The window in which the text is displayed.

◆ IsComposing()

virtual bool ITextInputMethodContext::IsComposing ( )
pure virtual

Returns whether or not this context is currently composing.

Note
This should be set to true when BeginComposition is called, and false when EndComposition is called.
Returns
True if we are composing, false otherwise.

◆ IsReadOnly()

virtual bool ITextInputMethodContext::IsReadOnly ( )
pure virtual

Returns whether or not this text is read-only.

Returns
True if the text is read-only, false otherwise.

◆ SetSelectionRange()

virtual void ITextInputMethodContext::SetSelectionRange ( const uint32  InBeginIndex,
const uint32  InLength,
const ECaretPosition  InCaretPosition 
)
pure virtual

Sets the range of code point indices that are selected and which end of the selection the caret is at.

Parameters
InBeginIndexThe code point index at the beginning of the selection range.
InLengthThe number of code points selected after the beginning index.
InCaretPositionA flag indicating whether the caret is at the beginning or ending of the range. Irrelevant if the Length is zero.

◆ SetTextInRange()

virtual void ITextInputMethodContext::SetTextInRange ( const uint32  InBeginIndex,
const uint32  InLength,
const FString &  InString 
)
pure virtual

Sets the code points in a range of indices.

Parameters
InBeginIndexThe code point index at the beginning of the range to set.
InLengthThe number of code points to set after the beginning index.
InStringA string of the code points to be set.

◆ UpdateCompositionRange()

virtual void ITextInputMethodContext::UpdateCompositionRange ( const int32  InBeginIndex,
const uint32  InLength 
)
pure virtual

Updates the range of code point indices being composed. These code points should be displayed in some manner to communicate they are being composed. IE: Highlighted and underlined.

Parameters
InBeginIndexThe code point index at the beginning of the range being composed.
InLengthThe number of code points to measure after the beginning index.

The documentation for this class was generated from the following file: