1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from webkit-gir-files
// DO NOT EDIT
use crate::ffi;
use glib::translate::*;
glib::wrapper! {
/// Range of text in an preedit string to be shown underlined.
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct InputMethodUnderline(Boxed<ffi::WebKitInputMethodUnderline>);
match fn {
copy => |ptr| ffi::webkit_input_method_underline_copy(mut_override(ptr)),
free => |ptr| ffi::webkit_input_method_underline_free(ptr),
type_ => || ffi::webkit_input_method_underline_get_type(),
}
}
impl InputMethodUnderline {
/// Create a new #WebKitInputMethodUnderline for the given range in preedit string
/// ## `start_offset`
/// the start offset in preedit string
/// ## `end_offset`
/// the end offset in preedit string
///
/// # Returns
///
/// A newly created #WebKitInputMethodUnderline
#[doc(alias = "webkit_input_method_underline_new")]
pub fn new(start_offset: u32, end_offset: u32) -> InputMethodUnderline {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::webkit_input_method_underline_new(
start_offset,
end_offset,
))
}
}
/// Set the color of the underline.
///
/// If @rgba is [`None`] the foreground text color will be used
/// for the underline too.
/// ## `rgba`
/// a #GdkRGBA or [`None`]
#[doc(alias = "webkit_input_method_underline_set_color")]
pub fn set_color(&mut self, rgba: Option<&gdk::RGBA>) {
unsafe {
ffi::webkit_input_method_underline_set_color(
self.to_glib_none_mut().0,
rgba.to_glib_none().0,
);
}
}
}