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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files.git)
// DO NOT EDIT
use crate::Navigator;
use glib::{prelude::*, translate::*};
use std::fmt;
glib::wrapper! {
///
///
/// ## Properties
///
///
/// #### `view`
/// The [`gtk::TextView`][crate::gtk::TextView]. The buffer is not sufficient, the view is needed to
/// scroll to the misspelled words.
///
/// Readable | Writeable | Construct Only
///
/// # Implements
///
/// [`NavigatorTextViewExt`][trait@crate::prelude::NavigatorTextViewExt], [`NavigatorExt`][trait@crate::prelude::NavigatorExt]
#[doc(alias = "GspellNavigatorTextView")]
pub struct NavigatorTextView(Object<ffi::GspellNavigatorTextView, ffi::GspellNavigatorTextViewClass>) @implements Navigator;
match fn {
type_ => || ffi::gspell_navigator_text_view_get_type(),
}
}
impl NavigatorTextView {
pub const NONE: Option<&'static NavigatorTextView> = None;
// rustdoc-stripper-ignore-next
/// Creates a new builder-pattern struct instance to construct [`NavigatorTextView`] objects.
///
/// This method returns an instance of [`NavigatorTextViewBuilder`](crate::builders::NavigatorTextViewBuilder) which can be used to create [`NavigatorTextView`] objects.
pub fn builder() -> NavigatorTextViewBuilder {
NavigatorTextViewBuilder::new()
}
/// ## `view`
/// a [`gtk::TextView`][crate::gtk::TextView].
///
/// # Returns
///
/// a new [`NavigatorTextView`][crate::NavigatorTextView] floating object.
#[doc(alias = "gspell_navigator_text_view_new")]
pub fn new(view: &impl IsA<gtk::TextView>) -> Option<Navigator> {
assert_initialized_main_thread!();
unsafe {
from_glib_none(ffi::gspell_navigator_text_view_new(
view.as_ref().to_glib_none().0,
))
}
}
}
// rustdoc-stripper-ignore-next
/// A [builder-pattern] type to construct [`NavigatorTextView`] objects.
///
/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
#[must_use = "The builder must be built to be used"]
pub struct NavigatorTextViewBuilder {
builder: glib::object::ObjectBuilder<'static, NavigatorTextView>,
}
impl NavigatorTextViewBuilder {
fn new() -> Self {
Self {
builder: glib::object::Object::builder(),
}
}
/// The [`gtk::TextView`][crate::gtk::TextView]. The buffer is not sufficient, the view is needed to
/// scroll to the misspelled words.
pub fn view(self, view: &impl IsA<gtk::TextView>) -> Self {
Self {
builder: self.builder.property("view", view.clone().upcast()),
}
}
// rustdoc-stripper-ignore-next
/// Build the [`NavigatorTextView`].
#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
pub fn build(self) -> NavigatorTextView {
self.builder.build()
}
}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::NavigatorTextView>> Sealed for T {}
}
/// Trait containing all [`struct@NavigatorTextView`] methods.
///
/// # Implementors
///
/// [`NavigatorTextView`][struct@crate::NavigatorTextView]
pub trait NavigatorTextViewExt: IsA<NavigatorTextView> + sealed::Sealed + 'static {
///
/// # Returns
///
/// the [`gtk::TextView`][crate::gtk::TextView].
#[doc(alias = "gspell_navigator_text_view_get_view")]
#[doc(alias = "get_view")]
fn view(&self) -> Option<gtk::TextView> {
unsafe {
from_glib_none(ffi::gspell_navigator_text_view_get_view(
self.as_ref().to_glib_none().0,
))
}
}
}
impl<O: IsA<NavigatorTextView>> NavigatorTextViewExt for O {}
impl fmt::Display for NavigatorTextView {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("NavigatorTextView")
}
}