Class InputMethodContext
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
InputMethodContext.InputMethodContext$Impl
WebKitInputMethodContext defines the interface to implement WebKit input methods. The input methods are used by WebKit, when editable content is focused, to map from key events to Unicode character strings.
An input method may consume multiple key events in sequence and finally output the composed result. This is called preediting, and an input method may provide feedback about this process by displaying the intermediate composition states as preedit text.
- Since:
- 2.28
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classInner class implementing a builder pattern to construct a GObject with properties.static interfaceFunctional interface declaration of theCommittedCallbackcallback.static interfaceFunctional interface declaration of theDeleteSurroundingCallbackcallback.static classThe InputMethodContext$Impl type represents a native instance of the abstract InputMethodContext class.static classstatic interfaceFunctional interface declaration of thePreeditChangedCallbackcallback.static interfaceFunctional interface declaration of thePreeditFinishedCallbackcallback.static interfaceFunctional interface declaration of thePreeditStartedCallbackcallback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new InputMethodContext.InputMethodContext(MemorySegment address) Create a InputMethodContext proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected InputMethodContextasParent()Returns this instance as if it were its parent type.protected voidprotected voiddeleteSurrounding(int offset, int nChars) voidemitCommitted(String text) Emits the "committed" signal.voidemitDeleteSurrounding(int offset, int nChars) Emits the "delete-surrounding" signal.voidEmits the "preedit-changed" signal.voidEmits the "preedit-finished" signal.voidEmits the "preedit-started" signal.booleanfilterKeyEvent(Event keyEvent) AllowkeyEventto be handled by the input method.Get the value of theWebKitInputMethodContext:input-hints property.Get the value of theWebKitInputMethodContext:input-purpose property.static MemoryLayoutThe memory layout of the native struct.voidgetPreedit(@Nullable Out<String> text, @Nullable Out<List<InputMethodUnderline>> underlines, @Nullable Out<Integer> cursorOffset) Get the pre-edit string and a list of WebKitInputMethodUnderline.static @Nullable TypegetType()Get the GType of the InputMethodContext classvoidnotifyCursorArea(int x, int y, int width, int height) Notify this InputMethodContext that cursor area changed in input associated.voidNotify this InputMethodContext that input associated has gained focus.voidNotify this InputMethodContext that input associated has lost focus.voidnotifySurrounding(String text, int length, int cursorIndex, int selectionIndex) Notify this InputMethodContext that the context surrounding the cursor has changed.Emitted when a complete input sequence has been entered by the user.Emitted when the input method wants to delete the context surrounding the cursor.Emitted whenever the preedit sequence currently being entered has changed.Emitted when a preediting sequence has been completed or canceled.Emitted when a new preediting sequence starts.protected voidprotected voidprotected voidvoidreset()Reset thecontext.voidsetEnablePreedit(boolean enabled) Set whether this InputMethodContext should enable preedit to display feedback.voidsetInputHints(Set<InputHints> hints) Set the value of theWebKitInputMethodContext:input-hints property.voidsetInputHints(InputHints... hints) Set the value of theWebKitInputMethodContext:input-hints property.voidsetInputPurpose(InputPurpose purpose) Set the value of theWebKitInputMethodContext:input-purpose property.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, builder, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
InputMethodContext
Create a InputMethodContext proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
InputMethodContext
public InputMethodContext()Creates a new InputMethodContext.
-
-
Method Details
-
getType
Get the GType of the InputMethodContext class- Returns:
- the GType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
filterKeyEvent
AllowkeyEventto be handled by the input method.If
trueis returned, then no further processing should be done for the key event.- Parameters:
keyEvent- the key event to filter- Returns:
trueif the key event was handled, orfalseotherwise- Since:
- 2.28
-
getInputHints
Get the value of theWebKitInputMethodContext:input-hints property.- Returns:
- the
WebKitInputHintsof the input associated with this InputMethodContext - Since:
- 2.28
-
getInputPurpose
Get the value of theWebKitInputMethodContext:input-purpose property.- Returns:
- the
WebKitInputPurposeof the input associated with this InputMethodContext - Since:
- 2.28
-
getPreedit
public void getPreedit(@Nullable Out<String> text, @Nullable Out<List<InputMethodUnderline>> underlines, @Nullable Out<Integer> cursorOffset) Get the pre-edit string and a list of WebKitInputMethodUnderline.Get the current pre-edit string for the
context,and a list of WebKitInputMethodUnderline to apply to the string. The string will be displayed inserted atcursorOffset.- Parameters:
text- location to store the preedit stringunderlines- location to store the underlines as aGListofWebKitInputMethodUnderlinecursorOffset- location to store the position of cursor in preedit string- Since:
- 2.28
-
notifyCursorArea
public void notifyCursorArea(int x, int y, int width, int height) Notify this InputMethodContext that cursor area changed in input associated.- Parameters:
x- the x coordinate of cursor locationy- the y coordinate of cursor locationwidth- the width of cursor areaheight- the height of cursor area- Since:
- 2.28
-
notifyFocusIn
public void notifyFocusIn()Notify this InputMethodContext that input associated has gained focus.- Since:
- 2.28
-
notifyFocusOut
public void notifyFocusOut()Notify this InputMethodContext that input associated has lost focus.- Since:
- 2.28
-
notifySurrounding
Notify this InputMethodContext that the context surrounding the cursor has changed.If there's no selection
selectionIndexis the same ascursorIndex.- Parameters:
text- text surrounding the insertion pointlength- the length oftext,or -1 iftextis nul-terminatedcursorIndex- the byte index of the insertion cursor withintext.selectionIndex- the byte index of the selection cursor withintext.- Since:
- 2.28
-
reset
public void reset()Reset thecontext.This will typically cause the input to clear the preedit state.
- Since:
- 2.28
-
setEnablePreedit
public void setEnablePreedit(boolean enabled) Set whether this InputMethodContext should enable preedit to display feedback.- Parameters:
enabled- whether to enable preedit- Since:
- 2.28
-
setInputHints
Set the value of theWebKitInputMethodContext:input-hints property.- Parameters:
hints- aWebKitInputHints- Since:
- 2.28
-
setInputHints
Set the value of theWebKitInputMethodContext:input-hints property.- Parameters:
hints- aWebKitInputHints- Since:
- 2.28
-
setInputPurpose
Set the value of theWebKitInputMethodContext:input-purpose property.- Parameters:
purpose- aWebKitInputPurpose- Since:
- 2.28
-
committed
-
deleteSurrounding
protected void deleteSurrounding(int offset, int nChars) -
preeditChanged
protected void preeditChanged() -
preeditFinished
protected void preeditFinished() -
preeditStarted
protected void preeditStarted() -
onCommitted
public SignalConnection<InputMethodContext.CommittedCallback> onCommitted(InputMethodContext.CommittedCallback handler) Emitted when a complete input sequence has been entered by the user. This can be a single character immediately after a key press or the final result of preediting.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- Since:
- 2.28
- See Also:
-
emitCommitted
Emits the "committed" signal. SeeonCommitted(org.webkitgtk.InputMethodContext.CommittedCallback). -
onDeleteSurrounding
public SignalConnection<InputMethodContext.DeleteSurroundingCallback> onDeleteSurrounding(InputMethodContext.DeleteSurroundingCallback handler) Emitted when the input method wants to delete the context surrounding the cursor. Ifoffsetis a negative value, it means a position before the cursor.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- Since:
- 2.28
- See Also:
-
emitDeleteSurrounding
public void emitDeleteSurrounding(int offset, int nChars) Emits the "delete-surrounding" signal. SeeonDeleteSurrounding(org.webkitgtk.InputMethodContext.DeleteSurroundingCallback). -
onPreeditChanged
public SignalConnection<InputMethodContext.PreeditChangedCallback> onPreeditChanged(InputMethodContext.PreeditChangedCallback handler) Emitted whenever the preedit sequence currently being entered has changed. It is also emitted at the end of a preedit sequence, in which case webkit_input_method_context_get_preedit() returns the empty string.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- Since:
- 2.28
- See Also:
-
emitPreeditChanged
public void emitPreeditChanged()Emits the "preedit-changed" signal. SeeonPreeditChanged(org.webkitgtk.InputMethodContext.PreeditChangedCallback). -
onPreeditFinished
public SignalConnection<InputMethodContext.PreeditFinishedCallback> onPreeditFinished(InputMethodContext.PreeditFinishedCallback handler) Emitted when a preediting sequence has been completed or canceled.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- Since:
- 2.28
- See Also:
-
emitPreeditFinished
public void emitPreeditFinished()Emits the "preedit-finished" signal. SeeonPreeditFinished(org.webkitgtk.InputMethodContext.PreeditFinishedCallback). -
onPreeditStarted
public SignalConnection<InputMethodContext.PreeditStartedCallback> onPreeditStarted(InputMethodContext.PreeditStartedCallback handler) Emitted when a new preediting sequence starts.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- Since:
- 2.28
- See Also:
-
emitPreeditStarted
public void emitPreeditStarted()Emits the "preedit-started" signal. SeeonPreeditStarted(org.webkitgtk.InputMethodContext.PreeditStartedCallback).
-