Class InputMethodContext
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
InputMethodContext.InputMethodContextImpl
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Inner class implementing a builder pattern to construct a GObject with properties.static interface
Functional interface declaration of theCommittedCallback
callback.static interface
Functional interface declaration of theDeleteSurroundingCallback
callback.static class
static class
The InputMethodContextImpl type represents a native instance of the abstract InputMethodContext class.static interface
Functional interface declaration of thePreeditChangedCallback
callback.static interface
Functional interface declaration of thePreeditFinishedCallback
callback.static interface
Functional interface declaration of thePreeditStartedCallback
callback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionInputMethodContext
(MemorySegment address) Create a InputMethodContext proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected InputMethodContext
asParent()
Returns this instance as if it were its parent type.static InputMethodContext.Builder
<? extends InputMethodContext.Builder> builder()
AInputMethodContext.Builder
object constructs aInputMethodContext
with the specified properties.protected void
protected void
deleteSurrounding
(int offset, int nChars) void
emitCommitted
(String text) Emits the "committed" signal.void
emitDeleteSurrounding
(int offset, int nChars) Emits the "delete-surrounding" signal.void
Emits the "preedit-changed" signal.void
Emits the "preedit-finished" signal.void
Emits the "preedit-started" signal.boolean
filterKeyEvent
(Event keyEvent) AllowkeyEvent
to be handled by the input method.Get the value of theWebKitInputMethodContext
:input-hints property.Get the value of theWebKitInputMethodContext
:input-purpose property.static MemoryLayout
The memory layout of the native struct.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.static Type
getType()
Get the GType of the InputMethodContext classvoid
notifyCursorArea
(int x, int y, int width, int height) Notify this InputMethodContext that cursor area changed in input associated.void
Notify this InputMethodContext that input associated has gained focus.void
Notify this InputMethodContext that input associated has lost focus.void
notifySurrounding
(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 void
protected void
protected void
void
reset()
Reset the this InputMethodContext.void
setEnablePreedit
(boolean enabled) Set whether this InputMethodContext should enable preedit to display feedback.void
setInputHints
(Set<InputHints> hints) Set the value of theWebKitInputMethodContext
:input-hints property.void
setInputHints
(InputHints... hints) Set the value of theWebKitInputMethodContext
:input-hints property.void
setInputPurpose
(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, 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, 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, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.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
-
-
Method Details
-
getType
-
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 Javasuper
keyword, 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
AllowkeyEvent
to be handled by the input method.If
true
is returned, then no further processing should be done for the key event.- Parameters:
keyEvent
- the key event to filter- Returns:
true
if the key event was handled, orfalse
otherwise
-
getInputHints
Get the value of theWebKitInputMethodContext
:input-hints property.- Returns:
- the
WebKitInputHints
of the input associated with this InputMethodContext
-
getInputPurpose
Get the value of theWebKitInputMethodContext
:input-purpose property.- Returns:
- the
WebKitInputPurpose
of the input associated with this InputMethodContext
-
getPreedit
public void getPreedit(@Nullable @Nullable Out<String> text, @Nullable @Nullable Out<List<InputMethodUnderline>> underlines, @Nullable @Nullable Out<Integer> cursorOffset) Get the pre-edit string and a list of WebKitInputMethodUnderline.Get the current pre-edit string for the this InputMethodContext, and a list of WebKitInputMethodUnderline to apply to the string. The string will be displayed inserted at
cursorOffset
.- Parameters:
text
- location to store the preedit stringunderlines
- location to store the underlines as aGList
ofWebKitInputMethodUnderline
cursorOffset
- location to store the position of cursor in preedit string
-
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
-
notifyFocusIn
public void notifyFocusIn()Notify this InputMethodContext that input associated has gained focus. -
notifyFocusOut
public void notifyFocusOut()Notify this InputMethodContext that input associated has lost focus. -
notifySurrounding
Notify this InputMethodContext that the context surrounding the cursor has changed.If there's no selection
selectionIndex
is the same ascursorIndex
.- Parameters:
text
- text surrounding the insertion pointlength
- the length oftext
, or -1 iftext
is nul-terminatedcursorIndex
- the byte index of the insertion cursor withintext
.selectionIndex
- the byte index of the selection cursor withintext
.
-
reset
public void reset()Reset the this InputMethodContext.This will typically cause the input to clear the preedit state.
-
setEnablePreedit
public void setEnablePreedit(boolean enabled) Set whether this InputMethodContext should enable preedit to display feedback.- Parameters:
enabled
- whether to enable preedit
-
setInputHints
Set the value of theWebKitInputMethodContext
:input-hints property.- Parameters:
hints
- aWebKitInputHints
-
setInputHints
Set the value of theWebKitInputMethodContext
:input-hints property.- Parameters:
hints
- aWebKitInputHints
-
setInputPurpose
Set the value of theWebKitInputMethodContext
:input-purpose property.- Parameters:
purpose
- aWebKitInputPurpose
-
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
- See Also:
-
emitCommitted
Emits the "committed" signal. SeeonCommitted(org.gnome.webkit.InputMethodContext.CommittedCallback)
. -
onDeleteSurrounding
public SignalConnection<InputMethodContext.DeleteSurroundingCallback> onDeleteSurrounding(InputMethodContext.DeleteSurroundingCallback handler) Emitted when the input method wants to delete the context surrounding the cursor. Ifoffset
is 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
- See Also:
-
emitDeleteSurrounding
public void emitDeleteSurrounding(int offset, int nChars) Emits the "delete-surrounding" signal. SeeonDeleteSurrounding(org.gnome.webkit.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
- See Also:
-
emitPreeditChanged
public void emitPreeditChanged()Emits the "preedit-changed" signal. SeeonPreeditChanged(org.gnome.webkit.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
- See Also:
-
emitPreeditFinished
public void emitPreeditFinished()Emits the "preedit-finished" signal. SeeonPreeditFinished(org.gnome.webkit.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
- See Also:
-
emitPreeditStarted
public void emitPreeditStarted()Emits the "preedit-started" signal. SeeonPreeditStarted(org.gnome.webkit.InputMethodContext.PreeditStartedCallback)
. -
builder
AInputMethodContext.Builder
object constructs aInputMethodContext
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withInputMethodContext.Builder.build()
.
-