Trait gtk4::prelude::IMContextExt
source · pub trait IMContextExt: 'static {
Show 26 methods
// Required methods
fn delete_surrounding(&self, offset: i32, n_chars: i32) -> bool;
fn filter_key(
&self,
press: bool,
surface: &impl IsA<Surface>,
device: &Device,
time: u32,
keycode: u32,
state: ModifierType,
group: i32
) -> bool;
fn filter_keypress(&self, event: impl AsRef<Event>) -> bool;
fn focus_in(&self);
fn focus_out(&self);
fn preedit_string(&self) -> (GString, AttrList, i32);
fn surrounding(&self) -> Option<(GString, i32)>;
fn surrounding_with_selection(&self) -> Option<(GString, i32, i32)>;
fn reset(&self);
fn set_client_widget(&self, widget: Option<&impl IsA<Widget>>);
fn set_cursor_location(&self, area: &Rectangle);
fn set_surrounding(&self, text: &str, cursor_index: i32);
fn set_surrounding_with_selection(
&self,
text: &str,
cursor_index: i32,
anchor_index: i32
);
fn set_use_preedit(&self, use_preedit: bool);
fn input_hints(&self) -> InputHints;
fn set_input_hints(&self, input_hints: InputHints);
fn input_purpose(&self) -> InputPurpose;
fn set_input_purpose(&self, input_purpose: InputPurpose);
fn connect_commit<F: Fn(&Self, &str) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_delete_surrounding<F: Fn(&Self, i32, i32) -> bool + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_preedit_changed<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_preedit_end<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_preedit_start<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_retrieve_surrounding<F: Fn(&Self) -> bool + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_input_hints_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_input_purpose_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
}
Expand description
Required Methods§
sourcefn delete_surrounding(&self, offset: i32, n_chars: i32) -> bool
fn delete_surrounding(&self, offset: i32, n_chars: i32) -> bool
Asks the widget that the input context is attached to delete
characters around the cursor position by emitting the
::delete_surrounding
signal.
Note that @offset and @n_chars are in characters not in bytes
which differs from the usage other places in IMContext
.
In order to use this function, you should first call
surrounding()
to get the current context,
and call this function immediately afterwards to make sure that you
know what you are deleting. You should also account for the fact
that even if the signal was handled, the input context might not
have deleted all the characters that were requested to be deleted.
This function is used by an input method that wants to make substitutions in the existing text in response to new input. It is not useful for applications.
offset
offset from cursor position in chars; a negative value means start before the cursor.
n_chars
number of characters to delete.
Returns
true
if the signal was handled.
sourcefn filter_key(
&self,
press: bool,
surface: &impl IsA<Surface>,
device: &Device,
time: u32,
keycode: u32,
state: ModifierType,
group: i32
) -> bool
fn filter_key( &self, press: bool, surface: &impl IsA<Surface>, device: &Device, time: u32, keycode: u32, state: ModifierType, group: i32 ) -> bool
Allow an input method to forward key press and release events
to another input method without necessarily having a gdk::Event
available.
press
whether to forward a key press or release event
surface
the surface the event is for
device
the device that the event is for
time
the timestamp for the event
keycode
the keycode for the event
state
modifier state for the event
group
the active keyboard group for the event
Returns
true
if the input method handled the key event.
sourcefn filter_keypress(&self, event: impl AsRef<Event>) -> bool
fn filter_keypress(&self, event: impl AsRef<Event>) -> bool
fn focus_in(&self)
fn focus_out(&self)
fn preedit_string(&self) -> (GString, AttrList, i32)
fn surrounding(&self) -> Option<(GString, i32)>
sourcefn surrounding_with_selection(&self) -> Option<(GString, i32, i32)>
fn surrounding_with_selection(&self) -> Option<(GString, i32, i32)>
v4_2
only.fn reset(&self)
fn set_client_widget(&self, widget: Option<&impl IsA<Widget>>)
fn set_cursor_location(&self, area: &Rectangle)
fn set_surrounding(&self, text: &str, cursor_index: i32)
sourcefn set_surrounding_with_selection(
&self,
text: &str,
cursor_index: i32,
anchor_index: i32
)
fn set_surrounding_with_selection( &self, text: &str, cursor_index: i32, anchor_index: i32 )
v4_2
only.