pub enum InputMethod<T = String> {
Disabled,
Enabled {
position: Point,
purpose: Purpose,
preedit: Option<Preedit<T>>,
},
}
Expand description
The input method strategy of a widget.
Variants§
Disabled
Input method is disabled.
Enabled
Input method is enabled.
Fields
§
preedit: Option<Preedit<T>>
The preedit to overlay on top of the input method dialog, if needed.
Ideally, your widget will show pre-edits on-the-spot; but, since that can be tricky, you can instead provide the current pre-edit here and the runtime will display it as an overlay (i.e. “Over-the-spot IME”).
Implementations§
Source§impl InputMethod
impl InputMethod
Sourcepub fn merge<T: AsRef<str>>(&mut self, other: &InputMethod<T>)
pub fn merge<T: AsRef<str>>(&mut self, other: &InputMethod<T>)
Merges two InputMethod
strategies, prioritizing the first one when both open:
let open = InputMethod::Enabled {
position: Point::ORIGIN,
purpose: Purpose::Normal,
preedit: Some(Preedit { content: "1".to_owned(), selection: None, text_size: None }),
};
let open_2 = InputMethod::Enabled {
position: Point::ORIGIN,
purpose: Purpose::Secure,
preedit: Some(Preedit { content: "2".to_owned(), selection: None, text_size: None }),
};
let mut ime = InputMethod::Disabled;
ime.merge(&open);
assert_eq!(ime, open);
ime.merge(&open_2);
assert_eq!(ime, open);
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Returns true if the InputMethod
is open.
Source§impl<T> InputMethod<T>
impl<T> InputMethod<T>
Sourcepub fn to_owned(&self) -> InputMethod
pub fn to_owned(&self) -> InputMethod
Turns an InputMethod
into its owned version.
Trait Implementations§
Source§impl<T: Clone> Clone for InputMethod<T>
impl<T: Clone> Clone for InputMethod<T>
Source§fn clone(&self) -> InputMethod<T>
fn clone(&self) -> InputMethod<T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T: Debug> Debug for InputMethod<T>
impl<T: Debug> Debug for InputMethod<T>
Source§impl<T: PartialEq> PartialEq for InputMethod<T>
impl<T: PartialEq> PartialEq for InputMethod<T>
impl<T> StructuralPartialEq for InputMethod<T>
Auto Trait Implementations§
impl<T> Freeze for InputMethod<T>where
T: Freeze,
impl<T> RefUnwindSafe for InputMethod<T>where
T: RefUnwindSafe,
impl<T> Send for InputMethod<T>where
T: Send,
impl<T> Sync for InputMethod<T>where
T: Sync,
impl<T> Unpin for InputMethod<T>where
T: Unpin,
impl<T> UnwindSafe for InputMethod<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more