sourceview5-0.9.0/.cargo_vcs_info.json0000644000000001510000000000100133170ustar { "git": { "sha1": "01c1049b83e3da22578467d7ec3e57f571239519" }, "path_in_vcs": "sourceview5" }sourceview5-0.9.0/Cargo.toml0000644000000037440000000000100113300ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2021" name = "sourceview5" version = "0.9.0" authors = ["Bilal Elmoussaoui "] description = "Rust bindings for GtkSourceView 5" homepage = "https://world.pages.gitlab.gnome.org/Rust/sourceview5-rs/" documentation = "https://world.pages.gitlab.gnome.org/Rust/sourceview5-rs/stable/latest/docs/sourceview5" readme = "README.md" keywords = [ "gtk4-rs", "gnome", "sourceview", "ffi", "GUI", ] categories = [ "api-bindings", "gui", ] license-file = "LICENSE" repository = "https://gitlab.gnome.org/World/Rust/sourceview5-rs/" [package.metadata.docs.rs] all-features = true rustc-args = [ "--cfg", "docsrs", ] rustdoc-args = [ "--cfg", "docsrs", "--generate-link-to-definition", ] [dependencies.ffi] version = "0.9" package = "sourceview5-sys" [dependencies.futures-channel] version = "0.3" [dependencies.futures-core] version = "0.3" default-features = false [dependencies.gdk] version = "0.9" package = "gdk4" [dependencies.gdk-pixbuf] version = "0.20" [dependencies.gio] version = "0.20" [dependencies.glib] version = "0.20" [dependencies.gtk] version = "0.9" package = "gtk4" [dependencies.libc] version = "0.2" [dependencies.pango] version = "0.20" [features] default = [] gtk_v4_12 = ["gtk/v4_12"] gtk_v4_6 = [ "gtk/v4_6", "pango/v1_50", ] v5_10 = [ "v5_6", "ffi/v5_10", ] v5_12 = [ "v5_10", "ffi/v5_12", ] v5_2 = ["ffi/v5_2"] v5_4 = [ "v5_2", "ffi/v5_4", "gtk_v4_6", ] v5_6 = [ "v5_4", "ffi/v5_6", ] sourceview5-0.9.0/Cargo.toml.orig000064400000000000000000000034141046102023000150030ustar 00000000000000[package] authors = ["Bilal Elmoussaoui "] edition = "2021" name = "sourceview5" version = "0.9.0" readme = "./../README.md" license-file = "./../LICENSE" homepage = "https://world.pages.gitlab.gnome.org/Rust/sourceview5-rs/" documentation = "https://world.pages.gitlab.gnome.org/Rust/sourceview5-rs/stable/latest/docs/sourceview5" repository = "https://gitlab.gnome.org/World/Rust/sourceview5-rs/" categories = ["api-bindings", "gui"] keywords = ["gtk4-rs", "gnome", "sourceview", "ffi", "GUI"] description = "Rust bindings for GtkSourceView 5" [features] default = [] gtk_v4_6 = ["gtk/v4_6", "pango/v1_50"] gtk_v4_12 = ["gtk/v4_12"] v5_2 = ["ffi/v5_2"] v5_4 = ["v5_2", "ffi/v5_4", "gtk_v4_6"] v5_6 = ["v5_4", "ffi/v5_6"] v5_10 = ["v5_6", "ffi/v5_10"] v5_12 = ["v5_10", "ffi/v5_12"] [package.metadata.docs.rs] all-features = true rustc-args = ["--cfg", "docsrs"] rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] [dependencies] libc = "0.2" futures-core = { version = "0.3", default-features = false } futures-channel = "0.3" [dependencies.gtk] git = "https://github.com/gtk-rs/gtk4-rs.git" package = "gtk4" branch = "0.9" version = "0.9" [dependencies.gdk] git = "https://github.com/gtk-rs/gtk4-rs.git" package = "gdk4" branch = "0.9" version = "0.9" [dependencies.glib] git = "https://github.com/gtk-rs/gtk-rs-core.git" branch = "0.20" version = "0.20" [dependencies.pango] git = "https://github.com/gtk-rs/gtk-rs-core.git" branch = "0.20" version = "0.20" [dependencies.gdk-pixbuf] git = "https://github.com/gtk-rs/gtk-rs-core.git" branch = "0.20" version = "0.20" [dependencies.gio] git = "https://github.com/gtk-rs/gtk-rs-core.git" branch = "0.20" version = "0.20" [dependencies.ffi] package = "sourceview5-sys" path = "./sys" version = "0.9" sourceview5-0.9.0/Gir.toml000064400000000000000000000112241046102023000135300ustar 00000000000000[options] deprecate_by_min_version = true generate_safety_asserts = true girs_directories = ["../gir-files", "../"] library = "GtkSource" min_cfg_version = "5.0" single_version_file = true target_path = "." version = "5" work_mode = "normal" generate_builder = true use_gi_docgen = true trust_return_value_nullability = true external_libraries = [ "GLib", "GObject", "Gdk", "GdkPixbuf", "Gio", "Gtk", "Pango", ] generate = [ "GtkSource.BackgroundPatternType", "GtkSource.BracketMatchType", "GtkSource.Buffer", "GtkSource.ChangeCaseType", "GtkSource.Completion", "GtkSource.CompletionActivation", "GtkSource.CompletionCell", "GtkSource.CompletionColumn", "GtkSource.CompletionContext", "GtkSource.CompletionProposal", "GtkSource.CompletionProvider", "GtkSource.CompletionSnippets", "GtkSource.CompletionWords", "GtkSource.CompressionType", "GtkSource.Encoding", "GtkSource.FileLoaderError", "GtkSource.FileSaverError", "GtkSource.FileSaverFlags", "GtkSource.Gutter", "GtkSource.GutterLines", "GtkSource.GutterRenderer", "GtkSource.GutterRendererAlignmentMode", "GtkSource.GutterRendererPixbuf", "GtkSource.GutterRendererText", "GtkSource.Hover", "GtkSource.HoverContext", "GtkSource.HoverDisplay", "GtkSource.HoverProvider", "GtkSource.Indenter", "GtkSource.Language", "GtkSource.LanguageManager", "GtkSource.Map", "GtkSource.Mark", "GtkSource.MarkAttributes", "GtkSource.MountOperationFactory", "GtkSource.NewlineType", "GtkSource.PrintCompositor", "GtkSource.Region", "GtkSource.SearchSettings", "GtkSource.SmartHomeEndType", "GtkSource.Snippet", "GtkSource.SnippetChunk", "GtkSource.SnippetContext", "GtkSource.SnippetManager", "GtkSource.SortFlags", "GtkSource.SpaceDrawer", "GtkSource.SpaceLocationFlags", "GtkSource.SpaceTypeFlags", "GtkSource.Style", "GtkSource.StyleScheme", "GtkSource.StyleSchemeChooser", "GtkSource.StyleSchemeChooserButton", "GtkSource.StyleSchemeChooserWidget", "GtkSource.StyleSchemeManager", "GtkSource.Tag", "GtkSource.ViewGutterPosition", "GtkSource.VimIMContext", ] manual = [ "GLib.Error", "GObject.Object", "GLib.Priority", "GLib.Quark", "GLib.Variant", "Gdk.Cursor", "Gdk.ModifierType", "Gdk.Paintable", "Gdk.Rectangle", "Gdk.RGBA", "GdkPixbuf.Pixbuf", "Gio.Cancellable", "Gio.File", "Gio.Icon", "Gio.InputStream", "Gio.ListModel", "Gio.MenuModel", "Gio.MountOperation", "Gio.Settings", "Gio.SettingsBindFlags", "Gtk.Accessible", "Gtk.AccessibleRole", "Gtk.Actionable", "Gtk.Adjustment", "Gtk.Align", "Gtk.Buildable", "Gtk.Button", "Gtk.ConstraintTarget", "Gtk.IMContext", "Gtk.InputHints", "Gtk.InputPurpose", "Gtk.Justification", "Gtk.LayoutManager", "Gtk.PrintContext", "Gtk.Overflow", "Gtk.Scrollable", "Gtk.ScrollablePolicy", "Gtk.TextBuffer", "Gtk.TextDirection", "Gtk.TextIter", "Gtk.TextMark", "Gtk.TextTag", "Gtk.TextTagTable", "Gtk.TextView", "Gtk.TextWindowType", "Gtk.Unit", "Gtk.Widget", "Gtk.WrapMode", "GtkSource.RegionIter", "Pango.AttrList", "Pango.FontDescription", "Pango.Overline", "Pango.ShowFlags", "Pango.Stretch", "Pango.Style", "Pango.TabArray", "Pango.TextTransform", "Pango.Underline", "Pango.Variant", "Pango.Weight", ] [[object]] name = "GtkSource.*" status = "generate" [[object]] name = "GtkSource.SearchContext" status = "generate" [[object.function]] name = "replace_all" manual = true # unexpected return type for a function that throws a gerror [[object]] generate_builder = true name = "GtkSource.File" status = "generate" trait_name = "SourceFileExt" # confilcts with gio::prelude::FileExt [[object]] generate_builder = true name = "GtkSource.FileLoader" status = "generate" [[object.function]] name = "set_candidate_encodings" ignore = true # manual [[object.function]] name = "load_async" # Multiple callbacks manual = true [[object]] generate_builder = true name = "GtkSource.FileSaver" status = "generate" [[object.function]] name = "save_async" # Multiple callbacks manual = true [[object]] name = "GtkSource.View" status = "generate" manual_traits = ["ViewManualExt"] [[object.function]] name = "get_mark_attributes" ignore = true # manual [[object.function]] name = "push_snippet" ignore = true # manual [[object]] name = "GtkSource.StyleSchemePreview" status = "generate" version = "5.4" sourceview5-0.9.0/LICENSE000064400000000000000000000020001046102023000131070ustar 00000000000000Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. sourceview5-0.9.0/README.md000064400000000000000000000005541046102023000133750ustar 00000000000000# sourceview5-rs [Gtk SourceView 5](https://gitlab.gnome.org/GNOME/gtksourceview/) Rust bindings
Screenshot
A small demo is available in the [demo](./demo) subdirectory. ## Documentation The versioned documentations can be found https://world.pages.gitlab.gnome.org/Rust/sourceview5-rs/ sourceview5-0.9.0/src/auto/buffer.rs000064400000000000000000000575201046102023000155010ustar 00000000000000// 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::{ffi, BracketMatchType, ChangeCaseType, Language, Mark, SortFlags, StyleScheme}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourceBuffer")] pub struct Buffer(Object) @extends gtk::TextBuffer; match fn { type_ => || ffi::gtk_source_buffer_get_type(), } } impl Buffer { pub const NONE: Option<&'static Buffer> = None; #[doc(alias = "gtk_source_buffer_new")] pub fn new(table: Option<>k::TextTagTable>) -> Buffer { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gtk_source_buffer_new(table.to_glib_none().0)) } } #[doc(alias = "gtk_source_buffer_new_with_language")] #[doc(alias = "new_with_language")] pub fn with_language(language: &Language) -> Buffer { skip_assert_initialized!(); unsafe { from_glib_full(ffi::gtk_source_buffer_new_with_language( language.to_glib_none().0, )) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Buffer`] objects. /// /// This method returns an instance of [`BufferBuilder`](crate::builders::BufferBuilder) which can be used to create [`Buffer`] objects. pub fn builder() -> BufferBuilder { BufferBuilder::new() } } impl Default for Buffer { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Buffer`] 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 BufferBuilder { builder: glib::object::ObjectBuilder<'static, Buffer>, } impl BufferBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn highlight_matching_brackets(self, highlight_matching_brackets: bool) -> Self { Self { builder: self .builder .property("highlight-matching-brackets", highlight_matching_brackets), } } pub fn highlight_syntax(self, highlight_syntax: bool) -> Self { Self { builder: self.builder.property("highlight-syntax", highlight_syntax), } } pub fn implicit_trailing_newline(self, implicit_trailing_newline: bool) -> Self { Self { builder: self .builder .property("implicit-trailing-newline", implicit_trailing_newline), } } pub fn language(self, language: &Language) -> Self { Self { builder: self.builder.property("language", language.clone()), } } pub fn style_scheme(self, style_scheme: &StyleScheme) -> Self { Self { builder: self.builder.property("style-scheme", style_scheme.clone()), } } pub fn enable_undo(self, enable_undo: bool) -> Self { Self { builder: self.builder.property("enable-undo", enable_undo), } } pub fn tag_table(self, tag_table: >k::TextTagTable) -> Self { Self { builder: self.builder.property("tag-table", tag_table.clone()), } } pub fn text(self, text: impl Into) -> Self { Self { builder: self.builder.property("text", text.into()), } } // rustdoc-stripper-ignore-next /// Build the [`Buffer`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Buffer { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait BufferExt: IsA + sealed::Sealed + 'static { //#[doc(alias = "gtk_source_buffer_backward_iter_to_source_mark")] //fn backward_iter_to_source_mark(&self, iter: /*Unimplemented*/gtk::TextIter, category: Option<&str>) -> bool { // unsafe { TODO: call ffi:gtk_source_buffer_backward_iter_to_source_mark() } //} #[doc(alias = "gtk_source_buffer_change_case")] fn change_case( &self, case_type: ChangeCaseType, start: &mut gtk::TextIter, end: &mut gtk::TextIter, ) { unsafe { ffi::gtk_source_buffer_change_case( self.as_ref().to_glib_none().0, case_type.into_glib(), start.to_glib_none_mut().0, end.to_glib_none_mut().0, ); } } #[doc(alias = "gtk_source_buffer_create_source_mark")] fn create_source_mark( &self, name: Option<&str>, category: &str, where_: >k::TextIter, ) -> Mark { unsafe { from_glib_none(ffi::gtk_source_buffer_create_source_mark( self.as_ref().to_glib_none().0, name.to_glib_none().0, category.to_glib_none().0, where_.to_glib_none().0, )) } } //#[doc(alias = "gtk_source_buffer_create_source_tag")] //fn create_source_tag(&self, tag_name: Option<&str>, first_property_name: Option<&str>, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> gtk::TextTag { // unsafe { TODO: call ffi:gtk_source_buffer_create_source_tag() } //} #[doc(alias = "gtk_source_buffer_ensure_highlight")] fn ensure_highlight(&self, start: >k::TextIter, end: >k::TextIter) { unsafe { ffi::gtk_source_buffer_ensure_highlight( self.as_ref().to_glib_none().0, start.to_glib_none().0, end.to_glib_none().0, ); } } //#[doc(alias = "gtk_source_buffer_forward_iter_to_source_mark")] //fn forward_iter_to_source_mark(&self, iter: /*Unimplemented*/gtk::TextIter, category: Option<&str>) -> bool { // unsafe { TODO: call ffi:gtk_source_buffer_forward_iter_to_source_mark() } //} #[doc(alias = "gtk_source_buffer_get_context_classes_at_iter")] #[doc(alias = "get_context_classes_at_iter")] fn context_classes_at_iter(&self, iter: >k::TextIter) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full( ffi::gtk_source_buffer_get_context_classes_at_iter( self.as_ref().to_glib_none().0, iter.to_glib_none().0, ), ) } } #[doc(alias = "gtk_source_buffer_get_highlight_matching_brackets")] #[doc(alias = "get_highlight_matching_brackets")] #[doc(alias = "highlight-matching-brackets")] fn is_highlight_matching_brackets(&self) -> bool { unsafe { from_glib(ffi::gtk_source_buffer_get_highlight_matching_brackets( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_buffer_get_highlight_syntax")] #[doc(alias = "get_highlight_syntax")] #[doc(alias = "highlight-syntax")] fn is_highlight_syntax(&self) -> bool { unsafe { from_glib(ffi::gtk_source_buffer_get_highlight_syntax( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_buffer_get_implicit_trailing_newline")] #[doc(alias = "get_implicit_trailing_newline")] #[doc(alias = "implicit-trailing-newline")] fn is_implicit_trailing_newline(&self) -> bool { unsafe { from_glib(ffi::gtk_source_buffer_get_implicit_trailing_newline( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_buffer_get_language")] #[doc(alias = "get_language")] fn language(&self) -> Option { unsafe { from_glib_none(ffi::gtk_source_buffer_get_language( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_buffer_get_loading")] #[doc(alias = "get_loading")] #[doc(alias = "loading")] fn is_loading(&self) -> bool { unsafe { from_glib(ffi::gtk_source_buffer_get_loading( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_buffer_get_source_marks_at_iter")] #[doc(alias = "get_source_marks_at_iter")] fn source_marks_at_iter(&self, iter: &mut gtk::TextIter, category: Option<&str>) -> Vec { unsafe { FromGlibPtrContainer::from_glib_container( ffi::gtk_source_buffer_get_source_marks_at_iter( self.as_ref().to_glib_none().0, iter.to_glib_none_mut().0, category.to_glib_none().0, ), ) } } #[doc(alias = "gtk_source_buffer_get_source_marks_at_line")] #[doc(alias = "get_source_marks_at_line")] fn source_marks_at_line(&self, line: i32, category: Option<&str>) -> Vec { unsafe { FromGlibPtrContainer::from_glib_container( ffi::gtk_source_buffer_get_source_marks_at_line( self.as_ref().to_glib_none().0, line, category.to_glib_none().0, ), ) } } #[doc(alias = "gtk_source_buffer_get_style_scheme")] #[doc(alias = "get_style_scheme")] #[doc(alias = "style-scheme")] fn style_scheme(&self) -> Option { unsafe { from_glib_none(ffi::gtk_source_buffer_get_style_scheme( self.as_ref().to_glib_none().0, )) } } //#[doc(alias = "gtk_source_buffer_iter_backward_to_context_class_toggle")] //fn iter_backward_to_context_class_toggle(&self, iter: /*Unimplemented*/gtk::TextIter, context_class: &str) -> bool { // unsafe { TODO: call ffi:gtk_source_buffer_iter_backward_to_context_class_toggle() } //} //#[doc(alias = "gtk_source_buffer_iter_forward_to_context_class_toggle")] //fn iter_forward_to_context_class_toggle(&self, iter: /*Unimplemented*/gtk::TextIter, context_class: &str) -> bool { // unsafe { TODO: call ffi:gtk_source_buffer_iter_forward_to_context_class_toggle() } //} #[doc(alias = "gtk_source_buffer_iter_has_context_class")] fn iter_has_context_class(&self, iter: >k::TextIter, context_class: &str) -> bool { unsafe { from_glib(ffi::gtk_source_buffer_iter_has_context_class( self.as_ref().to_glib_none().0, iter.to_glib_none().0, context_class.to_glib_none().0, )) } } #[doc(alias = "gtk_source_buffer_join_lines")] fn join_lines(&self, start: &mut gtk::TextIter, end: &mut gtk::TextIter) { unsafe { ffi::gtk_source_buffer_join_lines( self.as_ref().to_glib_none().0, start.to_glib_none_mut().0, end.to_glib_none_mut().0, ); } } #[doc(alias = "gtk_source_buffer_remove_source_marks")] fn remove_source_marks( &self, start: >k::TextIter, end: >k::TextIter, category: Option<&str>, ) { unsafe { ffi::gtk_source_buffer_remove_source_marks( self.as_ref().to_glib_none().0, start.to_glib_none().0, end.to_glib_none().0, category.to_glib_none().0, ); } } #[doc(alias = "gtk_source_buffer_set_highlight_matching_brackets")] #[doc(alias = "highlight-matching-brackets")] fn set_highlight_matching_brackets(&self, highlight: bool) { unsafe { ffi::gtk_source_buffer_set_highlight_matching_brackets( self.as_ref().to_glib_none().0, highlight.into_glib(), ); } } #[doc(alias = "gtk_source_buffer_set_highlight_syntax")] #[doc(alias = "highlight-syntax")] fn set_highlight_syntax(&self, highlight: bool) { unsafe { ffi::gtk_source_buffer_set_highlight_syntax( self.as_ref().to_glib_none().0, highlight.into_glib(), ); } } #[doc(alias = "gtk_source_buffer_set_implicit_trailing_newline")] #[doc(alias = "implicit-trailing-newline")] fn set_implicit_trailing_newline(&self, implicit_trailing_newline: bool) { unsafe { ffi::gtk_source_buffer_set_implicit_trailing_newline( self.as_ref().to_glib_none().0, implicit_trailing_newline.into_glib(), ); } } #[doc(alias = "gtk_source_buffer_set_language")] #[doc(alias = "language")] fn set_language(&self, language: Option<&Language>) { unsafe { ffi::gtk_source_buffer_set_language( self.as_ref().to_glib_none().0, language.to_glib_none().0, ); } } #[doc(alias = "gtk_source_buffer_set_style_scheme")] #[doc(alias = "style-scheme")] fn set_style_scheme(&self, scheme: Option<&StyleScheme>) { unsafe { ffi::gtk_source_buffer_set_style_scheme( self.as_ref().to_glib_none().0, scheme.to_glib_none().0, ); } } #[doc(alias = "gtk_source_buffer_sort_lines")] fn sort_lines( &self, start: &mut gtk::TextIter, end: &mut gtk::TextIter, flags: SortFlags, column: i32, ) { unsafe { ffi::gtk_source_buffer_sort_lines( self.as_ref().to_glib_none().0, start.to_glib_none_mut().0, end.to_glib_none_mut().0, flags.into_glib(), column, ); } } #[doc(alias = "bracket-matched")] fn connect_bracket_matched, BracketMatchType) + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn bracket_matched_trampoline< P: IsA, F: Fn(&P, Option<>k::TextIter>, BracketMatchType) + 'static, >( this: *mut ffi::GtkSourceBuffer, iter: *mut gtk::ffi::GtkTextIter, state: ffi::GtkSourceBracketMatchType, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( Buffer::from_glib_borrow(this).unsafe_cast_ref(), Option::::from_glib_borrow(iter) .as_ref() .as_ref(), from_glib(state), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"bracket-matched\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( bracket_matched_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "cursor-moved")] fn connect_cursor_moved(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn cursor_moved_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkSourceBuffer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Buffer::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"cursor-moved\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( cursor_moved_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "highlight-updated")] fn connect_highlight_updated( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn highlight_updated_trampoline< P: IsA, F: Fn(&P, >k::TextIter, >k::TextIter) + 'static, >( this: *mut ffi::GtkSourceBuffer, start: *mut gtk::ffi::GtkTextIter, end: *mut gtk::ffi::GtkTextIter, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( Buffer::from_glib_borrow(this).unsafe_cast_ref(), &from_glib_borrow(start), &from_glib_borrow(end), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"highlight-updated\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( highlight_updated_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "source-mark-updated")] fn connect_source_mark_updated( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn source_mark_updated_trampoline< P: IsA, F: Fn(&P, >k::TextMark) + 'static, >( this: *mut ffi::GtkSourceBuffer, mark: *mut gtk::ffi::GtkTextMark, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( Buffer::from_glib_borrow(this).unsafe_cast_ref(), &from_glib_borrow(mark), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"source-mark-updated\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( source_mark_updated_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "highlight-matching-brackets")] fn connect_highlight_matching_brackets_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_highlight_matching_brackets_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceBuffer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Buffer::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::highlight-matching-brackets\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_highlight_matching_brackets_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "highlight-syntax")] fn connect_highlight_syntax_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_highlight_syntax_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceBuffer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Buffer::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::highlight-syntax\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_highlight_syntax_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "implicit-trailing-newline")] fn connect_implicit_trailing_newline_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_implicit_trailing_newline_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceBuffer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Buffer::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::implicit-trailing-newline\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_implicit_trailing_newline_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "language")] fn connect_language_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_language_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkSourceBuffer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Buffer::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::language\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_language_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v5_10")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_10")))] #[doc(alias = "loading")] fn connect_loading_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_loading_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkSourceBuffer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Buffer::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::loading\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_loading_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "style-scheme")] fn connect_style_scheme_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_style_scheme_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkSourceBuffer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Buffer::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::style-scheme\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_style_scheme_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> BufferExt for O {} sourceview5-0.9.0/src/auto/completion.rs000064400000000000000000000355451046102023000164040ustar 00000000000000// 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::{ffi, Buffer, CompletionProvider, View}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourceCompletion")] pub struct Completion(Object); match fn { type_ => || ffi::gtk_source_completion_get_type(), } } impl Completion { // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Completion`] objects. /// /// This method returns an instance of [`CompletionBuilder`](crate::builders::CompletionBuilder) which can be used to create [`Completion`] objects. pub fn builder() -> CompletionBuilder { CompletionBuilder::new() } #[doc(alias = "gtk_source_completion_add_provider")] pub fn add_provider(&self, provider: &impl IsA) { unsafe { ffi::gtk_source_completion_add_provider( self.to_glib_none().0, provider.as_ref().to_glib_none().0, ); } } #[doc(alias = "gtk_source_completion_block_interactive")] pub fn block_interactive(&self) { unsafe { ffi::gtk_source_completion_block_interactive(self.to_glib_none().0); } } #[doc(alias = "gtk_source_completion_get_buffer")] #[doc(alias = "get_buffer")] pub fn buffer(&self) -> Buffer { unsafe { from_glib_none(ffi::gtk_source_completion_get_buffer(self.to_glib_none().0)) } } #[doc(alias = "gtk_source_completion_get_page_size")] #[doc(alias = "get_page_size")] #[doc(alias = "page-size")] pub fn page_size(&self) -> u32 { unsafe { ffi::gtk_source_completion_get_page_size(self.to_glib_none().0) } } #[doc(alias = "gtk_source_completion_get_view")] #[doc(alias = "get_view")] pub fn view(&self) -> View { unsafe { from_glib_none(ffi::gtk_source_completion_get_view(self.to_glib_none().0)) } } #[doc(alias = "gtk_source_completion_hide")] pub fn hide(&self) { unsafe { ffi::gtk_source_completion_hide(self.to_glib_none().0); } } #[doc(alias = "gtk_source_completion_remove_provider")] pub fn remove_provider(&self, provider: &impl IsA) { unsafe { ffi::gtk_source_completion_remove_provider( self.to_glib_none().0, provider.as_ref().to_glib_none().0, ); } } #[doc(alias = "gtk_source_completion_set_page_size")] #[doc(alias = "page-size")] pub fn set_page_size(&self, page_size: u32) { unsafe { ffi::gtk_source_completion_set_page_size(self.to_glib_none().0, page_size); } } #[doc(alias = "gtk_source_completion_show")] pub fn show(&self) { unsafe { ffi::gtk_source_completion_show(self.to_glib_none().0); } } #[doc(alias = "gtk_source_completion_unblock_interactive")] pub fn unblock_interactive(&self) { unsafe { ffi::gtk_source_completion_unblock_interactive(self.to_glib_none().0); } } #[doc(alias = "remember-info-visibility")] pub fn is_remember_info_visibility(&self) -> bool { ObjectExt::property(self, "remember-info-visibility") } #[doc(alias = "remember-info-visibility")] pub fn set_remember_info_visibility(&self, remember_info_visibility: bool) { ObjectExt::set_property(self, "remember-info-visibility", remember_info_visibility) } #[doc(alias = "select-on-show")] pub fn selects_on_show(&self) -> bool { ObjectExt::property(self, "select-on-show") } #[doc(alias = "select-on-show")] pub fn set_select_on_show(&self, select_on_show: bool) { ObjectExt::set_property(self, "select-on-show", select_on_show) } #[doc(alias = "show-icons")] pub fn shows_icons(&self) -> bool { ObjectExt::property(self, "show-icons") } #[doc(alias = "show-icons")] pub fn set_show_icons(&self, show_icons: bool) { ObjectExt::set_property(self, "show-icons", show_icons) } #[doc(alias = "gtk_source_completion_fuzzy_highlight")] pub fn fuzzy_highlight(haystack: &str, casefold_query: &str) -> Option { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gtk_source_completion_fuzzy_highlight( haystack.to_glib_none().0, casefold_query.to_glib_none().0, )) } } #[doc(alias = "gtk_source_completion_fuzzy_match")] pub fn fuzzy_match(haystack: Option<&str>, casefold_needle: &str) -> Option { assert_initialized_main_thread!(); unsafe { let mut priority = std::mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gtk_source_completion_fuzzy_match( haystack.to_glib_none().0, casefold_needle.to_glib_none().0, priority.as_mut_ptr(), )); if ret { Some(priority.assume_init()) } else { None } } } #[doc(alias = "hide")] pub fn connect_hide(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn hide_trampoline( this: *mut ffi::GtkSourceCompletion, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"hide\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( hide_trampoline:: as *const (), )), Box_::into_raw(f), ) } } pub fn emit_hide(&self) { self.emit_by_name::<()>("hide", &[]); } #[doc(alias = "provider-added")] pub fn connect_provider_added( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn provider_added_trampoline< F: Fn(&Completion, &CompletionProvider) + 'static, >( this: *mut ffi::GtkSourceCompletion, provider: *mut ffi::GtkSourceCompletionProvider, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(provider)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"provider-added\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( provider_added_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "provider-removed")] pub fn connect_provider_removed( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn provider_removed_trampoline< F: Fn(&Completion, &CompletionProvider) + 'static, >( this: *mut ffi::GtkSourceCompletion, provider: *mut ffi::GtkSourceCompletionProvider, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(provider)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"provider-removed\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( provider_removed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "show")] pub fn connect_show(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn show_trampoline( this: *mut ffi::GtkSourceCompletion, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"show\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( show_trampoline:: as *const (), )), Box_::into_raw(f), ) } } pub fn emit_show(&self) { self.emit_by_name::<()>("show", &[]); } #[doc(alias = "buffer")] pub fn connect_buffer_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_buffer_trampoline( this: *mut ffi::GtkSourceCompletion, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::buffer\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_buffer_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "page-size")] pub fn connect_page_size_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_page_size_trampoline( this: *mut ffi::GtkSourceCompletion, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::page-size\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_page_size_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "remember-info-visibility")] pub fn connect_remember_info_visibility_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_remember_info_visibility_trampoline< F: Fn(&Completion) + 'static, >( this: *mut ffi::GtkSourceCompletion, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::remember-info-visibility\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_remember_info_visibility_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "select-on-show")] pub fn connect_select_on_show_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_select_on_show_trampoline( this: *mut ffi::GtkSourceCompletion, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::select-on-show\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_select_on_show_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "show-icons")] pub fn connect_show_icons_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_show_icons_trampoline( this: *mut ffi::GtkSourceCompletion, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::show-icons\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_show_icons_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Completion`] 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 CompletionBuilder { builder: glib::object::ObjectBuilder<'static, Completion>, } impl CompletionBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn page_size(self, page_size: u32) -> Self { Self { builder: self.builder.property("page-size", page_size), } } pub fn remember_info_visibility(self, remember_info_visibility: bool) -> Self { Self { builder: self .builder .property("remember-info-visibility", remember_info_visibility), } } pub fn select_on_show(self, select_on_show: bool) -> Self { Self { builder: self.builder.property("select-on-show", select_on_show), } } pub fn show_icons(self, show_icons: bool) -> Self { Self { builder: self.builder.property("show-icons", show_icons), } } pub fn view(self, view: &impl IsA) -> Self { Self { builder: self.builder.property("view", view.clone().upcast()), } } // rustdoc-stripper-ignore-next /// Build the [`Completion`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Completion { self.builder.build() } } sourceview5-0.9.0/src/auto/completion_cell.rs000064400000000000000000000341331046102023000173730ustar 00000000000000// 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::{ffi, CompletionColumn}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourceCompletionCell")] pub struct CompletionCell(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::gtk_source_completion_cell_get_type(), } } impl CompletionCell { // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`CompletionCell`] objects. /// /// This method returns an instance of [`CompletionCellBuilder`](crate::builders::CompletionCellBuilder) which can be used to create [`CompletionCell`] objects. pub fn builder() -> CompletionCellBuilder { CompletionCellBuilder::new() } #[doc(alias = "gtk_source_completion_cell_get_column")] #[doc(alias = "get_column")] pub fn column(&self) -> CompletionColumn { unsafe { from_glib(ffi::gtk_source_completion_cell_get_column( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_completion_cell_get_widget")] #[doc(alias = "get_widget")] pub fn widget(&self) -> Option { unsafe { from_glib_none(ffi::gtk_source_completion_cell_get_widget( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_completion_cell_set_gicon")] pub fn set_gicon(&self, gicon: &impl IsA) { unsafe { ffi::gtk_source_completion_cell_set_gicon( self.to_glib_none().0, gicon.as_ref().to_glib_none().0, ); } } #[doc(alias = "gtk_source_completion_cell_set_icon_name")] pub fn set_icon_name(&self, icon_name: &str) { unsafe { ffi::gtk_source_completion_cell_set_icon_name( self.to_glib_none().0, icon_name.to_glib_none().0, ); } } #[doc(alias = "gtk_source_completion_cell_set_markup")] #[doc(alias = "markup")] pub fn set_markup(&self, markup: &str) { unsafe { ffi::gtk_source_completion_cell_set_markup( self.to_glib_none().0, markup.to_glib_none().0, ); } } #[doc(alias = "gtk_source_completion_cell_set_paintable")] #[doc(alias = "paintable")] pub fn set_paintable(&self, paintable: &impl IsA) { unsafe { ffi::gtk_source_completion_cell_set_paintable( self.to_glib_none().0, paintable.as_ref().to_glib_none().0, ); } } #[doc(alias = "gtk_source_completion_cell_set_text")] #[doc(alias = "text")] pub fn set_text(&self, text: Option<&str>) { unsafe { ffi::gtk_source_completion_cell_set_text(self.to_glib_none().0, text.to_glib_none().0); } } #[doc(alias = "gtk_source_completion_cell_set_text_with_attributes")] pub fn set_text_with_attributes(&self, text: &str, attrs: &pango::AttrList) { unsafe { ffi::gtk_source_completion_cell_set_text_with_attributes( self.to_glib_none().0, text.to_glib_none().0, attrs.to_glib_none().0, ); } } #[doc(alias = "gtk_source_completion_cell_set_widget")] #[doc(alias = "widget")] pub fn set_widget(&self, child: &impl IsA) { unsafe { ffi::gtk_source_completion_cell_set_widget( self.to_glib_none().0, child.as_ref().to_glib_none().0, ); } } pub fn markup(&self) -> Option { ObjectExt::property(self, "markup") } pub fn paintable(&self) -> Option { ObjectExt::property(self, "paintable") } pub fn text(&self) -> Option { ObjectExt::property(self, "text") } #[doc(alias = "markup")] pub fn connect_markup_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_markup_trampoline( this: *mut ffi::GtkSourceCompletionCell, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::markup\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_markup_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "paintable")] pub fn connect_paintable_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_paintable_trampoline( this: *mut ffi::GtkSourceCompletionCell, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::paintable\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_paintable_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "text")] pub fn connect_text_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_text_trampoline( this: *mut ffi::GtkSourceCompletionCell, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::text\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_text_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "widget")] pub fn connect_widget_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_widget_trampoline( this: *mut ffi::GtkSourceCompletionCell, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::widget\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_widget_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`CompletionCell`] 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 CompletionCellBuilder { builder: glib::object::ObjectBuilder<'static, CompletionCell>, } impl CompletionCellBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn column(self, column: CompletionColumn) -> Self { Self { builder: self.builder.property("column", column), } } pub fn markup(self, markup: impl Into) -> Self { Self { builder: self.builder.property("markup", markup.into()), } } pub fn paintable(self, paintable: &impl IsA) -> Self { Self { builder: self .builder .property("paintable", paintable.clone().upcast()), } } pub fn text(self, text: impl Into) -> Self { Self { builder: self.builder.property("text", text.into()), } } pub fn widget(self, widget: &impl IsA) -> Self { Self { builder: self.builder.property("widget", widget.clone().upcast()), } } pub fn can_focus(self, can_focus: bool) -> Self { Self { builder: self.builder.property("can-focus", can_focus), } } pub fn can_target(self, can_target: bool) -> Self { Self { builder: self.builder.property("can-target", can_target), } } pub fn css_classes(self, css_classes: impl Into) -> Self { Self { builder: self.builder.property("css-classes", css_classes.into()), } } pub fn css_name(self, css_name: impl Into) -> Self { Self { builder: self.builder.property("css-name", css_name.into()), } } pub fn cursor(self, cursor: &gdk::Cursor) -> Self { Self { builder: self.builder.property("cursor", cursor.clone()), } } pub fn focus_on_click(self, focus_on_click: bool) -> Self { Self { builder: self.builder.property("focus-on-click", focus_on_click), } } pub fn focusable(self, focusable: bool) -> Self { Self { builder: self.builder.property("focusable", focusable), } } pub fn halign(self, halign: gtk::Align) -> Self { Self { builder: self.builder.property("halign", halign), } } pub fn has_tooltip(self, has_tooltip: bool) -> Self { Self { builder: self.builder.property("has-tooltip", has_tooltip), } } pub fn height_request(self, height_request: i32) -> Self { Self { builder: self.builder.property("height-request", height_request), } } pub fn hexpand(self, hexpand: bool) -> Self { Self { builder: self.builder.property("hexpand", hexpand), } } pub fn hexpand_set(self, hexpand_set: bool) -> Self { Self { builder: self.builder.property("hexpand-set", hexpand_set), } } pub fn layout_manager(self, layout_manager: &impl IsA) -> Self { Self { builder: self .builder .property("layout-manager", layout_manager.clone().upcast()), } } pub fn margin_bottom(self, margin_bottom: i32) -> Self { Self { builder: self.builder.property("margin-bottom", margin_bottom), } } pub fn margin_end(self, margin_end: i32) -> Self { Self { builder: self.builder.property("margin-end", margin_end), } } pub fn margin_start(self, margin_start: i32) -> Self { Self { builder: self.builder.property("margin-start", margin_start), } } pub fn margin_top(self, margin_top: i32) -> Self { Self { builder: self.builder.property("margin-top", margin_top), } } pub fn name(self, name: impl Into) -> Self { Self { builder: self.builder.property("name", name.into()), } } pub fn opacity(self, opacity: f64) -> Self { Self { builder: self.builder.property("opacity", opacity), } } pub fn overflow(self, overflow: gtk::Overflow) -> Self { Self { builder: self.builder.property("overflow", overflow), } } pub fn receives_default(self, receives_default: bool) -> Self { Self { builder: self.builder.property("receives-default", receives_default), } } pub fn sensitive(self, sensitive: bool) -> Self { Self { builder: self.builder.property("sensitive", sensitive), } } pub fn tooltip_markup(self, tooltip_markup: impl Into) -> Self { Self { builder: self .builder .property("tooltip-markup", tooltip_markup.into()), } } pub fn tooltip_text(self, tooltip_text: impl Into) -> Self { Self { builder: self.builder.property("tooltip-text", tooltip_text.into()), } } pub fn valign(self, valign: gtk::Align) -> Self { Self { builder: self.builder.property("valign", valign), } } pub fn vexpand(self, vexpand: bool) -> Self { Self { builder: self.builder.property("vexpand", vexpand), } } pub fn vexpand_set(self, vexpand_set: bool) -> Self { Self { builder: self.builder.property("vexpand-set", vexpand_set), } } pub fn visible(self, visible: bool) -> Self { Self { builder: self.builder.property("visible", visible), } } pub fn width_request(self, width_request: i32) -> Self { Self { builder: self.builder.property("width-request", width_request), } } pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self { Self { builder: self.builder.property("accessible-role", accessible_role), } } // rustdoc-stripper-ignore-next /// Build the [`CompletionCell`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> CompletionCell { self.builder.build() } } sourceview5-0.9.0/src/auto/completion_context.rs000064400000000000000000000231271046102023000201410ustar 00000000000000// 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::{ffi, Buffer, Completion, CompletionActivation, CompletionProvider, Language, View}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourceCompletionContext")] pub struct CompletionContext(Object) @implements gio::ListModel; match fn { type_ => || ffi::gtk_source_completion_context_get_type(), } } impl CompletionContext { // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`CompletionContext`] objects. /// /// This method returns an instance of [`CompletionContextBuilder`](crate::builders::CompletionContextBuilder) which can be used to create [`CompletionContext`] objects. pub fn builder() -> CompletionContextBuilder { CompletionContextBuilder::new() } #[doc(alias = "gtk_source_completion_context_get_activation")] #[doc(alias = "get_activation")] pub fn activation(&self) -> CompletionActivation { unsafe { from_glib(ffi::gtk_source_completion_context_get_activation( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_completion_context_get_bounds")] #[doc(alias = "get_bounds")] pub fn bounds(&self) -> Option<(gtk::TextIter, gtk::TextIter)> { unsafe { let mut begin = gtk::TextIter::uninitialized(); let mut end = gtk::TextIter::uninitialized(); let ret = from_glib(ffi::gtk_source_completion_context_get_bounds( self.to_glib_none().0, begin.to_glib_none_mut().0, end.to_glib_none_mut().0, )); if ret { Some((begin, end)) } else { None } } } #[doc(alias = "gtk_source_completion_context_get_buffer")] #[doc(alias = "get_buffer")] pub fn buffer(&self) -> Option { unsafe { from_glib_none(ffi::gtk_source_completion_context_get_buffer( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_completion_context_get_busy")] #[doc(alias = "get_busy")] #[doc(alias = "busy")] pub fn is_busy(&self) -> bool { unsafe { from_glib(ffi::gtk_source_completion_context_get_busy( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_completion_context_get_completion")] #[doc(alias = "get_completion")] pub fn completion(&self) -> Option { unsafe { from_glib_none(ffi::gtk_source_completion_context_get_completion( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_completion_context_get_empty")] #[doc(alias = "get_empty")] #[doc(alias = "empty")] pub fn is_empty(&self) -> bool { unsafe { from_glib(ffi::gtk_source_completion_context_get_empty( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_completion_context_get_language")] #[doc(alias = "get_language")] pub fn language(&self) -> Option { unsafe { from_glib_none(ffi::gtk_source_completion_context_get_language( self.to_glib_none().0, )) } } #[cfg(feature = "v5_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_6")))] #[doc(alias = "gtk_source_completion_context_get_proposals_for_provider")] #[doc(alias = "get_proposals_for_provider")] pub fn proposals_for_provider( &self, provider: &impl IsA, ) -> Option { unsafe { from_glib_none( ffi::gtk_source_completion_context_get_proposals_for_provider( self.to_glib_none().0, provider.as_ref().to_glib_none().0, ), ) } } #[doc(alias = "gtk_source_completion_context_get_view")] #[doc(alias = "get_view")] pub fn view(&self) -> Option { unsafe { from_glib_none(ffi::gtk_source_completion_context_get_view( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_completion_context_get_word")] #[doc(alias = "get_word")] pub fn word(&self) -> glib::GString { unsafe { from_glib_full(ffi::gtk_source_completion_context_get_word( self.to_glib_none().0, )) } } #[cfg(feature = "v5_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_6")))] #[doc(alias = "gtk_source_completion_context_list_providers")] pub fn list_providers(&self) -> gio::ListModel { unsafe { from_glib_full(ffi::gtk_source_completion_context_list_providers( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_completion_context_set_proposals_for_provider")] pub fn set_proposals_for_provider( &self, provider: &impl IsA, results: Option<&impl IsA>, ) { unsafe { ffi::gtk_source_completion_context_set_proposals_for_provider( self.to_glib_none().0, provider.as_ref().to_glib_none().0, results.map(|p| p.as_ref()).to_glib_none().0, ); } } #[cfg(feature = "v5_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_6")))] #[doc(alias = "provider-model-changed")] pub fn connect_provider_model_changed< F: Fn(&Self, &CompletionProvider, Option<&gio::ListModel>) + 'static, >( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn provider_model_changed_trampoline< F: Fn(&CompletionContext, &CompletionProvider, Option<&gio::ListModel>) + 'static, >( this: *mut ffi::GtkSourceCompletionContext, provider: *mut ffi::GtkSourceCompletionProvider, model: *mut gio::ffi::GListModel, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( &from_glib_borrow(this), &from_glib_borrow(provider), Option::::from_glib_borrow(model) .as_ref() .as_ref(), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"provider-model-changed\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( provider_model_changed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "busy")] pub fn connect_busy_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_busy_trampoline( this: *mut ffi::GtkSourceCompletionContext, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::busy\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_busy_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "empty")] pub fn connect_empty_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_empty_trampoline( this: *mut ffi::GtkSourceCompletionContext, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::empty\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_empty_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`CompletionContext`] 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 CompletionContextBuilder { builder: glib::object::ObjectBuilder<'static, CompletionContext>, } impl CompletionContextBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn completion(self, completion: &Completion) -> Self { Self { builder: self.builder.property("completion", completion.clone()), } } // rustdoc-stripper-ignore-next /// Build the [`CompletionContext`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> CompletionContext { self.builder.build() } } sourceview5-0.9.0/src/auto/completion_proposal.rs000064400000000000000000000024671046102023000203200ustar 00000000000000// 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::ffi; use glib::prelude::*; #[cfg(feature = "v5_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_6")))] use glib::translate::*; glib::wrapper! { #[doc(alias = "GtkSourceCompletionProposal")] pub struct CompletionProposal(Interface); match fn { type_ => || ffi::gtk_source_completion_proposal_get_type(), } } impl CompletionProposal { pub const NONE: Option<&'static CompletionProposal> = None; } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait CompletionProposalExt: IsA + sealed::Sealed + 'static { #[cfg(feature = "v5_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_6")))] #[doc(alias = "gtk_source_completion_proposal_get_typed_text")] #[doc(alias = "get_typed_text")] fn typed_text(&self) -> Option { unsafe { from_glib_full(ffi::gtk_source_completion_proposal_get_typed_text( self.as_ref().to_glib_none().0, )) } } } impl> CompletionProposalExt for O {} sourceview5-0.9.0/src/auto/completion_provider.rs000064400000000000000000000156511046102023000203120ustar 00000000000000// 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::{ffi, CompletionCell, CompletionContext, CompletionProposal}; use glib::{prelude::*, translate::*}; use std::{boxed::Box as Box_, pin::Pin}; glib::wrapper! { #[doc(alias = "GtkSourceCompletionProvider")] pub struct CompletionProvider(Interface); match fn { type_ => || ffi::gtk_source_completion_provider_get_type(), } } impl CompletionProvider { pub const NONE: Option<&'static CompletionProvider> = None; } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait CompletionProviderExt: IsA + sealed::Sealed + 'static { #[doc(alias = "gtk_source_completion_provider_activate")] fn activate(&self, context: &CompletionContext, proposal: &impl IsA) { unsafe { ffi::gtk_source_completion_provider_activate( self.as_ref().to_glib_none().0, context.to_glib_none().0, proposal.as_ref().to_glib_none().0, ); } } #[doc(alias = "gtk_source_completion_provider_display")] fn display( &self, context: &CompletionContext, proposal: &impl IsA, cell: &CompletionCell, ) { unsafe { ffi::gtk_source_completion_provider_display( self.as_ref().to_glib_none().0, context.to_glib_none().0, proposal.as_ref().to_glib_none().0, cell.to_glib_none().0, ); } } #[doc(alias = "gtk_source_completion_provider_get_priority")] #[doc(alias = "get_priority")] fn priority(&self, context: &CompletionContext) -> i32 { unsafe { ffi::gtk_source_completion_provider_get_priority( self.as_ref().to_glib_none().0, context.to_glib_none().0, ) } } #[doc(alias = "gtk_source_completion_provider_get_title")] #[doc(alias = "get_title")] fn title(&self) -> Option { unsafe { from_glib_full(ffi::gtk_source_completion_provider_get_title( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_completion_provider_is_trigger")] fn is_trigger(&self, iter: >k::TextIter, ch: char) -> bool { unsafe { from_glib(ffi::gtk_source_completion_provider_is_trigger( self.as_ref().to_glib_none().0, iter.to_glib_none().0, ch.into_glib(), )) } } #[doc(alias = "gtk_source_completion_provider_key_activates")] fn key_activates( &self, context: &CompletionContext, proposal: &impl IsA, keyval: u32, state: gdk::ModifierType, ) -> bool { unsafe { from_glib(ffi::gtk_source_completion_provider_key_activates( self.as_ref().to_glib_none().0, context.to_glib_none().0, proposal.as_ref().to_glib_none().0, keyval, state.into_glib(), )) } } #[doc(alias = "gtk_source_completion_provider_list_alternates")] fn list_alternates( &self, context: &CompletionContext, proposal: &impl IsA, ) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full( ffi::gtk_source_completion_provider_list_alternates( self.as_ref().to_glib_none().0, context.to_glib_none().0, proposal.as_ref().to_glib_none().0, ), ) } } #[doc(alias = "gtk_source_completion_provider_populate_async")] fn populate_async) + 'static>( &self, context: &CompletionContext, cancellable: Option<&impl IsA>, callback: P, ) { let main_context = glib::MainContext::ref_thread_default(); let is_main_context_owner = main_context.is_owner(); let has_acquired_main_context = (!is_main_context_owner) .then(|| main_context.acquire().ok()) .flatten(); assert!( is_main_context_owner || has_acquired_main_context.is_some(), "Async operations only allowed if the thread is owning the MainContext" ); let user_data: Box_> = Box_::new(glib::thread_guard::ThreadGuard::new(callback)); unsafe extern "C" fn populate_async_trampoline< P: FnOnce(Result) + 'static, >( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer, ) { let mut error = std::ptr::null_mut(); let ret = ffi::gtk_source_completion_provider_populate_finish( _source_object as *mut _, res, &mut error, ); let result = if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }; let callback: Box_> = Box_::from_raw(user_data as *mut _); let callback: P = callback.into_inner(); callback(result); } let callback = populate_async_trampoline::

; unsafe { ffi::gtk_source_completion_provider_populate_async( self.as_ref().to_glib_none().0, context.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _, ); } } fn populate_future( &self, context: &CompletionContext, ) -> Pin> + 'static>> { let context = context.clone(); Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { obj.populate_async(&context, Some(cancellable), move |res| { send.resolve(res); }); })) } #[doc(alias = "gtk_source_completion_provider_refilter")] fn refilter(&self, context: &CompletionContext, model: &impl IsA) { unsafe { ffi::gtk_source_completion_provider_refilter( self.as_ref().to_glib_none().0, context.to_glib_none().0, model.as_ref().to_glib_none().0, ); } } } impl> CompletionProviderExt for O {} sourceview5-0.9.0/src/auto/completion_snippets.rs000064400000000000000000000116741046102023000203260ustar 00000000000000// 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::{ffi, CompletionProvider}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourceCompletionSnippets")] pub struct CompletionSnippets(Object) @implements CompletionProvider; match fn { type_ => || ffi::gtk_source_completion_snippets_get_type(), } } impl CompletionSnippets { pub const NONE: Option<&'static CompletionSnippets> = None; #[doc(alias = "gtk_source_completion_snippets_new")] pub fn new() -> CompletionSnippets { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gtk_source_completion_snippets_new()) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`CompletionSnippets`] objects. /// /// This method returns an instance of [`CompletionSnippetsBuilder`](crate::builders::CompletionSnippetsBuilder) which can be used to create [`CompletionSnippets`] objects. pub fn builder() -> CompletionSnippetsBuilder { CompletionSnippetsBuilder::new() } } impl Default for CompletionSnippets { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`CompletionSnippets`] 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 CompletionSnippetsBuilder { builder: glib::object::ObjectBuilder<'static, CompletionSnippets>, } impl CompletionSnippetsBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn priority(self, priority: i32) -> Self { Self { builder: self.builder.property("priority", priority), } } pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } // rustdoc-stripper-ignore-next /// Build the [`CompletionSnippets`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> CompletionSnippets { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait CompletionSnippetsExt: IsA + sealed::Sealed + 'static { fn priority(&self) -> i32 { ObjectExt::property(self.as_ref(), "priority") } fn set_priority(&self, priority: i32) { ObjectExt::set_property(self.as_ref(), "priority", priority) } fn set_title(&self, title: Option<&str>) { ObjectExt::set_property(self.as_ref(), "title", title) } #[doc(alias = "priority")] fn connect_priority_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_priority_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceCompletionSnippets, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(CompletionSnippets::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::priority\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_priority_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "title")] fn connect_title_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceCompletionSnippets, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(CompletionSnippets::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::title\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> CompletionSnippetsExt for O {} sourceview5-0.9.0/src/auto/completion_words.rs000064400000000000000000000241551046102023000176150ustar 00000000000000// 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::{ffi, CompletionProvider}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourceCompletionWords")] pub struct CompletionWords(Object) @implements CompletionProvider; match fn { type_ => || ffi::gtk_source_completion_words_get_type(), } } impl CompletionWords { pub const NONE: Option<&'static CompletionWords> = None; #[doc(alias = "gtk_source_completion_words_new")] pub fn new(title: Option<&str>) -> CompletionWords { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gtk_source_completion_words_new(title.to_glib_none().0)) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`CompletionWords`] objects. /// /// This method returns an instance of [`CompletionWordsBuilder`](crate::builders::CompletionWordsBuilder) which can be used to create [`CompletionWords`] objects. pub fn builder() -> CompletionWordsBuilder { CompletionWordsBuilder::new() } } impl Default for CompletionWords { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`CompletionWords`] 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 CompletionWordsBuilder { builder: glib::object::ObjectBuilder<'static, CompletionWords>, } impl CompletionWordsBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn minimum_word_size(self, minimum_word_size: u32) -> Self { Self { builder: self .builder .property("minimum-word-size", minimum_word_size), } } pub fn priority(self, priority: i32) -> Self { Self { builder: self.builder.property("priority", priority), } } pub fn proposals_batch_size(self, proposals_batch_size: u32) -> Self { Self { builder: self .builder .property("proposals-batch-size", proposals_batch_size), } } pub fn scan_batch_size(self, scan_batch_size: u32) -> Self { Self { builder: self.builder.property("scan-batch-size", scan_batch_size), } } pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } // rustdoc-stripper-ignore-next /// Build the [`CompletionWords`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> CompletionWords { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait CompletionWordsExt: IsA + sealed::Sealed + 'static { #[doc(alias = "gtk_source_completion_words_register")] fn register(&self, buffer: &impl IsA) { unsafe { ffi::gtk_source_completion_words_register( self.as_ref().to_glib_none().0, buffer.as_ref().to_glib_none().0, ); } } #[doc(alias = "gtk_source_completion_words_unregister")] fn unregister(&self, buffer: &impl IsA) { unsafe { ffi::gtk_source_completion_words_unregister( self.as_ref().to_glib_none().0, buffer.as_ref().to_glib_none().0, ); } } #[doc(alias = "minimum-word-size")] fn minimum_word_size(&self) -> u32 { ObjectExt::property(self.as_ref(), "minimum-word-size") } #[doc(alias = "minimum-word-size")] fn set_minimum_word_size(&self, minimum_word_size: u32) { ObjectExt::set_property(self.as_ref(), "minimum-word-size", minimum_word_size) } fn priority(&self) -> i32 { ObjectExt::property(self.as_ref(), "priority") } fn set_priority(&self, priority: i32) { ObjectExt::set_property(self.as_ref(), "priority", priority) } #[doc(alias = "proposals-batch-size")] fn proposals_batch_size(&self) -> u32 { ObjectExt::property(self.as_ref(), "proposals-batch-size") } #[doc(alias = "proposals-batch-size")] fn set_proposals_batch_size(&self, proposals_batch_size: u32) { ObjectExt::set_property(self.as_ref(), "proposals-batch-size", proposals_batch_size) } #[doc(alias = "scan-batch-size")] fn scan_batch_size(&self) -> u32 { ObjectExt::property(self.as_ref(), "scan-batch-size") } #[doc(alias = "scan-batch-size")] fn set_scan_batch_size(&self, scan_batch_size: u32) { ObjectExt::set_property(self.as_ref(), "scan-batch-size", scan_batch_size) } fn set_title(&self, title: Option<&str>) { ObjectExt::set_property(self.as_ref(), "title", title) } #[doc(alias = "minimum-word-size")] fn connect_minimum_word_size_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_minimum_word_size_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceCompletionWords, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(CompletionWords::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::minimum-word-size\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_minimum_word_size_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "priority")] fn connect_priority_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_priority_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceCompletionWords, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(CompletionWords::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::priority\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_priority_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "proposals-batch-size")] fn connect_proposals_batch_size_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_proposals_batch_size_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceCompletionWords, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(CompletionWords::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::proposals-batch-size\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_proposals_batch_size_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "scan-batch-size")] fn connect_scan_batch_size_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_scan_batch_size_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceCompletionWords, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(CompletionWords::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::scan-batch-size\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_scan_batch_size_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "title")] fn connect_title_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceCompletionWords, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(CompletionWords::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::title\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> CompletionWordsExt for O {} sourceview5-0.9.0/src/auto/encoding.rs000064400000000000000000000054701046102023000160130ustar 00000000000000// 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::ffi; use glib::translate::*; glib::wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Encoding(Boxed); match fn { copy => |ptr| ffi::gtk_source_encoding_copy(ptr), free => |ptr| ffi::gtk_source_encoding_free(ptr), type_ => || ffi::gtk_source_encoding_get_type(), } } impl Encoding { #[doc(alias = "gtk_source_encoding_get_charset")] #[doc(alias = "get_charset")] pub fn charset(&self) -> glib::GString { unsafe { from_glib_none(ffi::gtk_source_encoding_get_charset(self.to_glib_none().0)) } } #[doc(alias = "gtk_source_encoding_get_name")] #[doc(alias = "get_name")] pub fn name(&self) -> glib::GString { unsafe { from_glib_none(ffi::gtk_source_encoding_get_name(self.to_glib_none().0)) } } #[doc(alias = "gtk_source_encoding_to_string")] #[doc(alias = "to_string")] pub fn to_str(&self) -> glib::GString { unsafe { from_glib_full(ffi::gtk_source_encoding_to_string(self.to_glib_none().0)) } } #[doc(alias = "gtk_source_encoding_get_all")] #[doc(alias = "get_all")] pub fn all() -> Vec { assert_initialized_main_thread!(); unsafe { FromGlibPtrContainer::from_glib_container(ffi::gtk_source_encoding_get_all()) } } #[doc(alias = "gtk_source_encoding_get_current")] #[doc(alias = "get_current")] pub fn current() -> Encoding { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::gtk_source_encoding_get_current()) } } #[doc(alias = "gtk_source_encoding_get_default_candidates")] #[doc(alias = "get_default_candidates")] pub fn default_candidates() -> Vec { assert_initialized_main_thread!(); unsafe { FromGlibPtrContainer::from_glib_container( ffi::gtk_source_encoding_get_default_candidates(), ) } } #[doc(alias = "gtk_source_encoding_get_from_charset")] #[doc(alias = "get_from_charset")] pub fn from_charset(charset: &str) -> Option { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::gtk_source_encoding_get_from_charset( charset.to_glib_none().0, )) } } #[doc(alias = "gtk_source_encoding_get_utf8")] #[doc(alias = "get_utf8")] pub fn utf8() -> Encoding { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::gtk_source_encoding_get_utf8()) } } } impl std::fmt::Display for Encoding { #[inline] fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(&self.to_str()) } } sourceview5-0.9.0/src/auto/enums.rs000064400000000000000000001076661046102023000153660ustar 00000000000000// 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::ffi; use glib::{prelude::*, translate::*}; #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "GtkSourceBackgroundPatternType")] pub enum BackgroundPatternType { #[doc(alias = "GTK_SOURCE_BACKGROUND_PATTERN_TYPE_NONE")] None, #[doc(alias = "GTK_SOURCE_BACKGROUND_PATTERN_TYPE_GRID")] Grid, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for BackgroundPatternType { type GlibType = ffi::GtkSourceBackgroundPatternType; #[inline] fn into_glib(self) -> ffi::GtkSourceBackgroundPatternType { match self { Self::None => ffi::GTK_SOURCE_BACKGROUND_PATTERN_TYPE_NONE, Self::Grid => ffi::GTK_SOURCE_BACKGROUND_PATTERN_TYPE_GRID, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for BackgroundPatternType { #[inline] unsafe fn from_glib(value: ffi::GtkSourceBackgroundPatternType) -> Self { skip_assert_initialized!(); match value { ffi::GTK_SOURCE_BACKGROUND_PATTERN_TYPE_NONE => Self::None, ffi::GTK_SOURCE_BACKGROUND_PATTERN_TYPE_GRID => Self::Grid, value => Self::__Unknown(value), } } } impl StaticType for BackgroundPatternType { #[inline] #[doc(alias = "gtk_source_background_pattern_type_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gtk_source_background_pattern_type_get_type()) } } } impl glib::HasParamSpec for BackgroundPatternType { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for BackgroundPatternType { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for BackgroundPatternType { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for BackgroundPatternType { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: BackgroundPatternType) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "GtkSourceBracketMatchType")] pub enum BracketMatchType { #[doc(alias = "GTK_SOURCE_BRACKET_MATCH_NONE")] None, #[doc(alias = "GTK_SOURCE_BRACKET_MATCH_OUT_OF_RANGE")] OutOfRange, #[doc(alias = "GTK_SOURCE_BRACKET_MATCH_NOT_FOUND")] NotFound, #[doc(alias = "GTK_SOURCE_BRACKET_MATCH_FOUND")] Found, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for BracketMatchType { type GlibType = ffi::GtkSourceBracketMatchType; #[inline] fn into_glib(self) -> ffi::GtkSourceBracketMatchType { match self { Self::None => ffi::GTK_SOURCE_BRACKET_MATCH_NONE, Self::OutOfRange => ffi::GTK_SOURCE_BRACKET_MATCH_OUT_OF_RANGE, Self::NotFound => ffi::GTK_SOURCE_BRACKET_MATCH_NOT_FOUND, Self::Found => ffi::GTK_SOURCE_BRACKET_MATCH_FOUND, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for BracketMatchType { #[inline] unsafe fn from_glib(value: ffi::GtkSourceBracketMatchType) -> Self { skip_assert_initialized!(); match value { ffi::GTK_SOURCE_BRACKET_MATCH_NONE => Self::None, ffi::GTK_SOURCE_BRACKET_MATCH_OUT_OF_RANGE => Self::OutOfRange, ffi::GTK_SOURCE_BRACKET_MATCH_NOT_FOUND => Self::NotFound, ffi::GTK_SOURCE_BRACKET_MATCH_FOUND => Self::Found, value => Self::__Unknown(value), } } } impl StaticType for BracketMatchType { #[inline] #[doc(alias = "gtk_source_bracket_match_type_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gtk_source_bracket_match_type_get_type()) } } } impl glib::HasParamSpec for BracketMatchType { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for BracketMatchType { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for BracketMatchType { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for BracketMatchType { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: BracketMatchType) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "GtkSourceChangeCaseType")] pub enum ChangeCaseType { #[doc(alias = "GTK_SOURCE_CHANGE_CASE_LOWER")] Lower, #[doc(alias = "GTK_SOURCE_CHANGE_CASE_UPPER")] Upper, #[doc(alias = "GTK_SOURCE_CHANGE_CASE_TOGGLE")] Toggle, #[doc(alias = "GTK_SOURCE_CHANGE_CASE_TITLE")] Title, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for ChangeCaseType { type GlibType = ffi::GtkSourceChangeCaseType; #[inline] fn into_glib(self) -> ffi::GtkSourceChangeCaseType { match self { Self::Lower => ffi::GTK_SOURCE_CHANGE_CASE_LOWER, Self::Upper => ffi::GTK_SOURCE_CHANGE_CASE_UPPER, Self::Toggle => ffi::GTK_SOURCE_CHANGE_CASE_TOGGLE, Self::Title => ffi::GTK_SOURCE_CHANGE_CASE_TITLE, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for ChangeCaseType { #[inline] unsafe fn from_glib(value: ffi::GtkSourceChangeCaseType) -> Self { skip_assert_initialized!(); match value { ffi::GTK_SOURCE_CHANGE_CASE_LOWER => Self::Lower, ffi::GTK_SOURCE_CHANGE_CASE_UPPER => Self::Upper, ffi::GTK_SOURCE_CHANGE_CASE_TOGGLE => Self::Toggle, ffi::GTK_SOURCE_CHANGE_CASE_TITLE => Self::Title, value => Self::__Unknown(value), } } } impl StaticType for ChangeCaseType { #[inline] #[doc(alias = "gtk_source_change_case_type_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gtk_source_change_case_type_get_type()) } } } impl glib::HasParamSpec for ChangeCaseType { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for ChangeCaseType { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for ChangeCaseType { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for ChangeCaseType { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: ChangeCaseType) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "GtkSourceCompletionActivation")] pub enum CompletionActivation { #[doc(alias = "GTK_SOURCE_COMPLETION_ACTIVATION_NONE")] None, #[doc(alias = "GTK_SOURCE_COMPLETION_ACTIVATION_INTERACTIVE")] Interactive, #[doc(alias = "GTK_SOURCE_COMPLETION_ACTIVATION_USER_REQUESTED")] UserRequested, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for CompletionActivation { type GlibType = ffi::GtkSourceCompletionActivation; #[inline] fn into_glib(self) -> ffi::GtkSourceCompletionActivation { match self { Self::None => ffi::GTK_SOURCE_COMPLETION_ACTIVATION_NONE, Self::Interactive => ffi::GTK_SOURCE_COMPLETION_ACTIVATION_INTERACTIVE, Self::UserRequested => ffi::GTK_SOURCE_COMPLETION_ACTIVATION_USER_REQUESTED, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for CompletionActivation { #[inline] unsafe fn from_glib(value: ffi::GtkSourceCompletionActivation) -> Self { skip_assert_initialized!(); match value { ffi::GTK_SOURCE_COMPLETION_ACTIVATION_NONE => Self::None, ffi::GTK_SOURCE_COMPLETION_ACTIVATION_INTERACTIVE => Self::Interactive, ffi::GTK_SOURCE_COMPLETION_ACTIVATION_USER_REQUESTED => Self::UserRequested, value => Self::__Unknown(value), } } } impl StaticType for CompletionActivation { #[inline] #[doc(alias = "gtk_source_completion_activation_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gtk_source_completion_activation_get_type()) } } } impl glib::HasParamSpec for CompletionActivation { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for CompletionActivation { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for CompletionActivation { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for CompletionActivation { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: CompletionActivation) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "GtkSourceCompletionColumn")] pub enum CompletionColumn { #[doc(alias = "GTK_SOURCE_COMPLETION_COLUMN_ICON")] Icon, #[doc(alias = "GTK_SOURCE_COMPLETION_COLUMN_BEFORE")] Before, #[doc(alias = "GTK_SOURCE_COMPLETION_COLUMN_TYPED_TEXT")] TypedText, #[doc(alias = "GTK_SOURCE_COMPLETION_COLUMN_AFTER")] After, #[doc(alias = "GTK_SOURCE_COMPLETION_COLUMN_COMMENT")] Comment, #[doc(alias = "GTK_SOURCE_COMPLETION_COLUMN_DETAILS")] Details, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for CompletionColumn { type GlibType = ffi::GtkSourceCompletionColumn; #[inline] fn into_glib(self) -> ffi::GtkSourceCompletionColumn { match self { Self::Icon => ffi::GTK_SOURCE_COMPLETION_COLUMN_ICON, Self::Before => ffi::GTK_SOURCE_COMPLETION_COLUMN_BEFORE, Self::TypedText => ffi::GTK_SOURCE_COMPLETION_COLUMN_TYPED_TEXT, Self::After => ffi::GTK_SOURCE_COMPLETION_COLUMN_AFTER, Self::Comment => ffi::GTK_SOURCE_COMPLETION_COLUMN_COMMENT, Self::Details => ffi::GTK_SOURCE_COMPLETION_COLUMN_DETAILS, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for CompletionColumn { #[inline] unsafe fn from_glib(value: ffi::GtkSourceCompletionColumn) -> Self { skip_assert_initialized!(); match value { ffi::GTK_SOURCE_COMPLETION_COLUMN_ICON => Self::Icon, ffi::GTK_SOURCE_COMPLETION_COLUMN_BEFORE => Self::Before, ffi::GTK_SOURCE_COMPLETION_COLUMN_TYPED_TEXT => Self::TypedText, ffi::GTK_SOURCE_COMPLETION_COLUMN_AFTER => Self::After, ffi::GTK_SOURCE_COMPLETION_COLUMN_COMMENT => Self::Comment, ffi::GTK_SOURCE_COMPLETION_COLUMN_DETAILS => Self::Details, value => Self::__Unknown(value), } } } impl StaticType for CompletionColumn { #[inline] #[doc(alias = "gtk_source_completion_column_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gtk_source_completion_column_get_type()) } } } impl glib::HasParamSpec for CompletionColumn { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for CompletionColumn { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for CompletionColumn { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for CompletionColumn { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: CompletionColumn) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "GtkSourceCompressionType")] pub enum CompressionType { #[doc(alias = "GTK_SOURCE_COMPRESSION_TYPE_NONE")] None, #[doc(alias = "GTK_SOURCE_COMPRESSION_TYPE_GZIP")] Gzip, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for CompressionType { type GlibType = ffi::GtkSourceCompressionType; #[inline] fn into_glib(self) -> ffi::GtkSourceCompressionType { match self { Self::None => ffi::GTK_SOURCE_COMPRESSION_TYPE_NONE, Self::Gzip => ffi::GTK_SOURCE_COMPRESSION_TYPE_GZIP, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for CompressionType { #[inline] unsafe fn from_glib(value: ffi::GtkSourceCompressionType) -> Self { skip_assert_initialized!(); match value { ffi::GTK_SOURCE_COMPRESSION_TYPE_NONE => Self::None, ffi::GTK_SOURCE_COMPRESSION_TYPE_GZIP => Self::Gzip, value => Self::__Unknown(value), } } } impl StaticType for CompressionType { #[inline] #[doc(alias = "gtk_source_compression_type_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gtk_source_compression_type_get_type()) } } } impl glib::HasParamSpec for CompressionType { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for CompressionType { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for CompressionType { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for CompressionType { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: CompressionType) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "GtkSourceFileLoaderError")] pub enum FileLoaderError { #[doc(alias = "GTK_SOURCE_FILE_LOADER_ERROR_TOO_BIG")] TooBig, #[doc(alias = "GTK_SOURCE_FILE_LOADER_ERROR_ENCODING_AUTO_DETECTION_FAILED")] EncodingAutoDetectionFailed, #[doc(alias = "GTK_SOURCE_FILE_LOADER_ERROR_CONVERSION_FALLBACK")] ConversionFallback, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for FileLoaderError { type GlibType = ffi::GtkSourceFileLoaderError; #[inline] fn into_glib(self) -> ffi::GtkSourceFileLoaderError { match self { Self::TooBig => ffi::GTK_SOURCE_FILE_LOADER_ERROR_TOO_BIG, Self::EncodingAutoDetectionFailed => { ffi::GTK_SOURCE_FILE_LOADER_ERROR_ENCODING_AUTO_DETECTION_FAILED } Self::ConversionFallback => ffi::GTK_SOURCE_FILE_LOADER_ERROR_CONVERSION_FALLBACK, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for FileLoaderError { #[inline] unsafe fn from_glib(value: ffi::GtkSourceFileLoaderError) -> Self { skip_assert_initialized!(); match value { ffi::GTK_SOURCE_FILE_LOADER_ERROR_TOO_BIG => Self::TooBig, ffi::GTK_SOURCE_FILE_LOADER_ERROR_ENCODING_AUTO_DETECTION_FAILED => { Self::EncodingAutoDetectionFailed } ffi::GTK_SOURCE_FILE_LOADER_ERROR_CONVERSION_FALLBACK => Self::ConversionFallback, value => Self::__Unknown(value), } } } impl glib::error::ErrorDomain for FileLoaderError { #[inline] fn domain() -> glib::Quark { skip_assert_initialized!(); unsafe { from_glib(ffi::gtk_source_file_loader_error_quark()) } } #[inline] fn code(self) -> i32 { self.into_glib() } #[inline] #[allow(clippy::match_single_binding)] fn from(code: i32) -> Option { skip_assert_initialized!(); match unsafe { from_glib(code) } { value => Some(value), } } } impl StaticType for FileLoaderError { #[inline] #[doc(alias = "gtk_source_file_loader_error_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gtk_source_file_loader_error_get_type()) } } } impl glib::HasParamSpec for FileLoaderError { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for FileLoaderError { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for FileLoaderError { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for FileLoaderError { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: FileLoaderError) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "GtkSourceFileSaverError")] pub enum FileSaverError { #[doc(alias = "GTK_SOURCE_FILE_SAVER_ERROR_INVALID_CHARS")] InvalidChars, #[doc(alias = "GTK_SOURCE_FILE_SAVER_ERROR_EXTERNALLY_MODIFIED")] ExternallyModified, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for FileSaverError { type GlibType = ffi::GtkSourceFileSaverError; #[inline] fn into_glib(self) -> ffi::GtkSourceFileSaverError { match self { Self::InvalidChars => ffi::GTK_SOURCE_FILE_SAVER_ERROR_INVALID_CHARS, Self::ExternallyModified => ffi::GTK_SOURCE_FILE_SAVER_ERROR_EXTERNALLY_MODIFIED, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for FileSaverError { #[inline] unsafe fn from_glib(value: ffi::GtkSourceFileSaverError) -> Self { skip_assert_initialized!(); match value { ffi::GTK_SOURCE_FILE_SAVER_ERROR_INVALID_CHARS => Self::InvalidChars, ffi::GTK_SOURCE_FILE_SAVER_ERROR_EXTERNALLY_MODIFIED => Self::ExternallyModified, value => Self::__Unknown(value), } } } impl glib::error::ErrorDomain for FileSaverError { #[inline] fn domain() -> glib::Quark { skip_assert_initialized!(); unsafe { from_glib(ffi::gtk_source_file_saver_error_quark()) } } #[inline] fn code(self) -> i32 { self.into_glib() } #[inline] #[allow(clippy::match_single_binding)] fn from(code: i32) -> Option { skip_assert_initialized!(); match unsafe { from_glib(code) } { value => Some(value), } } } impl StaticType for FileSaverError { #[inline] #[doc(alias = "gtk_source_file_saver_error_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gtk_source_file_saver_error_get_type()) } } } impl glib::HasParamSpec for FileSaverError { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for FileSaverError { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for FileSaverError { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for FileSaverError { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: FileSaverError) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "GtkSourceGutterRendererAlignmentMode")] pub enum GutterRendererAlignmentMode { #[doc(alias = "GTK_SOURCE_GUTTER_RENDERER_ALIGNMENT_MODE_CELL")] Cell, #[doc(alias = "GTK_SOURCE_GUTTER_RENDERER_ALIGNMENT_MODE_FIRST")] First, #[doc(alias = "GTK_SOURCE_GUTTER_RENDERER_ALIGNMENT_MODE_LAST")] Last, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for GutterRendererAlignmentMode { type GlibType = ffi::GtkSourceGutterRendererAlignmentMode; #[inline] fn into_glib(self) -> ffi::GtkSourceGutterRendererAlignmentMode { match self { Self::Cell => ffi::GTK_SOURCE_GUTTER_RENDERER_ALIGNMENT_MODE_CELL, Self::First => ffi::GTK_SOURCE_GUTTER_RENDERER_ALIGNMENT_MODE_FIRST, Self::Last => ffi::GTK_SOURCE_GUTTER_RENDERER_ALIGNMENT_MODE_LAST, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for GutterRendererAlignmentMode { #[inline] unsafe fn from_glib(value: ffi::GtkSourceGutterRendererAlignmentMode) -> Self { skip_assert_initialized!(); match value { ffi::GTK_SOURCE_GUTTER_RENDERER_ALIGNMENT_MODE_CELL => Self::Cell, ffi::GTK_SOURCE_GUTTER_RENDERER_ALIGNMENT_MODE_FIRST => Self::First, ffi::GTK_SOURCE_GUTTER_RENDERER_ALIGNMENT_MODE_LAST => Self::Last, value => Self::__Unknown(value), } } } impl StaticType for GutterRendererAlignmentMode { #[inline] #[doc(alias = "gtk_source_gutter_renderer_alignment_mode_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gtk_source_gutter_renderer_alignment_mode_get_type()) } } } impl glib::HasParamSpec for GutterRendererAlignmentMode { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for GutterRendererAlignmentMode { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for GutterRendererAlignmentMode { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for GutterRendererAlignmentMode { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: GutterRendererAlignmentMode) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "GtkSourceNewlineType")] pub enum NewlineType { #[doc(alias = "GTK_SOURCE_NEWLINE_TYPE_LF")] Lf, #[doc(alias = "GTK_SOURCE_NEWLINE_TYPE_CR")] Cr, #[doc(alias = "GTK_SOURCE_NEWLINE_TYPE_CR_LF")] CrLf, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for NewlineType { type GlibType = ffi::GtkSourceNewlineType; #[inline] fn into_glib(self) -> ffi::GtkSourceNewlineType { match self { Self::Lf => ffi::GTK_SOURCE_NEWLINE_TYPE_LF, Self::Cr => ffi::GTK_SOURCE_NEWLINE_TYPE_CR, Self::CrLf => ffi::GTK_SOURCE_NEWLINE_TYPE_CR_LF, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for NewlineType { #[inline] unsafe fn from_glib(value: ffi::GtkSourceNewlineType) -> Self { skip_assert_initialized!(); match value { ffi::GTK_SOURCE_NEWLINE_TYPE_LF => Self::Lf, ffi::GTK_SOURCE_NEWLINE_TYPE_CR => Self::Cr, ffi::GTK_SOURCE_NEWLINE_TYPE_CR_LF => Self::CrLf, value => Self::__Unknown(value), } } } impl StaticType for NewlineType { #[inline] #[doc(alias = "gtk_source_newline_type_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gtk_source_newline_type_get_type()) } } } impl glib::HasParamSpec for NewlineType { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for NewlineType { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for NewlineType { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for NewlineType { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: NewlineType) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "GtkSourceSmartHomeEndType")] pub enum SmartHomeEndType { #[doc(alias = "GTK_SOURCE_SMART_HOME_END_DISABLED")] Disabled, #[doc(alias = "GTK_SOURCE_SMART_HOME_END_BEFORE")] Before, #[doc(alias = "GTK_SOURCE_SMART_HOME_END_AFTER")] After, #[doc(alias = "GTK_SOURCE_SMART_HOME_END_ALWAYS")] Always, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for SmartHomeEndType { type GlibType = ffi::GtkSourceSmartHomeEndType; #[inline] fn into_glib(self) -> ffi::GtkSourceSmartHomeEndType { match self { Self::Disabled => ffi::GTK_SOURCE_SMART_HOME_END_DISABLED, Self::Before => ffi::GTK_SOURCE_SMART_HOME_END_BEFORE, Self::After => ffi::GTK_SOURCE_SMART_HOME_END_AFTER, Self::Always => ffi::GTK_SOURCE_SMART_HOME_END_ALWAYS, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for SmartHomeEndType { #[inline] unsafe fn from_glib(value: ffi::GtkSourceSmartHomeEndType) -> Self { skip_assert_initialized!(); match value { ffi::GTK_SOURCE_SMART_HOME_END_DISABLED => Self::Disabled, ffi::GTK_SOURCE_SMART_HOME_END_BEFORE => Self::Before, ffi::GTK_SOURCE_SMART_HOME_END_AFTER => Self::After, ffi::GTK_SOURCE_SMART_HOME_END_ALWAYS => Self::Always, value => Self::__Unknown(value), } } } impl StaticType for SmartHomeEndType { #[inline] #[doc(alias = "gtk_source_smart_home_end_type_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gtk_source_smart_home_end_type_get_type()) } } } impl glib::HasParamSpec for SmartHomeEndType { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for SmartHomeEndType { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for SmartHomeEndType { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for SmartHomeEndType { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: SmartHomeEndType) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "GtkSourceViewGutterPosition")] pub enum ViewGutterPosition { #[doc(alias = "GTK_SOURCE_VIEW_GUTTER_POSITION_LINES")] Lines, #[doc(alias = "GTK_SOURCE_VIEW_GUTTER_POSITION_MARKS")] Marks, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for ViewGutterPosition { type GlibType = ffi::GtkSourceViewGutterPosition; #[inline] fn into_glib(self) -> ffi::GtkSourceViewGutterPosition { match self { Self::Lines => ffi::GTK_SOURCE_VIEW_GUTTER_POSITION_LINES, Self::Marks => ffi::GTK_SOURCE_VIEW_GUTTER_POSITION_MARKS, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for ViewGutterPosition { #[inline] unsafe fn from_glib(value: ffi::GtkSourceViewGutterPosition) -> Self { skip_assert_initialized!(); match value { ffi::GTK_SOURCE_VIEW_GUTTER_POSITION_LINES => Self::Lines, ffi::GTK_SOURCE_VIEW_GUTTER_POSITION_MARKS => Self::Marks, value => Self::__Unknown(value), } } } impl StaticType for ViewGutterPosition { #[inline] #[doc(alias = "gtk_source_view_gutter_position_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gtk_source_view_gutter_position_get_type()) } } } impl glib::HasParamSpec for ViewGutterPosition { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for ViewGutterPosition { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for ViewGutterPosition { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for ViewGutterPosition { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: ViewGutterPosition) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } sourceview5-0.9.0/src/auto/file.rs000064400000000000000000000255251046102023000151470ustar 00000000000000// 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::{ffi, CompressionType, Encoding, NewlineType}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourceFile")] pub struct File(Object); match fn { type_ => || ffi::gtk_source_file_get_type(), } } impl File { pub const NONE: Option<&'static File> = None; #[doc(alias = "gtk_source_file_new")] pub fn new() -> File { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gtk_source_file_new()) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`File`] objects. /// /// This method returns an instance of [`FileBuilder`](crate::builders::FileBuilder) which can be used to create [`File`] objects. pub fn builder() -> FileBuilder { FileBuilder::new() } } impl Default for File { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`File`] 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 FileBuilder { builder: glib::object::ObjectBuilder<'static, File>, } impl FileBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn location(self, location: &impl IsA) -> Self { Self { builder: self.builder.property("location", location.clone().upcast()), } } // rustdoc-stripper-ignore-next /// Build the [`File`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> File { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait SourceFileExt: IsA + sealed::Sealed + 'static { #[doc(alias = "gtk_source_file_check_file_on_disk")] fn check_file_on_disk(&self) { unsafe { ffi::gtk_source_file_check_file_on_disk(self.as_ref().to_glib_none().0); } } #[doc(alias = "gtk_source_file_get_compression_type")] #[doc(alias = "get_compression_type")] #[doc(alias = "compression-type")] fn compression_type(&self) -> CompressionType { unsafe { from_glib(ffi::gtk_source_file_get_compression_type( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_file_get_encoding")] #[doc(alias = "get_encoding")] fn encoding(&self) -> Encoding { unsafe { from_glib_none(ffi::gtk_source_file_get_encoding( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_file_get_location")] #[doc(alias = "get_location")] fn location(&self) -> gio::File { unsafe { from_glib_none(ffi::gtk_source_file_get_location( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_file_get_newline_type")] #[doc(alias = "get_newline_type")] #[doc(alias = "newline-type")] fn newline_type(&self) -> NewlineType { unsafe { from_glib(ffi::gtk_source_file_get_newline_type( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_file_is_deleted")] fn is_deleted(&self) -> bool { unsafe { from_glib(ffi::gtk_source_file_is_deleted( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_file_is_externally_modified")] fn is_externally_modified(&self) -> bool { unsafe { from_glib(ffi::gtk_source_file_is_externally_modified( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_file_is_local")] fn is_local(&self) -> bool { unsafe { from_glib(ffi::gtk_source_file_is_local( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_file_is_readonly")] fn is_readonly(&self) -> bool { unsafe { from_glib(ffi::gtk_source_file_is_readonly( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_file_set_location")] #[doc(alias = "location")] fn set_location(&self, location: Option<&impl IsA>) { unsafe { ffi::gtk_source_file_set_location( self.as_ref().to_glib_none().0, location.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "gtk_source_file_set_mount_operation_factory")] fn set_mount_operation_factory gio::MountOperation + 'static>( &self, callback: P, ) { let callback_data: Box_

= Box_::new(callback); unsafe extern "C" fn callback_func gio::MountOperation + 'static>( file: *mut ffi::GtkSourceFile, userdata: glib::ffi::gpointer, ) -> *mut gio::ffi::GMountOperation { let file = from_glib_borrow(file); let callback = &*(userdata as *mut P); (*callback)(&file) /*Not checked*/ .to_glib_none() .0 } let callback = Some(callback_func::

as _); unsafe extern "C" fn notify_func gio::MountOperation + 'static>( data: glib::ffi::gpointer, ) { let _callback = Box_::from_raw(data as *mut P); } let destroy_call3 = Some(notify_func::

as _); let super_callback0: Box_

= callback_data; unsafe { ffi::gtk_source_file_set_mount_operation_factory( self.as_ref().to_glib_none().0, callback, Box_::into_raw(super_callback0) as *mut _, destroy_call3, ); } } #[doc(alias = "read-only")] fn is_read_only(&self) -> bool { ObjectExt::property(self.as_ref(), "read-only") } #[doc(alias = "compression-type")] fn connect_compression_type_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_compression_type_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceFile, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(File::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::compression-type\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_compression_type_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "encoding")] fn connect_encoding_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_encoding_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkSourceFile, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(File::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::encoding\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_encoding_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "location")] fn connect_location_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_location_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkSourceFile, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(File::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::location\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_location_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "newline-type")] fn connect_newline_type_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_newline_type_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkSourceFile, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(File::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::newline-type\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_newline_type_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "read-only")] fn connect_read_only_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_read_only_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkSourceFile, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(File::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::read-only\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_read_only_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> SourceFileExt for O {} sourceview5-0.9.0/src/auto/file_loader.rs000064400000000000000000000126021046102023000164650ustar 00000000000000// 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::{ffi, Buffer, CompressionType, Encoding, File, NewlineType}; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "GtkSourceFileLoader")] pub struct FileLoader(Object); match fn { type_ => || ffi::gtk_source_file_loader_get_type(), } } impl FileLoader { #[doc(alias = "gtk_source_file_loader_new")] pub fn new(buffer: &impl IsA, file: &impl IsA) -> FileLoader { skip_assert_initialized!(); unsafe { from_glib_full(ffi::gtk_source_file_loader_new( buffer.as_ref().to_glib_none().0, file.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_file_loader_new_from_stream")] #[doc(alias = "new_from_stream")] pub fn from_stream( buffer: &impl IsA, file: &impl IsA, stream: &impl IsA, ) -> FileLoader { skip_assert_initialized!(); unsafe { from_glib_full(ffi::gtk_source_file_loader_new_from_stream( buffer.as_ref().to_glib_none().0, file.as_ref().to_glib_none().0, stream.as_ref().to_glib_none().0, )) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`FileLoader`] objects. /// /// This method returns an instance of [`FileLoaderBuilder`](crate::builders::FileLoaderBuilder) which can be used to create [`FileLoader`] objects. pub fn builder() -> FileLoaderBuilder { FileLoaderBuilder::new() } #[doc(alias = "gtk_source_file_loader_get_buffer")] #[doc(alias = "get_buffer")] pub fn buffer(&self) -> Buffer { unsafe { from_glib_none(ffi::gtk_source_file_loader_get_buffer( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_file_loader_get_compression_type")] #[doc(alias = "get_compression_type")] pub fn compression_type(&self) -> CompressionType { unsafe { from_glib(ffi::gtk_source_file_loader_get_compression_type( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_file_loader_get_encoding")] #[doc(alias = "get_encoding")] pub fn encoding(&self) -> Encoding { unsafe { from_glib_none(ffi::gtk_source_file_loader_get_encoding( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_file_loader_get_file")] #[doc(alias = "get_file")] pub fn file(&self) -> File { unsafe { from_glib_none(ffi::gtk_source_file_loader_get_file(self.to_glib_none().0)) } } #[doc(alias = "gtk_source_file_loader_get_input_stream")] #[doc(alias = "get_input_stream")] #[doc(alias = "input-stream")] pub fn input_stream(&self) -> Option { unsafe { from_glib_none(ffi::gtk_source_file_loader_get_input_stream( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_file_loader_get_location")] #[doc(alias = "get_location")] pub fn location(&self) -> Option { unsafe { from_glib_none(ffi::gtk_source_file_loader_get_location( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_file_loader_get_newline_type")] #[doc(alias = "get_newline_type")] pub fn newline_type(&self) -> NewlineType { unsafe { from_glib(ffi::gtk_source_file_loader_get_newline_type( self.to_glib_none().0, )) } } } impl Default for FileLoader { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`FileLoader`] 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 FileLoaderBuilder { builder: glib::object::ObjectBuilder<'static, FileLoader>, } impl FileLoaderBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn buffer(self, buffer: &impl IsA) -> Self { Self { builder: self.builder.property("buffer", buffer.clone().upcast()), } } pub fn file(self, file: &impl IsA) -> Self { Self { builder: self.builder.property("file", file.clone().upcast()), } } pub fn input_stream(self, input_stream: &impl IsA) -> Self { Self { builder: self .builder .property("input-stream", input_stream.clone().upcast()), } } pub fn location(self, location: &impl IsA) -> Self { Self { builder: self.builder.property("location", location.clone().upcast()), } } // rustdoc-stripper-ignore-next /// Build the [`FileLoader`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> FileLoader { self.builder.build() } } sourceview5-0.9.0/src/auto/file_saver.rs000064400000000000000000000247131046102023000163450ustar 00000000000000// 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::{ffi, Buffer, CompressionType, Encoding, File, FileSaverFlags, NewlineType}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourceFileSaver")] pub struct FileSaver(Object); match fn { type_ => || ffi::gtk_source_file_saver_get_type(), } } impl FileSaver { #[doc(alias = "gtk_source_file_saver_new")] pub fn new(buffer: &impl IsA, file: &impl IsA) -> FileSaver { skip_assert_initialized!(); unsafe { from_glib_full(ffi::gtk_source_file_saver_new( buffer.as_ref().to_glib_none().0, file.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_file_saver_new_with_target")] #[doc(alias = "new_with_target")] pub fn with_target( buffer: &impl IsA, file: &impl IsA, target_location: &impl IsA, ) -> FileSaver { skip_assert_initialized!(); unsafe { from_glib_full(ffi::gtk_source_file_saver_new_with_target( buffer.as_ref().to_glib_none().0, file.as_ref().to_glib_none().0, target_location.as_ref().to_glib_none().0, )) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`FileSaver`] objects. /// /// This method returns an instance of [`FileSaverBuilder`](crate::builders::FileSaverBuilder) which can be used to create [`FileSaver`] objects. pub fn builder() -> FileSaverBuilder { FileSaverBuilder::new() } #[doc(alias = "gtk_source_file_saver_get_buffer")] #[doc(alias = "get_buffer")] pub fn buffer(&self) -> Buffer { unsafe { from_glib_none(ffi::gtk_source_file_saver_get_buffer(self.to_glib_none().0)) } } #[doc(alias = "gtk_source_file_saver_get_compression_type")] #[doc(alias = "get_compression_type")] #[doc(alias = "compression-type")] pub fn compression_type(&self) -> CompressionType { unsafe { from_glib(ffi::gtk_source_file_saver_get_compression_type( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_file_saver_get_encoding")] #[doc(alias = "get_encoding")] pub fn encoding(&self) -> Encoding { unsafe { from_glib_none(ffi::gtk_source_file_saver_get_encoding( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_file_saver_get_file")] #[doc(alias = "get_file")] pub fn file(&self) -> File { unsafe { from_glib_none(ffi::gtk_source_file_saver_get_file(self.to_glib_none().0)) } } #[doc(alias = "gtk_source_file_saver_get_flags")] #[doc(alias = "get_flags")] pub fn flags(&self) -> FileSaverFlags { unsafe { from_glib(ffi::gtk_source_file_saver_get_flags(self.to_glib_none().0)) } } #[doc(alias = "gtk_source_file_saver_get_location")] #[doc(alias = "get_location")] pub fn location(&self) -> gio::File { unsafe { from_glib_none(ffi::gtk_source_file_saver_get_location( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_file_saver_get_newline_type")] #[doc(alias = "get_newline_type")] #[doc(alias = "newline-type")] pub fn newline_type(&self) -> NewlineType { unsafe { from_glib(ffi::gtk_source_file_saver_get_newline_type( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_file_saver_set_compression_type")] #[doc(alias = "compression-type")] pub fn set_compression_type(&self, compression_type: CompressionType) { unsafe { ffi::gtk_source_file_saver_set_compression_type( self.to_glib_none().0, compression_type.into_glib(), ); } } #[doc(alias = "gtk_source_file_saver_set_encoding")] #[doc(alias = "encoding")] pub fn set_encoding(&self, encoding: Option<&Encoding>) { unsafe { ffi::gtk_source_file_saver_set_encoding( self.to_glib_none().0, encoding.to_glib_none().0, ); } } #[doc(alias = "gtk_source_file_saver_set_flags")] #[doc(alias = "flags")] pub fn set_flags(&self, flags: FileSaverFlags) { unsafe { ffi::gtk_source_file_saver_set_flags(self.to_glib_none().0, flags.into_glib()); } } #[doc(alias = "gtk_source_file_saver_set_newline_type")] #[doc(alias = "newline-type")] pub fn set_newline_type(&self, newline_type: NewlineType) { unsafe { ffi::gtk_source_file_saver_set_newline_type( self.to_glib_none().0, newline_type.into_glib(), ); } } #[doc(alias = "compression-type")] pub fn connect_compression_type_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_compression_type_trampoline( this: *mut ffi::GtkSourceFileSaver, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::compression-type\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_compression_type_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "encoding")] pub fn connect_encoding_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_encoding_trampoline( this: *mut ffi::GtkSourceFileSaver, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::encoding\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_encoding_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "flags")] pub fn connect_flags_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_flags_trampoline( this: *mut ffi::GtkSourceFileSaver, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::flags\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_flags_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "newline-type")] pub fn connect_newline_type_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_newline_type_trampoline( this: *mut ffi::GtkSourceFileSaver, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::newline-type\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_newline_type_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for FileSaver { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`FileSaver`] 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 FileSaverBuilder { builder: glib::object::ObjectBuilder<'static, FileSaver>, } impl FileSaverBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn buffer(self, buffer: &impl IsA) -> Self { Self { builder: self.builder.property("buffer", buffer.clone().upcast()), } } pub fn compression_type(self, compression_type: CompressionType) -> Self { Self { builder: self.builder.property("compression-type", compression_type), } } pub fn encoding(self, encoding: &Encoding) -> Self { Self { builder: self.builder.property("encoding", encoding), } } pub fn file(self, file: &impl IsA) -> Self { Self { builder: self.builder.property("file", file.clone().upcast()), } } pub fn flags(self, flags: FileSaverFlags) -> Self { Self { builder: self.builder.property("flags", flags), } } pub fn location(self, location: &impl IsA) -> Self { Self { builder: self.builder.property("location", location.clone().upcast()), } } pub fn newline_type(self, newline_type: NewlineType) -> Self { Self { builder: self.builder.property("newline-type", newline_type), } } // rustdoc-stripper-ignore-next /// Build the [`FileSaver`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> FileSaver { self.builder.build() } } sourceview5-0.9.0/src/auto/flags.rs000064400000000000000000000253651046102023000153260ustar 00000000000000// 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::ffi; use glib::{bitflags::bitflags, prelude::*, translate::*}; bitflags! { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[doc(alias = "GtkSourceFileSaverFlags")] pub struct FileSaverFlags: u32 { #[doc(alias = "GTK_SOURCE_FILE_SAVER_FLAGS_NONE")] const NONE = ffi::GTK_SOURCE_FILE_SAVER_FLAGS_NONE as _; #[doc(alias = "GTK_SOURCE_FILE_SAVER_FLAGS_IGNORE_INVALID_CHARS")] const IGNORE_INVALID_CHARS = ffi::GTK_SOURCE_FILE_SAVER_FLAGS_IGNORE_INVALID_CHARS as _; #[doc(alias = "GTK_SOURCE_FILE_SAVER_FLAGS_IGNORE_MODIFICATION_TIME")] const IGNORE_MODIFICATION_TIME = ffi::GTK_SOURCE_FILE_SAVER_FLAGS_IGNORE_MODIFICATION_TIME as _; #[doc(alias = "GTK_SOURCE_FILE_SAVER_FLAGS_CREATE_BACKUP")] const CREATE_BACKUP = ffi::GTK_SOURCE_FILE_SAVER_FLAGS_CREATE_BACKUP as _; } } #[doc(hidden)] impl IntoGlib for FileSaverFlags { type GlibType = ffi::GtkSourceFileSaverFlags; #[inline] fn into_glib(self) -> ffi::GtkSourceFileSaverFlags { self.bits() } } #[doc(hidden)] impl FromGlib for FileSaverFlags { #[inline] unsafe fn from_glib(value: ffi::GtkSourceFileSaverFlags) -> Self { skip_assert_initialized!(); Self::from_bits_truncate(value) } } impl StaticType for FileSaverFlags { #[inline] #[doc(alias = "gtk_source_file_saver_flags_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gtk_source_file_saver_flags_get_type()) } } } impl glib::HasParamSpec for FileSaverFlags { type ParamSpec = glib::ParamSpecFlags; type SetValue = Self; type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder } } impl glib::value::ValueType for FileSaverFlags { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for FileSaverFlags { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) } } impl ToValue for FileSaverFlags { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: FileSaverFlags) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } bitflags! { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[doc(alias = "GtkSourceSortFlags")] pub struct SortFlags: u32 { #[doc(alias = "GTK_SOURCE_SORT_FLAGS_NONE")] const NONE = ffi::GTK_SOURCE_SORT_FLAGS_NONE as _; #[doc(alias = "GTK_SOURCE_SORT_FLAGS_CASE_SENSITIVE")] const CASE_SENSITIVE = ffi::GTK_SOURCE_SORT_FLAGS_CASE_SENSITIVE as _; #[doc(alias = "GTK_SOURCE_SORT_FLAGS_REVERSE_ORDER")] const REVERSE_ORDER = ffi::GTK_SOURCE_SORT_FLAGS_REVERSE_ORDER as _; #[doc(alias = "GTK_SOURCE_SORT_FLAGS_REMOVE_DUPLICATES")] const REMOVE_DUPLICATES = ffi::GTK_SOURCE_SORT_FLAGS_REMOVE_DUPLICATES as _; } } #[doc(hidden)] impl IntoGlib for SortFlags { type GlibType = ffi::GtkSourceSortFlags; #[inline] fn into_glib(self) -> ffi::GtkSourceSortFlags { self.bits() } } #[doc(hidden)] impl FromGlib for SortFlags { #[inline] unsafe fn from_glib(value: ffi::GtkSourceSortFlags) -> Self { skip_assert_initialized!(); Self::from_bits_truncate(value) } } impl StaticType for SortFlags { #[inline] #[doc(alias = "gtk_source_sort_flags_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gtk_source_sort_flags_get_type()) } } } impl glib::HasParamSpec for SortFlags { type ParamSpec = glib::ParamSpecFlags; type SetValue = Self; type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder } } impl glib::value::ValueType for SortFlags { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for SortFlags { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) } } impl ToValue for SortFlags { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: SortFlags) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } bitflags! { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[doc(alias = "GtkSourceSpaceLocationFlags")] pub struct SpaceLocationFlags: u32 { #[doc(alias = "GTK_SOURCE_SPACE_LOCATION_NONE")] const NONE = ffi::GTK_SOURCE_SPACE_LOCATION_NONE as _; #[doc(alias = "GTK_SOURCE_SPACE_LOCATION_LEADING")] const LEADING = ffi::GTK_SOURCE_SPACE_LOCATION_LEADING as _; #[doc(alias = "GTK_SOURCE_SPACE_LOCATION_INSIDE_TEXT")] const INSIDE_TEXT = ffi::GTK_SOURCE_SPACE_LOCATION_INSIDE_TEXT as _; #[doc(alias = "GTK_SOURCE_SPACE_LOCATION_TRAILING")] const TRAILING = ffi::GTK_SOURCE_SPACE_LOCATION_TRAILING as _; #[doc(alias = "GTK_SOURCE_SPACE_LOCATION_ALL")] const ALL = ffi::GTK_SOURCE_SPACE_LOCATION_ALL as _; } } #[doc(hidden)] impl IntoGlib for SpaceLocationFlags { type GlibType = ffi::GtkSourceSpaceLocationFlags; #[inline] fn into_glib(self) -> ffi::GtkSourceSpaceLocationFlags { self.bits() } } #[doc(hidden)] impl FromGlib for SpaceLocationFlags { #[inline] unsafe fn from_glib(value: ffi::GtkSourceSpaceLocationFlags) -> Self { skip_assert_initialized!(); Self::from_bits_truncate(value) } } impl StaticType for SpaceLocationFlags { #[inline] #[doc(alias = "gtk_source_space_location_flags_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gtk_source_space_location_flags_get_type()) } } } impl glib::HasParamSpec for SpaceLocationFlags { type ParamSpec = glib::ParamSpecFlags; type SetValue = Self; type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder } } impl glib::value::ValueType for SpaceLocationFlags { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for SpaceLocationFlags { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) } } impl ToValue for SpaceLocationFlags { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: SpaceLocationFlags) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } bitflags! { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[doc(alias = "GtkSourceSpaceTypeFlags")] pub struct SpaceTypeFlags: u32 { #[doc(alias = "GTK_SOURCE_SPACE_TYPE_NONE")] const NONE = ffi::GTK_SOURCE_SPACE_TYPE_NONE as _; #[doc(alias = "GTK_SOURCE_SPACE_TYPE_SPACE")] const SPACE = ffi::GTK_SOURCE_SPACE_TYPE_SPACE as _; #[doc(alias = "GTK_SOURCE_SPACE_TYPE_TAB")] const TAB = ffi::GTK_SOURCE_SPACE_TYPE_TAB as _; #[doc(alias = "GTK_SOURCE_SPACE_TYPE_NEWLINE")] const NEWLINE = ffi::GTK_SOURCE_SPACE_TYPE_NEWLINE as _; #[doc(alias = "GTK_SOURCE_SPACE_TYPE_NBSP")] const NBSP = ffi::GTK_SOURCE_SPACE_TYPE_NBSP as _; #[doc(alias = "GTK_SOURCE_SPACE_TYPE_ALL")] const ALL = ffi::GTK_SOURCE_SPACE_TYPE_ALL as _; } } #[doc(hidden)] impl IntoGlib for SpaceTypeFlags { type GlibType = ffi::GtkSourceSpaceTypeFlags; #[inline] fn into_glib(self) -> ffi::GtkSourceSpaceTypeFlags { self.bits() } } #[doc(hidden)] impl FromGlib for SpaceTypeFlags { #[inline] unsafe fn from_glib(value: ffi::GtkSourceSpaceTypeFlags) -> Self { skip_assert_initialized!(); Self::from_bits_truncate(value) } } impl StaticType for SpaceTypeFlags { #[inline] #[doc(alias = "gtk_source_space_type_flags_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gtk_source_space_type_flags_get_type()) } } } impl glib::HasParamSpec for SpaceTypeFlags { type ParamSpec = glib::ParamSpecFlags; type SetValue = Self; type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder } } impl glib::value::ValueType for SpaceTypeFlags { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for SpaceTypeFlags { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) } } impl ToValue for SpaceTypeFlags { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: SpaceTypeFlags) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } sourceview5-0.9.0/src/auto/functions.rs000064400000000000000000000101511046102023000162250ustar 00000000000000// 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::ffi; use glib::translate::*; #[cfg(feature = "v5_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_2")))] use std::boxed::Box as Box_; #[doc(alias = "gtk_source_check_version")] pub fn check_version(major: u32, minor: u32, micro: u32) -> bool { assert_initialized_main_thread!(); unsafe { from_glib(ffi::gtk_source_check_version(major, minor, micro)) } } #[doc(alias = "gtk_source_finalize")] pub fn finalize() { assert_initialized_main_thread!(); unsafe { ffi::gtk_source_finalize(); } } #[doc(alias = "gtk_source_get_major_version")] #[doc(alias = "get_major_version")] pub fn major_version() -> u32 { assert_initialized_main_thread!(); unsafe { ffi::gtk_source_get_major_version() } } #[doc(alias = "gtk_source_get_micro_version")] #[doc(alias = "get_micro_version")] pub fn micro_version() -> u32 { assert_initialized_main_thread!(); unsafe { ffi::gtk_source_get_micro_version() } } #[doc(alias = "gtk_source_get_minor_version")] #[doc(alias = "get_minor_version")] pub fn minor_version() -> u32 { assert_initialized_main_thread!(); unsafe { ffi::gtk_source_get_minor_version() } } #[doc(alias = "gtk_source_init")] pub fn init() { assert_initialized_main_thread!(); unsafe { ffi::gtk_source_init(); } } #[cfg(feature = "v5_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_2")))] #[doc(alias = "gtk_source_scheduler_add")] pub fn scheduler_add bool + Send + Sync + 'static>(callback: P) -> usize { assert_initialized_main_thread!(); let callback_data: Box_

= Box_::new(callback); unsafe extern "C" fn callback_func bool + Send + Sync + 'static>( deadline: i64, user_data: glib::ffi::gpointer, ) -> glib::ffi::gboolean { let callback = Box_::from_raw(user_data as *mut P); (*callback)(deadline).into_glib() } let callback = Some(callback_func::

as _); let super_callback0: Box_

= callback_data; unsafe { ffi::gtk_source_scheduler_add(callback, Box_::into_raw(super_callback0) as *mut _) } } #[cfg(feature = "v5_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_2")))] #[doc(alias = "gtk_source_scheduler_add_full")] pub fn scheduler_add_full bool + Send + Sync + 'static>(callback: P) -> usize { assert_initialized_main_thread!(); let callback_data: Box_

= Box_::new(callback); unsafe extern "C" fn callback_func bool + Send + Sync + 'static>( deadline: i64, user_data: glib::ffi::gpointer, ) -> glib::ffi::gboolean { let callback = &*(user_data as *mut P); (*callback)(deadline).into_glib() } let callback = Some(callback_func::

as _); unsafe extern "C" fn notify_func bool + Send + Sync + 'static>( data: glib::ffi::gpointer, ) { let _callback = Box_::from_raw(data as *mut P); } let destroy_call2 = Some(notify_func::

as _); let super_callback0: Box_

= callback_data; unsafe { ffi::gtk_source_scheduler_add_full( callback, Box_::into_raw(super_callback0) as *mut _, destroy_call2, ) } } #[cfg(feature = "v5_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_2")))] #[doc(alias = "gtk_source_scheduler_remove")] pub fn scheduler_remove(handler_id: usize) { assert_initialized_main_thread!(); unsafe { ffi::gtk_source_scheduler_remove(handler_id); } } #[doc(alias = "gtk_source_utils_escape_search_text")] pub fn utils_escape_search_text(text: &str) -> glib::GString { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gtk_source_utils_escape_search_text( text.to_glib_none().0, )) } } #[doc(alias = "gtk_source_utils_unescape_search_text")] pub fn utils_unescape_search_text(text: &str) -> glib::GString { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gtk_source_utils_unescape_search_text( text.to_glib_none().0, )) } } sourceview5-0.9.0/src/auto/gutter.rs000064400000000000000000000202131046102023000155270ustar 00000000000000// 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::{ffi, GutterRenderer, View}; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "GtkSourceGutter")] pub struct Gutter(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::gtk_source_gutter_get_type(), } } impl Gutter { // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Gutter`] objects. /// /// This method returns an instance of [`GutterBuilder`](crate::builders::GutterBuilder) which can be used to create [`Gutter`] objects. pub fn builder() -> GutterBuilder { GutterBuilder::new() } #[doc(alias = "gtk_source_gutter_get_view")] #[doc(alias = "get_view")] pub fn view(&self) -> View { unsafe { from_glib_none(ffi::gtk_source_gutter_get_view(self.to_glib_none().0)) } } #[doc(alias = "gtk_source_gutter_insert")] pub fn insert(&self, renderer: &impl IsA, position: i32) -> bool { unsafe { from_glib(ffi::gtk_source_gutter_insert( self.to_glib_none().0, renderer.as_ref().to_glib_none().0, position, )) } } #[doc(alias = "gtk_source_gutter_remove")] pub fn remove(&self, renderer: &impl IsA) { unsafe { ffi::gtk_source_gutter_remove( self.to_glib_none().0, renderer.as_ref().to_glib_none().0, ); } } #[doc(alias = "gtk_source_gutter_reorder")] pub fn reorder(&self, renderer: &impl IsA, position: i32) { unsafe { ffi::gtk_source_gutter_reorder( self.to_glib_none().0, renderer.as_ref().to_glib_none().0, position, ); } } #[doc(alias = "window-type")] pub fn window_type(&self) -> gtk::TextWindowType { ObjectExt::property(self, "window-type") } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Gutter`] 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 GutterBuilder { builder: glib::object::ObjectBuilder<'static, Gutter>, } impl GutterBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn view(self, view: &impl IsA) -> Self { Self { builder: self.builder.property("view", view.clone().upcast()), } } pub fn window_type(self, window_type: gtk::TextWindowType) -> Self { Self { builder: self.builder.property("window-type", window_type), } } pub fn can_focus(self, can_focus: bool) -> Self { Self { builder: self.builder.property("can-focus", can_focus), } } pub fn can_target(self, can_target: bool) -> Self { Self { builder: self.builder.property("can-target", can_target), } } pub fn css_classes(self, css_classes: impl Into) -> Self { Self { builder: self.builder.property("css-classes", css_classes.into()), } } pub fn css_name(self, css_name: impl Into) -> Self { Self { builder: self.builder.property("css-name", css_name.into()), } } pub fn cursor(self, cursor: &gdk::Cursor) -> Self { Self { builder: self.builder.property("cursor", cursor.clone()), } } pub fn focus_on_click(self, focus_on_click: bool) -> Self { Self { builder: self.builder.property("focus-on-click", focus_on_click), } } pub fn focusable(self, focusable: bool) -> Self { Self { builder: self.builder.property("focusable", focusable), } } pub fn halign(self, halign: gtk::Align) -> Self { Self { builder: self.builder.property("halign", halign), } } pub fn has_tooltip(self, has_tooltip: bool) -> Self { Self { builder: self.builder.property("has-tooltip", has_tooltip), } } pub fn height_request(self, height_request: i32) -> Self { Self { builder: self.builder.property("height-request", height_request), } } pub fn hexpand(self, hexpand: bool) -> Self { Self { builder: self.builder.property("hexpand", hexpand), } } pub fn hexpand_set(self, hexpand_set: bool) -> Self { Self { builder: self.builder.property("hexpand-set", hexpand_set), } } pub fn layout_manager(self, layout_manager: &impl IsA) -> Self { Self { builder: self .builder .property("layout-manager", layout_manager.clone().upcast()), } } pub fn margin_bottom(self, margin_bottom: i32) -> Self { Self { builder: self.builder.property("margin-bottom", margin_bottom), } } pub fn margin_end(self, margin_end: i32) -> Self { Self { builder: self.builder.property("margin-end", margin_end), } } pub fn margin_start(self, margin_start: i32) -> Self { Self { builder: self.builder.property("margin-start", margin_start), } } pub fn margin_top(self, margin_top: i32) -> Self { Self { builder: self.builder.property("margin-top", margin_top), } } pub fn name(self, name: impl Into) -> Self { Self { builder: self.builder.property("name", name.into()), } } pub fn opacity(self, opacity: f64) -> Self { Self { builder: self.builder.property("opacity", opacity), } } pub fn overflow(self, overflow: gtk::Overflow) -> Self { Self { builder: self.builder.property("overflow", overflow), } } pub fn receives_default(self, receives_default: bool) -> Self { Self { builder: self.builder.property("receives-default", receives_default), } } pub fn sensitive(self, sensitive: bool) -> Self { Self { builder: self.builder.property("sensitive", sensitive), } } pub fn tooltip_markup(self, tooltip_markup: impl Into) -> Self { Self { builder: self .builder .property("tooltip-markup", tooltip_markup.into()), } } pub fn tooltip_text(self, tooltip_text: impl Into) -> Self { Self { builder: self.builder.property("tooltip-text", tooltip_text.into()), } } pub fn valign(self, valign: gtk::Align) -> Self { Self { builder: self.builder.property("valign", valign), } } pub fn vexpand(self, vexpand: bool) -> Self { Self { builder: self.builder.property("vexpand", vexpand), } } pub fn vexpand_set(self, vexpand_set: bool) -> Self { Self { builder: self.builder.property("vexpand-set", vexpand_set), } } pub fn visible(self, visible: bool) -> Self { Self { builder: self.builder.property("visible", visible), } } pub fn width_request(self, width_request: i32) -> Self { Self { builder: self.builder.property("width-request", width_request), } } pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self { Self { builder: self.builder.property("accessible-role", accessible_role), } } // rustdoc-stripper-ignore-next /// Build the [`Gutter`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Gutter { self.builder.build() } } sourceview5-0.9.0/src/auto/gutter_lines.rs000064400000000000000000000127201046102023000167250ustar 00000000000000// 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::{ffi, GutterRendererAlignmentMode}; use glib::translate::*; glib::wrapper! { #[doc(alias = "GtkSourceGutterLines")] pub struct GutterLines(Object); match fn { type_ => || ffi::gtk_source_gutter_lines_get_type(), } } impl GutterLines { #[doc(alias = "gtk_source_gutter_lines_add_class")] pub fn add_class(&self, line: u32, name: &str) { unsafe { ffi::gtk_source_gutter_lines_add_class( self.to_glib_none().0, line, name.to_glib_none().0, ); } } #[doc(alias = "gtk_source_gutter_lines_add_qclass")] pub fn add_qclass(&self, line: u32, qname: glib::Quark) { unsafe { ffi::gtk_source_gutter_lines_add_qclass(self.to_glib_none().0, line, qname.into_glib()); } } #[doc(alias = "gtk_source_gutter_lines_get_buffer")] #[doc(alias = "get_buffer")] pub fn buffer(&self) -> gtk::TextBuffer { unsafe { from_glib_none(ffi::gtk_source_gutter_lines_get_buffer( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_gutter_lines_get_first")] #[doc(alias = "get_first")] pub fn first(&self) -> u32 { unsafe { ffi::gtk_source_gutter_lines_get_first(self.to_glib_none().0) } } #[doc(alias = "gtk_source_gutter_lines_get_iter_at_line")] #[doc(alias = "get_iter_at_line")] pub fn iter_at_line(&self, line: u32) -> gtk::TextIter { unsafe { let mut iter = gtk::TextIter::uninitialized(); ffi::gtk_source_gutter_lines_get_iter_at_line( self.to_glib_none().0, iter.to_glib_none_mut().0, line, ); iter } } #[doc(alias = "gtk_source_gutter_lines_get_last")] #[doc(alias = "get_last")] pub fn last(&self) -> u32 { unsafe { ffi::gtk_source_gutter_lines_get_last(self.to_glib_none().0) } } #[doc(alias = "gtk_source_gutter_lines_get_line_yrange")] #[doc(alias = "get_line_yrange")] pub fn line_yrange(&self, line: u32, mode: GutterRendererAlignmentMode) -> (i32, i32) { unsafe { let mut y = std::mem::MaybeUninit::uninit(); let mut height = std::mem::MaybeUninit::uninit(); ffi::gtk_source_gutter_lines_get_line_yrange( self.to_glib_none().0, line, mode.into_glib(), y.as_mut_ptr(), height.as_mut_ptr(), ); (y.assume_init(), height.assume_init()) } } #[doc(alias = "gtk_source_gutter_lines_get_view")] #[doc(alias = "get_view")] pub fn view(&self) -> gtk::TextView { unsafe { from_glib_none(ffi::gtk_source_gutter_lines_get_view(self.to_glib_none().0)) } } #[cfg(feature = "v5_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_6")))] #[doc(alias = "gtk_source_gutter_lines_has_any_class")] pub fn has_any_class(&self, line: u32) -> bool { unsafe { from_glib(ffi::gtk_source_gutter_lines_has_any_class( self.to_glib_none().0, line, )) } } #[doc(alias = "gtk_source_gutter_lines_has_class")] pub fn has_class(&self, line: u32, name: &str) -> bool { unsafe { from_glib(ffi::gtk_source_gutter_lines_has_class( self.to_glib_none().0, line, name.to_glib_none().0, )) } } #[doc(alias = "gtk_source_gutter_lines_has_qclass")] pub fn has_qclass(&self, line: u32, qname: glib::Quark) -> bool { unsafe { from_glib(ffi::gtk_source_gutter_lines_has_qclass( self.to_glib_none().0, line, qname.into_glib(), )) } } #[doc(alias = "gtk_source_gutter_lines_is_cursor")] pub fn is_cursor(&self, line: u32) -> bool { unsafe { from_glib(ffi::gtk_source_gutter_lines_is_cursor( self.to_glib_none().0, line, )) } } #[doc(alias = "gtk_source_gutter_lines_is_prelit")] pub fn is_prelit(&self, line: u32) -> bool { unsafe { from_glib(ffi::gtk_source_gutter_lines_is_prelit( self.to_glib_none().0, line, )) } } #[doc(alias = "gtk_source_gutter_lines_is_selected")] pub fn is_selected(&self, line: u32) -> bool { unsafe { from_glib(ffi::gtk_source_gutter_lines_is_selected( self.to_glib_none().0, line, )) } } #[doc(alias = "gtk_source_gutter_lines_remove_class")] pub fn remove_class(&self, line: u32, name: &str) { unsafe { ffi::gtk_source_gutter_lines_remove_class( self.to_glib_none().0, line, name.to_glib_none().0, ); } } #[doc(alias = "gtk_source_gutter_lines_remove_qclass")] pub fn remove_qclass(&self, line: u32, qname: glib::Quark) { unsafe { ffi::gtk_source_gutter_lines_remove_qclass( self.to_glib_none().0, line, qname.into_glib(), ); } } } sourceview5-0.9.0/src/auto/gutter_renderer.rs000064400000000000000000000375711046102023000174340ustar 00000000000000// 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::{ffi, Buffer, GutterLines, GutterRendererAlignmentMode, View}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourceGutterRenderer")] pub struct GutterRenderer(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::gtk_source_gutter_renderer_get_type(), } } impl GutterRenderer { pub const NONE: Option<&'static GutterRenderer> = None; } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait GutterRendererExt: IsA + sealed::Sealed + 'static { #[doc(alias = "gtk_source_gutter_renderer_activate")] fn activate( &self, iter: >k::TextIter, area: &gdk::Rectangle, button: u32, state: gdk::ModifierType, n_presses: i32, ) { unsafe { ffi::gtk_source_gutter_renderer_activate( self.as_ref().to_glib_none().0, iter.to_glib_none().0, area.to_glib_none().0, button, state.into_glib(), n_presses, ); } } #[doc(alias = "gtk_source_gutter_renderer_align_cell")] fn align_cell(&self, line: u32, width: f32, height: f32) -> (f32, f32) { unsafe { let mut x = std::mem::MaybeUninit::uninit(); let mut y = std::mem::MaybeUninit::uninit(); ffi::gtk_source_gutter_renderer_align_cell( self.as_ref().to_glib_none().0, line, width, height, x.as_mut_ptr(), y.as_mut_ptr(), ); (x.assume_init(), y.assume_init()) } } #[doc(alias = "gtk_source_gutter_renderer_get_alignment_mode")] #[doc(alias = "get_alignment_mode")] #[doc(alias = "alignment-mode")] fn alignment_mode(&self) -> GutterRendererAlignmentMode { unsafe { from_glib(ffi::gtk_source_gutter_renderer_get_alignment_mode( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_gutter_renderer_get_buffer")] #[doc(alias = "get_buffer")] fn buffer(&self) -> Option { unsafe { from_glib_none(ffi::gtk_source_gutter_renderer_get_buffer( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_gutter_renderer_get_view")] #[doc(alias = "get_view")] fn view(&self) -> View { unsafe { from_glib_none(ffi::gtk_source_gutter_renderer_get_view( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_gutter_renderer_get_xalign")] #[doc(alias = "get_xalign")] fn xalign(&self) -> f32 { unsafe { ffi::gtk_source_gutter_renderer_get_xalign(self.as_ref().to_glib_none().0) } } #[doc(alias = "gtk_source_gutter_renderer_get_xpad")] #[doc(alias = "get_xpad")] fn xpad(&self) -> i32 { unsafe { ffi::gtk_source_gutter_renderer_get_xpad(self.as_ref().to_glib_none().0) } } #[doc(alias = "gtk_source_gutter_renderer_get_yalign")] #[doc(alias = "get_yalign")] fn yalign(&self) -> f32 { unsafe { ffi::gtk_source_gutter_renderer_get_yalign(self.as_ref().to_glib_none().0) } } #[doc(alias = "gtk_source_gutter_renderer_get_ypad")] #[doc(alias = "get_ypad")] fn ypad(&self) -> i32 { unsafe { ffi::gtk_source_gutter_renderer_get_ypad(self.as_ref().to_glib_none().0) } } #[doc(alias = "gtk_source_gutter_renderer_query_activatable")] fn query_activatable(&self, iter: >k::TextIter, area: &gdk::Rectangle) -> bool { unsafe { from_glib(ffi::gtk_source_gutter_renderer_query_activatable( self.as_ref().to_glib_none().0, iter.to_glib_none().0, area.to_glib_none().0, )) } } #[doc(alias = "gtk_source_gutter_renderer_set_alignment_mode")] #[doc(alias = "alignment-mode")] fn set_alignment_mode(&self, mode: GutterRendererAlignmentMode) { unsafe { ffi::gtk_source_gutter_renderer_set_alignment_mode( self.as_ref().to_glib_none().0, mode.into_glib(), ); } } #[doc(alias = "gtk_source_gutter_renderer_set_xalign")] #[doc(alias = "xalign")] fn set_xalign(&self, xalign: f32) { unsafe { ffi::gtk_source_gutter_renderer_set_xalign(self.as_ref().to_glib_none().0, xalign); } } #[doc(alias = "gtk_source_gutter_renderer_set_xpad")] #[doc(alias = "xpad")] fn set_xpad(&self, xpad: i32) { unsafe { ffi::gtk_source_gutter_renderer_set_xpad(self.as_ref().to_glib_none().0, xpad); } } #[doc(alias = "gtk_source_gutter_renderer_set_yalign")] #[doc(alias = "yalign")] fn set_yalign(&self, yalign: f32) { unsafe { ffi::gtk_source_gutter_renderer_set_yalign(self.as_ref().to_glib_none().0, yalign); } } #[doc(alias = "gtk_source_gutter_renderer_set_ypad")] #[doc(alias = "ypad")] fn set_ypad(&self, ypad: i32) { unsafe { ffi::gtk_source_gutter_renderer_set_ypad(self.as_ref().to_glib_none().0, ypad); } } fn lines(&self) -> Option { ObjectExt::property(self.as_ref(), "lines") } #[doc(alias = "activate")] fn connect_activate< F: Fn(&Self, >k::TextIter, &gdk::Rectangle, u32, gdk::ModifierType, i32) + 'static, >( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn activate_trampoline< P: IsA, F: Fn(&P, >k::TextIter, &gdk::Rectangle, u32, gdk::ModifierType, i32) + 'static, >( this: *mut ffi::GtkSourceGutterRenderer, iter: *mut gtk::ffi::GtkTextIter, area: *mut gdk::ffi::GdkRectangle, button: libc::c_uint, state: gdk::ffi::GdkModifierType, n_presses: libc::c_int, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( GutterRenderer::from_glib_borrow(this).unsafe_cast_ref(), &from_glib_borrow(iter), &from_glib_borrow(area), button, from_glib(state), n_presses, ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"activate\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( activate_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "query-activatable")] fn connect_query_activatable< F: Fn(&Self, >k::TextIter, &gdk::Rectangle) -> bool + 'static, >( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn query_activatable_trampoline< P: IsA, F: Fn(&P, >k::TextIter, &gdk::Rectangle) -> bool + 'static, >( this: *mut ffi::GtkSourceGutterRenderer, iter: *mut gtk::ffi::GtkTextIter, area: *mut gdk::ffi::GdkRectangle, f: glib::ffi::gpointer, ) -> glib::ffi::gboolean { let f: &F = &*(f as *const F); f( GutterRenderer::from_glib_borrow(this).unsafe_cast_ref(), &from_glib_borrow(iter), &from_glib_borrow(area), ) .into_glib() } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"query-activatable\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( query_activatable_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "query-data")] fn connect_query_data( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn query_data_trampoline< P: IsA, F: Fn(&P, &glib::Object, u32) + 'static, >( this: *mut ffi::GtkSourceGutterRenderer, object: *mut glib::gobject_ffi::GObject, p0: libc::c_uint, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( GutterRenderer::from_glib_borrow(this).unsafe_cast_ref(), &from_glib_borrow(object), p0, ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"query-data\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( query_data_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "alignment-mode")] fn connect_alignment_mode_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_alignment_mode_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceGutterRenderer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(GutterRenderer::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::alignment-mode\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_alignment_mode_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "lines")] fn connect_lines_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_lines_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceGutterRenderer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(GutterRenderer::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::lines\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_lines_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "view")] fn connect_view_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_view_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkSourceGutterRenderer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(GutterRenderer::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::view\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_view_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "xalign")] fn connect_xalign_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_xalign_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceGutterRenderer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(GutterRenderer::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::xalign\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_xalign_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "xpad")] fn connect_xpad_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_xpad_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkSourceGutterRenderer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(GutterRenderer::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::xpad\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_xpad_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "yalign")] fn connect_yalign_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_yalign_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceGutterRenderer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(GutterRenderer::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::yalign\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_yalign_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "ypad")] fn connect_ypad_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_ypad_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkSourceGutterRenderer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(GutterRenderer::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::ypad\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_ypad_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> GutterRendererExt for O {} sourceview5-0.9.0/src/auto/gutter_renderer_pixbuf.rs000064400000000000000000000376631046102023000210130ustar 00000000000000// 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::{ffi, GutterRenderer, GutterRendererAlignmentMode}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourceGutterRendererPixbuf")] pub struct GutterRendererPixbuf(Object) @extends GutterRenderer, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::gtk_source_gutter_renderer_pixbuf_get_type(), } } impl GutterRendererPixbuf { pub const NONE: Option<&'static GutterRendererPixbuf> = None; #[doc(alias = "gtk_source_gutter_renderer_pixbuf_new")] pub fn new() -> GutterRendererPixbuf { assert_initialized_main_thread!(); unsafe { GutterRenderer::from_glib_full(ffi::gtk_source_gutter_renderer_pixbuf_new()) .unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`GutterRendererPixbuf`] objects. /// /// This method returns an instance of [`GutterRendererPixbufBuilder`](crate::builders::GutterRendererPixbufBuilder) which can be used to create [`GutterRendererPixbuf`] objects. pub fn builder() -> GutterRendererPixbufBuilder { GutterRendererPixbufBuilder::new() } } impl Default for GutterRendererPixbuf { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`GutterRendererPixbuf`] 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 GutterRendererPixbufBuilder { builder: glib::object::ObjectBuilder<'static, GutterRendererPixbuf>, } impl GutterRendererPixbufBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn gicon(self, gicon: &impl IsA) -> Self { Self { builder: self.builder.property("gicon", gicon.clone().upcast()), } } pub fn icon_name(self, icon_name: impl Into) -> Self { Self { builder: self.builder.property("icon-name", icon_name.into()), } } pub fn paintable(self, paintable: &impl IsA) -> Self { Self { builder: self .builder .property("paintable", paintable.clone().upcast()), } } pub fn pixbuf(self, pixbuf: &gdk_pixbuf::Pixbuf) -> Self { Self { builder: self.builder.property("pixbuf", pixbuf.clone()), } } pub fn alignment_mode(self, alignment_mode: GutterRendererAlignmentMode) -> Self { Self { builder: self.builder.property("alignment-mode", alignment_mode), } } pub fn xalign(self, xalign: f32) -> Self { Self { builder: self.builder.property("xalign", xalign), } } pub fn xpad(self, xpad: i32) -> Self { Self { builder: self.builder.property("xpad", xpad), } } pub fn yalign(self, yalign: f32) -> Self { Self { builder: self.builder.property("yalign", yalign), } } pub fn ypad(self, ypad: i32) -> Self { Self { builder: self.builder.property("ypad", ypad), } } pub fn can_focus(self, can_focus: bool) -> Self { Self { builder: self.builder.property("can-focus", can_focus), } } pub fn can_target(self, can_target: bool) -> Self { Self { builder: self.builder.property("can-target", can_target), } } pub fn css_classes(self, css_classes: impl Into) -> Self { Self { builder: self.builder.property("css-classes", css_classes.into()), } } pub fn css_name(self, css_name: impl Into) -> Self { Self { builder: self.builder.property("css-name", css_name.into()), } } pub fn cursor(self, cursor: &gdk::Cursor) -> Self { Self { builder: self.builder.property("cursor", cursor.clone()), } } pub fn focus_on_click(self, focus_on_click: bool) -> Self { Self { builder: self.builder.property("focus-on-click", focus_on_click), } } pub fn focusable(self, focusable: bool) -> Self { Self { builder: self.builder.property("focusable", focusable), } } pub fn halign(self, halign: gtk::Align) -> Self { Self { builder: self.builder.property("halign", halign), } } pub fn has_tooltip(self, has_tooltip: bool) -> Self { Self { builder: self.builder.property("has-tooltip", has_tooltip), } } pub fn height_request(self, height_request: i32) -> Self { Self { builder: self.builder.property("height-request", height_request), } } pub fn hexpand(self, hexpand: bool) -> Self { Self { builder: self.builder.property("hexpand", hexpand), } } pub fn hexpand_set(self, hexpand_set: bool) -> Self { Self { builder: self.builder.property("hexpand-set", hexpand_set), } } pub fn layout_manager(self, layout_manager: &impl IsA) -> Self { Self { builder: self .builder .property("layout-manager", layout_manager.clone().upcast()), } } pub fn margin_bottom(self, margin_bottom: i32) -> Self { Self { builder: self.builder.property("margin-bottom", margin_bottom), } } pub fn margin_end(self, margin_end: i32) -> Self { Self { builder: self.builder.property("margin-end", margin_end), } } pub fn margin_start(self, margin_start: i32) -> Self { Self { builder: self.builder.property("margin-start", margin_start), } } pub fn margin_top(self, margin_top: i32) -> Self { Self { builder: self.builder.property("margin-top", margin_top), } } pub fn name(self, name: impl Into) -> Self { Self { builder: self.builder.property("name", name.into()), } } pub fn opacity(self, opacity: f64) -> Self { Self { builder: self.builder.property("opacity", opacity), } } pub fn overflow(self, overflow: gtk::Overflow) -> Self { Self { builder: self.builder.property("overflow", overflow), } } pub fn receives_default(self, receives_default: bool) -> Self { Self { builder: self.builder.property("receives-default", receives_default), } } pub fn sensitive(self, sensitive: bool) -> Self { Self { builder: self.builder.property("sensitive", sensitive), } } pub fn tooltip_markup(self, tooltip_markup: impl Into) -> Self { Self { builder: self .builder .property("tooltip-markup", tooltip_markup.into()), } } pub fn tooltip_text(self, tooltip_text: impl Into) -> Self { Self { builder: self.builder.property("tooltip-text", tooltip_text.into()), } } pub fn valign(self, valign: gtk::Align) -> Self { Self { builder: self.builder.property("valign", valign), } } pub fn vexpand(self, vexpand: bool) -> Self { Self { builder: self.builder.property("vexpand", vexpand), } } pub fn vexpand_set(self, vexpand_set: bool) -> Self { Self { builder: self.builder.property("vexpand-set", vexpand_set), } } pub fn visible(self, visible: bool) -> Self { Self { builder: self.builder.property("visible", visible), } } pub fn width_request(self, width_request: i32) -> Self { Self { builder: self.builder.property("width-request", width_request), } } pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self { Self { builder: self.builder.property("accessible-role", accessible_role), } } // rustdoc-stripper-ignore-next /// Build the [`GutterRendererPixbuf`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> GutterRendererPixbuf { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait GutterRendererPixbufExt: IsA + sealed::Sealed + 'static { #[doc(alias = "gtk_source_gutter_renderer_pixbuf_get_gicon")] #[doc(alias = "get_gicon")] fn gicon(&self) -> gio::Icon { unsafe { from_glib_none(ffi::gtk_source_gutter_renderer_pixbuf_get_gicon( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_gutter_renderer_pixbuf_get_icon_name")] #[doc(alias = "get_icon_name")] #[doc(alias = "icon-name")] fn icon_name(&self) -> glib::GString { unsafe { from_glib_none(ffi::gtk_source_gutter_renderer_pixbuf_get_icon_name( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_gutter_renderer_pixbuf_get_paintable")] #[doc(alias = "get_paintable")] fn paintable(&self) -> Option { unsafe { from_glib_none(ffi::gtk_source_gutter_renderer_pixbuf_get_paintable( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_gutter_renderer_pixbuf_get_pixbuf")] #[doc(alias = "get_pixbuf")] fn pixbuf(&self) -> gdk_pixbuf::Pixbuf { unsafe { from_glib_none(ffi::gtk_source_gutter_renderer_pixbuf_get_pixbuf( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_gutter_renderer_pixbuf_overlay_paintable")] fn overlay_paintable(&self, paintable: &impl IsA) { unsafe { ffi::gtk_source_gutter_renderer_pixbuf_overlay_paintable( self.as_ref().to_glib_none().0, paintable.as_ref().to_glib_none().0, ); } } #[doc(alias = "gtk_source_gutter_renderer_pixbuf_set_gicon")] #[doc(alias = "gicon")] fn set_gicon(&self, icon: Option<&impl IsA>) { unsafe { ffi::gtk_source_gutter_renderer_pixbuf_set_gicon( self.as_ref().to_glib_none().0, icon.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "gtk_source_gutter_renderer_pixbuf_set_icon_name")] #[doc(alias = "icon-name")] fn set_icon_name(&self, icon_name: Option<&str>) { unsafe { ffi::gtk_source_gutter_renderer_pixbuf_set_icon_name( self.as_ref().to_glib_none().0, icon_name.to_glib_none().0, ); } } #[doc(alias = "gtk_source_gutter_renderer_pixbuf_set_paintable")] #[doc(alias = "paintable")] fn set_paintable(&self, paintable: Option<&impl IsA>) { unsafe { ffi::gtk_source_gutter_renderer_pixbuf_set_paintable( self.as_ref().to_glib_none().0, paintable.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "gtk_source_gutter_renderer_pixbuf_set_pixbuf")] #[doc(alias = "pixbuf")] fn set_pixbuf(&self, pixbuf: Option<&gdk_pixbuf::Pixbuf>) { unsafe { ffi::gtk_source_gutter_renderer_pixbuf_set_pixbuf( self.as_ref().to_glib_none().0, pixbuf.to_glib_none().0, ); } } #[doc(alias = "gicon")] fn connect_gicon_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_gicon_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceGutterRendererPixbuf, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(GutterRendererPixbuf::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::gicon\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_gicon_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "icon-name")] fn connect_icon_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_icon_name_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceGutterRendererPixbuf, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(GutterRendererPixbuf::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::icon-name\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_icon_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "paintable")] fn connect_paintable_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_paintable_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceGutterRendererPixbuf, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(GutterRendererPixbuf::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::paintable\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_paintable_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "pixbuf")] fn connect_pixbuf_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_pixbuf_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceGutterRendererPixbuf, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(GutterRendererPixbuf::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::pixbuf\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_pixbuf_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> GutterRendererPixbufExt for O {} sourceview5-0.9.0/src/auto/gutter_renderer_text.rs000064400000000000000000000307751046102023000204770ustar 00000000000000// 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::{ffi, GutterRenderer, GutterRendererAlignmentMode}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourceGutterRendererText")] pub struct GutterRendererText(Object) @extends GutterRenderer, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::gtk_source_gutter_renderer_text_get_type(), } } impl GutterRendererText { pub const NONE: Option<&'static GutterRendererText> = None; #[doc(alias = "gtk_source_gutter_renderer_text_new")] pub fn new() -> GutterRendererText { assert_initialized_main_thread!(); unsafe { GutterRenderer::from_glib_full(ffi::gtk_source_gutter_renderer_text_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`GutterRendererText`] objects. /// /// This method returns an instance of [`GutterRendererTextBuilder`](crate::builders::GutterRendererTextBuilder) which can be used to create [`GutterRendererText`] objects. pub fn builder() -> GutterRendererTextBuilder { GutterRendererTextBuilder::new() } } impl Default for GutterRendererText { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`GutterRendererText`] 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 GutterRendererTextBuilder { builder: glib::object::ObjectBuilder<'static, GutterRendererText>, } impl GutterRendererTextBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn markup(self, markup: impl Into) -> Self { Self { builder: self.builder.property("markup", markup.into()), } } pub fn text(self, text: impl Into) -> Self { Self { builder: self.builder.property("text", text.into()), } } pub fn alignment_mode(self, alignment_mode: GutterRendererAlignmentMode) -> Self { Self { builder: self.builder.property("alignment-mode", alignment_mode), } } pub fn xalign(self, xalign: f32) -> Self { Self { builder: self.builder.property("xalign", xalign), } } pub fn xpad(self, xpad: i32) -> Self { Self { builder: self.builder.property("xpad", xpad), } } pub fn yalign(self, yalign: f32) -> Self { Self { builder: self.builder.property("yalign", yalign), } } pub fn ypad(self, ypad: i32) -> Self { Self { builder: self.builder.property("ypad", ypad), } } pub fn can_focus(self, can_focus: bool) -> Self { Self { builder: self.builder.property("can-focus", can_focus), } } pub fn can_target(self, can_target: bool) -> Self { Self { builder: self.builder.property("can-target", can_target), } } pub fn css_classes(self, css_classes: impl Into) -> Self { Self { builder: self.builder.property("css-classes", css_classes.into()), } } pub fn css_name(self, css_name: impl Into) -> Self { Self { builder: self.builder.property("css-name", css_name.into()), } } pub fn cursor(self, cursor: &gdk::Cursor) -> Self { Self { builder: self.builder.property("cursor", cursor.clone()), } } pub fn focus_on_click(self, focus_on_click: bool) -> Self { Self { builder: self.builder.property("focus-on-click", focus_on_click), } } pub fn focusable(self, focusable: bool) -> Self { Self { builder: self.builder.property("focusable", focusable), } } pub fn halign(self, halign: gtk::Align) -> Self { Self { builder: self.builder.property("halign", halign), } } pub fn has_tooltip(self, has_tooltip: bool) -> Self { Self { builder: self.builder.property("has-tooltip", has_tooltip), } } pub fn height_request(self, height_request: i32) -> Self { Self { builder: self.builder.property("height-request", height_request), } } pub fn hexpand(self, hexpand: bool) -> Self { Self { builder: self.builder.property("hexpand", hexpand), } } pub fn hexpand_set(self, hexpand_set: bool) -> Self { Self { builder: self.builder.property("hexpand-set", hexpand_set), } } pub fn layout_manager(self, layout_manager: &impl IsA) -> Self { Self { builder: self .builder .property("layout-manager", layout_manager.clone().upcast()), } } pub fn margin_bottom(self, margin_bottom: i32) -> Self { Self { builder: self.builder.property("margin-bottom", margin_bottom), } } pub fn margin_end(self, margin_end: i32) -> Self { Self { builder: self.builder.property("margin-end", margin_end), } } pub fn margin_start(self, margin_start: i32) -> Self { Self { builder: self.builder.property("margin-start", margin_start), } } pub fn margin_top(self, margin_top: i32) -> Self { Self { builder: self.builder.property("margin-top", margin_top), } } pub fn name(self, name: impl Into) -> Self { Self { builder: self.builder.property("name", name.into()), } } pub fn opacity(self, opacity: f64) -> Self { Self { builder: self.builder.property("opacity", opacity), } } pub fn overflow(self, overflow: gtk::Overflow) -> Self { Self { builder: self.builder.property("overflow", overflow), } } pub fn receives_default(self, receives_default: bool) -> Self { Self { builder: self.builder.property("receives-default", receives_default), } } pub fn sensitive(self, sensitive: bool) -> Self { Self { builder: self.builder.property("sensitive", sensitive), } } pub fn tooltip_markup(self, tooltip_markup: impl Into) -> Self { Self { builder: self .builder .property("tooltip-markup", tooltip_markup.into()), } } pub fn tooltip_text(self, tooltip_text: impl Into) -> Self { Self { builder: self.builder.property("tooltip-text", tooltip_text.into()), } } pub fn valign(self, valign: gtk::Align) -> Self { Self { builder: self.builder.property("valign", valign), } } pub fn vexpand(self, vexpand: bool) -> Self { Self { builder: self.builder.property("vexpand", vexpand), } } pub fn vexpand_set(self, vexpand_set: bool) -> Self { Self { builder: self.builder.property("vexpand-set", vexpand_set), } } pub fn visible(self, visible: bool) -> Self { Self { builder: self.builder.property("visible", visible), } } pub fn width_request(self, width_request: i32) -> Self { Self { builder: self.builder.property("width-request", width_request), } } pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self { Self { builder: self.builder.property("accessible-role", accessible_role), } } // rustdoc-stripper-ignore-next /// Build the [`GutterRendererText`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> GutterRendererText { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait GutterRendererTextExt: IsA + sealed::Sealed + 'static { #[doc(alias = "gtk_source_gutter_renderer_text_measure")] fn measure(&self, text: &str) -> (i32, i32) { unsafe { let mut width = std::mem::MaybeUninit::uninit(); let mut height = std::mem::MaybeUninit::uninit(); ffi::gtk_source_gutter_renderer_text_measure( self.as_ref().to_glib_none().0, text.to_glib_none().0, width.as_mut_ptr(), height.as_mut_ptr(), ); (width.assume_init(), height.assume_init()) } } #[doc(alias = "gtk_source_gutter_renderer_text_measure_markup")] fn measure_markup(&self, markup: &str) -> (i32, i32) { unsafe { let mut width = std::mem::MaybeUninit::uninit(); let mut height = std::mem::MaybeUninit::uninit(); ffi::gtk_source_gutter_renderer_text_measure_markup( self.as_ref().to_glib_none().0, markup.to_glib_none().0, width.as_mut_ptr(), height.as_mut_ptr(), ); (width.assume_init(), height.assume_init()) } } #[doc(alias = "gtk_source_gutter_renderer_text_set_markup")] #[doc(alias = "markup")] fn set_markup(&self, markup: &str) { let length = markup.len() as _; unsafe { ffi::gtk_source_gutter_renderer_text_set_markup( self.as_ref().to_glib_none().0, markup.to_glib_none().0, length, ); } } #[doc(alias = "gtk_source_gutter_renderer_text_set_text")] #[doc(alias = "text")] fn set_text(&self, text: &str) { let length = text.len() as _; unsafe { ffi::gtk_source_gutter_renderer_text_set_text( self.as_ref().to_glib_none().0, text.to_glib_none().0, length, ); } } fn markup(&self) -> Option { ObjectExt::property(self.as_ref(), "markup") } fn text(&self) -> Option { ObjectExt::property(self.as_ref(), "text") } #[doc(alias = "markup")] fn connect_markup_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_markup_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceGutterRendererText, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(GutterRendererText::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::markup\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_markup_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "text")] fn connect_text_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_text_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceGutterRendererText, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(GutterRendererText::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::text\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_text_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> GutterRendererTextExt for O {} sourceview5-0.9.0/src/auto/hover.rs000064400000000000000000000067051046102023000153520ustar 00000000000000// 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::{ffi, HoverProvider}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourceHover")] pub struct Hover(Object); match fn { type_ => || ffi::gtk_source_hover_get_type(), } } impl Hover { // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Hover`] objects. /// /// This method returns an instance of [`HoverBuilder`](crate::builders::HoverBuilder) which can be used to create [`Hover`] objects. pub fn builder() -> HoverBuilder { HoverBuilder::new() } #[doc(alias = "gtk_source_hover_add_provider")] pub fn add_provider(&self, provider: &impl IsA) { unsafe { ffi::gtk_source_hover_add_provider( self.to_glib_none().0, provider.as_ref().to_glib_none().0, ); } } #[doc(alias = "gtk_source_hover_remove_provider")] pub fn remove_provider(&self, provider: &impl IsA) { unsafe { ffi::gtk_source_hover_remove_provider( self.to_glib_none().0, provider.as_ref().to_glib_none().0, ); } } #[doc(alias = "hover-delay")] pub fn hover_delay(&self) -> u32 { ObjectExt::property(self, "hover-delay") } #[doc(alias = "hover-delay")] pub fn set_hover_delay(&self, hover_delay: u32) { ObjectExt::set_property(self, "hover-delay", hover_delay) } #[doc(alias = "hover-delay")] pub fn connect_hover_delay_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_hover_delay_trampoline( this: *mut ffi::GtkSourceHover, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::hover-delay\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_hover_delay_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Hover`] 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 HoverBuilder { builder: glib::object::ObjectBuilder<'static, Hover>, } impl HoverBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn hover_delay(self, hover_delay: u32) -> Self { Self { builder: self.builder.property("hover-delay", hover_delay), } } // rustdoc-stripper-ignore-next /// Build the [`Hover`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Hover { self.builder.build() } } sourceview5-0.9.0/src/auto/hover_context.rs000064400000000000000000000037371046102023000171200ustar 00000000000000// 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::{ffi, Buffer, View}; use glib::translate::*; glib::wrapper! { #[doc(alias = "GtkSourceHoverContext")] pub struct HoverContext(Object); match fn { type_ => || ffi::gtk_source_hover_context_get_type(), } } impl HoverContext { #[doc(alias = "gtk_source_hover_context_get_bounds")] #[doc(alias = "get_bounds")] pub fn bounds(&self) -> Option<(gtk::TextIter, gtk::TextIter)> { unsafe { let mut begin = gtk::TextIter::uninitialized(); let mut end = gtk::TextIter::uninitialized(); let ret = from_glib(ffi::gtk_source_hover_context_get_bounds( self.to_glib_none().0, begin.to_glib_none_mut().0, end.to_glib_none_mut().0, )); if ret { Some((begin, end)) } else { None } } } #[doc(alias = "gtk_source_hover_context_get_buffer")] #[doc(alias = "get_buffer")] pub fn buffer(&self) -> Buffer { unsafe { from_glib_none(ffi::gtk_source_hover_context_get_buffer( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_hover_context_get_iter")] #[doc(alias = "get_iter")] pub fn is_iter(&self, iter: &mut gtk::TextIter) -> bool { unsafe { from_glib(ffi::gtk_source_hover_context_get_iter( self.to_glib_none().0, iter.to_glib_none_mut().0, )) } } #[doc(alias = "gtk_source_hover_context_get_view")] #[doc(alias = "get_view")] pub fn view(&self) -> View { unsafe { from_glib_none(ffi::gtk_source_hover_context_get_view( self.to_glib_none().0, )) } } } sourceview5-0.9.0/src/auto/hover_display.rs000064400000000000000000000175461046102023000171040ustar 00000000000000// 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::ffi; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "GtkSourceHoverDisplay")] pub struct HoverDisplay(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::gtk_source_hover_display_get_type(), } } impl HoverDisplay { // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`HoverDisplay`] objects. /// /// This method returns an instance of [`HoverDisplayBuilder`](crate::builders::HoverDisplayBuilder) which can be used to create [`HoverDisplay`] objects. pub fn builder() -> HoverDisplayBuilder { HoverDisplayBuilder::new() } #[doc(alias = "gtk_source_hover_display_append")] pub fn append(&self, child: &impl IsA) { unsafe { ffi::gtk_source_hover_display_append( self.to_glib_none().0, child.as_ref().to_glib_none().0, ); } } #[doc(alias = "gtk_source_hover_display_insert_after")] pub fn insert_after(&self, child: &impl IsA, sibling: &impl IsA) { unsafe { ffi::gtk_source_hover_display_insert_after( self.to_glib_none().0, child.as_ref().to_glib_none().0, sibling.as_ref().to_glib_none().0, ); } } #[doc(alias = "gtk_source_hover_display_prepend")] pub fn prepend(&self, child: &impl IsA) { unsafe { ffi::gtk_source_hover_display_prepend( self.to_glib_none().0, child.as_ref().to_glib_none().0, ); } } #[doc(alias = "gtk_source_hover_display_remove")] pub fn remove(&self, child: &impl IsA) { unsafe { ffi::gtk_source_hover_display_remove( self.to_glib_none().0, child.as_ref().to_glib_none().0, ); } } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`HoverDisplay`] 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 HoverDisplayBuilder { builder: glib::object::ObjectBuilder<'static, HoverDisplay>, } impl HoverDisplayBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn can_focus(self, can_focus: bool) -> Self { Self { builder: self.builder.property("can-focus", can_focus), } } pub fn can_target(self, can_target: bool) -> Self { Self { builder: self.builder.property("can-target", can_target), } } pub fn css_classes(self, css_classes: impl Into) -> Self { Self { builder: self.builder.property("css-classes", css_classes.into()), } } pub fn css_name(self, css_name: impl Into) -> Self { Self { builder: self.builder.property("css-name", css_name.into()), } } pub fn cursor(self, cursor: &gdk::Cursor) -> Self { Self { builder: self.builder.property("cursor", cursor.clone()), } } pub fn focus_on_click(self, focus_on_click: bool) -> Self { Self { builder: self.builder.property("focus-on-click", focus_on_click), } } pub fn focusable(self, focusable: bool) -> Self { Self { builder: self.builder.property("focusable", focusable), } } pub fn halign(self, halign: gtk::Align) -> Self { Self { builder: self.builder.property("halign", halign), } } pub fn has_tooltip(self, has_tooltip: bool) -> Self { Self { builder: self.builder.property("has-tooltip", has_tooltip), } } pub fn height_request(self, height_request: i32) -> Self { Self { builder: self.builder.property("height-request", height_request), } } pub fn hexpand(self, hexpand: bool) -> Self { Self { builder: self.builder.property("hexpand", hexpand), } } pub fn hexpand_set(self, hexpand_set: bool) -> Self { Self { builder: self.builder.property("hexpand-set", hexpand_set), } } pub fn layout_manager(self, layout_manager: &impl IsA) -> Self { Self { builder: self .builder .property("layout-manager", layout_manager.clone().upcast()), } } pub fn margin_bottom(self, margin_bottom: i32) -> Self { Self { builder: self.builder.property("margin-bottom", margin_bottom), } } pub fn margin_end(self, margin_end: i32) -> Self { Self { builder: self.builder.property("margin-end", margin_end), } } pub fn margin_start(self, margin_start: i32) -> Self { Self { builder: self.builder.property("margin-start", margin_start), } } pub fn margin_top(self, margin_top: i32) -> Self { Self { builder: self.builder.property("margin-top", margin_top), } } pub fn name(self, name: impl Into) -> Self { Self { builder: self.builder.property("name", name.into()), } } pub fn opacity(self, opacity: f64) -> Self { Self { builder: self.builder.property("opacity", opacity), } } pub fn overflow(self, overflow: gtk::Overflow) -> Self { Self { builder: self.builder.property("overflow", overflow), } } pub fn receives_default(self, receives_default: bool) -> Self { Self { builder: self.builder.property("receives-default", receives_default), } } pub fn sensitive(self, sensitive: bool) -> Self { Self { builder: self.builder.property("sensitive", sensitive), } } pub fn tooltip_markup(self, tooltip_markup: impl Into) -> Self { Self { builder: self .builder .property("tooltip-markup", tooltip_markup.into()), } } pub fn tooltip_text(self, tooltip_text: impl Into) -> Self { Self { builder: self.builder.property("tooltip-text", tooltip_text.into()), } } pub fn valign(self, valign: gtk::Align) -> Self { Self { builder: self.builder.property("valign", valign), } } pub fn vexpand(self, vexpand: bool) -> Self { Self { builder: self.builder.property("vexpand", vexpand), } } pub fn vexpand_set(self, vexpand_set: bool) -> Self { Self { builder: self.builder.property("vexpand-set", vexpand_set), } } pub fn visible(self, visible: bool) -> Self { Self { builder: self.builder.property("visible", visible), } } pub fn width_request(self, width_request: i32) -> Self { Self { builder: self.builder.property("width-request", width_request), } } pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self { Self { builder: self.builder.property("accessible-role", accessible_role), } } // rustdoc-stripper-ignore-next /// Build the [`HoverDisplay`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> HoverDisplay { self.builder.build() } } sourceview5-0.9.0/src/auto/hover_provider.rs000064400000000000000000000067521046102023000172660ustar 00000000000000// 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::{ffi, HoverContext, HoverDisplay}; use glib::{prelude::*, translate::*}; use std::{boxed::Box as Box_, pin::Pin}; glib::wrapper! { #[doc(alias = "GtkSourceHoverProvider")] pub struct HoverProvider(Interface); match fn { type_ => || ffi::gtk_source_hover_provider_get_type(), } } impl HoverProvider { pub const NONE: Option<&'static HoverProvider> = None; } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait HoverProviderExt: IsA + sealed::Sealed + 'static { #[doc(alias = "gtk_source_hover_provider_populate_async")] fn populate_async) + 'static>( &self, context: &HoverContext, display: &HoverDisplay, cancellable: Option<&impl IsA>, callback: P, ) { let main_context = glib::MainContext::ref_thread_default(); let is_main_context_owner = main_context.is_owner(); let has_acquired_main_context = (!is_main_context_owner) .then(|| main_context.acquire().ok()) .flatten(); assert!( is_main_context_owner || has_acquired_main_context.is_some(), "Async operations only allowed if the thread is owning the MainContext" ); let user_data: Box_> = Box_::new(glib::thread_guard::ThreadGuard::new(callback)); unsafe extern "C" fn populate_async_trampoline< P: FnOnce(Result<(), glib::Error>) + 'static, >( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer, ) { let mut error = std::ptr::null_mut(); let _ = ffi::gtk_source_hover_provider_populate_finish( _source_object as *mut _, res, &mut error, ); let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }; let callback: Box_> = Box_::from_raw(user_data as *mut _); let callback: P = callback.into_inner(); callback(result); } let callback = populate_async_trampoline::

; unsafe { ffi::gtk_source_hover_provider_populate_async( self.as_ref().to_glib_none().0, context.to_glib_none().0, display.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _, ); } } fn populate_future( &self, context: &HoverContext, display: &HoverDisplay, ) -> Pin> + 'static>> { let context = context.clone(); let display = display.clone(); Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { obj.populate_async(&context, &display, Some(cancellable), move |res| { send.resolve(res); }); })) } } impl> HoverProviderExt for O {} sourceview5-0.9.0/src/auto/indenter.rs000064400000000000000000000026731046102023000160370ustar 00000000000000// 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::{ffi, View}; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "GtkSourceIndenter")] pub struct Indenter(Interface); match fn { type_ => || ffi::gtk_source_indenter_get_type(), } } impl Indenter { pub const NONE: Option<&'static Indenter> = None; } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait IndenterExt: IsA + sealed::Sealed + 'static { //#[doc(alias = "gtk_source_indenter_indent")] //fn indent(&self, view: &impl IsA, iter: /*Unimplemented*/gtk::TextIter) { // unsafe { TODO: call ffi:gtk_source_indenter_indent() } //} #[doc(alias = "gtk_source_indenter_is_trigger")] fn is_trigger( &self, view: &impl IsA, location: >k::TextIter, state: gdk::ModifierType, keyval: u32, ) -> bool { unsafe { from_glib(ffi::gtk_source_indenter_is_trigger( self.as_ref().to_glib_none().0, view.as_ref().to_glib_none().0, location.to_glib_none().0, state.into_glib(), keyval, )) } } } impl> IndenterExt for O {} sourceview5-0.9.0/src/auto/language.rs000064400000000000000000000155721046102023000160140ustar 00000000000000// 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::ffi; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourceLanguage")] pub struct Language(Object); match fn { type_ => || ffi::gtk_source_language_get_type(), } } impl Language { #[doc(alias = "gtk_source_language_get_globs")] #[doc(alias = "get_globs")] pub fn globs(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(ffi::gtk_source_language_get_globs( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_language_get_hidden")] #[doc(alias = "get_hidden")] #[doc(alias = "hidden")] pub fn is_hidden(&self) -> bool { unsafe { from_glib(ffi::gtk_source_language_get_hidden(self.to_glib_none().0)) } } #[doc(alias = "gtk_source_language_get_id")] #[doc(alias = "get_id")] pub fn id(&self) -> glib::GString { unsafe { from_glib_none(ffi::gtk_source_language_get_id(self.to_glib_none().0)) } } #[doc(alias = "gtk_source_language_get_metadata")] #[doc(alias = "get_metadata")] pub fn metadata(&self, name: &str) -> Option { unsafe { from_glib_none(ffi::gtk_source_language_get_metadata( self.to_glib_none().0, name.to_glib_none().0, )) } } #[doc(alias = "gtk_source_language_get_mime_types")] #[doc(alias = "get_mime_types")] pub fn mime_types(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(ffi::gtk_source_language_get_mime_types( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_language_get_name")] #[doc(alias = "get_name")] pub fn name(&self) -> glib::GString { unsafe { from_glib_none(ffi::gtk_source_language_get_name(self.to_glib_none().0)) } } #[doc(alias = "gtk_source_language_get_section")] #[doc(alias = "get_section")] pub fn section(&self) -> glib::GString { unsafe { from_glib_none(ffi::gtk_source_language_get_section(self.to_glib_none().0)) } } #[doc(alias = "gtk_source_language_get_style_fallback")] #[doc(alias = "get_style_fallback")] pub fn style_fallback(&self, style_id: &str) -> Option { unsafe { from_glib_none(ffi::gtk_source_language_get_style_fallback( self.to_glib_none().0, style_id.to_glib_none().0, )) } } #[doc(alias = "gtk_source_language_get_style_ids")] #[doc(alias = "get_style_ids")] pub fn style_ids(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(ffi::gtk_source_language_get_style_ids( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_language_get_style_name")] #[doc(alias = "get_style_name")] pub fn style_name(&self, style_id: &str) -> Option { unsafe { from_glib_none(ffi::gtk_source_language_get_style_name( self.to_glib_none().0, style_id.to_glib_none().0, )) } } #[doc(alias = "hidden")] pub fn connect_hidden_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_hidden_trampoline( this: *mut ffi::GtkSourceLanguage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::hidden\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_hidden_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "id")] pub fn connect_id_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_id_trampoline( this: *mut ffi::GtkSourceLanguage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::id\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_id_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "name")] pub fn connect_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_name_trampoline( this: *mut ffi::GtkSourceLanguage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::name\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "section")] pub fn connect_section_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_section_trampoline( this: *mut ffi::GtkSourceLanguage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::section\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_section_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl std::fmt::Display for Language { #[inline] fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(&self.name()) } } sourceview5-0.9.0/src/auto/language_manager.rs000064400000000000000000000156751046102023000175120ustar 00000000000000// 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::{ffi, Language}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourceLanguageManager")] pub struct LanguageManager(Object); match fn { type_ => || ffi::gtk_source_language_manager_get_type(), } } impl LanguageManager { #[doc(alias = "gtk_source_language_manager_new")] pub fn new() -> LanguageManager { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gtk_source_language_manager_new()) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`LanguageManager`] objects. /// /// This method returns an instance of [`LanguageManagerBuilder`](crate::builders::LanguageManagerBuilder) which can be used to create [`LanguageManager`] objects. pub fn builder() -> LanguageManagerBuilder { LanguageManagerBuilder::new() } #[cfg(feature = "v5_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_4")))] #[doc(alias = "gtk_source_language_manager_append_search_path")] pub fn append_search_path(&self, path: &str) { unsafe { ffi::gtk_source_language_manager_append_search_path( self.to_glib_none().0, path.to_glib_none().0, ); } } #[doc(alias = "gtk_source_language_manager_get_language")] #[doc(alias = "get_language")] pub fn language(&self, id: &str) -> Option { unsafe { from_glib_none(ffi::gtk_source_language_manager_get_language( self.to_glib_none().0, id.to_glib_none().0, )) } } #[doc(alias = "gtk_source_language_manager_get_language_ids")] #[doc(alias = "get_language_ids")] #[doc(alias = "language-ids")] pub fn language_ids(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::gtk_source_language_manager_get_language_ids( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_language_manager_get_search_path")] #[doc(alias = "get_search_path")] #[doc(alias = "search-path")] pub fn search_path(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::gtk_source_language_manager_get_search_path( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_language_manager_guess_language")] pub fn guess_language( &self, filename: Option>, content_type: Option<&str>, ) -> Option { unsafe { from_glib_none(ffi::gtk_source_language_manager_guess_language( self.to_glib_none().0, filename.as_ref().map(|p| p.as_ref()).to_glib_none().0, content_type.to_glib_none().0, )) } } #[cfg(feature = "v5_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_4")))] #[doc(alias = "gtk_source_language_manager_prepend_search_path")] pub fn prepend_search_path(&self, path: &str) { unsafe { ffi::gtk_source_language_manager_prepend_search_path( self.to_glib_none().0, path.to_glib_none().0, ); } } #[doc(alias = "gtk_source_language_manager_set_search_path")] #[doc(alias = "search-path")] pub fn set_search_path(&self, dirs: &[&str]) { unsafe { ffi::gtk_source_language_manager_set_search_path( self.to_glib_none().0, dirs.to_glib_none().0, ); } } #[doc(alias = "gtk_source_language_manager_get_default")] #[doc(alias = "get_default")] #[allow(clippy::should_implement_trait)] pub fn default() -> LanguageManager { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::gtk_source_language_manager_get_default()) } } #[doc(alias = "language-ids")] pub fn connect_language_ids_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_language_ids_trampoline( this: *mut ffi::GtkSourceLanguageManager, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::language-ids\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_language_ids_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "search-path")] pub fn connect_search_path_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_search_path_trampoline( this: *mut ffi::GtkSourceLanguageManager, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::search-path\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_search_path_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for LanguageManager { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`LanguageManager`] 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 LanguageManagerBuilder { builder: glib::object::ObjectBuilder<'static, LanguageManager>, } impl LanguageManagerBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn search_path(self, search_path: impl Into) -> Self { Self { builder: self.builder.property("search-path", search_path.into()), } } // rustdoc-stripper-ignore-next /// Build the [`LanguageManager`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> LanguageManager { self.builder.build() } } sourceview5-0.9.0/src/auto/map.rs000064400000000000000000000425441046102023000150050ustar 00000000000000// 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::{ffi, BackgroundPatternType, Indenter, SmartHomeEndType, View}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourceMap")] pub struct Map(Object) @extends View, gtk::TextView, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Scrollable; match fn { type_ => || ffi::gtk_source_map_get_type(), } } impl Map { pub const NONE: Option<&'static Map> = None; #[doc(alias = "gtk_source_map_new")] pub fn new() -> Map { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::gtk_source_map_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Map`] objects. /// /// This method returns an instance of [`MapBuilder`](crate::builders::MapBuilder) which can be used to create [`Map`] objects. pub fn builder() -> MapBuilder { MapBuilder::new() } } impl Default for Map { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Map`] 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 MapBuilder { builder: glib::object::ObjectBuilder<'static, Map>, } impl MapBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn font_desc(self, font_desc: &pango::FontDescription) -> Self { Self { builder: self.builder.property("font-desc", font_desc), } } pub fn view(self, view: &impl IsA) -> Self { Self { builder: self.builder.property("view", view.clone().upcast()), } } pub fn auto_indent(self, auto_indent: bool) -> Self { Self { builder: self.builder.property("auto-indent", auto_indent), } } pub fn background_pattern(self, background_pattern: BackgroundPatternType) -> Self { Self { builder: self .builder .property("background-pattern", background_pattern), } } pub fn enable_snippets(self, enable_snippets: bool) -> Self { Self { builder: self.builder.property("enable-snippets", enable_snippets), } } pub fn highlight_current_line(self, highlight_current_line: bool) -> Self { Self { builder: self .builder .property("highlight-current-line", highlight_current_line), } } pub fn indent_on_tab(self, indent_on_tab: bool) -> Self { Self { builder: self.builder.property("indent-on-tab", indent_on_tab), } } pub fn indent_width(self, indent_width: i32) -> Self { Self { builder: self.builder.property("indent-width", indent_width), } } pub fn indenter(self, indenter: &impl IsA) -> Self { Self { builder: self.builder.property("indenter", indenter.clone().upcast()), } } pub fn insert_spaces_instead_of_tabs(self, insert_spaces_instead_of_tabs: bool) -> Self { Self { builder: self.builder.property( "insert-spaces-instead-of-tabs", insert_spaces_instead_of_tabs, ), } } pub fn right_margin_position(self, right_margin_position: u32) -> Self { Self { builder: self .builder .property("right-margin-position", right_margin_position), } } pub fn show_line_marks(self, show_line_marks: bool) -> Self { Self { builder: self.builder.property("show-line-marks", show_line_marks), } } pub fn show_line_numbers(self, show_line_numbers: bool) -> Self { Self { builder: self .builder .property("show-line-numbers", show_line_numbers), } } pub fn show_right_margin(self, show_right_margin: bool) -> Self { Self { builder: self .builder .property("show-right-margin", show_right_margin), } } pub fn smart_backspace(self, smart_backspace: bool) -> Self { Self { builder: self.builder.property("smart-backspace", smart_backspace), } } pub fn smart_home_end(self, smart_home_end: SmartHomeEndType) -> Self { Self { builder: self.builder.property("smart-home-end", smart_home_end), } } pub fn tab_width(self, tab_width: u32) -> Self { Self { builder: self.builder.property("tab-width", tab_width), } } pub fn accepts_tab(self, accepts_tab: bool) -> Self { Self { builder: self.builder.property("accepts-tab", accepts_tab), } } pub fn bottom_margin(self, bottom_margin: i32) -> Self { Self { builder: self.builder.property("bottom-margin", bottom_margin), } } pub fn buffer(self, buffer: &impl IsA) -> Self { Self { builder: self.builder.property("buffer", buffer.clone().upcast()), } } pub fn cursor_visible(self, cursor_visible: bool) -> Self { Self { builder: self.builder.property("cursor-visible", cursor_visible), } } pub fn editable(self, editable: bool) -> Self { Self { builder: self.builder.property("editable", editable), } } pub fn extra_menu(self, extra_menu: &impl IsA) -> Self { Self { builder: self .builder .property("extra-menu", extra_menu.clone().upcast()), } } pub fn im_module(self, im_module: impl Into) -> Self { Self { builder: self.builder.property("im-module", im_module.into()), } } pub fn indent(self, indent: i32) -> Self { Self { builder: self.builder.property("indent", indent), } } pub fn input_hints(self, input_hints: gtk::InputHints) -> Self { Self { builder: self.builder.property("input-hints", input_hints), } } pub fn input_purpose(self, input_purpose: gtk::InputPurpose) -> Self { Self { builder: self.builder.property("input-purpose", input_purpose), } } pub fn justification(self, justification: gtk::Justification) -> Self { Self { builder: self.builder.property("justification", justification), } } pub fn left_margin(self, left_margin: i32) -> Self { Self { builder: self.builder.property("left-margin", left_margin), } } pub fn monospace(self, monospace: bool) -> Self { Self { builder: self.builder.property("monospace", monospace), } } pub fn overwrite(self, overwrite: bool) -> Self { Self { builder: self.builder.property("overwrite", overwrite), } } pub fn pixels_above_lines(self, pixels_above_lines: i32) -> Self { Self { builder: self .builder .property("pixels-above-lines", pixels_above_lines), } } pub fn pixels_below_lines(self, pixels_below_lines: i32) -> Self { Self { builder: self .builder .property("pixels-below-lines", pixels_below_lines), } } pub fn pixels_inside_wrap(self, pixels_inside_wrap: i32) -> Self { Self { builder: self .builder .property("pixels-inside-wrap", pixels_inside_wrap), } } pub fn right_margin(self, right_margin: i32) -> Self { Self { builder: self.builder.property("right-margin", right_margin), } } pub fn tabs(self, tabs: &pango::TabArray) -> Self { Self { builder: self.builder.property("tabs", tabs), } } pub fn top_margin(self, top_margin: i32) -> Self { Self { builder: self.builder.property("top-margin", top_margin), } } pub fn wrap_mode(self, wrap_mode: gtk::WrapMode) -> Self { Self { builder: self.builder.property("wrap-mode", wrap_mode), } } pub fn can_focus(self, can_focus: bool) -> Self { Self { builder: self.builder.property("can-focus", can_focus), } } pub fn can_target(self, can_target: bool) -> Self { Self { builder: self.builder.property("can-target", can_target), } } pub fn css_classes(self, css_classes: impl Into) -> Self { Self { builder: self.builder.property("css-classes", css_classes.into()), } } pub fn css_name(self, css_name: impl Into) -> Self { Self { builder: self.builder.property("css-name", css_name.into()), } } pub fn cursor(self, cursor: &gdk::Cursor) -> Self { Self { builder: self.builder.property("cursor", cursor.clone()), } } pub fn focus_on_click(self, focus_on_click: bool) -> Self { Self { builder: self.builder.property("focus-on-click", focus_on_click), } } pub fn focusable(self, focusable: bool) -> Self { Self { builder: self.builder.property("focusable", focusable), } } pub fn halign(self, halign: gtk::Align) -> Self { Self { builder: self.builder.property("halign", halign), } } pub fn has_tooltip(self, has_tooltip: bool) -> Self { Self { builder: self.builder.property("has-tooltip", has_tooltip), } } pub fn height_request(self, height_request: i32) -> Self { Self { builder: self.builder.property("height-request", height_request), } } pub fn hexpand(self, hexpand: bool) -> Self { Self { builder: self.builder.property("hexpand", hexpand), } } pub fn hexpand_set(self, hexpand_set: bool) -> Self { Self { builder: self.builder.property("hexpand-set", hexpand_set), } } pub fn layout_manager(self, layout_manager: &impl IsA) -> Self { Self { builder: self .builder .property("layout-manager", layout_manager.clone().upcast()), } } pub fn margin_bottom(self, margin_bottom: i32) -> Self { Self { builder: self.builder.property("margin-bottom", margin_bottom), } } pub fn margin_end(self, margin_end: i32) -> Self { Self { builder: self.builder.property("margin-end", margin_end), } } pub fn margin_start(self, margin_start: i32) -> Self { Self { builder: self.builder.property("margin-start", margin_start), } } pub fn margin_top(self, margin_top: i32) -> Self { Self { builder: self.builder.property("margin-top", margin_top), } } pub fn name(self, name: impl Into) -> Self { Self { builder: self.builder.property("name", name.into()), } } pub fn opacity(self, opacity: f64) -> Self { Self { builder: self.builder.property("opacity", opacity), } } pub fn overflow(self, overflow: gtk::Overflow) -> Self { Self { builder: self.builder.property("overflow", overflow), } } pub fn receives_default(self, receives_default: bool) -> Self { Self { builder: self.builder.property("receives-default", receives_default), } } pub fn sensitive(self, sensitive: bool) -> Self { Self { builder: self.builder.property("sensitive", sensitive), } } pub fn tooltip_markup(self, tooltip_markup: impl Into) -> Self { Self { builder: self .builder .property("tooltip-markup", tooltip_markup.into()), } } pub fn tooltip_text(self, tooltip_text: impl Into) -> Self { Self { builder: self.builder.property("tooltip-text", tooltip_text.into()), } } pub fn valign(self, valign: gtk::Align) -> Self { Self { builder: self.builder.property("valign", valign), } } pub fn vexpand(self, vexpand: bool) -> Self { Self { builder: self.builder.property("vexpand", vexpand), } } pub fn vexpand_set(self, vexpand_set: bool) -> Self { Self { builder: self.builder.property("vexpand-set", vexpand_set), } } pub fn visible(self, visible: bool) -> Self { Self { builder: self.builder.property("visible", visible), } } pub fn width_request(self, width_request: i32) -> Self { Self { builder: self.builder.property("width-request", width_request), } } pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self { Self { builder: self.builder.property("accessible-role", accessible_role), } } pub fn hadjustment(self, hadjustment: &impl IsA) -> Self { Self { builder: self .builder .property("hadjustment", hadjustment.clone().upcast()), } } pub fn hscroll_policy(self, hscroll_policy: gtk::ScrollablePolicy) -> Self { Self { builder: self.builder.property("hscroll-policy", hscroll_policy), } } pub fn vadjustment(self, vadjustment: &impl IsA) -> Self { Self { builder: self .builder .property("vadjustment", vadjustment.clone().upcast()), } } pub fn vscroll_policy(self, vscroll_policy: gtk::ScrollablePolicy) -> Self { Self { builder: self.builder.property("vscroll-policy", vscroll_policy), } } // rustdoc-stripper-ignore-next /// Build the [`Map`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Map { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait MapExt: IsA + sealed::Sealed + 'static { #[doc(alias = "gtk_source_map_get_view")] #[doc(alias = "get_view")] fn view(&self) -> Option { unsafe { from_glib_none(ffi::gtk_source_map_get_view(self.as_ref().to_glib_none().0)) } } #[doc(alias = "gtk_source_map_set_view")] #[doc(alias = "view")] fn set_view(&self, view: &impl IsA) { unsafe { ffi::gtk_source_map_set_view( self.as_ref().to_glib_none().0, view.as_ref().to_glib_none().0, ); } } #[doc(alias = "font-desc")] fn font_desc(&self) -> Option { ObjectExt::property(self.as_ref(), "font-desc") } #[doc(alias = "font-desc")] fn set_font_desc(&self, font_desc: Option<&pango::FontDescription>) { ObjectExt::set_property(self.as_ref(), "font-desc", font_desc) } #[doc(alias = "font-desc")] fn connect_font_desc_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_font_desc_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkSourceMap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Map::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::font-desc\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_font_desc_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "view")] fn connect_view_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_view_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkSourceMap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Map::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::view\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_view_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> MapExt for O {} sourceview5-0.9.0/src/auto/mark.rs000064400000000000000000000067711046102023000151640ustar 00000000000000// 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::ffi; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "GtkSourceMark")] pub struct Mark(Object) @extends gtk::TextMark; match fn { type_ => || ffi::gtk_source_mark_get_type(), } } impl Mark { pub const NONE: Option<&'static Mark> = None; #[doc(alias = "gtk_source_mark_new")] pub fn new(name: Option<&str>, category: &str) -> Mark { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gtk_source_mark_new( name.to_glib_none().0, category.to_glib_none().0, )) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Mark`] objects. /// /// This method returns an instance of [`MarkBuilder`](crate::builders::MarkBuilder) which can be used to create [`Mark`] objects. pub fn builder() -> MarkBuilder { MarkBuilder::new() } } impl Default for Mark { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Mark`] 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 MarkBuilder { builder: glib::object::ObjectBuilder<'static, Mark>, } impl MarkBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn category(self, category: impl Into) -> Self { Self { builder: self.builder.property("category", category.into()), } } pub fn left_gravity(self, left_gravity: bool) -> Self { Self { builder: self.builder.property("left-gravity", left_gravity), } } pub fn name(self, name: impl Into) -> Self { Self { builder: self.builder.property("name", name.into()), } } // rustdoc-stripper-ignore-next /// Build the [`Mark`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Mark { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait MarkExt: IsA + sealed::Sealed + 'static { #[doc(alias = "gtk_source_mark_get_category")] #[doc(alias = "get_category")] fn category(&self) -> glib::GString { unsafe { from_glib_none(ffi::gtk_source_mark_get_category( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_mark_next")] #[must_use] fn next(&self, category: Option<&str>) -> Option { unsafe { from_glib_none(ffi::gtk_source_mark_next( self.as_ref().to_glib_none().0, category.to_glib_none().0, )) } } #[doc(alias = "gtk_source_mark_prev")] #[must_use] fn prev(&self, category: Option<&str>) -> Option { unsafe { from_glib_none(ffi::gtk_source_mark_prev( self.as_ref().to_glib_none().0, category.to_glib_none().0, )) } } } impl> MarkExt for O {} sourceview5-0.9.0/src/auto/mark_attributes.rs000064400000000000000000000277521046102023000174340ustar 00000000000000// 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::{ffi, Mark}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourceMarkAttributes")] pub struct MarkAttributes(Object); match fn { type_ => || ffi::gtk_source_mark_attributes_get_type(), } } impl MarkAttributes { #[doc(alias = "gtk_source_mark_attributes_new")] pub fn new() -> MarkAttributes { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gtk_source_mark_attributes_new()) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`MarkAttributes`] objects. /// /// This method returns an instance of [`MarkAttributesBuilder`](crate::builders::MarkAttributesBuilder) which can be used to create [`MarkAttributes`] objects. pub fn builder() -> MarkAttributesBuilder { MarkAttributesBuilder::new() } #[doc(alias = "gtk_source_mark_attributes_get_background")] #[doc(alias = "get_background")] pub fn background(&self) -> Option { unsafe { let mut background = gdk::RGBA::uninitialized(); let ret = from_glib(ffi::gtk_source_mark_attributes_get_background( self.to_glib_none().0, background.to_glib_none_mut().0, )); if ret { Some(background) } else { None } } } #[doc(alias = "gtk_source_mark_attributes_get_gicon")] #[doc(alias = "get_gicon")] pub fn gicon(&self) -> gio::Icon { unsafe { from_glib_none(ffi::gtk_source_mark_attributes_get_gicon( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_mark_attributes_get_icon_name")] #[doc(alias = "get_icon_name")] #[doc(alias = "icon-name")] pub fn icon_name(&self) -> glib::GString { unsafe { from_glib_none(ffi::gtk_source_mark_attributes_get_icon_name( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_mark_attributes_get_pixbuf")] #[doc(alias = "get_pixbuf")] pub fn pixbuf(&self) -> gdk_pixbuf::Pixbuf { unsafe { from_glib_none(ffi::gtk_source_mark_attributes_get_pixbuf( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_mark_attributes_get_tooltip_markup")] #[doc(alias = "get_tooltip_markup")] pub fn tooltip_markup(&self, mark: &impl IsA) -> glib::GString { unsafe { from_glib_full(ffi::gtk_source_mark_attributes_get_tooltip_markup( self.to_glib_none().0, mark.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_mark_attributes_get_tooltip_text")] #[doc(alias = "get_tooltip_text")] pub fn tooltip_text(&self, mark: &impl IsA) -> glib::GString { unsafe { from_glib_full(ffi::gtk_source_mark_attributes_get_tooltip_text( self.to_glib_none().0, mark.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_mark_attributes_render_icon")] pub fn render_icon(&self, widget: &impl IsA, size: i32) -> gdk::Paintable { unsafe { from_glib_none(ffi::gtk_source_mark_attributes_render_icon( self.to_glib_none().0, widget.as_ref().to_glib_none().0, size, )) } } #[doc(alias = "gtk_source_mark_attributes_set_background")] #[doc(alias = "background")] pub fn set_background(&self, background: &gdk::RGBA) { unsafe { ffi::gtk_source_mark_attributes_set_background( self.to_glib_none().0, background.to_glib_none().0, ); } } #[doc(alias = "gtk_source_mark_attributes_set_gicon")] #[doc(alias = "gicon")] pub fn set_gicon(&self, gicon: &impl IsA) { unsafe { ffi::gtk_source_mark_attributes_set_gicon( self.to_glib_none().0, gicon.as_ref().to_glib_none().0, ); } } #[doc(alias = "gtk_source_mark_attributes_set_icon_name")] #[doc(alias = "icon-name")] pub fn set_icon_name(&self, icon_name: &str) { unsafe { ffi::gtk_source_mark_attributes_set_icon_name( self.to_glib_none().0, icon_name.to_glib_none().0, ); } } #[doc(alias = "gtk_source_mark_attributes_set_pixbuf")] #[doc(alias = "pixbuf")] pub fn set_pixbuf(&self, pixbuf: &gdk_pixbuf::Pixbuf) { unsafe { ffi::gtk_source_mark_attributes_set_pixbuf( self.to_glib_none().0, pixbuf.to_glib_none().0, ); } } #[doc(alias = "query-tooltip-markup")] pub fn connect_query_tooltip_markup String + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn query_tooltip_markup_trampoline< F: Fn(&MarkAttributes, &Mark) -> String + 'static, >( this: *mut ffi::GtkSourceMarkAttributes, mark: *mut ffi::GtkSourceMark, f: glib::ffi::gpointer, ) -> *mut libc::c_char { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(mark)).to_glib_full() } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"query-tooltip-markup\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( query_tooltip_markup_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "query-tooltip-text")] pub fn connect_query_tooltip_text String + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn query_tooltip_text_trampoline< F: Fn(&MarkAttributes, &Mark) -> String + 'static, >( this: *mut ffi::GtkSourceMarkAttributes, mark: *mut ffi::GtkSourceMark, f: glib::ffi::gpointer, ) -> *mut libc::c_char { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(mark)).to_glib_full() } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"query-tooltip-text\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( query_tooltip_text_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "background")] pub fn connect_background_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_background_trampoline( this: *mut ffi::GtkSourceMarkAttributes, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::background\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_background_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "gicon")] pub fn connect_gicon_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_gicon_trampoline( this: *mut ffi::GtkSourceMarkAttributes, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::gicon\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_gicon_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "icon-name")] pub fn connect_icon_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_icon_name_trampoline( this: *mut ffi::GtkSourceMarkAttributes, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::icon-name\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_icon_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "pixbuf")] pub fn connect_pixbuf_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_pixbuf_trampoline( this: *mut ffi::GtkSourceMarkAttributes, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::pixbuf\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_pixbuf_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for MarkAttributes { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`MarkAttributes`] 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 MarkAttributesBuilder { builder: glib::object::ObjectBuilder<'static, MarkAttributes>, } impl MarkAttributesBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn background(self, background: &gdk::RGBA) -> Self { Self { builder: self.builder.property("background", background), } } pub fn gicon(self, gicon: &impl IsA) -> Self { Self { builder: self.builder.property("gicon", gicon.clone().upcast()), } } pub fn icon_name(self, icon_name: impl Into) -> Self { Self { builder: self.builder.property("icon-name", icon_name.into()), } } pub fn pixbuf(self, pixbuf: &gdk_pixbuf::Pixbuf) -> Self { Self { builder: self.builder.property("pixbuf", pixbuf.clone()), } } // rustdoc-stripper-ignore-next /// Build the [`MarkAttributes`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> MarkAttributes { self.builder.build() } } sourceview5-0.9.0/src/auto/mod.rs000064400000000000000000000156521046102023000150070ustar 00000000000000// 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 mod buffer; pub use self::buffer::Buffer; mod completion; pub use self::completion::Completion; mod completion_cell; pub use self::completion_cell::CompletionCell; mod completion_context; pub use self::completion_context::CompletionContext; mod completion_proposal; pub use self::completion_proposal::CompletionProposal; mod completion_provider; pub use self::completion_provider::CompletionProvider; mod completion_snippets; pub use self::completion_snippets::CompletionSnippets; mod completion_words; pub use self::completion_words::CompletionWords; mod file; pub use self::file::File; mod file_loader; pub use self::file_loader::FileLoader; mod file_saver; pub use self::file_saver::FileSaver; mod gutter; pub use self::gutter::Gutter; mod gutter_lines; pub use self::gutter_lines::GutterLines; mod gutter_renderer; pub use self::gutter_renderer::GutterRenderer; mod gutter_renderer_pixbuf; pub use self::gutter_renderer_pixbuf::GutterRendererPixbuf; mod gutter_renderer_text; pub use self::gutter_renderer_text::GutterRendererText; mod hover; pub use self::hover::Hover; mod hover_context; pub use self::hover_context::HoverContext; mod hover_display; pub use self::hover_display::HoverDisplay; mod hover_provider; pub use self::hover_provider::HoverProvider; mod indenter; pub use self::indenter::Indenter; mod language; pub use self::language::Language; mod language_manager; pub use self::language_manager::LanguageManager; mod map; pub use self::map::Map; mod mark; pub use self::mark::Mark; mod mark_attributes; pub use self::mark_attributes::MarkAttributes; mod print_compositor; pub use self::print_compositor::PrintCompositor; mod region; pub use self::region::Region; mod search_context; pub use self::search_context::SearchContext; mod search_settings; pub use self::search_settings::SearchSettings; mod snippet; pub use self::snippet::Snippet; mod snippet_chunk; pub use self::snippet_chunk::SnippetChunk; mod snippet_context; pub use self::snippet_context::SnippetContext; mod snippet_manager; pub use self::snippet_manager::SnippetManager; mod space_drawer; pub use self::space_drawer::SpaceDrawer; mod style; pub use self::style::Style; mod style_scheme; pub use self::style_scheme::StyleScheme; mod style_scheme_chooser; pub use self::style_scheme_chooser::StyleSchemeChooser; mod style_scheme_chooser_button; pub use self::style_scheme_chooser_button::StyleSchemeChooserButton; mod style_scheme_chooser_widget; pub use self::style_scheme_chooser_widget::StyleSchemeChooserWidget; mod style_scheme_manager; pub use self::style_scheme_manager::StyleSchemeManager; #[cfg(feature = "v5_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_4")))] mod style_scheme_preview; #[cfg(feature = "v5_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_4")))] pub use self::style_scheme_preview::StyleSchemePreview; mod tag; pub use self::tag::Tag; mod view; pub use self::view::View; #[cfg(feature = "v5_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_4")))] mod vim_im_context; #[cfg(feature = "v5_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_4")))] pub use self::vim_im_context::VimIMContext; mod encoding; pub use self::encoding::Encoding; mod enums; pub use self::enums::BackgroundPatternType; pub use self::enums::BracketMatchType; pub use self::enums::ChangeCaseType; pub use self::enums::CompletionActivation; pub use self::enums::CompletionColumn; pub use self::enums::CompressionType; pub use self::enums::FileLoaderError; pub use self::enums::FileSaverError; pub use self::enums::GutterRendererAlignmentMode; pub use self::enums::NewlineType; pub use self::enums::SmartHomeEndType; pub use self::enums::ViewGutterPosition; mod flags; pub use self::flags::FileSaverFlags; pub use self::flags::SortFlags; pub use self::flags::SpaceLocationFlags; pub use self::flags::SpaceTypeFlags; pub(crate) mod functions; pub(crate) mod traits { pub use super::buffer::BufferExt; pub use super::completion_proposal::CompletionProposalExt; pub use super::completion_provider::CompletionProviderExt; pub use super::completion_snippets::CompletionSnippetsExt; pub use super::completion_words::CompletionWordsExt; pub use super::file::SourceFileExt; pub use super::gutter_renderer::GutterRendererExt; pub use super::gutter_renderer_pixbuf::GutterRendererPixbufExt; pub use super::gutter_renderer_text::GutterRendererTextExt; pub use super::hover_provider::HoverProviderExt; pub use super::indenter::IndenterExt; pub use super::map::MapExt; pub use super::mark::MarkExt; pub use super::print_compositor::PrintCompositorExt; pub use super::region::RegionExt; pub use super::search_settings::SearchSettingsExt; pub use super::style_scheme_chooser::StyleSchemeChooserExt; pub use super::tag::TagExt; pub use super::view::ViewExt; } pub(crate) mod builders { pub use super::buffer::BufferBuilder; pub use super::completion::CompletionBuilder; pub use super::completion_cell::CompletionCellBuilder; pub use super::completion_context::CompletionContextBuilder; pub use super::completion_snippets::CompletionSnippetsBuilder; pub use super::completion_words::CompletionWordsBuilder; pub use super::file::FileBuilder; pub use super::file_loader::FileLoaderBuilder; pub use super::file_saver::FileSaverBuilder; pub use super::gutter::GutterBuilder; pub use super::gutter_renderer_pixbuf::GutterRendererPixbufBuilder; pub use super::gutter_renderer_text::GutterRendererTextBuilder; pub use super::hover::HoverBuilder; pub use super::hover_display::HoverDisplayBuilder; pub use super::language_manager::LanguageManagerBuilder; pub use super::map::MapBuilder; pub use super::mark::MarkBuilder; pub use super::mark_attributes::MarkAttributesBuilder; pub use super::print_compositor::PrintCompositorBuilder; pub use super::region::RegionBuilder; pub use super::search_context::SearchContextBuilder; pub use super::search_settings::SearchSettingsBuilder; pub use super::snippet::SnippetBuilder; pub use super::snippet_chunk::SnippetChunkBuilder; pub use super::snippet_manager::SnippetManagerBuilder; pub use super::space_drawer::SpaceDrawerBuilder; pub use super::style::StyleBuilder; pub use super::style_scheme::StyleSchemeBuilder; pub use super::style_scheme_chooser_button::StyleSchemeChooserButtonBuilder; pub use super::style_scheme_chooser_widget::StyleSchemeChooserWidgetBuilder; pub use super::style_scheme_manager::StyleSchemeManagerBuilder; #[cfg(feature = "v5_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_4")))] pub use super::style_scheme_preview::StyleSchemePreviewBuilder; pub use super::tag::TagBuilder; pub use super::view::ViewBuilder; #[cfg(feature = "v5_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_4")))] pub use super::vim_im_context::VimIMContextBuilder; } sourceview5-0.9.0/src/auto/print_compositor.rs000064400000000000000000000703031046102023000176340ustar 00000000000000// 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::{ffi, Buffer, View}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourcePrintCompositor")] pub struct PrintCompositor(Object); match fn { type_ => || ffi::gtk_source_print_compositor_get_type(), } } impl PrintCompositor { pub const NONE: Option<&'static PrintCompositor> = None; #[doc(alias = "gtk_source_print_compositor_new")] pub fn new(buffer: &impl IsA) -> PrintCompositor { skip_assert_initialized!(); unsafe { from_glib_full(ffi::gtk_source_print_compositor_new( buffer.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_print_compositor_new_from_view")] #[doc(alias = "new_from_view")] pub fn from_view(view: &impl IsA) -> PrintCompositor { skip_assert_initialized!(); unsafe { from_glib_full(ffi::gtk_source_print_compositor_new_from_view( view.as_ref().to_glib_none().0, )) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`PrintCompositor`] objects. /// /// This method returns an instance of [`PrintCompositorBuilder`](crate::builders::PrintCompositorBuilder) which can be used to create [`PrintCompositor`] objects. pub fn builder() -> PrintCompositorBuilder { PrintCompositorBuilder::new() } } impl Default for PrintCompositor { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`PrintCompositor`] 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 PrintCompositorBuilder { builder: glib::object::ObjectBuilder<'static, PrintCompositor>, } impl PrintCompositorBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn body_font_name(self, body_font_name: impl Into) -> Self { Self { builder: self .builder .property("body-font-name", body_font_name.into()), } } pub fn buffer(self, buffer: &impl IsA) -> Self { Self { builder: self.builder.property("buffer", buffer.clone().upcast()), } } pub fn footer_font_name(self, footer_font_name: impl Into) -> Self { Self { builder: self .builder .property("footer-font-name", footer_font_name.into()), } } pub fn header_font_name(self, header_font_name: impl Into) -> Self { Self { builder: self .builder .property("header-font-name", header_font_name.into()), } } pub fn highlight_syntax(self, highlight_syntax: bool) -> Self { Self { builder: self.builder.property("highlight-syntax", highlight_syntax), } } pub fn line_numbers_font_name(self, line_numbers_font_name: impl Into) -> Self { Self { builder: self .builder .property("line-numbers-font-name", line_numbers_font_name.into()), } } pub fn print_footer(self, print_footer: bool) -> Self { Self { builder: self.builder.property("print-footer", print_footer), } } pub fn print_header(self, print_header: bool) -> Self { Self { builder: self.builder.property("print-header", print_header), } } pub fn print_line_numbers(self, print_line_numbers: u32) -> Self { Self { builder: self .builder .property("print-line-numbers", print_line_numbers), } } pub fn tab_width(self, tab_width: u32) -> Self { Self { builder: self.builder.property("tab-width", tab_width), } } pub fn wrap_mode(self, wrap_mode: gtk::WrapMode) -> Self { Self { builder: self.builder.property("wrap-mode", wrap_mode), } } // rustdoc-stripper-ignore-next /// Build the [`PrintCompositor`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> PrintCompositor { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait PrintCompositorExt: IsA + sealed::Sealed + 'static { #[doc(alias = "gtk_source_print_compositor_draw_page")] fn draw_page(&self, context: >k::PrintContext, page_nr: i32) { unsafe { ffi::gtk_source_print_compositor_draw_page( self.as_ref().to_glib_none().0, context.to_glib_none().0, page_nr, ); } } #[doc(alias = "gtk_source_print_compositor_get_body_font_name")] #[doc(alias = "get_body_font_name")] #[doc(alias = "body-font-name")] fn body_font_name(&self) -> glib::GString { unsafe { from_glib_full(ffi::gtk_source_print_compositor_get_body_font_name( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_print_compositor_get_bottom_margin")] #[doc(alias = "get_bottom_margin")] fn bottom_margin(&self, unit: gtk::Unit) -> f64 { unsafe { ffi::gtk_source_print_compositor_get_bottom_margin( self.as_ref().to_glib_none().0, unit.into_glib(), ) } } #[doc(alias = "gtk_source_print_compositor_get_buffer")] #[doc(alias = "get_buffer")] fn buffer(&self) -> Buffer { unsafe { from_glib_none(ffi::gtk_source_print_compositor_get_buffer( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_print_compositor_get_footer_font_name")] #[doc(alias = "get_footer_font_name")] #[doc(alias = "footer-font-name")] fn footer_font_name(&self) -> glib::GString { unsafe { from_glib_full(ffi::gtk_source_print_compositor_get_footer_font_name( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_print_compositor_get_header_font_name")] #[doc(alias = "get_header_font_name")] #[doc(alias = "header-font-name")] fn header_font_name(&self) -> glib::GString { unsafe { from_glib_full(ffi::gtk_source_print_compositor_get_header_font_name( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_print_compositor_get_highlight_syntax")] #[doc(alias = "get_highlight_syntax")] #[doc(alias = "highlight-syntax")] fn is_highlight_syntax(&self) -> bool { unsafe { from_glib(ffi::gtk_source_print_compositor_get_highlight_syntax( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_print_compositor_get_left_margin")] #[doc(alias = "get_left_margin")] fn left_margin(&self, unit: gtk::Unit) -> f64 { unsafe { ffi::gtk_source_print_compositor_get_left_margin( self.as_ref().to_glib_none().0, unit.into_glib(), ) } } #[doc(alias = "gtk_source_print_compositor_get_line_numbers_font_name")] #[doc(alias = "get_line_numbers_font_name")] #[doc(alias = "line-numbers-font-name")] fn line_numbers_font_name(&self) -> glib::GString { unsafe { from_glib_full(ffi::gtk_source_print_compositor_get_line_numbers_font_name( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_print_compositor_get_n_pages")] #[doc(alias = "get_n_pages")] #[doc(alias = "n-pages")] fn n_pages(&self) -> i32 { unsafe { ffi::gtk_source_print_compositor_get_n_pages(self.as_ref().to_glib_none().0) } } #[doc(alias = "gtk_source_print_compositor_get_pagination_progress")] #[doc(alias = "get_pagination_progress")] fn pagination_progress(&self) -> f64 { unsafe { ffi::gtk_source_print_compositor_get_pagination_progress(self.as_ref().to_glib_none().0) } } #[doc(alias = "gtk_source_print_compositor_get_print_footer")] #[doc(alias = "get_print_footer")] #[doc(alias = "print-footer")] fn is_print_footer(&self) -> bool { unsafe { from_glib(ffi::gtk_source_print_compositor_get_print_footer( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_print_compositor_get_print_header")] #[doc(alias = "get_print_header")] #[doc(alias = "print-header")] fn is_print_header(&self) -> bool { unsafe { from_glib(ffi::gtk_source_print_compositor_get_print_header( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_print_compositor_get_print_line_numbers")] #[doc(alias = "get_print_line_numbers")] #[doc(alias = "print-line-numbers")] fn print_line_numbers(&self) -> u32 { unsafe { ffi::gtk_source_print_compositor_get_print_line_numbers(self.as_ref().to_glib_none().0) } } #[doc(alias = "gtk_source_print_compositor_get_right_margin")] #[doc(alias = "get_right_margin")] fn right_margin(&self, unit: gtk::Unit) -> f64 { unsafe { ffi::gtk_source_print_compositor_get_right_margin( self.as_ref().to_glib_none().0, unit.into_glib(), ) } } #[doc(alias = "gtk_source_print_compositor_get_tab_width")] #[doc(alias = "get_tab_width")] #[doc(alias = "tab-width")] fn tab_width(&self) -> u32 { unsafe { ffi::gtk_source_print_compositor_get_tab_width(self.as_ref().to_glib_none().0) } } #[doc(alias = "gtk_source_print_compositor_get_top_margin")] #[doc(alias = "get_top_margin")] fn top_margin(&self, unit: gtk::Unit) -> f64 { unsafe { ffi::gtk_source_print_compositor_get_top_margin( self.as_ref().to_glib_none().0, unit.into_glib(), ) } } #[doc(alias = "gtk_source_print_compositor_get_wrap_mode")] #[doc(alias = "get_wrap_mode")] #[doc(alias = "wrap-mode")] fn wrap_mode(&self) -> gtk::WrapMode { unsafe { from_glib(ffi::gtk_source_print_compositor_get_wrap_mode( self.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v5_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_2")))] #[doc(alias = "gtk_source_print_compositor_ignore_tag")] fn ignore_tag(&self, tag: &impl IsA) { unsafe { ffi::gtk_source_print_compositor_ignore_tag( self.as_ref().to_glib_none().0, tag.as_ref().to_glib_none().0, ); } } #[doc(alias = "gtk_source_print_compositor_paginate")] fn paginate(&self, context: >k::PrintContext) -> bool { unsafe { from_glib(ffi::gtk_source_print_compositor_paginate( self.as_ref().to_glib_none().0, context.to_glib_none().0, )) } } #[doc(alias = "gtk_source_print_compositor_set_body_font_name")] #[doc(alias = "body-font-name")] fn set_body_font_name(&self, font_name: &str) { unsafe { ffi::gtk_source_print_compositor_set_body_font_name( self.as_ref().to_glib_none().0, font_name.to_glib_none().0, ); } } #[doc(alias = "gtk_source_print_compositor_set_bottom_margin")] fn set_bottom_margin(&self, margin: f64, unit: gtk::Unit) { unsafe { ffi::gtk_source_print_compositor_set_bottom_margin( self.as_ref().to_glib_none().0, margin, unit.into_glib(), ); } } #[doc(alias = "gtk_source_print_compositor_set_footer_font_name")] #[doc(alias = "footer-font-name")] fn set_footer_font_name(&self, font_name: Option<&str>) { unsafe { ffi::gtk_source_print_compositor_set_footer_font_name( self.as_ref().to_glib_none().0, font_name.to_glib_none().0, ); } } #[doc(alias = "gtk_source_print_compositor_set_footer_format")] fn set_footer_format( &self, separator: bool, left: Option<&str>, center: Option<&str>, right: Option<&str>, ) { unsafe { ffi::gtk_source_print_compositor_set_footer_format( self.as_ref().to_glib_none().0, separator.into_glib(), left.to_glib_none().0, center.to_glib_none().0, right.to_glib_none().0, ); } } #[doc(alias = "gtk_source_print_compositor_set_header_font_name")] #[doc(alias = "header-font-name")] fn set_header_font_name(&self, font_name: Option<&str>) { unsafe { ffi::gtk_source_print_compositor_set_header_font_name( self.as_ref().to_glib_none().0, font_name.to_glib_none().0, ); } } #[doc(alias = "gtk_source_print_compositor_set_header_format")] fn set_header_format( &self, separator: bool, left: Option<&str>, center: Option<&str>, right: Option<&str>, ) { unsafe { ffi::gtk_source_print_compositor_set_header_format( self.as_ref().to_glib_none().0, separator.into_glib(), left.to_glib_none().0, center.to_glib_none().0, right.to_glib_none().0, ); } } #[doc(alias = "gtk_source_print_compositor_set_highlight_syntax")] #[doc(alias = "highlight-syntax")] fn set_highlight_syntax(&self, highlight: bool) { unsafe { ffi::gtk_source_print_compositor_set_highlight_syntax( self.as_ref().to_glib_none().0, highlight.into_glib(), ); } } #[doc(alias = "gtk_source_print_compositor_set_left_margin")] fn set_left_margin(&self, margin: f64, unit: gtk::Unit) { unsafe { ffi::gtk_source_print_compositor_set_left_margin( self.as_ref().to_glib_none().0, margin, unit.into_glib(), ); } } #[doc(alias = "gtk_source_print_compositor_set_line_numbers_font_name")] #[doc(alias = "line-numbers-font-name")] fn set_line_numbers_font_name(&self, font_name: Option<&str>) { unsafe { ffi::gtk_source_print_compositor_set_line_numbers_font_name( self.as_ref().to_glib_none().0, font_name.to_glib_none().0, ); } } #[doc(alias = "gtk_source_print_compositor_set_print_footer")] #[doc(alias = "print-footer")] fn set_print_footer(&self, print: bool) { unsafe { ffi::gtk_source_print_compositor_set_print_footer( self.as_ref().to_glib_none().0, print.into_glib(), ); } } #[doc(alias = "gtk_source_print_compositor_set_print_header")] #[doc(alias = "print-header")] fn set_print_header(&self, print: bool) { unsafe { ffi::gtk_source_print_compositor_set_print_header( self.as_ref().to_glib_none().0, print.into_glib(), ); } } #[doc(alias = "gtk_source_print_compositor_set_print_line_numbers")] #[doc(alias = "print-line-numbers")] fn set_print_line_numbers(&self, interval: u32) { unsafe { ffi::gtk_source_print_compositor_set_print_line_numbers( self.as_ref().to_glib_none().0, interval, ); } } #[doc(alias = "gtk_source_print_compositor_set_right_margin")] fn set_right_margin(&self, margin: f64, unit: gtk::Unit) { unsafe { ffi::gtk_source_print_compositor_set_right_margin( self.as_ref().to_glib_none().0, margin, unit.into_glib(), ); } } #[doc(alias = "gtk_source_print_compositor_set_tab_width")] #[doc(alias = "tab-width")] fn set_tab_width(&self, width: u32) { unsafe { ffi::gtk_source_print_compositor_set_tab_width(self.as_ref().to_glib_none().0, width); } } #[doc(alias = "gtk_source_print_compositor_set_top_margin")] fn set_top_margin(&self, margin: f64, unit: gtk::Unit) { unsafe { ffi::gtk_source_print_compositor_set_top_margin( self.as_ref().to_glib_none().0, margin, unit.into_glib(), ); } } #[doc(alias = "gtk_source_print_compositor_set_wrap_mode")] #[doc(alias = "wrap-mode")] fn set_wrap_mode(&self, wrap_mode: gtk::WrapMode) { unsafe { ffi::gtk_source_print_compositor_set_wrap_mode( self.as_ref().to_glib_none().0, wrap_mode.into_glib(), ); } } #[doc(alias = "body-font-name")] fn connect_body_font_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_body_font_name_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourcePrintCompositor, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PrintCompositor::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::body-font-name\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_body_font_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "footer-font-name")] fn connect_footer_font_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_footer_font_name_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourcePrintCompositor, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PrintCompositor::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::footer-font-name\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_footer_font_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "header-font-name")] fn connect_header_font_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_header_font_name_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourcePrintCompositor, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PrintCompositor::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::header-font-name\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_header_font_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "highlight-syntax")] fn connect_highlight_syntax_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_highlight_syntax_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourcePrintCompositor, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PrintCompositor::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::highlight-syntax\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_highlight_syntax_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "line-numbers-font-name")] fn connect_line_numbers_font_name_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_line_numbers_font_name_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourcePrintCompositor, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PrintCompositor::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::line-numbers-font-name\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_line_numbers_font_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "n-pages")] fn connect_n_pages_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_n_pages_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourcePrintCompositor, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PrintCompositor::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::n-pages\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_n_pages_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "print-footer")] fn connect_print_footer_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_print_footer_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourcePrintCompositor, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PrintCompositor::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::print-footer\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_print_footer_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "print-header")] fn connect_print_header_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_print_header_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourcePrintCompositor, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PrintCompositor::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::print-header\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_print_header_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "print-line-numbers")] fn connect_print_line_numbers_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_print_line_numbers_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourcePrintCompositor, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PrintCompositor::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::print-line-numbers\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_print_line_numbers_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "tab-width")] fn connect_tab_width_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_tab_width_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourcePrintCompositor, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PrintCompositor::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::tab-width\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_tab_width_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "wrap-mode")] fn connect_wrap_mode_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_wrap_mode_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourcePrintCompositor, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PrintCompositor::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::wrap-mode\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_wrap_mode_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> PrintCompositorExt for O {} sourceview5-0.9.0/src/auto/region.rs000064400000000000000000000144021046102023000155030ustar 00000000000000// 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::{ffi, RegionIter}; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "GtkSourceRegion")] pub struct Region(Object); match fn { type_ => || ffi::gtk_source_region_get_type(), } } impl Region { pub const NONE: Option<&'static Region> = None; #[doc(alias = "gtk_source_region_new")] pub fn new(buffer: &impl IsA) -> Region { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gtk_source_region_new(buffer.as_ref().to_glib_none().0)) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Region`] objects. /// /// This method returns an instance of [`RegionBuilder`](crate::builders::RegionBuilder) which can be used to create [`Region`] objects. pub fn builder() -> RegionBuilder { RegionBuilder::new() } } impl Default for Region { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Region`] 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 RegionBuilder { builder: glib::object::ObjectBuilder<'static, Region>, } impl RegionBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn buffer(self, buffer: &impl IsA) -> Self { Self { builder: self.builder.property("buffer", buffer.clone().upcast()), } } // rustdoc-stripper-ignore-next /// Build the [`Region`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Region { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait RegionExt: IsA + sealed::Sealed + 'static { #[doc(alias = "gtk_source_region_add_region")] fn add_region(&self, region_to_add: Option<&impl IsA>) { unsafe { ffi::gtk_source_region_add_region( self.as_ref().to_glib_none().0, region_to_add.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "gtk_source_region_add_subregion")] fn add_subregion(&self, _start: >k::TextIter, _end: >k::TextIter) { unsafe { ffi::gtk_source_region_add_subregion( self.as_ref().to_glib_none().0, _start.to_glib_none().0, _end.to_glib_none().0, ); } } #[doc(alias = "gtk_source_region_get_bounds")] #[doc(alias = "get_bounds")] fn bounds(&self) -> Option<(gtk::TextIter, gtk::TextIter)> { unsafe { let mut start = gtk::TextIter::uninitialized(); let mut end = gtk::TextIter::uninitialized(); let ret = from_glib(ffi::gtk_source_region_get_bounds( self.as_ref().to_glib_none().0, start.to_glib_none_mut().0, end.to_glib_none_mut().0, )); if ret { Some((start, end)) } else { None } } } #[doc(alias = "gtk_source_region_get_buffer")] #[doc(alias = "get_buffer")] fn buffer(&self) -> Option { unsafe { from_glib_none(ffi::gtk_source_region_get_buffer( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_region_get_start_region_iter")] #[doc(alias = "get_start_region_iter")] fn start_region_iter(&self) -> RegionIter { unsafe { let mut iter = RegionIter::uninitialized(); ffi::gtk_source_region_get_start_region_iter( self.as_ref().to_glib_none().0, iter.to_glib_none_mut().0, ); iter } } #[doc(alias = "gtk_source_region_intersect_region")] #[must_use] fn intersect_region(&self, region2: Option<&impl IsA>) -> Option { unsafe { from_glib_full(ffi::gtk_source_region_intersect_region( self.as_ref().to_glib_none().0, region2.map(|p| p.as_ref()).to_glib_none().0, )) } } #[doc(alias = "gtk_source_region_intersect_subregion")] #[must_use] fn intersect_subregion(&self, _start: >k::TextIter, _end: >k::TextIter) -> Option { unsafe { from_glib_full(ffi::gtk_source_region_intersect_subregion( self.as_ref().to_glib_none().0, _start.to_glib_none().0, _end.to_glib_none().0, )) } } #[doc(alias = "gtk_source_region_is_empty")] fn is_empty(&self) -> bool { unsafe { from_glib(ffi::gtk_source_region_is_empty( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_region_subtract_region")] fn subtract_region(&self, region_to_subtract: Option<&impl IsA>) { unsafe { ffi::gtk_source_region_subtract_region( self.as_ref().to_glib_none().0, region_to_subtract.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "gtk_source_region_subtract_subregion")] fn subtract_subregion(&self, _start: >k::TextIter, _end: >k::TextIter) { unsafe { ffi::gtk_source_region_subtract_subregion( self.as_ref().to_glib_none().0, _start.to_glib_none().0, _end.to_glib_none().0, ); } } #[doc(alias = "gtk_source_region_to_string")] #[doc(alias = "to_string")] fn to_str(&self) -> Option { unsafe { from_glib_full(ffi::gtk_source_region_to_string( self.as_ref().to_glib_none().0, )) } } } impl> RegionExt for O {} sourceview5-0.9.0/src/auto/search_context.rs000064400000000000000000000447761046102023000172520ustar 00000000000000// 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::{ffi, Buffer, SearchSettings, Style}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::{boxed::Box as Box_, pin::Pin}; glib::wrapper! { #[doc(alias = "GtkSourceSearchContext")] pub struct SearchContext(Object); match fn { type_ => || ffi::gtk_source_search_context_get_type(), } } impl SearchContext { #[doc(alias = "gtk_source_search_context_new")] pub fn new( buffer: &impl IsA, settings: Option<&impl IsA>, ) -> SearchContext { skip_assert_initialized!(); unsafe { from_glib_full(ffi::gtk_source_search_context_new( buffer.as_ref().to_glib_none().0, settings.map(|p| p.as_ref()).to_glib_none().0, )) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`SearchContext`] objects. /// /// This method returns an instance of [`SearchContextBuilder`](crate::builders::SearchContextBuilder) which can be used to create [`SearchContext`] objects. pub fn builder() -> SearchContextBuilder { SearchContextBuilder::new() } #[doc(alias = "gtk_source_search_context_backward")] pub fn backward(&self, iter: >k::TextIter) -> Option<(gtk::TextIter, gtk::TextIter, bool)> { unsafe { let mut match_start = gtk::TextIter::uninitialized(); let mut match_end = gtk::TextIter::uninitialized(); let mut has_wrapped_around = std::mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gtk_source_search_context_backward( self.to_glib_none().0, iter.to_glib_none().0, match_start.to_glib_none_mut().0, match_end.to_glib_none_mut().0, has_wrapped_around.as_mut_ptr(), )); if ret { Some(( match_start, match_end, from_glib(has_wrapped_around.assume_init()), )) } else { None } } } #[doc(alias = "gtk_source_search_context_backward_async")] pub fn backward_async< P: FnOnce(Result<(gtk::TextIter, gtk::TextIter, bool), glib::Error>) + 'static, >( &self, iter: >k::TextIter, cancellable: Option<&impl IsA>, callback: P, ) { let main_context = glib::MainContext::ref_thread_default(); let is_main_context_owner = main_context.is_owner(); let has_acquired_main_context = (!is_main_context_owner) .then(|| main_context.acquire().ok()) .flatten(); assert!( is_main_context_owner || has_acquired_main_context.is_some(), "Async operations only allowed if the thread is owning the MainContext" ); let user_data: Box_> = Box_::new(glib::thread_guard::ThreadGuard::new(callback)); unsafe extern "C" fn backward_async_trampoline< P: FnOnce(Result<(gtk::TextIter, gtk::TextIter, bool), glib::Error>) + 'static, >( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer, ) { let mut error = std::ptr::null_mut(); let mut match_start = gtk::TextIter::uninitialized(); let mut match_end = gtk::TextIter::uninitialized(); let mut has_wrapped_around = std::mem::MaybeUninit::uninit(); let _ = ffi::gtk_source_search_context_backward_finish( _source_object as *mut _, res, match_start.to_glib_none_mut().0, match_end.to_glib_none_mut().0, has_wrapped_around.as_mut_ptr(), &mut error, ); let result = if error.is_null() { Ok(( match_start, match_end, from_glib(has_wrapped_around.assume_init()), )) } else { Err(from_glib_full(error)) }; let callback: Box_> = Box_::from_raw(user_data as *mut _); let callback: P = callback.into_inner(); callback(result); } let callback = backward_async_trampoline::

; unsafe { ffi::gtk_source_search_context_backward_async( self.to_glib_none().0, iter.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _, ); } } pub fn backward_future( &self, iter: >k::TextIter, ) -> Pin< Box_< dyn std::future::Future< Output = Result<(gtk::TextIter, gtk::TextIter, bool), glib::Error>, > + 'static, >, > { let iter = iter.clone(); Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { obj.backward_async(&iter, Some(cancellable), move |res| { send.resolve(res); }); })) } #[doc(alias = "gtk_source_search_context_forward")] pub fn forward(&self, iter: >k::TextIter) -> Option<(gtk::TextIter, gtk::TextIter, bool)> { unsafe { let mut match_start = gtk::TextIter::uninitialized(); let mut match_end = gtk::TextIter::uninitialized(); let mut has_wrapped_around = std::mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gtk_source_search_context_forward( self.to_glib_none().0, iter.to_glib_none().0, match_start.to_glib_none_mut().0, match_end.to_glib_none_mut().0, has_wrapped_around.as_mut_ptr(), )); if ret { Some(( match_start, match_end, from_glib(has_wrapped_around.assume_init()), )) } else { None } } } #[doc(alias = "gtk_source_search_context_forward_async")] pub fn forward_async< P: FnOnce(Result<(gtk::TextIter, gtk::TextIter, bool), glib::Error>) + 'static, >( &self, iter: >k::TextIter, cancellable: Option<&impl IsA>, callback: P, ) { let main_context = glib::MainContext::ref_thread_default(); let is_main_context_owner = main_context.is_owner(); let has_acquired_main_context = (!is_main_context_owner) .then(|| main_context.acquire().ok()) .flatten(); assert!( is_main_context_owner || has_acquired_main_context.is_some(), "Async operations only allowed if the thread is owning the MainContext" ); let user_data: Box_> = Box_::new(glib::thread_guard::ThreadGuard::new(callback)); unsafe extern "C" fn forward_async_trampoline< P: FnOnce(Result<(gtk::TextIter, gtk::TextIter, bool), glib::Error>) + 'static, >( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer, ) { let mut error = std::ptr::null_mut(); let mut match_start = gtk::TextIter::uninitialized(); let mut match_end = gtk::TextIter::uninitialized(); let mut has_wrapped_around = std::mem::MaybeUninit::uninit(); let _ = ffi::gtk_source_search_context_forward_finish( _source_object as *mut _, res, match_start.to_glib_none_mut().0, match_end.to_glib_none_mut().0, has_wrapped_around.as_mut_ptr(), &mut error, ); let result = if error.is_null() { Ok(( match_start, match_end, from_glib(has_wrapped_around.assume_init()), )) } else { Err(from_glib_full(error)) }; let callback: Box_> = Box_::from_raw(user_data as *mut _); let callback: P = callback.into_inner(); callback(result); } let callback = forward_async_trampoline::

; unsafe { ffi::gtk_source_search_context_forward_async( self.to_glib_none().0, iter.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _, ); } } pub fn forward_future( &self, iter: >k::TextIter, ) -> Pin< Box_< dyn std::future::Future< Output = Result<(gtk::TextIter, gtk::TextIter, bool), glib::Error>, > + 'static, >, > { let iter = iter.clone(); Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { obj.forward_async(&iter, Some(cancellable), move |res| { send.resolve(res); }); })) } #[doc(alias = "gtk_source_search_context_get_buffer")] #[doc(alias = "get_buffer")] pub fn buffer(&self) -> Buffer { unsafe { from_glib_none(ffi::gtk_source_search_context_get_buffer( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_search_context_get_highlight")] #[doc(alias = "get_highlight")] #[doc(alias = "highlight")] pub fn is_highlight(&self) -> bool { unsafe { from_glib(ffi::gtk_source_search_context_get_highlight( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_search_context_get_match_style")] #[doc(alias = "get_match_style")] #[doc(alias = "match-style")] pub fn match_style(&self) -> Style { unsafe { from_glib_none(ffi::gtk_source_search_context_get_match_style( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_search_context_get_occurrence_position")] #[doc(alias = "get_occurrence_position")] pub fn occurrence_position( &self, match_start: >k::TextIter, match_end: >k::TextIter, ) -> i32 { unsafe { ffi::gtk_source_search_context_get_occurrence_position( self.to_glib_none().0, match_start.to_glib_none().0, match_end.to_glib_none().0, ) } } #[doc(alias = "gtk_source_search_context_get_occurrences_count")] #[doc(alias = "get_occurrences_count")] #[doc(alias = "occurrences-count")] pub fn occurrences_count(&self) -> i32 { unsafe { ffi::gtk_source_search_context_get_occurrences_count(self.to_glib_none().0) } } #[doc(alias = "gtk_source_search_context_get_regex_error")] #[doc(alias = "get_regex_error")] #[doc(alias = "regex-error")] pub fn regex_error(&self) -> Option { unsafe { from_glib_full(ffi::gtk_source_search_context_get_regex_error( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_search_context_get_settings")] #[doc(alias = "get_settings")] pub fn settings(&self) -> SearchSettings { unsafe { from_glib_none(ffi::gtk_source_search_context_get_settings( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_search_context_replace")] pub fn replace( &self, match_start: &mut gtk::TextIter, match_end: &mut gtk::TextIter, replace: &str, ) -> Result<(), glib::Error> { let replace_length = replace.len() as _; unsafe { let mut error = std::ptr::null_mut(); let is_ok = ffi::gtk_source_search_context_replace( self.to_glib_none().0, match_start.to_glib_none_mut().0, match_end.to_glib_none_mut().0, replace.to_glib_none().0, replace_length, &mut error, ); debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "gtk_source_search_context_set_highlight")] #[doc(alias = "highlight")] pub fn set_highlight(&self, highlight: bool) { unsafe { ffi::gtk_source_search_context_set_highlight( self.to_glib_none().0, highlight.into_glib(), ); } } #[doc(alias = "gtk_source_search_context_set_match_style")] #[doc(alias = "match-style")] pub fn set_match_style(&self, match_style: Option<&Style>) { unsafe { ffi::gtk_source_search_context_set_match_style( self.to_glib_none().0, match_style.to_glib_none().0, ); } } #[doc(alias = "highlight")] pub fn connect_highlight_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_highlight_trampoline( this: *mut ffi::GtkSourceSearchContext, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::highlight\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_highlight_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "match-style")] pub fn connect_match_style_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_match_style_trampoline( this: *mut ffi::GtkSourceSearchContext, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::match-style\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_match_style_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "occurrences-count")] pub fn connect_occurrences_count_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_occurrences_count_trampoline< F: Fn(&SearchContext) + 'static, >( this: *mut ffi::GtkSourceSearchContext, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::occurrences-count\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_occurrences_count_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "regex-error")] pub fn connect_regex_error_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_regex_error_trampoline( this: *mut ffi::GtkSourceSearchContext, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::regex-error\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_regex_error_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for SearchContext { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`SearchContext`] 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 SearchContextBuilder { builder: glib::object::ObjectBuilder<'static, SearchContext>, } impl SearchContextBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn buffer(self, buffer: &impl IsA) -> Self { Self { builder: self.builder.property("buffer", buffer.clone().upcast()), } } pub fn highlight(self, highlight: bool) -> Self { Self { builder: self.builder.property("highlight", highlight), } } pub fn match_style(self, match_style: &Style) -> Self { Self { builder: self.builder.property("match-style", match_style.clone()), } } pub fn settings(self, settings: &impl IsA) -> Self { Self { builder: self.builder.property("settings", settings.clone().upcast()), } } // rustdoc-stripper-ignore-next /// Build the [`SearchContext`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> SearchContext { self.builder.build() } } sourceview5-0.9.0/src/auto/search_settings.rs000064400000000000000000000331701046102023000174100ustar 00000000000000// 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::ffi; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourceSearchSettings")] pub struct SearchSettings(Object); match fn { type_ => || ffi::gtk_source_search_settings_get_type(), } } impl SearchSettings { pub const NONE: Option<&'static SearchSettings> = None; #[doc(alias = "gtk_source_search_settings_new")] pub fn new() -> SearchSettings { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gtk_source_search_settings_new()) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`SearchSettings`] objects. /// /// This method returns an instance of [`SearchSettingsBuilder`](crate::builders::SearchSettingsBuilder) which can be used to create [`SearchSettings`] objects. pub fn builder() -> SearchSettingsBuilder { SearchSettingsBuilder::new() } } impl Default for SearchSettings { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`SearchSettings`] 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 SearchSettingsBuilder { builder: glib::object::ObjectBuilder<'static, SearchSettings>, } impl SearchSettingsBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn at_word_boundaries(self, at_word_boundaries: bool) -> Self { Self { builder: self .builder .property("at-word-boundaries", at_word_boundaries), } } pub fn case_sensitive(self, case_sensitive: bool) -> Self { Self { builder: self.builder.property("case-sensitive", case_sensitive), } } pub fn regex_enabled(self, regex_enabled: bool) -> Self { Self { builder: self.builder.property("regex-enabled", regex_enabled), } } pub fn search_text(self, search_text: impl Into) -> Self { Self { builder: self.builder.property("search-text", search_text.into()), } } #[cfg(feature = "v5_12")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_12")))] pub fn visible_only(self, visible_only: bool) -> Self { Self { builder: self.builder.property("visible-only", visible_only), } } pub fn wrap_around(self, wrap_around: bool) -> Self { Self { builder: self.builder.property("wrap-around", wrap_around), } } // rustdoc-stripper-ignore-next /// Build the [`SearchSettings`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> SearchSettings { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait SearchSettingsExt: IsA + sealed::Sealed + 'static { #[doc(alias = "gtk_source_search_settings_get_at_word_boundaries")] #[doc(alias = "get_at_word_boundaries")] #[doc(alias = "at-word-boundaries")] fn is_at_word_boundaries(&self) -> bool { unsafe { from_glib(ffi::gtk_source_search_settings_get_at_word_boundaries( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_search_settings_get_case_sensitive")] #[doc(alias = "get_case_sensitive")] #[doc(alias = "case-sensitive")] fn is_case_sensitive(&self) -> bool { unsafe { from_glib(ffi::gtk_source_search_settings_get_case_sensitive( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_search_settings_get_regex_enabled")] #[doc(alias = "get_regex_enabled")] #[doc(alias = "regex-enabled")] fn is_regex_enabled(&self) -> bool { unsafe { from_glib(ffi::gtk_source_search_settings_get_regex_enabled( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_search_settings_get_search_text")] #[doc(alias = "get_search_text")] #[doc(alias = "search-text")] fn search_text(&self) -> Option { unsafe { from_glib_none(ffi::gtk_source_search_settings_get_search_text( self.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v5_12")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_12")))] #[doc(alias = "gtk_source_search_settings_get_visible_only")] #[doc(alias = "get_visible_only")] #[doc(alias = "visible-only")] fn is_visible_only(&self) -> bool { unsafe { from_glib(ffi::gtk_source_search_settings_get_visible_only( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_search_settings_get_wrap_around")] #[doc(alias = "get_wrap_around")] #[doc(alias = "wrap-around")] fn wraps_around(&self) -> bool { unsafe { from_glib(ffi::gtk_source_search_settings_get_wrap_around( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gtk_source_search_settings_set_at_word_boundaries")] #[doc(alias = "at-word-boundaries")] fn set_at_word_boundaries(&self, at_word_boundaries: bool) { unsafe { ffi::gtk_source_search_settings_set_at_word_boundaries( self.as_ref().to_glib_none().0, at_word_boundaries.into_glib(), ); } } #[doc(alias = "gtk_source_search_settings_set_case_sensitive")] #[doc(alias = "case-sensitive")] fn set_case_sensitive(&self, case_sensitive: bool) { unsafe { ffi::gtk_source_search_settings_set_case_sensitive( self.as_ref().to_glib_none().0, case_sensitive.into_glib(), ); } } #[doc(alias = "gtk_source_search_settings_set_regex_enabled")] #[doc(alias = "regex-enabled")] fn set_regex_enabled(&self, regex_enabled: bool) { unsafe { ffi::gtk_source_search_settings_set_regex_enabled( self.as_ref().to_glib_none().0, regex_enabled.into_glib(), ); } } #[doc(alias = "gtk_source_search_settings_set_search_text")] #[doc(alias = "search-text")] fn set_search_text(&self, search_text: Option<&str>) { unsafe { ffi::gtk_source_search_settings_set_search_text( self.as_ref().to_glib_none().0, search_text.to_glib_none().0, ); } } #[cfg(feature = "v5_12")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_12")))] #[doc(alias = "gtk_source_search_settings_set_visible_only")] #[doc(alias = "visible-only")] fn set_visible_only(&self, visible_only: bool) { unsafe { ffi::gtk_source_search_settings_set_visible_only( self.as_ref().to_glib_none().0, visible_only.into_glib(), ); } } #[doc(alias = "gtk_source_search_settings_set_wrap_around")] #[doc(alias = "wrap-around")] fn set_wrap_around(&self, wrap_around: bool) { unsafe { ffi::gtk_source_search_settings_set_wrap_around( self.as_ref().to_glib_none().0, wrap_around.into_glib(), ); } } #[doc(alias = "at-word-boundaries")] fn connect_at_word_boundaries_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_at_word_boundaries_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceSearchSettings, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(SearchSettings::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::at-word-boundaries\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_at_word_boundaries_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "case-sensitive")] fn connect_case_sensitive_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_case_sensitive_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceSearchSettings, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(SearchSettings::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::case-sensitive\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_case_sensitive_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "regex-enabled")] fn connect_regex_enabled_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_regex_enabled_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceSearchSettings, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(SearchSettings::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::regex-enabled\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_regex_enabled_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "search-text")] fn connect_search_text_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_search_text_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceSearchSettings, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(SearchSettings::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::search-text\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_search_text_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v5_12")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_12")))] #[doc(alias = "visible-only")] fn connect_visible_only_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_visible_only_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceSearchSettings, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(SearchSettings::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::visible-only\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_visible_only_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "wrap-around")] fn connect_wrap_around_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_wrap_around_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkSourceSearchSettings, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(SearchSettings::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::wrap-around\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_wrap_around_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> SearchSettingsExt for O {} sourceview5-0.9.0/src/auto/snippet.rs000064400000000000000000000304111046102023000157000ustar 00000000000000// 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::{ffi, SnippetChunk, SnippetContext}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourceSnippet")] pub struct Snippet(Object); match fn { type_ => || ffi::gtk_source_snippet_get_type(), } } impl Snippet { #[doc(alias = "gtk_source_snippet_new")] pub fn new(trigger: Option<&str>, language_id: Option<&str>) -> Snippet { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gtk_source_snippet_new( trigger.to_glib_none().0, language_id.to_glib_none().0, )) } } #[cfg(feature = "v5_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_6")))] #[doc(alias = "gtk_source_snippet_new_parsed")] pub fn new_parsed(text: &str) -> Result { assert_initialized_main_thread!(); unsafe { let mut error = std::ptr::null_mut(); let ret = ffi::gtk_source_snippet_new_parsed(text.to_glib_none().0, &mut error); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Snippet`] objects. /// /// This method returns an instance of [`SnippetBuilder`](crate::builders::SnippetBuilder) which can be used to create [`Snippet`] objects. pub fn builder() -> SnippetBuilder { SnippetBuilder::new() } #[doc(alias = "gtk_source_snippet_add_chunk")] pub fn add_chunk(&self, chunk: &SnippetChunk) { unsafe { ffi::gtk_source_snippet_add_chunk(self.to_glib_none().0, chunk.to_glib_none().0); } } #[doc(alias = "gtk_source_snippet_copy")] #[must_use] pub fn copy(&self) -> Snippet { unsafe { from_glib_full(ffi::gtk_source_snippet_copy(self.to_glib_none().0)) } } #[doc(alias = "gtk_source_snippet_get_context")] #[doc(alias = "get_context")] pub fn context(&self) -> Option { unsafe { from_glib_none(ffi::gtk_source_snippet_get_context(self.to_glib_none().0)) } } #[doc(alias = "gtk_source_snippet_get_description")] #[doc(alias = "get_description")] pub fn description(&self) -> glib::GString { unsafe { from_glib_none(ffi::gtk_source_snippet_get_description( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_snippet_get_focus_position")] #[doc(alias = "get_focus_position")] #[doc(alias = "focus-position")] pub fn focus_position(&self) -> i32 { unsafe { ffi::gtk_source_snippet_get_focus_position(self.to_glib_none().0) } } #[doc(alias = "gtk_source_snippet_get_language_id")] #[doc(alias = "get_language_id")] #[doc(alias = "language-id")] pub fn language_id(&self) -> glib::GString { unsafe { from_glib_none(ffi::gtk_source_snippet_get_language_id( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_snippet_get_n_chunks")] #[doc(alias = "get_n_chunks")] pub fn n_chunks(&self) -> u32 { unsafe { ffi::gtk_source_snippet_get_n_chunks(self.to_glib_none().0) } } #[doc(alias = "gtk_source_snippet_get_name")] #[doc(alias = "get_name")] pub fn name(&self) -> glib::GString { unsafe { from_glib_none(ffi::gtk_source_snippet_get_name(self.to_glib_none().0)) } } #[doc(alias = "gtk_source_snippet_get_nth_chunk")] #[doc(alias = "get_nth_chunk")] pub fn nth_chunk(&self, nth: u32) -> SnippetChunk { unsafe { from_glib_none(ffi::gtk_source_snippet_get_nth_chunk( self.to_glib_none().0, nth, )) } } #[doc(alias = "gtk_source_snippet_get_trigger")] #[doc(alias = "get_trigger")] pub fn trigger(&self) -> Option { unsafe { from_glib_none(ffi::gtk_source_snippet_get_trigger(self.to_glib_none().0)) } } #[doc(alias = "gtk_source_snippet_set_description")] #[doc(alias = "description")] pub fn set_description(&self, description: &str) { unsafe { ffi::gtk_source_snippet_set_description( self.to_glib_none().0, description.to_glib_none().0, ); } } #[doc(alias = "gtk_source_snippet_set_language_id")] #[doc(alias = "language-id")] pub fn set_language_id(&self, language_id: &str) { unsafe { ffi::gtk_source_snippet_set_language_id( self.to_glib_none().0, language_id.to_glib_none().0, ); } } #[doc(alias = "gtk_source_snippet_set_name")] #[doc(alias = "name")] pub fn set_name(&self, name: &str) { unsafe { ffi::gtk_source_snippet_set_name(self.to_glib_none().0, name.to_glib_none().0); } } #[doc(alias = "gtk_source_snippet_set_trigger")] #[doc(alias = "trigger")] pub fn set_trigger(&self, trigger: &str) { unsafe { ffi::gtk_source_snippet_set_trigger(self.to_glib_none().0, trigger.to_glib_none().0); } } pub fn buffer(&self) -> Option { ObjectExt::property(self, "buffer") } #[doc(alias = "buffer")] pub fn connect_buffer_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_buffer_trampoline( this: *mut ffi::GtkSourceSnippet, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::buffer\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_buffer_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "description")] pub fn connect_description_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_description_trampoline( this: *mut ffi::GtkSourceSnippet, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::description\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_description_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "focus-position")] pub fn connect_focus_position_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_focus_position_trampoline( this: *mut ffi::GtkSourceSnippet, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::focus-position\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_focus_position_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "language-id")] pub fn connect_language_id_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_language_id_trampoline( this: *mut ffi::GtkSourceSnippet, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::language-id\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_language_id_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "name")] pub fn connect_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_name_trampoline( this: *mut ffi::GtkSourceSnippet, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::name\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "trigger")] pub fn connect_trigger_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_trigger_trampoline( this: *mut ffi::GtkSourceSnippet, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::trigger\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_trigger_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for Snippet { fn default() -> Self { glib::object::Object::new::() } } impl std::fmt::Display for Snippet { #[inline] fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(&self.name()) } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Snippet`] 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 SnippetBuilder { builder: glib::object::ObjectBuilder<'static, Snippet>, } impl SnippetBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn description(self, description: impl Into) -> Self { Self { builder: self.builder.property("description", description.into()), } } pub fn language_id(self, language_id: impl Into) -> Self { Self { builder: self.builder.property("language-id", language_id.into()), } } pub fn name(self, name: impl Into) -> Self { Self { builder: self.builder.property("name", name.into()), } } pub fn trigger(self, trigger: impl Into) -> Self { Self { builder: self.builder.property("trigger", trigger.into()), } } // rustdoc-stripper-ignore-next /// Build the [`Snippet`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Snippet { self.builder.build() } } sourceview5-0.9.0/src/auto/snippet_chunk.rs000064400000000000000000000273611046102023000171020ustar 00000000000000// 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::{ffi, SnippetContext}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourceSnippetChunk")] pub struct SnippetChunk(Object); match fn { type_ => || ffi::gtk_source_snippet_chunk_get_type(), } } impl SnippetChunk { #[doc(alias = "gtk_source_snippet_chunk_new")] pub fn new() -> SnippetChunk { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::gtk_source_snippet_chunk_new()) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`SnippetChunk`] objects. /// /// This method returns an instance of [`SnippetChunkBuilder`](crate::builders::SnippetChunkBuilder) which can be used to create [`SnippetChunk`] objects. pub fn builder() -> SnippetChunkBuilder { SnippetChunkBuilder::new() } #[doc(alias = "gtk_source_snippet_chunk_copy")] #[must_use] pub fn copy(&self) -> SnippetChunk { unsafe { from_glib_full(ffi::gtk_source_snippet_chunk_copy(self.to_glib_none().0)) } } #[doc(alias = "gtk_source_snippet_chunk_get_context")] #[doc(alias = "get_context")] pub fn context(&self) -> SnippetContext { unsafe { from_glib_none(ffi::gtk_source_snippet_chunk_get_context( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_snippet_chunk_get_focus_position")] #[doc(alias = "get_focus_position")] #[doc(alias = "focus-position")] pub fn focus_position(&self) -> i32 { unsafe { ffi::gtk_source_snippet_chunk_get_focus_position(self.to_glib_none().0) } } #[doc(alias = "gtk_source_snippet_chunk_get_spec")] #[doc(alias = "get_spec")] pub fn spec(&self) -> Option { unsafe { from_glib_none(ffi::gtk_source_snippet_chunk_get_spec( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_snippet_chunk_get_text")] #[doc(alias = "get_text")] pub fn text(&self) -> glib::GString { unsafe { from_glib_none(ffi::gtk_source_snippet_chunk_get_text( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_snippet_chunk_get_text_set")] #[doc(alias = "get_text_set")] #[doc(alias = "text-set")] pub fn is_text_set(&self) -> bool { unsafe { from_glib(ffi::gtk_source_snippet_chunk_get_text_set( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_snippet_chunk_get_tooltip_text")] #[doc(alias = "get_tooltip_text")] #[doc(alias = "tooltip-text")] pub fn tooltip_text(&self) -> glib::GString { unsafe { from_glib_none(ffi::gtk_source_snippet_chunk_get_tooltip_text( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_snippet_chunk_set_context")] #[doc(alias = "context")] pub fn set_context(&self, context: &SnippetContext) { unsafe { ffi::gtk_source_snippet_chunk_set_context( self.to_glib_none().0, context.to_glib_none().0, ); } } #[doc(alias = "gtk_source_snippet_chunk_set_focus_position")] #[doc(alias = "focus-position")] pub fn set_focus_position(&self, focus_position: i32) { unsafe { ffi::gtk_source_snippet_chunk_set_focus_position(self.to_glib_none().0, focus_position); } } #[doc(alias = "gtk_source_snippet_chunk_set_spec")] #[doc(alias = "spec")] pub fn set_spec(&self, spec: &str) { unsafe { ffi::gtk_source_snippet_chunk_set_spec(self.to_glib_none().0, spec.to_glib_none().0); } } #[doc(alias = "gtk_source_snippet_chunk_set_text")] #[doc(alias = "text")] pub fn set_text(&self, text: &str) { unsafe { ffi::gtk_source_snippet_chunk_set_text(self.to_glib_none().0, text.to_glib_none().0); } } #[doc(alias = "gtk_source_snippet_chunk_set_text_set")] #[doc(alias = "text-set")] pub fn set_text_set(&self, text_set: bool) { unsafe { ffi::gtk_source_snippet_chunk_set_text_set(self.to_glib_none().0, text_set.into_glib()); } } #[doc(alias = "gtk_source_snippet_chunk_set_tooltip_text")] #[doc(alias = "tooltip-text")] pub fn set_tooltip_text(&self, tooltip_text: &str) { unsafe { ffi::gtk_source_snippet_chunk_set_tooltip_text( self.to_glib_none().0, tooltip_text.to_glib_none().0, ); } } #[doc(alias = "context")] pub fn connect_context_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_context_trampoline( this: *mut ffi::GtkSourceSnippetChunk, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::context\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_context_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "focus-position")] pub fn connect_focus_position_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_focus_position_trampoline( this: *mut ffi::GtkSourceSnippetChunk, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::focus-position\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_focus_position_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "spec")] pub fn connect_spec_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_spec_trampoline( this: *mut ffi::GtkSourceSnippetChunk, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::spec\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_spec_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "text")] pub fn connect_text_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_text_trampoline( this: *mut ffi::GtkSourceSnippetChunk, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::text\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_text_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "text-set")] pub fn connect_text_set_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_text_set_trampoline( this: *mut ffi::GtkSourceSnippetChunk, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::text-set\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_text_set_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "tooltip-text")] pub fn connect_tooltip_text_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_tooltip_text_trampoline( this: *mut ffi::GtkSourceSnippetChunk, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::tooltip-text\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_tooltip_text_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for SnippetChunk { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`SnippetChunk`] 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 SnippetChunkBuilder { builder: glib::object::ObjectBuilder<'static, SnippetChunk>, } impl SnippetChunkBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn context(self, context: &SnippetContext) -> Self { Self { builder: self.builder.property("context", context.clone()), } } pub fn focus_position(self, focus_position: i32) -> Self { Self { builder: self.builder.property("focus-position", focus_position), } } pub fn spec(self, spec: impl Into) -> Self { Self { builder: self.builder.property("spec", spec.into()), } } pub fn text(self, text: impl Into) -> Self { Self { builder: self.builder.property("text", text.into()), } } pub fn text_set(self, text_set: bool) -> Self { Self { builder: self.builder.property("text-set", text_set), } } pub fn tooltip_text(self, tooltip_text: impl Into) -> Self { Self { builder: self.builder.property("tooltip-text", tooltip_text.into()), } } // rustdoc-stripper-ignore-next /// Build the [`SnippetChunk`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> SnippetChunk { self.builder.build() } } sourceview5-0.9.0/src/auto/snippet_context.rs000064400000000000000000000100001046102023000174340ustar 00000000000000// 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::ffi; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourceSnippetContext")] pub struct SnippetContext(Object); match fn { type_ => || ffi::gtk_source_snippet_context_get_type(), } } impl SnippetContext { #[doc(alias = "gtk_source_snippet_context_new")] pub fn new() -> SnippetContext { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gtk_source_snippet_context_new()) } } #[doc(alias = "gtk_source_snippet_context_clear_variables")] pub fn clear_variables(&self) { unsafe { ffi::gtk_source_snippet_context_clear_variables(self.to_glib_none().0); } } #[doc(alias = "gtk_source_snippet_context_expand")] pub fn expand(&self, input: &str) -> glib::GString { unsafe { from_glib_full(ffi::gtk_source_snippet_context_expand( self.to_glib_none().0, input.to_glib_none().0, )) } } #[doc(alias = "gtk_source_snippet_context_get_variable")] #[doc(alias = "get_variable")] pub fn variable(&self, key: &str) -> Option { unsafe { from_glib_none(ffi::gtk_source_snippet_context_get_variable( self.to_glib_none().0, key.to_glib_none().0, )) } } #[doc(alias = "gtk_source_snippet_context_set_constant")] pub fn set_constant(&self, key: &str, value: &str) { unsafe { ffi::gtk_source_snippet_context_set_constant( self.to_glib_none().0, key.to_glib_none().0, value.to_glib_none().0, ); } } #[doc(alias = "gtk_source_snippet_context_set_line_prefix")] pub fn set_line_prefix(&self, line_prefix: &str) { unsafe { ffi::gtk_source_snippet_context_set_line_prefix( self.to_glib_none().0, line_prefix.to_glib_none().0, ); } } #[doc(alias = "gtk_source_snippet_context_set_tab_width")] pub fn set_tab_width(&self, tab_width: i32) { unsafe { ffi::gtk_source_snippet_context_set_tab_width(self.to_glib_none().0, tab_width); } } #[doc(alias = "gtk_source_snippet_context_set_use_spaces")] pub fn set_use_spaces(&self, use_spaces: bool) { unsafe { ffi::gtk_source_snippet_context_set_use_spaces( self.to_glib_none().0, use_spaces.into_glib(), ); } } #[doc(alias = "gtk_source_snippet_context_set_variable")] pub fn set_variable(&self, key: &str, value: &str) { unsafe { ffi::gtk_source_snippet_context_set_variable( self.to_glib_none().0, key.to_glib_none().0, value.to_glib_none().0, ); } } #[doc(alias = "changed")] pub fn connect_changed(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn changed_trampoline( this: *mut ffi::GtkSourceSnippetContext, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"changed\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( changed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for SnippetContext { fn default() -> Self { Self::new() } } sourceview5-0.9.0/src/auto/snippet_manager.rs000064400000000000000000000126451046102023000174030ustar 00000000000000// 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::{ffi, Snippet}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourceSnippetManager")] pub struct SnippetManager(Object); match fn { type_ => || ffi::gtk_source_snippet_manager_get_type(), } } impl SnippetManager { // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`SnippetManager`] objects. /// /// This method returns an instance of [`SnippetManagerBuilder`](crate::builders::SnippetManagerBuilder) which can be used to create [`SnippetManager`] objects. pub fn builder() -> SnippetManagerBuilder { SnippetManagerBuilder::new() } #[doc(alias = "gtk_source_snippet_manager_get_search_path")] #[doc(alias = "get_search_path")] #[doc(alias = "search-path")] pub fn search_path(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::gtk_source_snippet_manager_get_search_path( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_snippet_manager_get_snippet")] #[doc(alias = "get_snippet")] pub fn snippet( &self, group: Option<&str>, language_id: Option<&str>, trigger: &str, ) -> Option { unsafe { from_glib_full(ffi::gtk_source_snippet_manager_get_snippet( self.to_glib_none().0, group.to_glib_none().0, language_id.to_glib_none().0, trigger.to_glib_none().0, )) } } #[cfg(feature = "v5_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_6")))] #[doc(alias = "gtk_source_snippet_manager_list_all")] pub fn list_all(&self) -> gio::ListModel { unsafe { from_glib_none(ffi::gtk_source_snippet_manager_list_all( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_snippet_manager_list_groups")] pub fn list_groups(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_container(ffi::gtk_source_snippet_manager_list_groups( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_snippet_manager_list_matching")] pub fn list_matching( &self, group: Option<&str>, language_id: Option<&str>, trigger_prefix: Option<&str>, ) -> gio::ListModel { unsafe { from_glib_full(ffi::gtk_source_snippet_manager_list_matching( self.to_glib_none().0, group.to_glib_none().0, language_id.to_glib_none().0, trigger_prefix.to_glib_none().0, )) } } #[doc(alias = "gtk_source_snippet_manager_set_search_path")] #[doc(alias = "search-path")] pub fn set_search_path(&self, dirs: &[&str]) { unsafe { ffi::gtk_source_snippet_manager_set_search_path( self.to_glib_none().0, dirs.to_glib_none().0, ); } } #[doc(alias = "gtk_source_snippet_manager_get_default")] #[doc(alias = "get_default")] #[allow(clippy::should_implement_trait)] pub fn default() -> SnippetManager { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::gtk_source_snippet_manager_get_default()) } } #[doc(alias = "search-path")] pub fn connect_search_path_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_search_path_trampoline( this: *mut ffi::GtkSourceSnippetManager, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::search-path\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_search_path_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`SnippetManager`] 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 SnippetManagerBuilder { builder: glib::object::ObjectBuilder<'static, SnippetManager>, } impl SnippetManagerBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn search_path(self, search_path: impl Into) -> Self { Self { builder: self.builder.property("search-path", search_path.into()), } } // rustdoc-stripper-ignore-next /// Build the [`SnippetManager`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> SnippetManager { self.builder.build() } } sourceview5-0.9.0/src/auto/space_drawer.rs000064400000000000000000000147621046102023000166700ustar 00000000000000// 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::{ffi, SpaceLocationFlags, SpaceTypeFlags}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourceSpaceDrawer")] pub struct SpaceDrawer(Object); match fn { type_ => || ffi::gtk_source_space_drawer_get_type(), } } impl SpaceDrawer { #[doc(alias = "gtk_source_space_drawer_new")] pub fn new() -> SpaceDrawer { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gtk_source_space_drawer_new()) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`SpaceDrawer`] objects. /// /// This method returns an instance of [`SpaceDrawerBuilder`](crate::builders::SpaceDrawerBuilder) which can be used to create [`SpaceDrawer`] objects. pub fn builder() -> SpaceDrawerBuilder { SpaceDrawerBuilder::new() } #[doc(alias = "gtk_source_space_drawer_bind_matrix_setting")] pub fn bind_matrix_setting( &self, settings: &impl IsA, key: &str, flags: gio::SettingsBindFlags, ) { unsafe { ffi::gtk_source_space_drawer_bind_matrix_setting( self.to_glib_none().0, settings.as_ref().to_glib_none().0, key.to_glib_none().0, flags.into_glib(), ); } } #[doc(alias = "gtk_source_space_drawer_get_enable_matrix")] #[doc(alias = "get_enable_matrix")] #[doc(alias = "enable-matrix")] pub fn enables_matrix(&self) -> bool { unsafe { from_glib(ffi::gtk_source_space_drawer_get_enable_matrix( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_space_drawer_get_matrix")] #[doc(alias = "get_matrix")] pub fn matrix(&self) -> glib::Variant { unsafe { from_glib_full(ffi::gtk_source_space_drawer_get_matrix( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_space_drawer_get_types_for_locations")] #[doc(alias = "get_types_for_locations")] pub fn types_for_locations(&self, locations: SpaceLocationFlags) -> SpaceTypeFlags { unsafe { from_glib(ffi::gtk_source_space_drawer_get_types_for_locations( self.to_glib_none().0, locations.into_glib(), )) } } #[doc(alias = "gtk_source_space_drawer_set_enable_matrix")] #[doc(alias = "enable-matrix")] pub fn set_enable_matrix(&self, enable_matrix: bool) { unsafe { ffi::gtk_source_space_drawer_set_enable_matrix( self.to_glib_none().0, enable_matrix.into_glib(), ); } } #[doc(alias = "gtk_source_space_drawer_set_matrix")] #[doc(alias = "matrix")] pub fn set_matrix(&self, matrix: Option<&glib::Variant>) { unsafe { ffi::gtk_source_space_drawer_set_matrix(self.to_glib_none().0, matrix.to_glib_none().0); } } #[doc(alias = "gtk_source_space_drawer_set_types_for_locations")] pub fn set_types_for_locations(&self, locations: SpaceLocationFlags, types: SpaceTypeFlags) { unsafe { ffi::gtk_source_space_drawer_set_types_for_locations( self.to_glib_none().0, locations.into_glib(), types.into_glib(), ); } } #[doc(alias = "enable-matrix")] pub fn connect_enable_matrix_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_enable_matrix_trampoline( this: *mut ffi::GtkSourceSpaceDrawer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::enable-matrix\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_enable_matrix_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "matrix")] pub fn connect_matrix_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_matrix_trampoline( this: *mut ffi::GtkSourceSpaceDrawer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::matrix\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_matrix_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for SpaceDrawer { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`SpaceDrawer`] 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 SpaceDrawerBuilder { builder: glib::object::ObjectBuilder<'static, SpaceDrawer>, } impl SpaceDrawerBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn enable_matrix(self, enable_matrix: bool) -> Self { Self { builder: self.builder.property("enable-matrix", enable_matrix), } } pub fn matrix(self, matrix: &glib::Variant) -> Self { Self { builder: self.builder.property("matrix", matrix.clone()), } } // rustdoc-stripper-ignore-next /// Build the [`SpaceDrawer`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> SpaceDrawer { self.builder.build() } } sourceview5-0.9.0/src/auto/style.rs000064400000000000000000000176121046102023000153660ustar 00000000000000// 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::ffi; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "GtkSourceStyle")] pub struct Style(Object); match fn { type_ => || ffi::gtk_source_style_get_type(), } } impl Style { // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Style`] objects. /// /// This method returns an instance of [`StyleBuilder`](crate::builders::StyleBuilder) which can be used to create [`Style`] objects. pub fn builder() -> StyleBuilder { StyleBuilder::new() } #[doc(alias = "gtk_source_style_apply")] pub fn apply(&self, tag: &impl IsA) { unsafe { ffi::gtk_source_style_apply(self.to_glib_none().0, tag.as_ref().to_glib_none().0); } } #[doc(alias = "gtk_source_style_copy")] #[must_use] pub fn copy(&self) -> Style { unsafe { from_glib_full(ffi::gtk_source_style_copy(self.to_glib_none().0)) } } pub fn background(&self) -> Option { ObjectExt::property(self, "background") } #[doc(alias = "background-set")] pub fn is_background_set(&self) -> bool { ObjectExt::property(self, "background-set") } pub fn is_bold(&self) -> bool { ObjectExt::property(self, "bold") } #[doc(alias = "bold-set")] pub fn is_bold_set(&self) -> bool { ObjectExt::property(self, "bold-set") } pub fn foreground(&self) -> Option { ObjectExt::property(self, "foreground") } #[doc(alias = "foreground-set")] pub fn is_foreground_set(&self) -> bool { ObjectExt::property(self, "foreground-set") } pub fn is_italic(&self) -> bool { ObjectExt::property(self, "italic") } #[doc(alias = "italic-set")] pub fn is_italic_set(&self) -> bool { ObjectExt::property(self, "italic-set") } #[doc(alias = "line-background")] pub fn line_background(&self) -> Option { ObjectExt::property(self, "line-background") } #[doc(alias = "line-background-set")] pub fn is_line_background_set(&self) -> bool { ObjectExt::property(self, "line-background-set") } #[doc(alias = "pango-underline")] pub fn pango_underline(&self) -> pango::Underline { ObjectExt::property(self, "pango-underline") } pub fn scale(&self) -> Option { ObjectExt::property(self, "scale") } #[doc(alias = "scale-set")] pub fn is_scale_set(&self) -> bool { ObjectExt::property(self, "scale-set") } pub fn is_strikethrough(&self) -> bool { ObjectExt::property(self, "strikethrough") } #[doc(alias = "strikethrough-set")] pub fn is_strikethrough_set(&self) -> bool { ObjectExt::property(self, "strikethrough-set") } #[doc(alias = "underline-color")] pub fn underline_color(&self) -> Option { ObjectExt::property(self, "underline-color") } #[doc(alias = "underline-color-set")] pub fn is_underline_color_set(&self) -> bool { ObjectExt::property(self, "underline-color-set") } #[doc(alias = "underline-set")] pub fn is_underline_set(&self) -> bool { ObjectExt::property(self, "underline-set") } pub fn weight(&self) -> pango::Weight { ObjectExt::property(self, "weight") } #[doc(alias = "weight-set")] pub fn is_weight_set(&self) -> bool { ObjectExt::property(self, "weight-set") } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Style`] 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 StyleBuilder { builder: glib::object::ObjectBuilder<'static, Style>, } impl StyleBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn background(self, background: impl Into) -> Self { Self { builder: self.builder.property("background", background.into()), } } pub fn background_set(self, background_set: bool) -> Self { Self { builder: self.builder.property("background-set", background_set), } } pub fn bold(self, bold: bool) -> Self { Self { builder: self.builder.property("bold", bold), } } pub fn bold_set(self, bold_set: bool) -> Self { Self { builder: self.builder.property("bold-set", bold_set), } } pub fn foreground(self, foreground: impl Into) -> Self { Self { builder: self.builder.property("foreground", foreground.into()), } } pub fn foreground_set(self, foreground_set: bool) -> Self { Self { builder: self.builder.property("foreground-set", foreground_set), } } pub fn italic(self, italic: bool) -> Self { Self { builder: self.builder.property("italic", italic), } } pub fn italic_set(self, italic_set: bool) -> Self { Self { builder: self.builder.property("italic-set", italic_set), } } pub fn line_background(self, line_background: impl Into) -> Self { Self { builder: self .builder .property("line-background", line_background.into()), } } pub fn line_background_set(self, line_background_set: bool) -> Self { Self { builder: self .builder .property("line-background-set", line_background_set), } } pub fn pango_underline(self, pango_underline: pango::Underline) -> Self { Self { builder: self.builder.property("pango-underline", pango_underline), } } pub fn scale(self, scale: impl Into) -> Self { Self { builder: self.builder.property("scale", scale.into()), } } pub fn scale_set(self, scale_set: bool) -> Self { Self { builder: self.builder.property("scale-set", scale_set), } } pub fn strikethrough(self, strikethrough: bool) -> Self { Self { builder: self.builder.property("strikethrough", strikethrough), } } pub fn strikethrough_set(self, strikethrough_set: bool) -> Self { Self { builder: self .builder .property("strikethrough-set", strikethrough_set), } } pub fn underline_color(self, underline_color: impl Into) -> Self { Self { builder: self .builder .property("underline-color", underline_color.into()), } } pub fn underline_color_set(self, underline_color_set: bool) -> Self { Self { builder: self .builder .property("underline-color-set", underline_color_set), } } pub fn underline_set(self, underline_set: bool) -> Self { Self { builder: self.builder.property("underline-set", underline_set), } } pub fn weight(self, weight: pango::Weight) -> Self { Self { builder: self.builder.property("weight", weight), } } pub fn weight_set(self, weight_set: bool) -> Self { Self { builder: self.builder.property("weight-set", weight_set), } } // rustdoc-stripper-ignore-next /// Build the [`Style`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Style { self.builder.build() } } sourceview5-0.9.0/src/auto/style_scheme.rs000064400000000000000000000151641046102023000167120ustar 00000000000000// 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::{ffi, Style}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GtkSourceStyleScheme")] pub struct StyleScheme(Object); match fn { type_ => || ffi::gtk_source_style_scheme_get_type(), } } impl StyleScheme { // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`StyleScheme`] objects. /// /// This method returns an instance of [`StyleSchemeBuilder`](crate::builders::StyleSchemeBuilder) which can be used to create [`StyleScheme`] objects. pub fn builder() -> StyleSchemeBuilder { StyleSchemeBuilder::new() } #[doc(alias = "gtk_source_style_scheme_get_authors")] #[doc(alias = "get_authors")] pub fn authors(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::gtk_source_style_scheme_get_authors( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_style_scheme_get_description")] #[doc(alias = "get_description")] pub fn description(&self) -> Option { unsafe { from_glib_none(ffi::gtk_source_style_scheme_get_description( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_style_scheme_get_filename")] #[doc(alias = "get_filename")] pub fn filename(&self) -> Option { unsafe { from_glib_none(ffi::gtk_source_style_scheme_get_filename( self.to_glib_none().0, )) } } #[doc(alias = "gtk_source_style_scheme_get_id")] #[doc(alias = "get_id")] pub fn id(&self) -> glib::GString { unsafe { from_glib_none(ffi::gtk_source_style_scheme_get_id(self.to_glib_none().0)) } } #[cfg(feature = "v5_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v5_4")))] #[doc(alias = "gtk_source_style_scheme_get_metadata")] #[doc(alias = "get_metadata")] pub fn metadata(&self, name: &str) -> Option { unsafe { from_glib_none(ffi::gtk_source_style_scheme_get_metadata( self.to_glib_none().0, name.to_glib_none().0, )) } } #[doc(alias = "gtk_source_style_scheme_get_name")] #[doc(alias = "get_name")] pub fn name(&self) -> glib::GString { unsafe { from_glib_none(ffi::gtk_source_style_scheme_get_name(self.to_glib_none().0)) } } #[doc(alias = "gtk_source_style_scheme_get_style")] #[doc(alias = "get_style")] pub fn style(&self, style_id: &str) -> Option