gtk4/auto/
any_filter.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{ffi, Buildable, Filter, MultiFilter};
6use glib::translate::*;
7
8glib::wrapper! {
9    /// Matches an item when at least one of its filters matches.
10    ///
11    /// To add filters to a [`AnyFilter`][crate::AnyFilter], use [`MultiFilterExt::append()`][crate::prelude::MultiFilterExt::append()].
12    ///
13    /// # Implements
14    ///
15    /// [`MultiFilterExt`][trait@crate::prelude::MultiFilterExt], [`FilterExt`][trait@crate::prelude::FilterExt], [`trait@glib::ObjectExt`], [`trait@gio::prelude::ListModelExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt]
16    #[doc(alias = "GtkAnyFilter")]
17    pub struct AnyFilter(Object<ffi::GtkAnyFilter, ffi::GtkAnyFilterClass>) @extends MultiFilter, Filter, @implements gio::ListModel, Buildable;
18
19    match fn {
20        type_ => || ffi::gtk_any_filter_get_type(),
21    }
22}
23
24impl AnyFilter {
25    /// Creates a new empty "any" filter.
26    ///
27    /// Use [`MultiFilterExt::append()`][crate::prelude::MultiFilterExt::append()] to add filters to it.
28    ///
29    /// This filter matches an item if any of the filters added to it
30    /// matches the item. In particular, this means that if no filter
31    /// has been added to it, the filter matches no item.
32    ///
33    /// # Returns
34    ///
35    /// a new [`AnyFilter`][crate::AnyFilter]
36    #[doc(alias = "gtk_any_filter_new")]
37    pub fn new() -> AnyFilter {
38        assert_initialized_main_thread!();
39        unsafe { from_glib_full(ffi::gtk_any_filter_new()) }
40    }
41}
42
43impl Default for AnyFilter {
44    fn default() -> Self {
45        Self::new()
46    }
47}