libadwaita-0.7.2/.cargo_vcs_info.json0000644000000001500000000000100131370ustar { "git": { "sha1": "b0bb4cb809cd38dbedbeba6dc7129ea0ed3476a6" }, "path_in_vcs": "libadwaita" }libadwaita-0.7.2/Cargo.lock0000644000000427300000000000100111240ustar # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 4 [[package]] name = "autocfg" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" [[package]] name = "cairo-rs" version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae50b5510d86cf96ac2370e66d8dc960882f3df179d6a5a1e52bd94a1416c0f7" dependencies = [ "bitflags", "cairo-sys-rs", "glib", "libc", ] [[package]] name = "cairo-sys-rs" version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f18b6bb8e43c7eb0f2aac7976afe0c61b6f5fc2ab7bc4c139537ea56c92290df" dependencies = [ "glib-sys", "libc", "system-deps", ] [[package]] name = "cfg-expr" version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d4ba6e40bd1184518716a6e1a781bf9160e286d219ccdb8ab2612e74cfe4789" dependencies = [ "smallvec", "target-lexicon", ] [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "field-offset" version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" dependencies = [ "memoffset", "rustc_version", ] [[package]] name = "futures-channel" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", ] [[package]] name = "futures-core" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", "futures-util", ] [[package]] name = "futures-io" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "futures-task" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-core", "futures-macro", "futures-task", "pin-project-lite", "pin-utils", "slab", ] [[package]] name = "gdk-pixbuf" version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7563afd6ff0a221edfbb70a78add5075b8d9cb48e637a40a24c3ece3fea414d0" dependencies = [ "gdk-pixbuf-sys", "gio", "glib", "libc", ] [[package]] name = "gdk-pixbuf-sys" version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67f2587c9202bf997476bbba6aaed4f78a11538a2567df002a5f57f5331d0b5c" dependencies = [ "gio-sys", "glib-sys", "gobject-sys", "libc", "system-deps", ] [[package]] name = "gdk4" version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4850c9d9c1aecd1a3eb14fadc1cdb0ac0a2298037e116264c7473e1740a32d60" dependencies = [ "cairo-rs", "gdk-pixbuf", "gdk4-sys", "gio", "glib", "libc", "pango", ] [[package]] name = "gdk4-sys" version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f6eb95798e2b46f279cf59005daf297d5b69555428f185650d71974a910473a" dependencies = [ "cairo-sys-rs", "gdk-pixbuf-sys", "gio-sys", "glib-sys", "gobject-sys", "libc", "pango-sys", "pkg-config", "system-deps", ] [[package]] name = "gio" version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4f00c70f8029d84ea7572dd0e1aaa79e5329667b4c17f329d79ffb1e6277487" dependencies = [ "futures-channel", "futures-core", "futures-io", "futures-util", "gio-sys", "glib", "libc", "pin-project-lite", "smallvec", ] [[package]] name = "gio-sys" version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "160eb5250a26998c3e1b54e6a3d4ea15c6c7762a6062a19a7b63eff6e2b33f9e" dependencies = [ "glib-sys", "gobject-sys", "libc", "system-deps", "windows-sys", ] [[package]] name = "glib" version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "707b819af8059ee5395a2de9f2317d87a53dbad8846a2f089f0bb44703f37686" dependencies = [ "bitflags", "futures-channel", "futures-core", "futures-executor", "futures-task", "futures-util", "gio-sys", "glib-macros", "glib-sys", "gobject-sys", "libc", "memchr", "smallvec", ] [[package]] name = "glib-macros" version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "715601f8f02e71baef9c1f94a657a9a77c192aea6097cf9ae7e5e177cd8cde68" dependencies = [ "heck", "proc-macro-crate", "proc-macro2", "quote", "syn", ] [[package]] name = "glib-sys" version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8928869a44cfdd1fccb17d6746e4ff82c8f82e41ce705aa026a52ca8dc3aefb" dependencies = [ "libc", "system-deps", ] [[package]] name = "gobject-sys" version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c773a3cb38a419ad9c26c81d177d96b4b08980e8bdbbf32dace883e96e96e7e3" dependencies = [ "glib-sys", "libc", "system-deps", ] [[package]] name = "graphene-rs" version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3cbc5911bfb32d68dcfa92c9510c462696c2f715548fcd7f3f1be424c739de19" dependencies = [ "glib", "graphene-sys", "libc", ] [[package]] name = "graphene-sys" version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11a68d39515bf340e879b72cecd4a25c1332557757ada6e8aba8654b4b81d23a" dependencies = [ "glib-sys", "libc", "pkg-config", "system-deps", ] [[package]] name = "gsk4" version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61f5e72f931c8c9f65fbfc89fe0ddc7746f147f822f127a53a9854666ac1f855" dependencies = [ "cairo-rs", "gdk4", "glib", "graphene-rs", "gsk4-sys", "libc", "pango", ] [[package]] name = "gsk4-sys" version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "755059de55fa6f85a46bde8caf03e2184c96bfda1f6206163c72fb0ea12436dc" dependencies = [ "cairo-sys-rs", "gdk4-sys", "glib-sys", "gobject-sys", "graphene-sys", "libc", "pango-sys", "system-deps", ] [[package]] name = "gtk4" version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af1c491051f030994fd0cde6f3c44f3f5640210308cff1298c7673c47408091d" dependencies = [ "cairo-rs", "field-offset", "futures-channel", "gdk-pixbuf", "gdk4", "gio", "glib", "graphene-rs", "gsk4", "gtk4-macros", "gtk4-sys", "libc", "pango", ] [[package]] name = "gtk4-macros" version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ed1786c4703dd196baf7e103525ce0cf579b3a63a0570fe653b7ee6bac33999" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", "syn", ] [[package]] name = "gtk4-sys" version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41e03b01e54d77c310e1d98647d73f996d04b2f29b9121fe493ea525a7ec03d6" dependencies = [ "cairo-sys-rs", "gdk-pixbuf-sys", "gdk4-sys", "gio-sys", "glib-sys", "gobject-sys", "graphene-sys", "gsk4-sys", "libc", "pango-sys", "system-deps", ] [[package]] name = "hashbrown" version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" [[package]] name = "heck" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "indexmap" version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" dependencies = [ "equivalent", "hashbrown", ] [[package]] name = "libadwaita" version = "0.7.2" dependencies = [ "gdk4", "gio", "glib", "gtk4", "libadwaita-sys", "libc", "pango", ] [[package]] name = "libadwaita-sys" version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6680988058c2558baf3f548a370e4e78da3bf7f08469daa822ac414842c912db" dependencies = [ "gdk4-sys", "gio-sys", "glib-sys", "gobject-sys", "gtk4-sys", "libc", "pango-sys", "system-deps", ] [[package]] name = "libc" version = "0.2.171" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" [[package]] name = "memchr" version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "memoffset" version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" dependencies = [ "autocfg", ] [[package]] name = "pango" version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b1f5dc1b8cf9bc08bfc0843a04ee0fa2e78f1e1fa4b126844a383af4f25f0ec" dependencies = [ "gio", "glib", "libc", "pango-sys", ] [[package]] name = "pango-sys" version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dbb9b751673bd8fe49eb78620547973a1e719ed431372122b20abd12445bab5" dependencies = [ "glib-sys", "gobject-sys", "libc", "system-deps", ] [[package]] name = "pin-project-lite" version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "proc-macro-crate" version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" dependencies = [ "toml_edit", ] [[package]] name = "proc-macro2" version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ "unicode-ident", ] [[package]] name = "quote" version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] [[package]] name = "rustc_version" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver", ] [[package]] name = "semver" version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" [[package]] name = "serde" version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "serde_spanned" version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] [[package]] name = "slab" version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] [[package]] name = "smallvec" version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" [[package]] name = "syn" version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "system-deps" version = "7.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66d23aaf9f331227789a99e8de4c91bf46703add012bdfd45fdecdfb2975a005" dependencies = [ "cfg-expr", "heck", "pkg-config", "toml", "version-compare", ] [[package]] name = "target-lexicon" version = "0.12.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "toml" version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" dependencies = [ "serde", "serde_spanned", "toml_datetime", "toml_edit", ] [[package]] name = "toml_datetime" version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] [[package]] name = "toml_edit" version = "0.22.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" dependencies = [ "indexmap", "serde", "serde_spanned", "toml_datetime", "winnow", ] [[package]] name = "unicode-ident" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "version-compare" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" [[package]] name = "windows-sys" version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", "windows_i686_gnullvm", "windows_i686_msvc", "windows_x86_64_gnu", "windows_x86_64_gnullvm", "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e97b544156e9bebe1a0ffbc03484fc1ffe3100cbce3ffb17eac35f7cdd7ab36" dependencies = [ "memchr", ] libadwaita-0.7.2/Cargo.toml0000644000000040270000000000100111440ustar # 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 = "libadwaita" version = "0.7.2" authors = ["Bilal Elmoussaoui "] build = false autolib = false autobins = false autoexamples = false autotests = false autobenches = false description = "Rust bindings for libadwaita" homepage = "https://world.pages.gitlab.gnome.org/Rust/libadwaita-rs/" documentation = "https://world.pages.gitlab.gnome.org/Rust/libadwaita-rs/stable/latest/docs/libadwaita" readme = "README.md" keywords = [ "gtk4-rs", "gnome", "adwaita", "GUI", ] categories = [ "api-bindings", "gui", ] license = "MIT" repository = "https://gitlab.gnome.org/World/Rust/libadwaita-rs" [package.metadata.docs.rs] all-features = true rustc-args = [ "--cfg", "docsrs", ] rustdoc-args = [ "--cfg", "docsrs", ] [features] gio_v2_80 = ["gio/v2_80"] gtk_v4_2 = ["gtk/v4_2"] gtk_v4_6 = [ "gtk_v4_2", "gtk/v4_6", ] v1_1 = ["ffi/v1_1"] v1_2 = [ "v1_1", "ffi/v1_2", ] v1_3 = [ "v1_2", "ffi/v1_3", ] v1_4 = [ "v1_3", "ffi/v1_4", ] v1_5 = [ "v1_4", "ffi/v1_5", ] v1_6 = [ "v1_5", "ffi/v1_6", ] v1_7 = [ "v1_6", "ffi/v1_7", ] [lib] name = "libadwaita" path = "src/lib.rs" [[example]] name = "hello-world" path = "examples/hello-world.rs" [dependencies.ffi] version = "0.7" package = "libadwaita-sys" [dependencies.gdk] version = "0.9" package = "gdk4" [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" libadwaita-0.7.2/Cargo.toml.orig000064400000000000000000000030701046102023000146220ustar 00000000000000[package] name = "libadwaita" version = "0.7.2" authors = ["Bilal Elmoussaoui "] edition = "2021" readme = "../README.md" homepage = "https://world.pages.gitlab.gnome.org/Rust/libadwaita-rs/" description = "Rust bindings for libadwaita" license = "MIT" repository = "https://gitlab.gnome.org/World/Rust/libadwaita-rs" documentation = "https://world.pages.gitlab.gnome.org/Rust/libadwaita-rs/stable/latest/docs/libadwaita" categories = ["api-bindings", "gui"] keywords = ["gtk4-rs", "gnome", "adwaita", "GUI"] [lib] name = "libadwaita" [features] gtk_v4_2 = ["gtk/v4_2"] gtk_v4_6 = ["gtk_v4_2", "gtk/v4_6"] gio_v2_80 = ["gio/v2_80"] v1_1 = ["ffi/v1_1"] v1_2 = ["v1_1", "ffi/v1_2"] v1_3 = ["v1_2", "ffi/v1_3"] v1_4 = ["v1_3", "ffi/v1_4"] v1_5 = ["v1_4", "ffi/v1_5"] v1_6 = ["v1_5", "ffi/v1_6"] v1_7 = ["v1_6", "ffi/v1_7"] [package.metadata.docs.rs] all-features = true rustc-args = ["--cfg", "docsrs"] rustdoc-args = ["--cfg", "docsrs"] [dependencies] libc = '0.2' [dependencies.glib] git = "https://github.com/gtk-rs/gtk-rs-core" branch = "0.20" version = "0.20" [dependencies.gio] git = "https://github.com/gtk-rs/gtk-rs-core" branch = "0.20" version = "0.20" [dependencies.pango] git = "https://github.com/gtk-rs/gtk-rs-core" branch = "0.20" version = "0.20" [dependencies.gdk] package = "gdk4" git = "https://github.com/gtk-rs/gtk4-rs" branch = "0.9" version = "0.9" [dependencies.gtk] package = "gtk4" git = "https://github.com/gtk-rs/gtk4-rs" branch = "0.9" version = "0.9" [dependencies.ffi] package = "libadwaita-sys" path = './sys' version = "0.7" libadwaita-0.7.2/Gir.toml000064400000000000000000000231721046102023000133560ustar 00000000000000[external_libraries] Gio = {min_version = "2.66"} [options] girs_directories = ["../gir-files", "../"] library = "Adw" version = "1" min_cfg_version = "1" target_path = "." use_gi_docgen = true work_mode = "normal" generate_safety_asserts = true deprecate_by_min_version = true # with this option enabled, versions for gir and gir-files saved only to one file to minimize noise single_version_file = true generate_builder = true trust_return_value_nullability = true external_libraries = [ "GLib", "GObject", "Gdk", "GdkPixbuf", "Gtk", "Pango", ] generate = [ "Adw.AccentColor", "Adw.ActionRow", "Adw.AnimationState", "Adw.Avatar", "Adw.Banner", "Adw.BannerButtonStyle", "Adw.Bin", "Adw.BottomSheet", "Adw.BreakpointBin", "Adw.BreakpointConditionLengthType", "Adw.BreakpointConditionRatioType", "Adw.ButtonContent", "Adw.ButtonRow", "Adw.CarouselIndicatorDots", "Adw.CarouselIndicatorLines", "Adw.CenteringPolicy", "Adw.Clamp", "Adw.ClampLayout", "Adw.ClampScrollable", "Adw.ColorScheme", "Adw.ComboRow", "Adw.DialogPresentationMode", "Adw.Easing", "Adw.EntryRow", "Adw.ExpanderRow", "Adw.FoldThresholdPolicy", "Adw.Flap", "Adw.FlapFoldPolicy", "Adw.FlapTransitionType", "Adw.EnumListItem", "Adw.HeaderBar", "Adw.InlineViewSwitcherDisplayMode", "Adw.InlineViewSwitcher", "Adw.JustifyMode", "Adw.LayoutSlot", "Adw.Leaflet", "Adw.LeafletTransitionType", "Adw.LengthUnit", "Adw.MultiLayoutView", "Adw.NavigationDirection", "Adw.NavigationPage", "Adw.NavigationSplitView", "Adw.NavigationView", "Adw.OverlaySplitView", "Adw.PackDirection", "Adw.PasswordEntryRow", "Adw.PreferencesDialog", "Adw.PreferencesGroup", "Adw.PreferencesPage", "Adw.PreferencesRow", "Adw.PreferencesWindow", "Adw.ResponseAppearance", "Adw.Spinner", "Adw.SplitButton", "Adw.SpringAnimation", "Adw.SpringParams", "Adw.Squeezer", "Adw.SqueezerTransitionType", "Adw.StatusPage", "Adw.SwipeTracker", "Adw.SwitchRow", "Adw.Swipeable", "Adw.TabButton", "Adw.TabViewShortcuts", "Adw.TimedAnimation", "Adw.ToastPriority", "Adw.Toggle", "Adw.ToggleGroup", "Adw.ToolbarStyle", "Adw.ToolbarView", "Adw.ViewStack", "Adw.ViewSwitcher", "Adw.ViewSwitcherBar", "Adw.ViewSwitcherPolicy", "Adw.ViewSwitcherTitle", "Adw.WindowTitle", "Adw.WrapBox", "Adw.WrapLayout", "Adw.WrapPolicy", ] manual = [ "GLib.Variant", "GObject.Object", "GObject.ParamSpec", "GObject.Value", "Gdk.Cursor", "Gdk.Display", "Gdk.DragAction", "Gdk.Paintable", "Gdk.RGBA", "Gdk.Rectangle", "Gdk.Texture", "Gio.Application", "Gio.ApplicationFlags", "Gio.ActionGroup", "Gio.ActionMap", "Gio.Cancellable", "Gio.Icon", "Gio.ListModel", "Gio.MenuModel", "Gtk.Accessible", "Gtk.AccessibleRole", "Gtk.Actionable", "Gtk.Adjustment", "Gtk.Align", "Gtk.Application", "Gtk.ApplicationWindow", "Gtk.ArrowType", "Gtk.Buildable", "Gtk.ConstraintTarget", "Gtk.Editable", "Gtk.Entry", "Gtk.Expression", "Gtk.HeaderBar", "Gtk.InputHints", "Gtk.InputPurpose", "Gtk.LayoutManager", "Gtk.License", "Gtk.ListBoxRow", "Gtk.ListItemFactory", "Gtk.ListView", "Gtk.Native", "Gtk.Orientable", "Gtk.Orientation", "Gtk.Overflow", "Gtk.PackType", "Gtk.Popover", "Gtk.Root", "Gtk.Scrollable", "Gtk.ScrollablePolicy", "Gtk.ScrolledWindow", "Gtk.SelectionModel", "Gtk.Settings", "Gtk.ShortcutManager", "Gtk.SpinButtonUpdatePolicy", "Gtk.Stack", "Gtk.StringFilterMatchMode", "Gtk.Widget", "Pango.AttrList", "Pango.EllipsizeMode", ] [[object]] name = "Gtk.Window" status = "manual" trait_name = "GtkWindowExt" [[object.property]] name = "child" # adw use content not child, using it could result in a crash ignore = true [[object]] name = "Adw.*" status = "generate" [[object.constant]] name = "VERSION_S" ignore = true [[object.function]] name = "get_enable_animations" rename = "is_animations_enabled" [[object.function]] name = "init" manual = true [[object.function]] name = "show_about_window" ignore = true # C only function, replaced by AboutWindow::builder [[object.function]] pattern = "(show_about_dialog_from_appdata|show_about_window_from_appdata|show_about_dialog|show_about_window)" ignore = true # C only function [[object]] name = "Adw.AboutDialog" status = "generate" [[object.function]] name = "new_from_appdata" cfg_condition = "not(target_env = \"msvc\")" [[object]] name = "Adw.AboutWindow" status = "generate" [[object.function]] name = "new_from_appdata" cfg_condition = "not(target_env = \"msvc\")" [[object]] name = "Adw.AlertDialog" status = "generate" manual_traits = ["AlertDialogExtManual"] [[object.function]] name = "add_responses" manual = true [[object.function]] pattern = "(format_body|format_body_markup|format_heading|format_heading_markup)" ignore = true # C only function [[object.function]] name = "get_response_label" manual = true # assert has_response [[object.function]] name = "choose" manual = true [[object.function]] name = "get_prefer_wide_layout" rename = "prefers_wide_layout" [[object]] name = "Adw.Animation" status = "generate" generate_builder = false [[object]] name = "Adw.AnimationTarget" status = "generate" generate_builder = false [[object]] name = "Adw.Application" status = "generate" builder_postprocess = "Application::register_startup_hook(&ret);" trait_name = "AdwApplicationExt" [[object.function]] name = "new" manual = true [[object]] name = "Adw.ApplicationWindow" status = "generate" trait_name = "AdwApplicationWindowExt" [[object]] name = "Adw.Breakpoint" status = "generate" generate_builder = false [[object.function]] pattern = "(add_setters_valist|add_setters)" ignore = true # C only functions, add_setters replaced by add_settersv [[object.function]] name = "add_settersv" rename = "add_setters" manual = true [[object.function]] name = "set_condition" [[object.function.parameter]] name = "condition" const = true # iter shouldn't be mutable here [[object]] name = "Adw.BreakpointCondition" status = "generate" [[object.function]] name = "to_string" [[object.function.parameter]] name = "self" const = true # iter shouldn't be mutable here [[object.function]] name = "parse" [object.function.return] nullable = true nullable_return_is_error = "Invalid condition" [[object]] name = "Adw.CallbackAnimationTarget" status = "generate" generate_builder = false [[object]] name = "Adw.Carousel" status = "generate" [[object.function]] name = "get_nth_page" manual = true # assert n < n_pages [[object]] name = "Adw.Dialog" status = "generate" trait_name = "AdwDialogExt" [[object]] name = "Adw.EnumListModel" status = "generate" generate_builder = false [[object]] name = "Adw.Layout" status = "generate" generate_builder = false [[object]] name = "Adw.LeafletPage" status = "generate" generate_builder = false [[object]] name = "Adw.MessageDialog" status = "generate" manual_traits = ["MessageDialogExtManual"] [[object.function]] name = "add_responses" manual = true [[object.function]] pattern = "(format_body|format_body_markup|format_heading|format_heading_markup)" ignore = true # C only function [[object.function]] name = "get_response_label" manual = true # assert has_response [[object.function]] name = "choose" manual = true [[object]] name = "Adw.PropertyAnimationTarget" status = "generate" generate_builder = false [[object]] name = "Adw.SpinnerPaintable" status = "generate" generate_builder = false [[object]] name = "Adw.SpinRow" status = "generate" [[object.signal]] name = "input" manual = true [[object]] name = "Adw.StyleManager" status = "generate" generate_builder = false [[object.function]] name = "get_system_supports_color_schemes" rename = "system_supports_color_schemes" [[object]] name = "Adw.SqueezerPage" status = "generate" generate_builder = false [[object]] name = "Adw.TabBar" status = "generate" [[object.function]] name = "setup_extra_drop_target" manual = true # somehow gir fails to handle functions that have a array with a specific length [[object]] name = "Adw.TabOverview" status = "generate" [[object.function]] name = "setup_extra_drop_target" manual = true # somehow gir fails to handle functions that have a array with a specific length [[object]] name = "Adw.TabView" status = "generate" [[object.function]] name = "get_nth_page" manual = true # assert n < n_pages [[object.signal]] name = "close-page" inhibit = true [[object]] name = "Adw.Toast" status = "generate" [[object.function]] name = "new_format" ignore = true # C only function [[object.function]] name = "set_action_target" manual = true [[object.property]] name = "action-target" generate = ["notify"] [[object]] name = "Adw.ToastOverlay" status = "generate" generate_builder = false [[object]] name = "Adw.TabPage" status = "generate" generate_builder = false [[object]] name = "Adw.ViewStackPage" status = "generate" generate_builder = false [[object]] name = "Adw.ViewStackPages" status = "generate" generate_builder = false [[object]] name = "Adw.Window" status = "generate" trait_name = "AdwWindowExt" libadwaita-0.7.2/LICENCE000064400000000000000000000020001046102023000127100ustar 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. libadwaita-0.7.2/README.md000064400000000000000000000006111046102023000132100ustar 00000000000000# libadwaita-rs The Rust bindings of [libadwaita](https://gitlab.gnome.org/GNOME/libadwaita) Website: ## Documentation - libadwaita: - libadwaita-sys: libadwaita-0.7.2/examples/hello-world.rs000064400000000000000000000031371046102023000163530ustar 00000000000000use libadwaita as adw; use adw::prelude::*; use adw::{ActionRow, ApplicationWindow, HeaderBar}; use gtk::{Application, Box, ListBox, Orientation}; fn main() { let application = Application::builder() .application_id("com.example.FirstAdwaitaApp") .build(); application.connect_startup(|_| { adw::init().unwrap(); }); application.connect_activate(|app| { // ActionRows are only available in Adwaita let row = ActionRow::builder() .activatable(true) .selectable(false) .title("Click me") .build(); row.connect_activated(|_| { eprintln!("Clicked!"); }); let list = ListBox::builder() .margin_top(32) .margin_end(32) .margin_bottom(32) .margin_start(32) // the content class makes the list look nicer .css_classes(vec![String::from("content")]) .build(); list.append(&row); // Combine the content in a box let content = Box::new(Orientation::Vertical, 0); // Adwaitas' ApplicationWindow does not include a HeaderBar content.append( &HeaderBar::builder() .title_widget(&adw::WindowTitle::new("First App", "")) .build(), ); content.append(&list); let window = ApplicationWindow::builder() .application(app) .default_width(350) // add content to window .content(&content) .build(); window.show(); }); application.run(); } libadwaita-0.7.2/src/alert_dialog.rs000064400000000000000000000064211046102023000155210ustar 00000000000000use glib::object::IsA; use glib::translate::*; use crate::prelude::*; use crate::AlertDialog; use std::boxed::Box as Box_; use std::pin::Pin; mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait AlertDialogExtManual: sealed::Sealed + IsA + 'static { #[doc(alias = "adw_alert_dialog_get_response_label")] #[doc(alias = "get_response_label")] fn response_label(&self, response: &str) -> glib::GString { assert!(self.as_ref().has_response(response)); unsafe { from_glib_none(ffi::adw_alert_dialog_get_response_label( self.as_ref().to_glib_none().0, response.to_glib_none().0, )) } } #[doc(alias = "adw_alert_dialog_add_responses")] fn add_responses(&self, ids_and_labels: &[(&str, &str)]) { ids_and_labels.iter().for_each(|(id, label)| { self.add_response(id, label); }); } #[doc(alias = "adw_alert_dialog_choose")] fn choose( self, parent: &impl IsA, 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 choose_trampoline( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer, ) { let result = from_glib_none(ffi::adw_alert_dialog_choose_finish( _source_object as *mut _, res, )); let callback: Box_> = Box_::from_raw(user_data as *mut _); let callback: P = callback.into_inner(); callback(result); } let callback = choose_trampoline::

; unsafe { ffi::adw_alert_dialog_choose( self.upcast().into_glib_ptr(), parent.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _, ); } } fn choose_future( self, parent: &impl IsA, ) -> Pin + 'static>> { let parent = parent.clone(); Box_::pin(gio::GioFuture::new( &self, move |obj: &Self, cancellable, send| { obj.clone().choose(&parent, Some(cancellable), move |res| { send.resolve(res); }); }, )) } } impl> AlertDialogExtManual for O {} libadwaita-0.7.2/src/application.rs000064400000000000000000000027461046102023000154040ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::Application; use glib::translate::*; use std::cell::RefCell; use std::rc::Rc; use glib::prelude::*; use glib::signal::SignalHandlerId; use gtk::prelude::*; impl Application { #[doc(alias = "adw_application_new")] pub fn new(application_id: Option<&str>, flags: gio::ApplicationFlags) -> Self { skip_assert_initialized!(); let app = unsafe { from_glib_full(ffi::adw_application_new( application_id.to_glib_none().0, flags.into_glib(), )) }; Self::register_startup_hook(&app); app } pub(crate) fn register_startup_hook(app: &Self) { skip_assert_initialized!(); let signalid: Rc>> = Rc::new(RefCell::new(None)); { let signalid_ = signalid.clone(); let id = app.connect_startup(move |app| { app.disconnect( signalid_ .borrow_mut() .take() .expect("Signal ID went missing"), ); gtk::init().expect("Failed to initialize gtk4"); }); *signalid.borrow_mut() = Some(id); } } } impl Default for Application { fn default() -> Self { let app = glib::object::Object::new::(); Self::register_startup_hook(&app); app } } libadwaita-0.7.2/src/auto/about_dialog.rs000064400000000000000000001430271046102023000165000ustar 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, Dialog, DialogPresentationMode}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwAboutDialog")] pub struct AboutDialog(Object) @extends Dialog, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::ShortcutManager; match fn { type_ => || ffi::adw_about_dialog_get_type(), } } impl AboutDialog { #[doc(alias = "adw_about_dialog_new")] pub fn new() -> AboutDialog { assert_initialized_main_thread!(); unsafe { Dialog::from_glib_none(ffi::adw_about_dialog_new()).unsafe_cast() } } #[cfg(not(target_env = "msvc"))] #[cfg_attr(docsrs, doc(cfg(not(target_env = "msvc"))))] #[doc(alias = "adw_about_dialog_new_from_appdata")] #[doc(alias = "new_from_appdata")] pub fn from_appdata(resource_path: &str, release_notes_version: Option<&str>) -> AboutDialog { assert_initialized_main_thread!(); unsafe { Dialog::from_glib_none(ffi::adw_about_dialog_new_from_appdata( resource_path.to_glib_none().0, release_notes_version.to_glib_none().0, )) .unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`AboutDialog`] objects. /// /// This method returns an instance of [`AboutDialogBuilder`](crate::builders::AboutDialogBuilder) which can be used to create [`AboutDialog`] objects. pub fn builder() -> AboutDialogBuilder { AboutDialogBuilder::new() } #[doc(alias = "adw_about_dialog_add_acknowledgement_section")] pub fn add_acknowledgement_section(&self, name: Option<&str>, people: &[&str]) { unsafe { ffi::adw_about_dialog_add_acknowledgement_section( self.to_glib_none().0, name.to_glib_none().0, people.to_glib_none().0, ); } } #[doc(alias = "adw_about_dialog_add_credit_section")] pub fn add_credit_section(&self, name: Option<&str>, people: &[&str]) { unsafe { ffi::adw_about_dialog_add_credit_section( self.to_glib_none().0, name.to_glib_none().0, people.to_glib_none().0, ); } } #[doc(alias = "adw_about_dialog_add_legal_section")] pub fn add_legal_section( &self, title: &str, copyright: Option<&str>, license_type: gtk::License, license: Option<&str>, ) { unsafe { ffi::adw_about_dialog_add_legal_section( self.to_glib_none().0, title.to_glib_none().0, copyright.to_glib_none().0, license_type.into_glib(), license.to_glib_none().0, ); } } #[doc(alias = "adw_about_dialog_add_link")] pub fn add_link(&self, title: &str, url: &str) { unsafe { ffi::adw_about_dialog_add_link( self.to_glib_none().0, title.to_glib_none().0, url.to_glib_none().0, ); } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_about_dialog_add_other_app")] pub fn add_other_app(&self, appid: &str, name: &str, summary: &str) { unsafe { ffi::adw_about_dialog_add_other_app( self.to_glib_none().0, appid.to_glib_none().0, name.to_glib_none().0, summary.to_glib_none().0, ); } } #[doc(alias = "adw_about_dialog_get_application_icon")] #[doc(alias = "get_application_icon")] #[doc(alias = "application-icon")] pub fn application_icon(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_dialog_get_application_icon( self.to_glib_none().0, )) } } #[doc(alias = "adw_about_dialog_get_application_name")] #[doc(alias = "get_application_name")] #[doc(alias = "application-name")] pub fn application_name(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_dialog_get_application_name( self.to_glib_none().0, )) } } #[doc(alias = "adw_about_dialog_get_artists")] #[doc(alias = "get_artists")] pub fn artists(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::adw_about_dialog_get_artists( self.to_glib_none().0, )) } } #[doc(alias = "adw_about_dialog_get_comments")] #[doc(alias = "get_comments")] pub fn comments(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_dialog_get_comments(self.to_glib_none().0)) } } #[doc(alias = "adw_about_dialog_get_copyright")] #[doc(alias = "get_copyright")] pub fn copyright(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_dialog_get_copyright(self.to_glib_none().0)) } } #[doc(alias = "adw_about_dialog_get_debug_info")] #[doc(alias = "get_debug_info")] #[doc(alias = "debug-info")] pub fn debug_info(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_dialog_get_debug_info(self.to_glib_none().0)) } } #[doc(alias = "adw_about_dialog_get_debug_info_filename")] #[doc(alias = "get_debug_info_filename")] #[doc(alias = "debug-info-filename")] pub fn debug_info_filename(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_dialog_get_debug_info_filename( self.to_glib_none().0, )) } } #[doc(alias = "adw_about_dialog_get_designers")] #[doc(alias = "get_designers")] pub fn designers(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::adw_about_dialog_get_designers( self.to_glib_none().0, )) } } #[doc(alias = "adw_about_dialog_get_developer_name")] #[doc(alias = "get_developer_name")] #[doc(alias = "developer-name")] pub fn developer_name(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_dialog_get_developer_name( self.to_glib_none().0, )) } } #[doc(alias = "adw_about_dialog_get_developers")] #[doc(alias = "get_developers")] pub fn developers(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::adw_about_dialog_get_developers( self.to_glib_none().0, )) } } #[doc(alias = "adw_about_dialog_get_documenters")] #[doc(alias = "get_documenters")] pub fn documenters(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::adw_about_dialog_get_documenters( self.to_glib_none().0, )) } } #[doc(alias = "adw_about_dialog_get_issue_url")] #[doc(alias = "get_issue_url")] #[doc(alias = "issue-url")] pub fn issue_url(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_dialog_get_issue_url(self.to_glib_none().0)) } } #[doc(alias = "adw_about_dialog_get_license")] #[doc(alias = "get_license")] pub fn license(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_dialog_get_license(self.to_glib_none().0)) } } #[doc(alias = "adw_about_dialog_get_license_type")] #[doc(alias = "get_license_type")] #[doc(alias = "license-type")] pub fn license_type(&self) -> gtk::License { unsafe { from_glib(ffi::adw_about_dialog_get_license_type( self.to_glib_none().0, )) } } #[doc(alias = "adw_about_dialog_get_release_notes")] #[doc(alias = "get_release_notes")] #[doc(alias = "release-notes")] pub fn release_notes(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_dialog_get_release_notes( self.to_glib_none().0, )) } } #[doc(alias = "adw_about_dialog_get_release_notes_version")] #[doc(alias = "get_release_notes_version")] #[doc(alias = "release-notes-version")] pub fn release_notes_version(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_dialog_get_release_notes_version( self.to_glib_none().0, )) } } #[doc(alias = "adw_about_dialog_get_support_url")] #[doc(alias = "get_support_url")] #[doc(alias = "support-url")] pub fn support_url(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_dialog_get_support_url(self.to_glib_none().0)) } } #[doc(alias = "adw_about_dialog_get_translator_credits")] #[doc(alias = "get_translator_credits")] #[doc(alias = "translator-credits")] pub fn translator_credits(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_dialog_get_translator_credits( self.to_glib_none().0, )) } } #[doc(alias = "adw_about_dialog_get_version")] #[doc(alias = "get_version")] pub fn version(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_dialog_get_version(self.to_glib_none().0)) } } #[doc(alias = "adw_about_dialog_get_website")] #[doc(alias = "get_website")] pub fn website(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_dialog_get_website(self.to_glib_none().0)) } } #[doc(alias = "adw_about_dialog_set_application_icon")] #[doc(alias = "application-icon")] pub fn set_application_icon(&self, application_icon: &str) { unsafe { ffi::adw_about_dialog_set_application_icon( self.to_glib_none().0, application_icon.to_glib_none().0, ); } } #[doc(alias = "adw_about_dialog_set_application_name")] #[doc(alias = "application-name")] pub fn set_application_name(&self, application_name: &str) { unsafe { ffi::adw_about_dialog_set_application_name( self.to_glib_none().0, application_name.to_glib_none().0, ); } } #[doc(alias = "adw_about_dialog_set_artists")] #[doc(alias = "artists")] pub fn set_artists(&self, artists: &[&str]) { unsafe { ffi::adw_about_dialog_set_artists(self.to_glib_none().0, artists.to_glib_none().0); } } #[doc(alias = "adw_about_dialog_set_comments")] #[doc(alias = "comments")] pub fn set_comments(&self, comments: &str) { unsafe { ffi::adw_about_dialog_set_comments(self.to_glib_none().0, comments.to_glib_none().0); } } #[doc(alias = "adw_about_dialog_set_copyright")] #[doc(alias = "copyright")] pub fn set_copyright(&self, copyright: &str) { unsafe { ffi::adw_about_dialog_set_copyright(self.to_glib_none().0, copyright.to_glib_none().0); } } #[doc(alias = "adw_about_dialog_set_debug_info")] #[doc(alias = "debug-info")] pub fn set_debug_info(&self, debug_info: &str) { unsafe { ffi::adw_about_dialog_set_debug_info( self.to_glib_none().0, debug_info.to_glib_none().0, ); } } #[doc(alias = "adw_about_dialog_set_debug_info_filename")] #[doc(alias = "debug-info-filename")] pub fn set_debug_info_filename(&self, filename: &str) { unsafe { ffi::adw_about_dialog_set_debug_info_filename( self.to_glib_none().0, filename.to_glib_none().0, ); } } #[doc(alias = "adw_about_dialog_set_designers")] #[doc(alias = "designers")] pub fn set_designers(&self, designers: &[&str]) { unsafe { ffi::adw_about_dialog_set_designers(self.to_glib_none().0, designers.to_glib_none().0); } } #[doc(alias = "adw_about_dialog_set_developer_name")] #[doc(alias = "developer-name")] pub fn set_developer_name(&self, developer_name: &str) { unsafe { ffi::adw_about_dialog_set_developer_name( self.to_glib_none().0, developer_name.to_glib_none().0, ); } } #[doc(alias = "adw_about_dialog_set_developers")] #[doc(alias = "developers")] pub fn set_developers(&self, developers: &[&str]) { unsafe { ffi::adw_about_dialog_set_developers( self.to_glib_none().0, developers.to_glib_none().0, ); } } #[doc(alias = "adw_about_dialog_set_documenters")] #[doc(alias = "documenters")] pub fn set_documenters(&self, documenters: &[&str]) { unsafe { ffi::adw_about_dialog_set_documenters( self.to_glib_none().0, documenters.to_glib_none().0, ); } } #[doc(alias = "adw_about_dialog_set_issue_url")] #[doc(alias = "issue-url")] pub fn set_issue_url(&self, issue_url: &str) { unsafe { ffi::adw_about_dialog_set_issue_url(self.to_glib_none().0, issue_url.to_glib_none().0); } } #[doc(alias = "adw_about_dialog_set_license")] #[doc(alias = "license")] pub fn set_license(&self, license: &str) { unsafe { ffi::adw_about_dialog_set_license(self.to_glib_none().0, license.to_glib_none().0); } } #[doc(alias = "adw_about_dialog_set_license_type")] #[doc(alias = "license-type")] pub fn set_license_type(&self, license_type: gtk::License) { unsafe { ffi::adw_about_dialog_set_license_type(self.to_glib_none().0, license_type.into_glib()); } } #[doc(alias = "adw_about_dialog_set_release_notes")] #[doc(alias = "release-notes")] pub fn set_release_notes(&self, release_notes: &str) { unsafe { ffi::adw_about_dialog_set_release_notes( self.to_glib_none().0, release_notes.to_glib_none().0, ); } } #[doc(alias = "adw_about_dialog_set_release_notes_version")] #[doc(alias = "release-notes-version")] pub fn set_release_notes_version(&self, version: &str) { unsafe { ffi::adw_about_dialog_set_release_notes_version( self.to_glib_none().0, version.to_glib_none().0, ); } } #[doc(alias = "adw_about_dialog_set_support_url")] #[doc(alias = "support-url")] pub fn set_support_url(&self, support_url: &str) { unsafe { ffi::adw_about_dialog_set_support_url( self.to_glib_none().0, support_url.to_glib_none().0, ); } } #[doc(alias = "adw_about_dialog_set_translator_credits")] #[doc(alias = "translator-credits")] pub fn set_translator_credits(&self, translator_credits: &str) { unsafe { ffi::adw_about_dialog_set_translator_credits( self.to_glib_none().0, translator_credits.to_glib_none().0, ); } } #[doc(alias = "adw_about_dialog_set_version")] #[doc(alias = "version")] pub fn set_version(&self, version: &str) { unsafe { ffi::adw_about_dialog_set_version(self.to_glib_none().0, version.to_glib_none().0); } } #[doc(alias = "adw_about_dialog_set_website")] #[doc(alias = "website")] pub fn set_website(&self, website: &str) { unsafe { ffi::adw_about_dialog_set_website(self.to_glib_none().0, website.to_glib_none().0); } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "activate-link")] pub fn connect_activate_link bool + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn activate_link_trampoline< F: Fn(&AboutDialog, &str) -> bool + 'static, >( this: *mut ffi::AdwAboutDialog, uri: *mut std::ffi::c_char, f: glib::ffi::gpointer, ) -> glib::ffi::gboolean { let f: &F = &*(f as *const F); f( &from_glib_borrow(this), &glib::GString::from_glib_borrow(uri), ) .into_glib() } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"activate-link".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( activate_link_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "application-icon")] pub fn connect_application_icon_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_application_icon_trampoline( this: *mut ffi::AdwAboutDialog, _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 _, c"notify::application-icon".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_application_icon_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "application-name")] pub fn connect_application_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_application_name_trampoline( this: *mut ffi::AdwAboutDialog, _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 _, c"notify::application-name".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_application_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "artists")] pub fn connect_artists_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_artists_trampoline( this: *mut ffi::AdwAboutDialog, _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 _, c"notify::artists".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_artists_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "comments")] pub fn connect_comments_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_comments_trampoline( this: *mut ffi::AdwAboutDialog, _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 _, c"notify::comments".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_comments_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "copyright")] pub fn connect_copyright_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_copyright_trampoline( this: *mut ffi::AdwAboutDialog, _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 _, c"notify::copyright".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_copyright_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "debug-info")] pub fn connect_debug_info_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_debug_info_trampoline( this: *mut ffi::AdwAboutDialog, _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 _, c"notify::debug-info".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_debug_info_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "debug-info-filename")] pub fn connect_debug_info_filename_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_debug_info_filename_trampoline< F: Fn(&AboutDialog) + 'static, >( this: *mut ffi::AdwAboutDialog, _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 _, c"notify::debug-info-filename".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_debug_info_filename_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "designers")] pub fn connect_designers_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_designers_trampoline( this: *mut ffi::AdwAboutDialog, _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 _, c"notify::designers".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_designers_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "developer-name")] pub fn connect_developer_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_developer_name_trampoline( this: *mut ffi::AdwAboutDialog, _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 _, c"notify::developer-name".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_developer_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "developers")] pub fn connect_developers_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_developers_trampoline( this: *mut ffi::AdwAboutDialog, _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 _, c"notify::developers".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_developers_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "documenters")] pub fn connect_documenters_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_documenters_trampoline( this: *mut ffi::AdwAboutDialog, _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 _, c"notify::documenters".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_documenters_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "issue-url")] pub fn connect_issue_url_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_issue_url_trampoline( this: *mut ffi::AdwAboutDialog, _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 _, c"notify::issue-url".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_issue_url_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "license")] pub fn connect_license_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_license_trampoline( this: *mut ffi::AdwAboutDialog, _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 _, c"notify::license".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_license_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "license-type")] pub fn connect_license_type_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_license_type_trampoline( this: *mut ffi::AdwAboutDialog, _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 _, c"notify::license-type".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_license_type_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "release-notes")] pub fn connect_release_notes_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_release_notes_trampoline( this: *mut ffi::AdwAboutDialog, _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 _, c"notify::release-notes".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_release_notes_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "release-notes-version")] pub fn connect_release_notes_version_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_release_notes_version_trampoline< F: Fn(&AboutDialog) + 'static, >( this: *mut ffi::AdwAboutDialog, _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 _, c"notify::release-notes-version".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_release_notes_version_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "support-url")] pub fn connect_support_url_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_support_url_trampoline( this: *mut ffi::AdwAboutDialog, _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 _, c"notify::support-url".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_support_url_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "translator-credits")] pub fn connect_translator_credits_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_translator_credits_trampoline( this: *mut ffi::AdwAboutDialog, _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 _, c"notify::translator-credits".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_translator_credits_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "version")] pub fn connect_version_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_version_trampoline( this: *mut ffi::AdwAboutDialog, _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 _, c"notify::version".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_version_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "website")] pub fn connect_website_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_website_trampoline( this: *mut ffi::AdwAboutDialog, _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 _, c"notify::website".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_website_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] impl Default for AboutDialog { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`AboutDialog`] 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 AboutDialogBuilder { builder: glib::object::ObjectBuilder<'static, AboutDialog>, } impl AboutDialogBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn application_icon(self, application_icon: impl Into) -> Self { Self { builder: self .builder .property("application-icon", application_icon.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn application_name(self, application_name: impl Into) -> Self { Self { builder: self .builder .property("application-name", application_name.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn artists(self, artists: impl Into) -> Self { Self { builder: self.builder.property("artists", artists.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn comments(self, comments: impl Into) -> Self { Self { builder: self.builder.property("comments", comments.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn copyright(self, copyright: impl Into) -> Self { Self { builder: self.builder.property("copyright", copyright.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn debug_info(self, debug_info: impl Into) -> Self { Self { builder: self.builder.property("debug-info", debug_info.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn debug_info_filename(self, debug_info_filename: impl Into) -> Self { Self { builder: self .builder .property("debug-info-filename", debug_info_filename.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn designers(self, designers: impl Into) -> Self { Self { builder: self.builder.property("designers", designers.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn developer_name(self, developer_name: impl Into) -> Self { Self { builder: self .builder .property("developer-name", developer_name.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn developers(self, developers: impl Into) -> Self { Self { builder: self.builder.property("developers", developers.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn documenters(self, documenters: impl Into) -> Self { Self { builder: self.builder.property("documenters", documenters.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn issue_url(self, issue_url: impl Into) -> Self { Self { builder: self.builder.property("issue-url", issue_url.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn license(self, license: impl Into) -> Self { Self { builder: self.builder.property("license", license.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn license_type(self, license_type: gtk::License) -> Self { Self { builder: self.builder.property("license-type", license_type), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn release_notes(self, release_notes: impl Into) -> Self { Self { builder: self.builder.property("release-notes", release_notes.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn release_notes_version(self, release_notes_version: impl Into) -> Self { Self { builder: self .builder .property("release-notes-version", release_notes_version.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn support_url(self, support_url: impl Into) -> Self { Self { builder: self.builder.property("support-url", support_url.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn translator_credits(self, translator_credits: impl Into) -> Self { Self { builder: self .builder .property("translator-credits", translator_credits.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn version(self, version: impl Into) -> Self { Self { builder: self.builder.property("version", version.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn website(self, website: impl Into) -> Self { Self { builder: self.builder.property("website", website.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn can_close(self, can_close: bool) -> Self { Self { builder: self.builder.property("can-close", can_close), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn child(self, child: &impl IsA) -> Self { Self { builder: self.builder.property("child", child.clone().upcast()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn content_height(self, content_height: i32) -> Self { Self { builder: self.builder.property("content-height", content_height), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn content_width(self, content_width: i32) -> Self { Self { builder: self.builder.property("content-width", content_width), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn default_widget(self, default_widget: &impl IsA) -> Self { Self { builder: self .builder .property("default-widget", default_widget.clone().upcast()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn focus_widget(self, focus_widget: &impl IsA) -> Self { Self { builder: self .builder .property("focus-widget", focus_widget.clone().upcast()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn follows_content_size(self, follows_content_size: bool) -> Self { Self { builder: self .builder .property("follows-content-size", follows_content_size), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn presentation_mode(self, presentation_mode: DialogPresentationMode) -> Self { Self { builder: self .builder .property("presentation-mode", presentation_mode), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } 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 [`AboutDialog`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> AboutDialog { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/about_window.rs000064400000000000000000001631261046102023000165520ustar 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 #![allow(deprecated)] use crate::{ffi, Window}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwAboutWindow")] pub struct AboutWindow(Object) @extends Window, gtk::Window, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Native, gtk::Root, gtk::ShortcutManager; match fn { type_ => || ffi::adw_about_window_get_type(), } } impl AboutWindow { #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_new")] pub fn new() -> AboutWindow { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_about_window_new()).unsafe_cast() } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(not(target_env = "msvc"))] #[cfg_attr(docsrs, doc(cfg(not(target_env = "msvc"))))] #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[allow(deprecated)] #[doc(alias = "adw_about_window_new_from_appdata")] #[doc(alias = "new_from_appdata")] pub fn from_appdata(resource_path: &str, release_notes_version: Option<&str>) -> AboutWindow { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_about_window_new_from_appdata( resource_path.to_glib_none().0, release_notes_version.to_glib_none().0, )) .unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`AboutWindow`] objects. /// /// This method returns an instance of [`AboutWindowBuilder`](crate::builders::AboutWindowBuilder) which can be used to create [`AboutWindow`] objects. pub fn builder() -> AboutWindowBuilder { AboutWindowBuilder::new() } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_add_acknowledgement_section")] pub fn add_acknowledgement_section(&self, name: Option<&str>, people: &[&str]) { unsafe { ffi::adw_about_window_add_acknowledgement_section( self.to_glib_none().0, name.to_glib_none().0, people.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_add_credit_section")] pub fn add_credit_section(&self, name: Option<&str>, people: &[&str]) { unsafe { ffi::adw_about_window_add_credit_section( self.to_glib_none().0, name.to_glib_none().0, people.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_add_legal_section")] pub fn add_legal_section( &self, title: &str, copyright: Option<&str>, license_type: gtk::License, license: Option<&str>, ) { unsafe { ffi::adw_about_window_add_legal_section( self.to_glib_none().0, title.to_glib_none().0, copyright.to_glib_none().0, license_type.into_glib(), license.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_add_link")] pub fn add_link(&self, title: &str, url: &str) { unsafe { ffi::adw_about_window_add_link( self.to_glib_none().0, title.to_glib_none().0, url.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_get_application_icon")] #[doc(alias = "get_application_icon")] #[doc(alias = "application-icon")] pub fn application_icon(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_window_get_application_icon( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_get_application_name")] #[doc(alias = "get_application_name")] #[doc(alias = "application-name")] pub fn application_name(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_window_get_application_name( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_get_artists")] #[doc(alias = "get_artists")] pub fn artists(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::adw_about_window_get_artists( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_get_comments")] #[doc(alias = "get_comments")] pub fn comments(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_window_get_comments(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_get_copyright")] #[doc(alias = "get_copyright")] pub fn copyright(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_window_get_copyright(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_get_debug_info")] #[doc(alias = "get_debug_info")] #[doc(alias = "debug-info")] pub fn debug_info(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_window_get_debug_info(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_get_debug_info_filename")] #[doc(alias = "get_debug_info_filename")] #[doc(alias = "debug-info-filename")] pub fn debug_info_filename(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_window_get_debug_info_filename( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_get_designers")] #[doc(alias = "get_designers")] pub fn designers(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::adw_about_window_get_designers( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_get_developer_name")] #[doc(alias = "get_developer_name")] #[doc(alias = "developer-name")] pub fn developer_name(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_window_get_developer_name( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_get_developers")] #[doc(alias = "get_developers")] pub fn developers(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::adw_about_window_get_developers( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_get_documenters")] #[doc(alias = "get_documenters")] pub fn documenters(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::adw_about_window_get_documenters( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_get_issue_url")] #[doc(alias = "get_issue_url")] #[doc(alias = "issue-url")] pub fn issue_url(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_window_get_issue_url(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_get_license")] #[doc(alias = "get_license")] pub fn license(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_window_get_license(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_get_license_type")] #[doc(alias = "get_license_type")] #[doc(alias = "license-type")] pub fn license_type(&self) -> gtk::License { unsafe { from_glib(ffi::adw_about_window_get_license_type( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_get_release_notes")] #[doc(alias = "get_release_notes")] #[doc(alias = "release-notes")] pub fn release_notes(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_window_get_release_notes( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_get_release_notes_version")] #[doc(alias = "get_release_notes_version")] #[doc(alias = "release-notes-version")] pub fn release_notes_version(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_window_get_release_notes_version( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_get_support_url")] #[doc(alias = "get_support_url")] #[doc(alias = "support-url")] pub fn support_url(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_window_get_support_url(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_get_translator_credits")] #[doc(alias = "get_translator_credits")] #[doc(alias = "translator-credits")] pub fn translator_credits(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_window_get_translator_credits( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_get_version")] #[doc(alias = "get_version")] pub fn version(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_window_get_version(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_get_website")] #[doc(alias = "get_website")] pub fn website(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_about_window_get_website(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_set_application_icon")] #[doc(alias = "application-icon")] pub fn set_application_icon(&self, application_icon: &str) { unsafe { ffi::adw_about_window_set_application_icon( self.to_glib_none().0, application_icon.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_set_application_name")] #[doc(alias = "application-name")] pub fn set_application_name(&self, application_name: &str) { unsafe { ffi::adw_about_window_set_application_name( self.to_glib_none().0, application_name.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_set_artists")] #[doc(alias = "artists")] pub fn set_artists(&self, artists: &[&str]) { unsafe { ffi::adw_about_window_set_artists(self.to_glib_none().0, artists.to_glib_none().0); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_set_comments")] #[doc(alias = "comments")] pub fn set_comments(&self, comments: &str) { unsafe { ffi::adw_about_window_set_comments(self.to_glib_none().0, comments.to_glib_none().0); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_set_copyright")] #[doc(alias = "copyright")] pub fn set_copyright(&self, copyright: &str) { unsafe { ffi::adw_about_window_set_copyright(self.to_glib_none().0, copyright.to_glib_none().0); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_set_debug_info")] #[doc(alias = "debug-info")] pub fn set_debug_info(&self, debug_info: &str) { unsafe { ffi::adw_about_window_set_debug_info( self.to_glib_none().0, debug_info.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_set_debug_info_filename")] #[doc(alias = "debug-info-filename")] pub fn set_debug_info_filename(&self, filename: &str) { unsafe { ffi::adw_about_window_set_debug_info_filename( self.to_glib_none().0, filename.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_set_designers")] #[doc(alias = "designers")] pub fn set_designers(&self, designers: &[&str]) { unsafe { ffi::adw_about_window_set_designers(self.to_glib_none().0, designers.to_glib_none().0); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_set_developer_name")] #[doc(alias = "developer-name")] pub fn set_developer_name(&self, developer_name: &str) { unsafe { ffi::adw_about_window_set_developer_name( self.to_glib_none().0, developer_name.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_set_developers")] #[doc(alias = "developers")] pub fn set_developers(&self, developers: &[&str]) { unsafe { ffi::adw_about_window_set_developers( self.to_glib_none().0, developers.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_set_documenters")] #[doc(alias = "documenters")] pub fn set_documenters(&self, documenters: &[&str]) { unsafe { ffi::adw_about_window_set_documenters( self.to_glib_none().0, documenters.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_set_issue_url")] #[doc(alias = "issue-url")] pub fn set_issue_url(&self, issue_url: &str) { unsafe { ffi::adw_about_window_set_issue_url(self.to_glib_none().0, issue_url.to_glib_none().0); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_set_license")] #[doc(alias = "license")] pub fn set_license(&self, license: &str) { unsafe { ffi::adw_about_window_set_license(self.to_glib_none().0, license.to_glib_none().0); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_set_license_type")] #[doc(alias = "license-type")] pub fn set_license_type(&self, license_type: gtk::License) { unsafe { ffi::adw_about_window_set_license_type(self.to_glib_none().0, license_type.into_glib()); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_set_release_notes")] #[doc(alias = "release-notes")] pub fn set_release_notes(&self, release_notes: &str) { unsafe { ffi::adw_about_window_set_release_notes( self.to_glib_none().0, release_notes.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_set_release_notes_version")] #[doc(alias = "release-notes-version")] pub fn set_release_notes_version(&self, version: &str) { unsafe { ffi::adw_about_window_set_release_notes_version( self.to_glib_none().0, version.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_set_support_url")] #[doc(alias = "support-url")] pub fn set_support_url(&self, support_url: &str) { unsafe { ffi::adw_about_window_set_support_url( self.to_glib_none().0, support_url.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_set_translator_credits")] #[doc(alias = "translator-credits")] pub fn set_translator_credits(&self, translator_credits: &str) { unsafe { ffi::adw_about_window_set_translator_credits( self.to_glib_none().0, translator_credits.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_set_version")] #[doc(alias = "version")] pub fn set_version(&self, version: &str) { unsafe { ffi::adw_about_window_set_version(self.to_glib_none().0, version.to_glib_none().0); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_about_window_set_website")] #[doc(alias = "website")] pub fn set_website(&self, website: &str) { unsafe { ffi::adw_about_window_set_website(self.to_glib_none().0, website.to_glib_none().0); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "activate-link")] pub fn connect_activate_link bool + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn activate_link_trampoline< F: Fn(&AboutWindow, &str) -> bool + 'static, >( this: *mut ffi::AdwAboutWindow, uri: *mut std::ffi::c_char, f: glib::ffi::gpointer, ) -> glib::ffi::gboolean { let f: &F = &*(f as *const F); f( &from_glib_borrow(this), &glib::GString::from_glib_borrow(uri), ) .into_glib() } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"activate-link".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( activate_link_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "application-icon")] pub fn connect_application_icon_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_application_icon_trampoline( this: *mut ffi::AdwAboutWindow, _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 _, c"notify::application-icon".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_application_icon_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "application-name")] pub fn connect_application_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_application_name_trampoline( this: *mut ffi::AdwAboutWindow, _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 _, c"notify::application-name".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_application_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "artists")] pub fn connect_artists_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_artists_trampoline( this: *mut ffi::AdwAboutWindow, _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 _, c"notify::artists".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_artists_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "comments")] pub fn connect_comments_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_comments_trampoline( this: *mut ffi::AdwAboutWindow, _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 _, c"notify::comments".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_comments_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "copyright")] pub fn connect_copyright_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_copyright_trampoline( this: *mut ffi::AdwAboutWindow, _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 _, c"notify::copyright".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_copyright_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "debug-info")] pub fn connect_debug_info_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_debug_info_trampoline( this: *mut ffi::AdwAboutWindow, _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 _, c"notify::debug-info".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_debug_info_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "debug-info-filename")] pub fn connect_debug_info_filename_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_debug_info_filename_trampoline< F: Fn(&AboutWindow) + 'static, >( this: *mut ffi::AdwAboutWindow, _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 _, c"notify::debug-info-filename".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_debug_info_filename_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "designers")] pub fn connect_designers_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_designers_trampoline( this: *mut ffi::AdwAboutWindow, _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 _, c"notify::designers".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_designers_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "developer-name")] pub fn connect_developer_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_developer_name_trampoline( this: *mut ffi::AdwAboutWindow, _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 _, c"notify::developer-name".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_developer_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "developers")] pub fn connect_developers_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_developers_trampoline( this: *mut ffi::AdwAboutWindow, _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 _, c"notify::developers".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_developers_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "documenters")] pub fn connect_documenters_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_documenters_trampoline( this: *mut ffi::AdwAboutWindow, _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 _, c"notify::documenters".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_documenters_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "issue-url")] pub fn connect_issue_url_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_issue_url_trampoline( this: *mut ffi::AdwAboutWindow, _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 _, c"notify::issue-url".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_issue_url_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "license")] pub fn connect_license_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_license_trampoline( this: *mut ffi::AdwAboutWindow, _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 _, c"notify::license".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_license_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "license-type")] pub fn connect_license_type_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_license_type_trampoline( this: *mut ffi::AdwAboutWindow, _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 _, c"notify::license-type".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_license_type_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "release-notes")] pub fn connect_release_notes_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_release_notes_trampoline( this: *mut ffi::AdwAboutWindow, _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 _, c"notify::release-notes".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_release_notes_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "release-notes-version")] pub fn connect_release_notes_version_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_release_notes_version_trampoline< F: Fn(&AboutWindow) + 'static, >( this: *mut ffi::AdwAboutWindow, _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 _, c"notify::release-notes-version".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_release_notes_version_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "support-url")] pub fn connect_support_url_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_support_url_trampoline( this: *mut ffi::AdwAboutWindow, _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 _, c"notify::support-url".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_support_url_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "translator-credits")] pub fn connect_translator_credits_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_translator_credits_trampoline( this: *mut ffi::AdwAboutWindow, _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 _, c"notify::translator-credits".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_translator_credits_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "version")] pub fn connect_version_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_version_trampoline( this: *mut ffi::AdwAboutWindow, _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 _, c"notify::version".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_version_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "website")] pub fn connect_website_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_website_trampoline( this: *mut ffi::AdwAboutWindow, _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 _, c"notify::website".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_website_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] impl Default for AboutWindow { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`AboutWindow`] 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 AboutWindowBuilder { builder: glib::object::ObjectBuilder<'static, AboutWindow>, } impl AboutWindowBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn application_icon(self, application_icon: impl Into) -> Self { Self { builder: self .builder .property("application-icon", application_icon.into()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn application_name(self, application_name: impl Into) -> Self { Self { builder: self .builder .property("application-name", application_name.into()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn artists(self, artists: impl Into) -> Self { Self { builder: self.builder.property("artists", artists.into()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn comments(self, comments: impl Into) -> Self { Self { builder: self.builder.property("comments", comments.into()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn copyright(self, copyright: impl Into) -> Self { Self { builder: self.builder.property("copyright", copyright.into()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn debug_info(self, debug_info: impl Into) -> Self { Self { builder: self.builder.property("debug-info", debug_info.into()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn debug_info_filename(self, debug_info_filename: impl Into) -> Self { Self { builder: self .builder .property("debug-info-filename", debug_info_filename.into()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn designers(self, designers: impl Into) -> Self { Self { builder: self.builder.property("designers", designers.into()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn developer_name(self, developer_name: impl Into) -> Self { Self { builder: self .builder .property("developer-name", developer_name.into()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn developers(self, developers: impl Into) -> Self { Self { builder: self.builder.property("developers", developers.into()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn documenters(self, documenters: impl Into) -> Self { Self { builder: self.builder.property("documenters", documenters.into()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn issue_url(self, issue_url: impl Into) -> Self { Self { builder: self.builder.property("issue-url", issue_url.into()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn license(self, license: impl Into) -> Self { Self { builder: self.builder.property("license", license.into()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn license_type(self, license_type: gtk::License) -> Self { Self { builder: self.builder.property("license-type", license_type), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn release_notes(self, release_notes: impl Into) -> Self { Self { builder: self.builder.property("release-notes", release_notes.into()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn release_notes_version(self, release_notes_version: impl Into) -> Self { Self { builder: self .builder .property("release-notes-version", release_notes_version.into()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn support_url(self, support_url: impl Into) -> Self { Self { builder: self.builder.property("support-url", support_url.into()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn translator_credits(self, translator_credits: impl Into) -> Self { Self { builder: self .builder .property("translator-credits", translator_credits.into()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn version(self, version: impl Into) -> Self { Self { builder: self.builder.property("version", version.into()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn website(self, website: impl Into) -> Self { Self { builder: self.builder.property("website", website.into()), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn adaptive_preview(self, adaptive_preview: bool) -> Self { Self { builder: self.builder.property("adaptive-preview", adaptive_preview), } } pub fn content(self, content: &impl IsA) -> Self { Self { builder: self.builder.property("content", content.clone().upcast()), } } pub fn application(self, application: &impl IsA) -> Self { Self { builder: self .builder .property("application", application.clone().upcast()), } } pub fn decorated(self, decorated: bool) -> Self { Self { builder: self.builder.property("decorated", decorated), } } pub fn default_height(self, default_height: i32) -> Self { Self { builder: self.builder.property("default-height", default_height), } } pub fn default_widget(self, default_widget: &impl IsA) -> Self { Self { builder: self .builder .property("default-widget", default_widget.clone().upcast()), } } pub fn default_width(self, default_width: i32) -> Self { Self { builder: self.builder.property("default-width", default_width), } } pub fn deletable(self, deletable: bool) -> Self { Self { builder: self.builder.property("deletable", deletable), } } pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self { Self { builder: self .builder .property("destroy-with-parent", destroy_with_parent), } } pub fn display(self, display: &gdk::Display) -> Self { Self { builder: self.builder.property("display", display.clone()), } } pub fn focus_visible(self, focus_visible: bool) -> Self { Self { builder: self.builder.property("focus-visible", focus_visible), } } pub fn focus_widget(self, focus_widget: &impl IsA) -> Self { Self { builder: self .builder .property("focus-widget", focus_widget.clone().upcast()), } } pub fn fullscreened(self, fullscreened: bool) -> Self { Self { builder: self.builder.property("fullscreened", fullscreened), } } #[cfg(feature = "gtk_v4_2")] #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_2")))] pub fn handle_menubar_accel(self, handle_menubar_accel: bool) -> Self { Self { builder: self .builder .property("handle-menubar-accel", handle_menubar_accel), } } pub fn hide_on_close(self, hide_on_close: bool) -> Self { Self { builder: self.builder.property("hide-on-close", hide_on_close), } } pub fn icon_name(self, icon_name: impl Into) -> Self { Self { builder: self.builder.property("icon-name", icon_name.into()), } } pub fn maximized(self, maximized: bool) -> Self { Self { builder: self.builder.property("maximized", maximized), } } pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self { Self { builder: self .builder .property("mnemonics-visible", mnemonics_visible), } } pub fn modal(self, modal: bool) -> Self { Self { builder: self.builder.property("modal", modal), } } pub fn resizable(self, resizable: bool) -> Self { Self { builder: self.builder.property("resizable", resizable), } } pub fn startup_id(self, startup_id: impl Into) -> Self { Self { builder: self.builder.property("startup-id", startup_id.into()), } } pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } #[cfg(feature = "gtk_v4_6")] #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_6")))] pub fn titlebar(self, titlebar: &impl IsA) -> Self { Self { builder: self.builder.property("titlebar", titlebar.clone().upcast()), } } pub fn transient_for(self, transient_for: &impl IsA) -> Self { Self { builder: self .builder .property("transient-for", transient_for.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 [`AboutWindow`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> AboutWindow { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/action_row.rs000064400000000000000000000533331046102023000162130ustar 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 #![allow(deprecated)] use crate::{ffi, PreferencesRow}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwActionRow")] pub struct ActionRow(Object) @extends PreferencesRow, gtk::ListBoxRow, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Actionable; match fn { type_ => || ffi::adw_action_row_get_type(), } } impl ActionRow { pub const NONE: Option<&'static ActionRow> = None; #[doc(alias = "adw_action_row_new")] pub fn new() -> ActionRow { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_action_row_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`ActionRow`] objects. /// /// This method returns an instance of [`ActionRowBuilder`](crate::builders::ActionRowBuilder) which can be used to create [`ActionRow`] objects. pub fn builder() -> ActionRowBuilder { ActionRowBuilder::new() } } impl Default for ActionRow { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`ActionRow`] 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 ActionRowBuilder { builder: glib::object::ObjectBuilder<'static, ActionRow>, } impl ActionRowBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn activatable_widget(self, activatable_widget: &impl IsA) -> Self { Self { builder: self .builder .property("activatable-widget", activatable_widget.clone().upcast()), } } #[cfg_attr(feature = "v1_3", deprecated = "Since 1.3")] pub fn icon_name(self, icon_name: impl Into) -> Self { Self { builder: self.builder.property("icon-name", icon_name.into()), } } pub fn subtitle(self, subtitle: impl Into) -> Self { Self { builder: self.builder.property("subtitle", subtitle.into()), } } pub fn subtitle_lines(self, subtitle_lines: i32) -> Self { Self { builder: self.builder.property("subtitle-lines", subtitle_lines), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn subtitle_selectable(self, subtitle_selectable: bool) -> Self { Self { builder: self .builder .property("subtitle-selectable", subtitle_selectable), } } pub fn title_lines(self, title_lines: i32) -> Self { Self { builder: self.builder.property("title-lines", title_lines), } } pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub fn title_selectable(self, title_selectable: bool) -> Self { Self { builder: self.builder.property("title-selectable", title_selectable), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn use_markup(self, use_markup: bool) -> Self { Self { builder: self.builder.property("use-markup", use_markup), } } pub fn use_underline(self, use_underline: bool) -> Self { Self { builder: self.builder.property("use-underline", use_underline), } } pub fn activatable(self, activatable: bool) -> Self { Self { builder: self.builder.property("activatable", activatable), } } pub fn child(self, child: &impl IsA) -> Self { Self { builder: self.builder.property("child", child.clone().upcast()), } } pub fn selectable(self, selectable: bool) -> Self { Self { builder: self.builder.property("selectable", selectable), } } 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 action_name(self, action_name: impl Into) -> Self { Self { builder: self.builder.property("action-name", action_name.into()), } } pub fn action_target(self, action_target: &glib::Variant) -> Self { Self { builder: self .builder .property("action-target", action_target.clone()), } } // rustdoc-stripper-ignore-next /// Build the [`ActionRow`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> ActionRow { assert_initialized_main_thread!(); self.builder.build() } } pub trait ActionRowExt: IsA + 'static { #[doc(alias = "adw_action_row_activate")] fn activate(&self) { unsafe { ffi::adw_action_row_activate(self.as_ref().to_glib_none().0); } } #[doc(alias = "adw_action_row_add_prefix")] fn add_prefix(&self, widget: &impl IsA) { unsafe { ffi::adw_action_row_add_prefix( self.as_ref().to_glib_none().0, widget.as_ref().to_glib_none().0, ); } } #[doc(alias = "adw_action_row_add_suffix")] fn add_suffix(&self, widget: &impl IsA) { unsafe { ffi::adw_action_row_add_suffix( self.as_ref().to_glib_none().0, widget.as_ref().to_glib_none().0, ); } } #[doc(alias = "adw_action_row_get_activatable_widget")] #[doc(alias = "get_activatable_widget")] #[doc(alias = "activatable-widget")] fn activatable_widget(&self) -> Option { unsafe { from_glib_none(ffi::adw_action_row_get_activatable_widget( self.as_ref().to_glib_none().0, )) } } #[cfg_attr(feature = "v1_3", deprecated = "Since 1.3")] #[allow(deprecated)] #[doc(alias = "adw_action_row_get_icon_name")] #[doc(alias = "get_icon_name")] #[doc(alias = "icon-name")] fn icon_name(&self) -> Option { unsafe { from_glib_none(ffi::adw_action_row_get_icon_name( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_action_row_get_subtitle")] #[doc(alias = "get_subtitle")] fn subtitle(&self) -> Option { unsafe { from_glib_none(ffi::adw_action_row_get_subtitle( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_action_row_get_subtitle_lines")] #[doc(alias = "get_subtitle_lines")] #[doc(alias = "subtitle-lines")] fn subtitle_lines(&self) -> i32 { unsafe { ffi::adw_action_row_get_subtitle_lines(self.as_ref().to_glib_none().0) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_action_row_get_subtitle_selectable")] #[doc(alias = "get_subtitle_selectable")] #[doc(alias = "subtitle-selectable")] fn is_subtitle_selectable(&self) -> bool { unsafe { from_glib(ffi::adw_action_row_get_subtitle_selectable( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_action_row_get_title_lines")] #[doc(alias = "get_title_lines")] #[doc(alias = "title-lines")] fn title_lines(&self) -> i32 { unsafe { ffi::adw_action_row_get_title_lines(self.as_ref().to_glib_none().0) } } #[doc(alias = "adw_action_row_remove")] fn remove(&self, widget: &impl IsA) { unsafe { ffi::adw_action_row_remove( self.as_ref().to_glib_none().0, widget.as_ref().to_glib_none().0, ); } } #[doc(alias = "adw_action_row_set_activatable_widget")] #[doc(alias = "activatable-widget")] fn set_activatable_widget(&self, widget: Option<&impl IsA>) { unsafe { ffi::adw_action_row_set_activatable_widget( self.as_ref().to_glib_none().0, widget.map(|p| p.as_ref()).to_glib_none().0, ); } } #[cfg_attr(feature = "v1_3", deprecated = "Since 1.3")] #[allow(deprecated)] #[doc(alias = "adw_action_row_set_icon_name")] #[doc(alias = "icon-name")] fn set_icon_name(&self, icon_name: Option<&str>) { unsafe { ffi::adw_action_row_set_icon_name( self.as_ref().to_glib_none().0, icon_name.to_glib_none().0, ); } } #[doc(alias = "adw_action_row_set_subtitle")] #[doc(alias = "subtitle")] fn set_subtitle(&self, subtitle: &str) { unsafe { ffi::adw_action_row_set_subtitle( self.as_ref().to_glib_none().0, subtitle.to_glib_none().0, ); } } #[doc(alias = "adw_action_row_set_subtitle_lines")] #[doc(alias = "subtitle-lines")] fn set_subtitle_lines(&self, subtitle_lines: i32) { unsafe { ffi::adw_action_row_set_subtitle_lines(self.as_ref().to_glib_none().0, subtitle_lines); } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_action_row_set_subtitle_selectable")] #[doc(alias = "subtitle-selectable")] fn set_subtitle_selectable(&self, subtitle_selectable: bool) { unsafe { ffi::adw_action_row_set_subtitle_selectable( self.as_ref().to_glib_none().0, subtitle_selectable.into_glib(), ); } } #[doc(alias = "adw_action_row_set_title_lines")] #[doc(alias = "title-lines")] fn set_title_lines(&self, title_lines: i32) { unsafe { ffi::adw_action_row_set_title_lines(self.as_ref().to_glib_none().0, title_lines); } } #[doc(alias = "activated")] fn connect_activated(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn activated_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwActionRow, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ActionRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"activated".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( activated_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "activatable-widget")] fn connect_activatable_widget_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_activatable_widget_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwActionRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ActionRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::activatable-widget".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_activatable_widget_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_3", deprecated = "Since 1.3")] #[doc(alias = "icon-name")] fn connect_icon_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_icon_name_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwActionRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ActionRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::icon-name".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 = "subtitle")] fn connect_subtitle_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_subtitle_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwActionRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ActionRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::subtitle".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_subtitle_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "subtitle-lines")] fn connect_subtitle_lines_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_subtitle_lines_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwActionRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ActionRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::subtitle-lines".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_subtitle_lines_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "subtitle-selectable")] fn connect_subtitle_selectable_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_subtitle_selectable_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwActionRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ActionRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::subtitle-selectable".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_subtitle_selectable_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "title-lines")] fn connect_title_lines_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_lines_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwActionRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ActionRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::title-lines".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_title_lines_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> ActionRowExt for O {} libadwaita-0.7.2/src/auto/alert_dialog.rs000064400000000000000000000731341046102023000164760ustar 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, Dialog, DialogPresentationMode, ResponseAppearance}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwAlertDialog")] pub struct AlertDialog(Object) @extends Dialog, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::ShortcutManager; match fn { type_ => || ffi::adw_alert_dialog_get_type(), } } impl AlertDialog { pub const NONE: Option<&'static AlertDialog> = None; #[doc(alias = "adw_alert_dialog_new")] pub fn new(heading: Option<&str>, body: Option<&str>) -> AlertDialog { assert_initialized_main_thread!(); unsafe { Dialog::from_glib_none(ffi::adw_alert_dialog_new( heading.to_glib_none().0, body.to_glib_none().0, )) .unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`AlertDialog`] objects. /// /// This method returns an instance of [`AlertDialogBuilder`](crate::builders::AlertDialogBuilder) which can be used to create [`AlertDialog`] objects. pub fn builder() -> AlertDialogBuilder { AlertDialogBuilder::new() } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] impl Default for AlertDialog { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`AlertDialog`] 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 AlertDialogBuilder { builder: glib::object::ObjectBuilder<'static, AlertDialog>, } impl AlertDialogBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn body(self, body: impl Into) -> Self { Self { builder: self.builder.property("body", body.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn body_use_markup(self, body_use_markup: bool) -> Self { Self { builder: self.builder.property("body-use-markup", body_use_markup), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn close_response(self, close_response: impl Into) -> Self { Self { builder: self .builder .property("close-response", close_response.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn default_response(self, default_response: impl Into) -> Self { Self { builder: self .builder .property("default-response", default_response.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn extra_child(self, extra_child: &impl IsA) -> Self { Self { builder: self .builder .property("extra-child", extra_child.clone().upcast()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn heading(self, heading: impl Into) -> Self { Self { builder: self.builder.property("heading", heading.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn heading_use_markup(self, heading_use_markup: bool) -> Self { Self { builder: self .builder .property("heading-use-markup", heading_use_markup), } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub fn prefer_wide_layout(self, prefer_wide_layout: bool) -> Self { Self { builder: self .builder .property("prefer-wide-layout", prefer_wide_layout), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn can_close(self, can_close: bool) -> Self { Self { builder: self.builder.property("can-close", can_close), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn child(self, child: &impl IsA) -> Self { Self { builder: self.builder.property("child", child.clone().upcast()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn content_height(self, content_height: i32) -> Self { Self { builder: self.builder.property("content-height", content_height), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn content_width(self, content_width: i32) -> Self { Self { builder: self.builder.property("content-width", content_width), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn default_widget(self, default_widget: &impl IsA) -> Self { Self { builder: self .builder .property("default-widget", default_widget.clone().upcast()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn focus_widget(self, focus_widget: &impl IsA) -> Self { Self { builder: self .builder .property("focus-widget", focus_widget.clone().upcast()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn follows_content_size(self, follows_content_size: bool) -> Self { Self { builder: self .builder .property("follows-content-size", follows_content_size), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn presentation_mode(self, presentation_mode: DialogPresentationMode) -> Self { Self { builder: self .builder .property("presentation-mode", presentation_mode), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } 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 [`AlertDialog`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> AlertDialog { assert_initialized_main_thread!(); self.builder.build() } } pub trait AlertDialogExt: IsA + 'static { #[doc(alias = "adw_alert_dialog_add_response")] fn add_response(&self, id: &str, label: &str) { unsafe { ffi::adw_alert_dialog_add_response( self.as_ref().to_glib_none().0, id.to_glib_none().0, label.to_glib_none().0, ); } } #[doc(alias = "adw_alert_dialog_get_body")] #[doc(alias = "get_body")] fn body(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_alert_dialog_get_body( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_alert_dialog_get_body_use_markup")] #[doc(alias = "get_body_use_markup")] #[doc(alias = "body-use-markup")] fn is_body_use_markup(&self) -> bool { unsafe { from_glib(ffi::adw_alert_dialog_get_body_use_markup( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_alert_dialog_get_close_response")] #[doc(alias = "get_close_response")] #[doc(alias = "close-response")] fn close_response(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_alert_dialog_get_close_response( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_alert_dialog_get_default_response")] #[doc(alias = "get_default_response")] #[doc(alias = "default-response")] fn default_response(&self) -> Option { unsafe { from_glib_none(ffi::adw_alert_dialog_get_default_response( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_alert_dialog_get_extra_child")] #[doc(alias = "get_extra_child")] #[doc(alias = "extra-child")] fn extra_child(&self) -> Option { unsafe { from_glib_none(ffi::adw_alert_dialog_get_extra_child( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_alert_dialog_get_heading")] #[doc(alias = "get_heading")] fn heading(&self) -> Option { unsafe { from_glib_none(ffi::adw_alert_dialog_get_heading( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_alert_dialog_get_heading_use_markup")] #[doc(alias = "get_heading_use_markup")] #[doc(alias = "heading-use-markup")] fn is_heading_use_markup(&self) -> bool { unsafe { from_glib(ffi::adw_alert_dialog_get_heading_use_markup( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_alert_dialog_get_prefer_wide_layout")] #[doc(alias = "get_prefer_wide_layout")] #[doc(alias = "prefer-wide-layout")] fn prefers_wide_layout(&self) -> bool { unsafe { from_glib(ffi::adw_alert_dialog_get_prefer_wide_layout( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_alert_dialog_get_response_appearance")] #[doc(alias = "get_response_appearance")] fn response_appearance(&self, response: &str) -> ResponseAppearance { unsafe { from_glib(ffi::adw_alert_dialog_get_response_appearance( self.as_ref().to_glib_none().0, response.to_glib_none().0, )) } } #[doc(alias = "adw_alert_dialog_get_response_enabled")] #[doc(alias = "get_response_enabled")] fn is_response_enabled(&self, response: &str) -> bool { unsafe { from_glib(ffi::adw_alert_dialog_get_response_enabled( self.as_ref().to_glib_none().0, response.to_glib_none().0, )) } } #[doc(alias = "adw_alert_dialog_has_response")] fn has_response(&self, response: &str) -> bool { unsafe { from_glib(ffi::adw_alert_dialog_has_response( self.as_ref().to_glib_none().0, response.to_glib_none().0, )) } } #[doc(alias = "adw_alert_dialog_remove_response")] fn remove_response(&self, id: &str) { unsafe { ffi::adw_alert_dialog_remove_response( self.as_ref().to_glib_none().0, id.to_glib_none().0, ); } } #[doc(alias = "adw_alert_dialog_set_body")] #[doc(alias = "body")] fn set_body(&self, body: &str) { unsafe { ffi::adw_alert_dialog_set_body(self.as_ref().to_glib_none().0, body.to_glib_none().0); } } #[doc(alias = "adw_alert_dialog_set_body_use_markup")] #[doc(alias = "body-use-markup")] fn set_body_use_markup(&self, use_markup: bool) { unsafe { ffi::adw_alert_dialog_set_body_use_markup( self.as_ref().to_glib_none().0, use_markup.into_glib(), ); } } #[doc(alias = "adw_alert_dialog_set_close_response")] #[doc(alias = "close-response")] fn set_close_response(&self, response: &str) { unsafe { ffi::adw_alert_dialog_set_close_response( self.as_ref().to_glib_none().0, response.to_glib_none().0, ); } } #[doc(alias = "adw_alert_dialog_set_default_response")] #[doc(alias = "default-response")] fn set_default_response(&self, response: Option<&str>) { unsafe { ffi::adw_alert_dialog_set_default_response( self.as_ref().to_glib_none().0, response.to_glib_none().0, ); } } #[doc(alias = "adw_alert_dialog_set_extra_child")] #[doc(alias = "extra-child")] fn set_extra_child(&self, child: Option<&impl IsA>) { unsafe { ffi::adw_alert_dialog_set_extra_child( self.as_ref().to_glib_none().0, child.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_alert_dialog_set_heading")] #[doc(alias = "heading")] fn set_heading(&self, heading: Option<&str>) { unsafe { ffi::adw_alert_dialog_set_heading( self.as_ref().to_glib_none().0, heading.to_glib_none().0, ); } } #[doc(alias = "adw_alert_dialog_set_heading_use_markup")] #[doc(alias = "heading-use-markup")] fn set_heading_use_markup(&self, use_markup: bool) { unsafe { ffi::adw_alert_dialog_set_heading_use_markup( self.as_ref().to_glib_none().0, use_markup.into_glib(), ); } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "adw_alert_dialog_set_prefer_wide_layout")] #[doc(alias = "prefer-wide-layout")] fn set_prefer_wide_layout(&self, prefer_wide_layout: bool) { unsafe { ffi::adw_alert_dialog_set_prefer_wide_layout( self.as_ref().to_glib_none().0, prefer_wide_layout.into_glib(), ); } } #[doc(alias = "adw_alert_dialog_set_response_appearance")] fn set_response_appearance(&self, response: &str, appearance: ResponseAppearance) { unsafe { ffi::adw_alert_dialog_set_response_appearance( self.as_ref().to_glib_none().0, response.to_glib_none().0, appearance.into_glib(), ); } } #[doc(alias = "adw_alert_dialog_set_response_enabled")] fn set_response_enabled(&self, response: &str, enabled: bool) { unsafe { ffi::adw_alert_dialog_set_response_enabled( self.as_ref().to_glib_none().0, response.to_glib_none().0, enabled.into_glib(), ); } } #[doc(alias = "adw_alert_dialog_set_response_label")] fn set_response_label(&self, response: &str, label: &str) { unsafe { ffi::adw_alert_dialog_set_response_label( self.as_ref().to_glib_none().0, response.to_glib_none().0, label.to_glib_none().0, ); } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "response")] fn connect_response( &self, detail: Option<&str>, f: F, ) -> SignalHandlerId { unsafe extern "C" fn response_trampoline, F: Fn(&P, &str) + 'static>( this: *mut ffi::AdwAlertDialog, response: *mut std::ffi::c_char, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( AlertDialog::from_glib_borrow(this).unsafe_cast_ref(), &glib::GString::from_glib_borrow(response), ) } unsafe { let f: Box_ = Box_::new(f); let detailed_signal_name = detail.map(|name| format!("response::{name}\0")); let signal_name: &[u8] = detailed_signal_name .as_ref() .map_or(&b"response\0"[..], |n| n.as_bytes()); connect_raw( self.as_ptr() as *mut _, signal_name.as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( response_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "body")] fn connect_body_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_body_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwAlertDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::body".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_body_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "body-use-markup")] fn connect_body_use_markup_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_body_use_markup_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwAlertDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::body-use-markup".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_body_use_markup_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "close-response")] fn connect_close_response_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_close_response_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwAlertDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::close-response".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_close_response_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "default-response")] fn connect_default_response_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_default_response_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwAlertDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::default-response".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_default_response_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "extra-child")] fn connect_extra_child_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_extra_child_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwAlertDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::extra-child".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_extra_child_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "heading")] fn connect_heading_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_heading_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwAlertDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::heading".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_heading_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "heading-use-markup")] fn connect_heading_use_markup_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_heading_use_markup_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwAlertDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::heading-use-markup".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_heading_use_markup_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "prefer-wide-layout")] fn connect_prefer_wide_layout_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_prefer_wide_layout_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwAlertDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::prefer-wide-layout".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_prefer_wide_layout_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> AlertDialogExt for O {} libadwaita-0.7.2/src/auto/animation.rs000064400000000000000000000203251046102023000160210ustar 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, AnimationState, AnimationTarget}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwAnimation")] pub struct Animation(Object); match fn { type_ => || ffi::adw_animation_get_type(), } } impl Animation { pub const NONE: Option<&'static Animation> = None; } pub trait AnimationExt: IsA + 'static { #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_animation_get_follow_enable_animations_setting")] #[doc(alias = "get_follow_enable_animations_setting")] #[doc(alias = "follow-enable-animations-setting")] fn follows_enable_animations_setting(&self) -> bool { unsafe { from_glib(ffi::adw_animation_get_follow_enable_animations_setting( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_animation_get_state")] #[doc(alias = "get_state")] fn state(&self) -> AnimationState { unsafe { from_glib(ffi::adw_animation_get_state(self.as_ref().to_glib_none().0)) } } #[doc(alias = "adw_animation_get_target")] #[doc(alias = "get_target")] fn target(&self) -> AnimationTarget { unsafe { from_glib_none(ffi::adw_animation_get_target( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_animation_get_value")] #[doc(alias = "get_value")] fn value(&self) -> f64 { unsafe { ffi::adw_animation_get_value(self.as_ref().to_glib_none().0) } } #[doc(alias = "adw_animation_get_widget")] #[doc(alias = "get_widget")] fn widget(&self) -> gtk::Widget { unsafe { from_glib_none(ffi::adw_animation_get_widget( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_animation_pause")] fn pause(&self) { unsafe { ffi::adw_animation_pause(self.as_ref().to_glib_none().0); } } #[doc(alias = "adw_animation_play")] fn play(&self) { unsafe { ffi::adw_animation_play(self.as_ref().to_glib_none().0); } } #[doc(alias = "adw_animation_reset")] fn reset(&self) { unsafe { ffi::adw_animation_reset(self.as_ref().to_glib_none().0); } } #[doc(alias = "adw_animation_resume")] fn resume(&self) { unsafe { ffi::adw_animation_resume(self.as_ref().to_glib_none().0); } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_animation_set_follow_enable_animations_setting")] #[doc(alias = "follow-enable-animations-setting")] fn set_follow_enable_animations_setting(&self, setting: bool) { unsafe { ffi::adw_animation_set_follow_enable_animations_setting( self.as_ref().to_glib_none().0, setting.into_glib(), ); } } #[doc(alias = "adw_animation_set_target")] #[doc(alias = "target")] fn set_target(&self, target: &impl IsA) { unsafe { ffi::adw_animation_set_target( self.as_ref().to_glib_none().0, target.as_ref().to_glib_none().0, ); } } #[doc(alias = "adw_animation_skip")] fn skip(&self) { unsafe { ffi::adw_animation_skip(self.as_ref().to_glib_none().0); } } #[doc(alias = "done")] fn connect_done(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn done_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwAnimation, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Animation::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"done".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( done_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "follow-enable-animations-setting")] fn connect_follow_enable_animations_setting_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_follow_enable_animations_setting_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwAnimation, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Animation::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::follow-enable-animations-setting".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_follow_enable_animations_setting_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "state")] fn connect_state_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_state_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwAnimation, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Animation::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::state".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_state_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "target")] fn connect_target_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_target_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwAnimation, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Animation::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::target".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_target_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "value")] fn connect_value_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_value_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwAnimation, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Animation::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::value".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_value_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> AnimationExt for O {} libadwaita-0.7.2/src/auto/animation_target.rs000064400000000000000000000007511046102023000173700ustar 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; glib::wrapper! { #[doc(alias = "AdwAnimationTarget")] pub struct AnimationTarget(Object); match fn { type_ => || ffi::adw_animation_target_get_type(), } } impl AnimationTarget { pub const NONE: Option<&'static AnimationTarget> = None; } libadwaita-0.7.2/src/auto/application.rs000064400000000000000000000113201046102023000163400ustar 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, StyleManager}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwApplication")] pub struct Application(Object) @extends gtk::Application, gio::Application, @implements gio::ActionGroup, gio::ActionMap; match fn { type_ => || ffi::adw_application_get_type(), } } impl Application { pub const NONE: Option<&'static Application> = None; // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Application`] objects. /// /// This method returns an instance of [`ApplicationBuilder`](crate::builders::ApplicationBuilder) which can be used to create [`Application`] objects. pub fn builder() -> ApplicationBuilder { ApplicationBuilder::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Application`] 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 ApplicationBuilder { builder: glib::object::ObjectBuilder<'static, Application>, } impl ApplicationBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn menubar(self, menubar: &impl IsA) -> Self { Self { builder: self.builder.property("menubar", menubar.clone().upcast()), } } pub fn register_session(self, register_session: bool) -> Self { Self { builder: self.builder.property("register-session", register_session), } } pub fn application_id(self, application_id: impl Into) -> Self { Self { builder: self .builder .property("application-id", application_id.into()), } } pub fn flags(self, flags: gio::ApplicationFlags) -> Self { Self { builder: self.builder.property("flags", flags), } } pub fn inactivity_timeout(self, inactivity_timeout: u32) -> Self { Self { builder: self .builder .property("inactivity-timeout", inactivity_timeout), } } pub fn resource_base_path(self, resource_base_path: impl Into) -> Self { Self { builder: self .builder .property("resource-base-path", resource_base_path.into()), } } #[cfg(feature = "gio_v2_80")] #[cfg_attr(docsrs, doc(cfg(feature = "gio_v2_80")))] pub fn version(self, version: impl Into) -> Self { Self { builder: self.builder.property("version", version.into()), } } // rustdoc-stripper-ignore-next /// Build the [`Application`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Application { let ret = self.builder.build(); { Application::register_startup_hook(&ret); } ret } } pub trait AdwApplicationExt: IsA + 'static { #[doc(alias = "adw_application_get_style_manager")] #[doc(alias = "get_style_manager")] #[doc(alias = "style-manager")] fn style_manager(&self) -> StyleManager { unsafe { from_glib_none(ffi::adw_application_get_style_manager( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "style-manager")] fn connect_style_manager_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_style_manager_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwApplication, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Application::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::style-manager".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_style_manager_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> AdwApplicationExt for O {} libadwaita-0.7.2/src/auto/application_window.rs000064400000000000000000000514171046102023000177420ustar 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; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] use crate::Breakpoint; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] use crate::Dialog; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwApplicationWindow")] pub struct ApplicationWindow(Object) @extends gtk::ApplicationWindow, gtk::Window, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Native, gtk::Root, gtk::ShortcutManager, gio::ActionGroup, gio::ActionMap; match fn { type_ => || ffi::adw_application_window_get_type(), } } impl ApplicationWindow { pub const NONE: Option<&'static ApplicationWindow> = None; #[doc(alias = "adw_application_window_new")] pub fn new(app: &impl IsA) -> ApplicationWindow { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_application_window_new( app.as_ref().to_glib_none().0, )) .unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`ApplicationWindow`] objects. /// /// This method returns an instance of [`ApplicationWindowBuilder`](crate::builders::ApplicationWindowBuilder) which can be used to create [`ApplicationWindow`] objects. pub fn builder() -> ApplicationWindowBuilder { ApplicationWindowBuilder::new() } } impl Default for ApplicationWindow { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`ApplicationWindow`] 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 ApplicationWindowBuilder { builder: glib::object::ObjectBuilder<'static, ApplicationWindow>, } impl ApplicationWindowBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn adaptive_preview(self, adaptive_preview: bool) -> Self { Self { builder: self.builder.property("adaptive-preview", adaptive_preview), } } pub fn content(self, content: &impl IsA) -> Self { Self { builder: self.builder.property("content", content.clone().upcast()), } } pub fn show_menubar(self, show_menubar: bool) -> Self { Self { builder: self.builder.property("show-menubar", show_menubar), } } pub fn application(self, application: &impl IsA) -> Self { Self { builder: self .builder .property("application", application.clone().upcast()), } } pub fn decorated(self, decorated: bool) -> Self { Self { builder: self.builder.property("decorated", decorated), } } pub fn default_height(self, default_height: i32) -> Self { Self { builder: self.builder.property("default-height", default_height), } } pub fn default_widget(self, default_widget: &impl IsA) -> Self { Self { builder: self .builder .property("default-widget", default_widget.clone().upcast()), } } pub fn default_width(self, default_width: i32) -> Self { Self { builder: self.builder.property("default-width", default_width), } } pub fn deletable(self, deletable: bool) -> Self { Self { builder: self.builder.property("deletable", deletable), } } pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self { Self { builder: self .builder .property("destroy-with-parent", destroy_with_parent), } } pub fn display(self, display: &gdk::Display) -> Self { Self { builder: self.builder.property("display", display.clone()), } } pub fn focus_visible(self, focus_visible: bool) -> Self { Self { builder: self.builder.property("focus-visible", focus_visible), } } pub fn focus_widget(self, focus_widget: &impl IsA) -> Self { Self { builder: self .builder .property("focus-widget", focus_widget.clone().upcast()), } } pub fn fullscreened(self, fullscreened: bool) -> Self { Self { builder: self.builder.property("fullscreened", fullscreened), } } #[cfg(feature = "gtk_v4_2")] #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_2")))] pub fn handle_menubar_accel(self, handle_menubar_accel: bool) -> Self { Self { builder: self .builder .property("handle-menubar-accel", handle_menubar_accel), } } pub fn hide_on_close(self, hide_on_close: bool) -> Self { Self { builder: self.builder.property("hide-on-close", hide_on_close), } } pub fn icon_name(self, icon_name: impl Into) -> Self { Self { builder: self.builder.property("icon-name", icon_name.into()), } } pub fn maximized(self, maximized: bool) -> Self { Self { builder: self.builder.property("maximized", maximized), } } pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self { Self { builder: self .builder .property("mnemonics-visible", mnemonics_visible), } } pub fn modal(self, modal: bool) -> Self { Self { builder: self.builder.property("modal", modal), } } pub fn resizable(self, resizable: bool) -> Self { Self { builder: self.builder.property("resizable", resizable), } } pub fn startup_id(self, startup_id: impl Into) -> Self { Self { builder: self.builder.property("startup-id", startup_id.into()), } } pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } #[cfg(feature = "gtk_v4_6")] #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_6")))] pub fn titlebar(self, titlebar: &impl IsA) -> Self { Self { builder: self.builder.property("titlebar", titlebar.clone().upcast()), } } pub fn transient_for(self, transient_for: &impl IsA) -> Self { Self { builder: self .builder .property("transient-for", transient_for.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 [`ApplicationWindow`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> ApplicationWindow { assert_initialized_main_thread!(); self.builder.build() } } pub trait AdwApplicationWindowExt: IsA + 'static { #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_application_window_add_breakpoint")] fn add_breakpoint(&self, breakpoint: Breakpoint) { unsafe { ffi::adw_application_window_add_breakpoint( self.as_ref().to_glib_none().0, breakpoint.into_glib_ptr(), ); } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_application_window_get_adaptive_preview")] #[doc(alias = "get_adaptive_preview")] #[doc(alias = "adaptive-preview")] fn is_adaptive_preview(&self) -> bool { unsafe { from_glib(ffi::adw_application_window_get_adaptive_preview( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_application_window_get_content")] #[doc(alias = "get_content")] fn content(&self) -> Option { unsafe { from_glib_none(ffi::adw_application_window_get_content( self.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_application_window_get_current_breakpoint")] #[doc(alias = "get_current_breakpoint")] #[doc(alias = "current-breakpoint")] fn current_breakpoint(&self) -> Option { unsafe { from_glib_none(ffi::adw_application_window_get_current_breakpoint( self.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "adw_application_window_get_dialogs")] #[doc(alias = "get_dialogs")] fn dialogs(&self) -> gio::ListModel { unsafe { from_glib_full(ffi::adw_application_window_get_dialogs( self.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "adw_application_window_get_visible_dialog")] #[doc(alias = "get_visible_dialog")] #[doc(alias = "visible-dialog")] fn visible_dialog(&self) -> Option

{ unsafe { from_glib_none(ffi::adw_application_window_get_visible_dialog( self.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_application_window_set_adaptive_preview")] #[doc(alias = "adaptive-preview")] fn set_adaptive_preview(&self, adaptive_preview: bool) { unsafe { ffi::adw_application_window_set_adaptive_preview( self.as_ref().to_glib_none().0, adaptive_preview.into_glib(), ); } } #[doc(alias = "adw_application_window_set_content")] #[doc(alias = "content")] fn set_content(&self, content: Option<&impl IsA>) { unsafe { ffi::adw_application_window_set_content( self.as_ref().to_glib_none().0, content.map(|p| p.as_ref()).to_glib_none().0, ); } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adaptive-preview")] fn connect_adaptive_preview_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_adaptive_preview_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwApplicationWindow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ApplicationWindow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::adaptive-preview".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_adaptive_preview_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "content")] fn connect_content_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_content_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwApplicationWindow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ApplicationWindow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::content".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_content_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "current-breakpoint")] fn connect_current_breakpoint_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_current_breakpoint_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwApplicationWindow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ApplicationWindow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::current-breakpoint".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_current_breakpoint_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "dialogs")] fn connect_dialogs_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_dialogs_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwApplicationWindow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ApplicationWindow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::dialogs".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_dialogs_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "visible-dialog")] fn connect_visible_dialog_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_visible_dialog_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwApplicationWindow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ApplicationWindow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::visible-dialog".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_visible_dialog_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> AdwApplicationWindowExt for O {} libadwaita-0.7.2/src/auto/avatar.rs000064400000000000000000000355711046102023000153310ustar 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 = "AdwAvatar")] pub struct Avatar(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_avatar_get_type(), } } impl Avatar { #[doc(alias = "adw_avatar_new")] pub fn new(size: i32, text: Option<&str>, show_initials: bool) -> Avatar { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_avatar_new( size, text.to_glib_none().0, show_initials.into_glib(), )) .unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Avatar`] objects. /// /// This method returns an instance of [`AvatarBuilder`](crate::builders::AvatarBuilder) which can be used to create [`Avatar`] objects. pub fn builder() -> AvatarBuilder { AvatarBuilder::new() } #[doc(alias = "adw_avatar_draw_to_texture")] pub fn draw_to_texture(&self, scale_factor: i32) -> gdk::Texture { unsafe { from_glib_full(ffi::adw_avatar_draw_to_texture( self.to_glib_none().0, scale_factor, )) } } #[doc(alias = "adw_avatar_get_custom_image")] #[doc(alias = "get_custom_image")] #[doc(alias = "custom-image")] pub fn custom_image(&self) -> Option { unsafe { from_glib_none(ffi::adw_avatar_get_custom_image(self.to_glib_none().0)) } } #[doc(alias = "adw_avatar_get_icon_name")] #[doc(alias = "get_icon_name")] #[doc(alias = "icon-name")] pub fn icon_name(&self) -> Option { unsafe { from_glib_none(ffi::adw_avatar_get_icon_name(self.to_glib_none().0)) } } #[doc(alias = "adw_avatar_get_show_initials")] #[doc(alias = "get_show_initials")] #[doc(alias = "show-initials")] pub fn shows_initials(&self) -> bool { unsafe { from_glib(ffi::adw_avatar_get_show_initials(self.to_glib_none().0)) } } #[doc(alias = "adw_avatar_get_size")] #[doc(alias = "get_size")] pub fn size(&self) -> i32 { unsafe { ffi::adw_avatar_get_size(self.to_glib_none().0) } } #[doc(alias = "adw_avatar_get_text")] #[doc(alias = "get_text")] pub fn text(&self) -> Option { unsafe { from_glib_none(ffi::adw_avatar_get_text(self.to_glib_none().0)) } } #[doc(alias = "adw_avatar_set_custom_image")] #[doc(alias = "custom-image")] pub fn set_custom_image(&self, custom_image: Option<&impl IsA>) { unsafe { ffi::adw_avatar_set_custom_image( self.to_glib_none().0, custom_image.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_avatar_set_icon_name")] #[doc(alias = "icon-name")] pub fn set_icon_name(&self, icon_name: Option<&str>) { unsafe { ffi::adw_avatar_set_icon_name(self.to_glib_none().0, icon_name.to_glib_none().0); } } #[doc(alias = "adw_avatar_set_show_initials")] #[doc(alias = "show-initials")] pub fn set_show_initials(&self, show_initials: bool) { unsafe { ffi::adw_avatar_set_show_initials(self.to_glib_none().0, show_initials.into_glib()); } } #[doc(alias = "adw_avatar_set_size")] #[doc(alias = "size")] pub fn set_size(&self, size: i32) { unsafe { ffi::adw_avatar_set_size(self.to_glib_none().0, size); } } #[doc(alias = "adw_avatar_set_text")] #[doc(alias = "text")] pub fn set_text(&self, text: Option<&str>) { unsafe { ffi::adw_avatar_set_text(self.to_glib_none().0, text.to_glib_none().0); } } #[doc(alias = "custom-image")] pub fn connect_custom_image_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_custom_image_trampoline( this: *mut ffi::AdwAvatar, _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 _, c"notify::custom-image".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_custom_image_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::AdwAvatar, _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 _, c"notify::icon-name".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 = "show-initials")] pub fn connect_show_initials_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_show_initials_trampoline( this: *mut ffi::AdwAvatar, _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 _, c"notify::show-initials".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_show_initials_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "size")] pub fn connect_size_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_size_trampoline( this: *mut ffi::AdwAvatar, _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 _, c"notify::size".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_size_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::AdwAvatar, _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 _, c"notify::text".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_text_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for Avatar { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Avatar`] 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 AvatarBuilder { builder: glib::object::ObjectBuilder<'static, Avatar>, } impl AvatarBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn custom_image(self, custom_image: &impl IsA) -> Self { Self { builder: self .builder .property("custom-image", custom_image.clone().upcast()), } } pub fn icon_name(self, icon_name: impl Into) -> Self { Self { builder: self.builder.property("icon-name", icon_name.into()), } } pub fn show_initials(self, show_initials: bool) -> Self { Self { builder: self.builder.property("show-initials", show_initials), } } pub fn size(self, size: i32) -> Self { Self { builder: self.builder.property("size", size), } } pub fn text(self, text: impl Into) -> Self { Self { builder: self.builder.property("text", text.into()), } } 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 [`Avatar`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Avatar { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/banner.rs000064400000000000000000000414511046102023000153120ustar 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; #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] use crate::BannerButtonStyle; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwBanner")] pub struct Banner(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Actionable; match fn { type_ => || ffi::adw_banner_get_type(), } } impl Banner { #[doc(alias = "adw_banner_new")] pub fn new(title: &str) -> Banner { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_banner_new(title.to_glib_none().0)).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Banner`] objects. /// /// This method returns an instance of [`BannerBuilder`](crate::builders::BannerBuilder) which can be used to create [`Banner`] objects. pub fn builder() -> BannerBuilder { BannerBuilder::new() } #[doc(alias = "adw_banner_get_button_label")] #[doc(alias = "get_button_label")] #[doc(alias = "button-label")] pub fn button_label(&self) -> Option { unsafe { from_glib_none(ffi::adw_banner_get_button_label(self.to_glib_none().0)) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_banner_get_button_style")] #[doc(alias = "get_button_style")] #[doc(alias = "button-style")] pub fn button_style(&self) -> BannerButtonStyle { unsafe { from_glib(ffi::adw_banner_get_button_style(self.to_glib_none().0)) } } #[doc(alias = "adw_banner_get_revealed")] #[doc(alias = "get_revealed")] #[doc(alias = "revealed")] pub fn is_revealed(&self) -> bool { unsafe { from_glib(ffi::adw_banner_get_revealed(self.to_glib_none().0)) } } #[doc(alias = "adw_banner_get_title")] #[doc(alias = "get_title")] pub fn title(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_banner_get_title(self.to_glib_none().0)) } } #[doc(alias = "adw_banner_get_use_markup")] #[doc(alias = "get_use_markup")] #[doc(alias = "use-markup")] pub fn uses_markup(&self) -> bool { unsafe { from_glib(ffi::adw_banner_get_use_markup(self.to_glib_none().0)) } } #[doc(alias = "adw_banner_set_button_label")] #[doc(alias = "button-label")] pub fn set_button_label(&self, label: Option<&str>) { unsafe { ffi::adw_banner_set_button_label(self.to_glib_none().0, label.to_glib_none().0); } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_banner_set_button_style")] #[doc(alias = "button-style")] pub fn set_button_style(&self, style: BannerButtonStyle) { unsafe { ffi::adw_banner_set_button_style(self.to_glib_none().0, style.into_glib()); } } #[doc(alias = "adw_banner_set_revealed")] #[doc(alias = "revealed")] pub fn set_revealed(&self, revealed: bool) { unsafe { ffi::adw_banner_set_revealed(self.to_glib_none().0, revealed.into_glib()); } } #[doc(alias = "adw_banner_set_title")] #[doc(alias = "title")] pub fn set_title(&self, title: &str) { unsafe { ffi::adw_banner_set_title(self.to_glib_none().0, title.to_glib_none().0); } } #[doc(alias = "adw_banner_set_use_markup")] #[doc(alias = "use-markup")] pub fn set_use_markup(&self, use_markup: bool) { unsafe { ffi::adw_banner_set_use_markup(self.to_glib_none().0, use_markup.into_glib()); } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "button-clicked")] pub fn connect_button_clicked(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn button_clicked_trampoline( this: *mut ffi::AdwBanner, 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 _, c"button-clicked".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( button_clicked_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "button-label")] pub fn connect_button_label_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_button_label_trampoline( this: *mut ffi::AdwBanner, _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 _, c"notify::button-label".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_button_label_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "button-style")] pub fn connect_button_style_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_button_style_trampoline( this: *mut ffi::AdwBanner, _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 _, c"notify::button-style".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_button_style_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "revealed")] pub fn connect_revealed_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_revealed_trampoline( this: *mut ffi::AdwBanner, _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 _, c"notify::revealed".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_revealed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "title")] pub fn connect_title_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_trampoline( this: *mut ffi::AdwBanner, _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 _, c"notify::title".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "use-markup")] pub fn connect_use_markup_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_use_markup_trampoline( this: *mut ffi::AdwBanner, _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 _, c"notify::use-markup".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_use_markup_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] impl Default for Banner { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Banner`] 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 BannerBuilder { builder: glib::object::ObjectBuilder<'static, Banner>, } impl BannerBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn button_label(self, button_label: impl Into) -> Self { Self { builder: self.builder.property("button-label", button_label.into()), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn button_style(self, button_style: BannerButtonStyle) -> Self { Self { builder: self.builder.property("button-style", button_style), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn revealed(self, revealed: bool) -> Self { Self { builder: self.builder.property("revealed", revealed), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn use_markup(self, use_markup: bool) -> Self { Self { builder: self.builder.property("use-markup", use_markup), } } 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 action_name(self, action_name: impl Into) -> Self { Self { builder: self.builder.property("action-name", action_name.into()), } } pub fn action_target(self, action_target: &glib::Variant) -> Self { Self { builder: self .builder .property("action-target", action_target.clone()), } } // rustdoc-stripper-ignore-next /// Build the [`Banner`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Banner { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/bin.rs000064400000000000000000000207061046102023000146150ustar 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 = "AdwBin")] pub struct Bin(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_bin_get_type(), } } impl Bin { pub const NONE: Option<&'static Bin> = None; #[doc(alias = "adw_bin_new")] pub fn new() -> Bin { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_bin_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Bin`] objects. /// /// This method returns an instance of [`BinBuilder`](crate::builders::BinBuilder) which can be used to create [`Bin`] objects. pub fn builder() -> BinBuilder { BinBuilder::new() } } impl Default for Bin { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Bin`] 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 BinBuilder { builder: glib::object::ObjectBuilder<'static, Bin>, } impl BinBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn child(self, child: &impl IsA) -> Self { Self { builder: self.builder.property("child", child.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 [`Bin`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Bin { assert_initialized_main_thread!(); self.builder.build() } } pub trait BinExt: IsA + 'static { #[doc(alias = "adw_bin_get_child")] #[doc(alias = "get_child")] fn child(&self) -> Option { unsafe { from_glib_none(ffi::adw_bin_get_child(self.as_ref().to_glib_none().0)) } } #[doc(alias = "adw_bin_set_child")] #[doc(alias = "child")] fn set_child(&self, child: Option<&impl IsA>) { unsafe { ffi::adw_bin_set_child( self.as_ref().to_glib_none().0, child.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "child")] fn connect_child_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_child_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwBin, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Bin::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::child".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_child_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> BinExt for O {} libadwaita-0.7.2/src/auto/bottom_sheet.rs000064400000000000000000000724231046102023000165440ustar 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, Swipeable}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwBottomSheet")] pub struct BottomSheet(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, Swipeable; match fn { type_ => || ffi::adw_bottom_sheet_get_type(), } } impl BottomSheet { #[doc(alias = "adw_bottom_sheet_new")] pub fn new() -> BottomSheet { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_bottom_sheet_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`BottomSheet`] objects. /// /// This method returns an instance of [`BottomSheetBuilder`](crate::builders::BottomSheetBuilder) which can be used to create [`BottomSheet`] objects. pub fn builder() -> BottomSheetBuilder { BottomSheetBuilder::new() } #[doc(alias = "adw_bottom_sheet_get_align")] #[doc(alias = "get_align")] pub fn align(&self) -> f32 { unsafe { ffi::adw_bottom_sheet_get_align(self.to_glib_none().0) } } #[doc(alias = "adw_bottom_sheet_get_bottom_bar")] #[doc(alias = "get_bottom_bar")] #[doc(alias = "bottom-bar")] pub fn bottom_bar(&self) -> Option { unsafe { from_glib_none(ffi::adw_bottom_sheet_get_bottom_bar(self.to_glib_none().0)) } } #[doc(alias = "adw_bottom_sheet_get_bottom_bar_height")] #[doc(alias = "get_bottom_bar_height")] #[doc(alias = "bottom-bar-height")] pub fn bottom_bar_height(&self) -> i32 { unsafe { ffi::adw_bottom_sheet_get_bottom_bar_height(self.to_glib_none().0) } } #[doc(alias = "adw_bottom_sheet_get_can_close")] #[doc(alias = "get_can_close")] #[doc(alias = "can-close")] pub fn can_close(&self) -> bool { unsafe { from_glib(ffi::adw_bottom_sheet_get_can_close(self.to_glib_none().0)) } } #[doc(alias = "adw_bottom_sheet_get_can_open")] #[doc(alias = "get_can_open")] #[doc(alias = "can-open")] pub fn can_open(&self) -> bool { unsafe { from_glib(ffi::adw_bottom_sheet_get_can_open(self.to_glib_none().0)) } } #[doc(alias = "adw_bottom_sheet_get_content")] #[doc(alias = "get_content")] pub fn content(&self) -> Option { unsafe { from_glib_none(ffi::adw_bottom_sheet_get_content(self.to_glib_none().0)) } } #[doc(alias = "adw_bottom_sheet_get_full_width")] #[doc(alias = "get_full_width")] #[doc(alias = "full-width")] pub fn is_full_width(&self) -> bool { unsafe { from_glib(ffi::adw_bottom_sheet_get_full_width(self.to_glib_none().0)) } } #[doc(alias = "adw_bottom_sheet_get_modal")] #[doc(alias = "get_modal")] #[doc(alias = "modal")] pub fn is_modal(&self) -> bool { unsafe { from_glib(ffi::adw_bottom_sheet_get_modal(self.to_glib_none().0)) } } #[doc(alias = "adw_bottom_sheet_get_open")] #[doc(alias = "get_open")] #[doc(alias = "open")] pub fn is_open(&self) -> bool { unsafe { from_glib(ffi::adw_bottom_sheet_get_open(self.to_glib_none().0)) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_bottom_sheet_get_reveal_bottom_bar")] #[doc(alias = "get_reveal_bottom_bar")] #[doc(alias = "reveal-bottom-bar")] pub fn reveals_bottom_bar(&self) -> bool { unsafe { from_glib(ffi::adw_bottom_sheet_get_reveal_bottom_bar( self.to_glib_none().0, )) } } #[doc(alias = "adw_bottom_sheet_get_sheet")] #[doc(alias = "get_sheet")] pub fn sheet(&self) -> Option { unsafe { from_glib_none(ffi::adw_bottom_sheet_get_sheet(self.to_glib_none().0)) } } #[doc(alias = "adw_bottom_sheet_get_sheet_height")] #[doc(alias = "get_sheet_height")] #[doc(alias = "sheet-height")] pub fn sheet_height(&self) -> i32 { unsafe { ffi::adw_bottom_sheet_get_sheet_height(self.to_glib_none().0) } } #[doc(alias = "adw_bottom_sheet_get_show_drag_handle")] #[doc(alias = "get_show_drag_handle")] #[doc(alias = "show-drag-handle")] pub fn shows_drag_handle(&self) -> bool { unsafe { from_glib(ffi::adw_bottom_sheet_get_show_drag_handle( self.to_glib_none().0, )) } } #[doc(alias = "adw_bottom_sheet_set_align")] #[doc(alias = "align")] pub fn set_align(&self, align: f32) { unsafe { ffi::adw_bottom_sheet_set_align(self.to_glib_none().0, align); } } #[doc(alias = "adw_bottom_sheet_set_bottom_bar")] #[doc(alias = "bottom-bar")] pub fn set_bottom_bar(&self, bottom_bar: Option<&impl IsA>) { unsafe { ffi::adw_bottom_sheet_set_bottom_bar( self.to_glib_none().0, bottom_bar.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_bottom_sheet_set_can_close")] #[doc(alias = "can-close")] pub fn set_can_close(&self, can_close: bool) { unsafe { ffi::adw_bottom_sheet_set_can_close(self.to_glib_none().0, can_close.into_glib()); } } #[doc(alias = "adw_bottom_sheet_set_can_open")] #[doc(alias = "can-open")] pub fn set_can_open(&self, can_open: bool) { unsafe { ffi::adw_bottom_sheet_set_can_open(self.to_glib_none().0, can_open.into_glib()); } } #[doc(alias = "adw_bottom_sheet_set_content")] #[doc(alias = "content")] pub fn set_content(&self, content: Option<&impl IsA>) { unsafe { ffi::adw_bottom_sheet_set_content( self.to_glib_none().0, content.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_bottom_sheet_set_full_width")] #[doc(alias = "full-width")] pub fn set_full_width(&self, full_width: bool) { unsafe { ffi::adw_bottom_sheet_set_full_width(self.to_glib_none().0, full_width.into_glib()); } } #[doc(alias = "adw_bottom_sheet_set_modal")] #[doc(alias = "modal")] pub fn set_modal(&self, modal: bool) { unsafe { ffi::adw_bottom_sheet_set_modal(self.to_glib_none().0, modal.into_glib()); } } #[doc(alias = "adw_bottom_sheet_set_open")] #[doc(alias = "open")] pub fn set_open(&self, open: bool) { unsafe { ffi::adw_bottom_sheet_set_open(self.to_glib_none().0, open.into_glib()); } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_bottom_sheet_set_reveal_bottom_bar")] #[doc(alias = "reveal-bottom-bar")] pub fn set_reveal_bottom_bar(&self, reveal: bool) { unsafe { ffi::adw_bottom_sheet_set_reveal_bottom_bar(self.to_glib_none().0, reveal.into_glib()); } } #[doc(alias = "adw_bottom_sheet_set_sheet")] #[doc(alias = "sheet")] pub fn set_sheet(&self, sheet: Option<&impl IsA>) { unsafe { ffi::adw_bottom_sheet_set_sheet( self.to_glib_none().0, sheet.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_bottom_sheet_set_show_drag_handle")] #[doc(alias = "show-drag-handle")] pub fn set_show_drag_handle(&self, show_drag_handle: bool) { unsafe { ffi::adw_bottom_sheet_set_show_drag_handle( self.to_glib_none().0, show_drag_handle.into_glib(), ); } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "close-attempt")] pub fn connect_close_attempt(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn close_attempt_trampoline( this: *mut ffi::AdwBottomSheet, 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 _, c"close-attempt".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( close_attempt_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "align")] pub fn connect_align_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_align_trampoline( this: *mut ffi::AdwBottomSheet, _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 _, c"notify::align".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_align_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "bottom-bar")] pub fn connect_bottom_bar_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_bottom_bar_trampoline( this: *mut ffi::AdwBottomSheet, _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 _, c"notify::bottom-bar".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_bottom_bar_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "bottom-bar-height")] pub fn connect_bottom_bar_height_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_bottom_bar_height_trampoline( this: *mut ffi::AdwBottomSheet, _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 _, c"notify::bottom-bar-height".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_bottom_bar_height_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "can-close")] pub fn connect_can_close_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_can_close_trampoline( this: *mut ffi::AdwBottomSheet, _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 _, c"notify::can-close".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_can_close_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "can-open")] pub fn connect_can_open_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_can_open_trampoline( this: *mut ffi::AdwBottomSheet, _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 _, c"notify::can-open".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_can_open_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "content")] pub fn connect_content_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_content_trampoline( this: *mut ffi::AdwBottomSheet, _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 _, c"notify::content".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_content_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "full-width")] pub fn connect_full_width_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_full_width_trampoline( this: *mut ffi::AdwBottomSheet, _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 _, c"notify::full-width".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_full_width_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "modal")] pub fn connect_modal_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_modal_trampoline( this: *mut ffi::AdwBottomSheet, _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 _, c"notify::modal".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_modal_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "open")] pub fn connect_open_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_open_trampoline( this: *mut ffi::AdwBottomSheet, _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 _, c"notify::open".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_open_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "reveal-bottom-bar")] pub fn connect_reveal_bottom_bar_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_reveal_bottom_bar_trampoline( this: *mut ffi::AdwBottomSheet, _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 _, c"notify::reveal-bottom-bar".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_reveal_bottom_bar_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "sheet")] pub fn connect_sheet_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_sheet_trampoline( this: *mut ffi::AdwBottomSheet, _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 _, c"notify::sheet".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_sheet_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "sheet-height")] pub fn connect_sheet_height_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_sheet_height_trampoline( this: *mut ffi::AdwBottomSheet, _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 _, c"notify::sheet-height".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_sheet_height_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "show-drag-handle")] pub fn connect_show_drag_handle_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_show_drag_handle_trampoline( this: *mut ffi::AdwBottomSheet, _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 _, c"notify::show-drag-handle".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_show_drag_handle_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] impl Default for BottomSheet { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`BottomSheet`] 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 BottomSheetBuilder { builder: glib::object::ObjectBuilder<'static, BottomSheet>, } impl BottomSheetBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub fn align(self, align: f32) -> Self { Self { builder: self.builder.property("align", align), } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub fn bottom_bar(self, bottom_bar: &impl IsA) -> Self { Self { builder: self .builder .property("bottom-bar", bottom_bar.clone().upcast()), } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub fn can_close(self, can_close: bool) -> Self { Self { builder: self.builder.property("can-close", can_close), } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub fn can_open(self, can_open: bool) -> Self { Self { builder: self.builder.property("can-open", can_open), } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub fn content(self, content: &impl IsA) -> Self { Self { builder: self.builder.property("content", content.clone().upcast()), } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub fn full_width(self, full_width: bool) -> Self { Self { builder: self.builder.property("full-width", full_width), } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub fn modal(self, modal: bool) -> Self { Self { builder: self.builder.property("modal", modal), } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub fn open(self, open: bool) -> Self { Self { builder: self.builder.property("open", open), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn reveal_bottom_bar(self, reveal_bottom_bar: bool) -> Self { Self { builder: self .builder .property("reveal-bottom-bar", reveal_bottom_bar), } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub fn sheet(self, sheet: &impl IsA) -> Self { Self { builder: self.builder.property("sheet", sheet.clone().upcast()), } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub fn show_drag_handle(self, show_drag_handle: bool) -> Self { Self { builder: self.builder.property("show-drag-handle", show_drag_handle), } } 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 [`BottomSheet`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> BottomSheet { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/breakpoint.rs000064400000000000000000000106361046102023000162040ustar 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, BreakpointCondition}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwBreakpoint")] pub struct Breakpoint(Object) @implements gtk::Buildable; match fn { type_ => || ffi::adw_breakpoint_get_type(), } } impl Breakpoint { #[doc(alias = "adw_breakpoint_new")] pub fn new(condition: BreakpointCondition) -> Breakpoint { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::adw_breakpoint_new(condition.into_glib_ptr())) } } #[doc(alias = "adw_breakpoint_add_setter")] pub fn add_setter( &self, object: &impl IsA, property: &str, value: Option<&glib::Value>, ) { unsafe { ffi::adw_breakpoint_add_setter( self.to_glib_none().0, object.as_ref().to_glib_none().0, property.to_glib_none().0, value.to_glib_none().0, ); } } #[doc(alias = "adw_breakpoint_get_condition")] #[doc(alias = "get_condition")] pub fn condition(&self) -> Option { unsafe { from_glib_none(ffi::adw_breakpoint_get_condition(self.to_glib_none().0)) } } #[doc(alias = "adw_breakpoint_set_condition")] #[doc(alias = "condition")] pub fn set_condition(&self, condition: Option<&BreakpointCondition>) { unsafe { ffi::adw_breakpoint_set_condition( self.to_glib_none().0, mut_override(condition.to_glib_none().0), ); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "apply")] pub fn connect_apply(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn apply_trampoline( this: *mut ffi::AdwBreakpoint, 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 _, c"apply".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( apply_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "unapply")] pub fn connect_unapply(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn unapply_trampoline( this: *mut ffi::AdwBreakpoint, 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 _, c"unapply".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( unapply_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "condition")] pub fn connect_condition_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_condition_trampoline( this: *mut ffi::AdwBreakpoint, _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 _, c"notify::condition".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_condition_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } libadwaita-0.7.2/src/auto/breakpoint_bin.rs000064400000000000000000000262641046102023000170400ustar 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, Breakpoint}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwBreakpointBin")] pub struct BreakpointBin(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_breakpoint_bin_get_type(), } } impl BreakpointBin { pub const NONE: Option<&'static BreakpointBin> = None; #[doc(alias = "adw_breakpoint_bin_new")] pub fn new() -> BreakpointBin { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_breakpoint_bin_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`BreakpointBin`] objects. /// /// This method returns an instance of [`BreakpointBinBuilder`](crate::builders::BreakpointBinBuilder) which can be used to create [`BreakpointBin`] objects. pub fn builder() -> BreakpointBinBuilder { BreakpointBinBuilder::new() } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl Default for BreakpointBin { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`BreakpointBin`] 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 BreakpointBinBuilder { builder: glib::object::ObjectBuilder<'static, BreakpointBin>, } impl BreakpointBinBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn child(self, child: &impl IsA) -> Self { Self { builder: self.builder.property("child", child.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 [`BreakpointBin`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> BreakpointBin { assert_initialized_main_thread!(); self.builder.build() } } pub trait BreakpointBinExt: IsA + 'static { #[doc(alias = "adw_breakpoint_bin_add_breakpoint")] fn add_breakpoint(&self, breakpoint: Breakpoint) { unsafe { ffi::adw_breakpoint_bin_add_breakpoint( self.as_ref().to_glib_none().0, breakpoint.into_glib_ptr(), ); } } #[doc(alias = "adw_breakpoint_bin_get_child")] #[doc(alias = "get_child")] fn child(&self) -> Option { unsafe { from_glib_none(ffi::adw_breakpoint_bin_get_child( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_breakpoint_bin_get_current_breakpoint")] #[doc(alias = "get_current_breakpoint")] #[doc(alias = "current-breakpoint")] fn current_breakpoint(&self) -> Option { unsafe { from_glib_none(ffi::adw_breakpoint_bin_get_current_breakpoint( self.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "adw_breakpoint_bin_remove_breakpoint")] fn remove_breakpoint(&self, breakpoint: &Breakpoint) { unsafe { ffi::adw_breakpoint_bin_remove_breakpoint( self.as_ref().to_glib_none().0, breakpoint.to_glib_none().0, ); } } #[doc(alias = "adw_breakpoint_bin_set_child")] #[doc(alias = "child")] fn set_child(&self, child: Option<&impl IsA>) { unsafe { ffi::adw_breakpoint_bin_set_child( self.as_ref().to_glib_none().0, child.map(|p| p.as_ref()).to_glib_none().0, ); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "child")] fn connect_child_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_child_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwBreakpointBin, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(BreakpointBin::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::child".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_child_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "current-breakpoint")] fn connect_current_breakpoint_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_current_breakpoint_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwBreakpointBin, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(BreakpointBin::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::current-breakpoint".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_current_breakpoint_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> BreakpointBinExt for O {} libadwaita-0.7.2/src/auto/breakpoint_condition.rs000064400000000000000000000063371046102023000202550ustar 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, BreakpointConditionLengthType, BreakpointConditionRatioType, LengthUnit}; use glib::translate::*; glib::wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct BreakpointCondition(Boxed); match fn { copy => |ptr| ffi::adw_breakpoint_condition_copy(mut_override(ptr)), free => |ptr| ffi::adw_breakpoint_condition_free(ptr), type_ => || ffi::adw_breakpoint_condition_get_type(), } } impl BreakpointCondition { #[doc(alias = "adw_breakpoint_condition_new_and")] pub fn new_and( condition_1: BreakpointCondition, condition_2: BreakpointCondition, ) -> BreakpointCondition { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::adw_breakpoint_condition_new_and( condition_1.into_glib_ptr(), condition_2.into_glib_ptr(), )) } } #[doc(alias = "adw_breakpoint_condition_new_length")] pub fn new_length( type_: BreakpointConditionLengthType, value: f64, unit: LengthUnit, ) -> BreakpointCondition { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::adw_breakpoint_condition_new_length( type_.into_glib(), value, unit.into_glib(), )) } } #[doc(alias = "adw_breakpoint_condition_new_or")] pub fn new_or( condition_1: BreakpointCondition, condition_2: BreakpointCondition, ) -> BreakpointCondition { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::adw_breakpoint_condition_new_or( condition_1.into_glib_ptr(), condition_2.into_glib_ptr(), )) } } #[doc(alias = "adw_breakpoint_condition_new_ratio")] pub fn new_ratio( type_: BreakpointConditionRatioType, width: i32, height: i32, ) -> BreakpointCondition { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::adw_breakpoint_condition_new_ratio( type_.into_glib(), width, height, )) } } #[doc(alias = "adw_breakpoint_condition_to_string")] #[doc(alias = "to_string")] pub fn to_str(&self) -> glib::GString { unsafe { from_glib_full(ffi::adw_breakpoint_condition_to_string(mut_override( self.to_glib_none().0, ))) } } #[doc(alias = "adw_breakpoint_condition_parse")] pub fn parse(str: &str) -> Result { assert_initialized_main_thread!(); unsafe { Option::<_>::from_glib_full(ffi::adw_breakpoint_condition_parse(str.to_glib_none().0)) .ok_or_else(|| glib::bool_error!("Invalid condition")) } } } impl std::fmt::Display for BreakpointCondition { #[inline] fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(&self.to_str()) } } libadwaita-0.7.2/src/auto/button_content.rs000064400000000000000000000332161046102023000171120ustar 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 = "AdwButtonContent")] pub struct ButtonContent(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_button_content_get_type(), } } impl ButtonContent { #[doc(alias = "adw_button_content_new")] pub fn new() -> ButtonContent { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_button_content_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`ButtonContent`] objects. /// /// This method returns an instance of [`ButtonContentBuilder`](crate::builders::ButtonContentBuilder) which can be used to create [`ButtonContent`] objects. pub fn builder() -> ButtonContentBuilder { ButtonContentBuilder::new() } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_button_content_get_can_shrink")] #[doc(alias = "get_can_shrink")] #[doc(alias = "can-shrink")] pub fn can_shrink(&self) -> bool { unsafe { from_glib(ffi::adw_button_content_get_can_shrink( self.to_glib_none().0, )) } } #[doc(alias = "adw_button_content_get_icon_name")] #[doc(alias = "get_icon_name")] #[doc(alias = "icon-name")] pub fn icon_name(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_button_content_get_icon_name(self.to_glib_none().0)) } } #[doc(alias = "adw_button_content_get_label")] #[doc(alias = "get_label")] pub fn label(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_button_content_get_label(self.to_glib_none().0)) } } #[doc(alias = "adw_button_content_get_use_underline")] #[doc(alias = "get_use_underline")] #[doc(alias = "use-underline")] pub fn uses_underline(&self) -> bool { unsafe { from_glib(ffi::adw_button_content_get_use_underline( self.to_glib_none().0, )) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_button_content_set_can_shrink")] #[doc(alias = "can-shrink")] pub fn set_can_shrink(&self, can_shrink: bool) { unsafe { ffi::adw_button_content_set_can_shrink(self.to_glib_none().0, can_shrink.into_glib()); } } #[doc(alias = "adw_button_content_set_icon_name")] #[doc(alias = "icon-name")] pub fn set_icon_name(&self, icon_name: &str) { unsafe { ffi::adw_button_content_set_icon_name( self.to_glib_none().0, icon_name.to_glib_none().0, ); } } #[doc(alias = "adw_button_content_set_label")] #[doc(alias = "label")] pub fn set_label(&self, label: &str) { unsafe { ffi::adw_button_content_set_label(self.to_glib_none().0, label.to_glib_none().0); } } #[doc(alias = "adw_button_content_set_use_underline")] #[doc(alias = "use-underline")] pub fn set_use_underline(&self, use_underline: bool) { unsafe { ffi::adw_button_content_set_use_underline( self.to_glib_none().0, use_underline.into_glib(), ); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "can-shrink")] pub fn connect_can_shrink_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_can_shrink_trampoline( this: *mut ffi::AdwButtonContent, _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 _, c"notify::can-shrink".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_can_shrink_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::AdwButtonContent, _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 _, c"notify::icon-name".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 = "label")] pub fn connect_label_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_label_trampoline( this: *mut ffi::AdwButtonContent, _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 _, c"notify::label".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_label_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "use-underline")] pub fn connect_use_underline_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_use_underline_trampoline( this: *mut ffi::AdwButtonContent, _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 _, c"notify::use-underline".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_use_underline_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for ButtonContent { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`ButtonContent`] 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 ButtonContentBuilder { builder: glib::object::ObjectBuilder<'static, ButtonContent>, } impl ButtonContentBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn can_shrink(self, can_shrink: bool) -> Self { Self { builder: self.builder.property("can-shrink", can_shrink), } } pub fn icon_name(self, icon_name: impl Into) -> Self { Self { builder: self.builder.property("icon-name", icon_name.into()), } } pub fn label(self, label: impl Into) -> Self { Self { builder: self.builder.property("label", label.into()), } } pub fn use_underline(self, use_underline: bool) -> Self { Self { builder: self.builder.property("use-underline", use_underline), } } 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 [`ButtonContent`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> ButtonContent { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/button_row.rs000064400000000000000000000325621046102023000162520ustar 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, PreferencesRow}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwButtonRow")] pub struct ButtonRow(Object) @extends PreferencesRow, gtk::ListBoxRow, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Actionable; match fn { type_ => || ffi::adw_button_row_get_type(), } } impl ButtonRow { #[doc(alias = "adw_button_row_new")] pub fn new() -> ButtonRow { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_button_row_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`ButtonRow`] objects. /// /// This method returns an instance of [`ButtonRowBuilder`](crate::builders::ButtonRowBuilder) which can be used to create [`ButtonRow`] objects. pub fn builder() -> ButtonRowBuilder { ButtonRowBuilder::new() } #[doc(alias = "adw_button_row_get_end_icon_name")] #[doc(alias = "get_end_icon_name")] #[doc(alias = "end-icon-name")] pub fn end_icon_name(&self) -> Option { unsafe { from_glib_none(ffi::adw_button_row_get_end_icon_name(self.to_glib_none().0)) } } #[doc(alias = "adw_button_row_get_start_icon_name")] #[doc(alias = "get_start_icon_name")] #[doc(alias = "start-icon-name")] pub fn start_icon_name(&self) -> Option { unsafe { from_glib_none(ffi::adw_button_row_get_start_icon_name( self.to_glib_none().0, )) } } #[doc(alias = "adw_button_row_set_end_icon_name")] #[doc(alias = "end-icon-name")] pub fn set_end_icon_name(&self, icon_name: Option<&str>) { unsafe { ffi::adw_button_row_set_end_icon_name( self.to_glib_none().0, icon_name.to_glib_none().0, ); } } #[doc(alias = "adw_button_row_set_start_icon_name")] #[doc(alias = "start-icon-name")] pub fn set_start_icon_name(&self, icon_name: Option<&str>) { unsafe { ffi::adw_button_row_set_start_icon_name( self.to_glib_none().0, icon_name.to_glib_none().0, ); } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "activated")] pub fn connect_activated(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn activated_trampoline( this: *mut ffi::AdwButtonRow, 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 _, c"activated".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( activated_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "end-icon-name")] pub fn connect_end_icon_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_end_icon_name_trampoline( this: *mut ffi::AdwButtonRow, _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 _, c"notify::end-icon-name".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_end_icon_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "start-icon-name")] pub fn connect_start_icon_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_start_icon_name_trampoline( this: *mut ffi::AdwButtonRow, _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 _, c"notify::start-icon-name".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_start_icon_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] impl Default for ButtonRow { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`ButtonRow`] 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 ButtonRowBuilder { builder: glib::object::ObjectBuilder<'static, ButtonRow>, } impl ButtonRowBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub fn end_icon_name(self, end_icon_name: impl Into) -> Self { Self { builder: self.builder.property("end-icon-name", end_icon_name.into()), } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub fn start_icon_name(self, start_icon_name: impl Into) -> Self { Self { builder: self .builder .property("start-icon-name", start_icon_name.into()), } } pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub fn title_selectable(self, title_selectable: bool) -> Self { Self { builder: self.builder.property("title-selectable", title_selectable), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn use_markup(self, use_markup: bool) -> Self { Self { builder: self.builder.property("use-markup", use_markup), } } pub fn use_underline(self, use_underline: bool) -> Self { Self { builder: self.builder.property("use-underline", use_underline), } } pub fn activatable(self, activatable: bool) -> Self { Self { builder: self.builder.property("activatable", activatable), } } pub fn child(self, child: &impl IsA) -> Self { Self { builder: self.builder.property("child", child.clone().upcast()), } } pub fn selectable(self, selectable: bool) -> Self { Self { builder: self.builder.property("selectable", selectable), } } 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 action_name(self, action_name: impl Into) -> Self { Self { builder: self.builder.property("action-name", action_name.into()), } } pub fn action_target(self, action_target: &glib::Variant) -> Self { Self { builder: self .builder .property("action-target", action_target.clone()), } } // rustdoc-stripper-ignore-next /// Build the [`ButtonRow`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> ButtonRow { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/callback_animation_target.rs000064400000000000000000000032221046102023000212000ustar 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, AnimationTarget}; use glib::{prelude::*, translate::*}; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwCallbackAnimationTarget")] pub struct CallbackAnimationTarget(Object) @extends AnimationTarget; match fn { type_ => || ffi::adw_callback_animation_target_get_type(), } } impl CallbackAnimationTarget { #[doc(alias = "adw_callback_animation_target_new")] pub fn new(callback: P) -> CallbackAnimationTarget { assert_initialized_main_thread!(); let callback_data: Box_

= Box_::new(callback); unsafe extern "C" fn callback_func( value: std::ffi::c_double, user_data: glib::ffi::gpointer, ) { let callback = &*(user_data as *mut P); (*callback)(value) } let callback = Some(callback_func::

as _); unsafe extern "C" fn destroy_func(data: glib::ffi::gpointer) { let _callback = Box_::from_raw(data as *mut P); } let destroy_call2 = Some(destroy_func::

as _); let super_callback0: Box_

= callback_data; unsafe { AnimationTarget::from_glib_full(ffi::adw_callback_animation_target_new( callback, Box_::into_raw(super_callback0) as *mut _, destroy_call2, )) .unsafe_cast() } } } libadwaita-0.7.2/src/auto/carousel.rs000064400000000000000000000560461046102023000156700ustar 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, SpringParams, Swipeable}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwCarousel")] pub struct Carousel(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, Swipeable, gtk::Orientable; match fn { type_ => || ffi::adw_carousel_get_type(), } } impl Carousel { #[doc(alias = "adw_carousel_new")] pub fn new() -> Carousel { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_carousel_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Carousel`] objects. /// /// This method returns an instance of [`CarouselBuilder`](crate::builders::CarouselBuilder) which can be used to create [`Carousel`] objects. pub fn builder() -> CarouselBuilder { CarouselBuilder::new() } #[doc(alias = "adw_carousel_append")] pub fn append(&self, child: &impl IsA) { unsafe { ffi::adw_carousel_append(self.to_glib_none().0, child.as_ref().to_glib_none().0); } } #[doc(alias = "adw_carousel_get_allow_long_swipes")] #[doc(alias = "get_allow_long_swipes")] #[doc(alias = "allow-long-swipes")] pub fn allows_long_swipes(&self) -> bool { unsafe { from_glib(ffi::adw_carousel_get_allow_long_swipes( self.to_glib_none().0, )) } } #[doc(alias = "adw_carousel_get_allow_mouse_drag")] #[doc(alias = "get_allow_mouse_drag")] #[doc(alias = "allow-mouse-drag")] pub fn allows_mouse_drag(&self) -> bool { unsafe { from_glib(ffi::adw_carousel_get_allow_mouse_drag( self.to_glib_none().0, )) } } #[doc(alias = "adw_carousel_get_allow_scroll_wheel")] #[doc(alias = "get_allow_scroll_wheel")] #[doc(alias = "allow-scroll-wheel")] pub fn allows_scroll_wheel(&self) -> bool { unsafe { from_glib(ffi::adw_carousel_get_allow_scroll_wheel( self.to_glib_none().0, )) } } #[doc(alias = "adw_carousel_get_interactive")] #[doc(alias = "get_interactive")] #[doc(alias = "interactive")] pub fn is_interactive(&self) -> bool { unsafe { from_glib(ffi::adw_carousel_get_interactive(self.to_glib_none().0)) } } #[doc(alias = "adw_carousel_get_n_pages")] #[doc(alias = "get_n_pages")] #[doc(alias = "n-pages")] pub fn n_pages(&self) -> u32 { unsafe { ffi::adw_carousel_get_n_pages(self.to_glib_none().0) } } #[doc(alias = "adw_carousel_get_position")] #[doc(alias = "get_position")] pub fn position(&self) -> f64 { unsafe { ffi::adw_carousel_get_position(self.to_glib_none().0) } } #[doc(alias = "adw_carousel_get_reveal_duration")] #[doc(alias = "get_reveal_duration")] #[doc(alias = "reveal-duration")] pub fn reveal_duration(&self) -> u32 { unsafe { ffi::adw_carousel_get_reveal_duration(self.to_glib_none().0) } } #[doc(alias = "adw_carousel_get_scroll_params")] #[doc(alias = "get_scroll_params")] #[doc(alias = "scroll-params")] pub fn scroll_params(&self) -> SpringParams { unsafe { from_glib_full(ffi::adw_carousel_get_scroll_params(self.to_glib_none().0)) } } #[doc(alias = "adw_carousel_get_spacing")] #[doc(alias = "get_spacing")] pub fn spacing(&self) -> u32 { unsafe { ffi::adw_carousel_get_spacing(self.to_glib_none().0) } } #[doc(alias = "adw_carousel_insert")] pub fn insert(&self, child: &impl IsA, position: i32) { unsafe { ffi::adw_carousel_insert( self.to_glib_none().0, child.as_ref().to_glib_none().0, position, ); } } #[doc(alias = "adw_carousel_prepend")] pub fn prepend(&self, child: &impl IsA) { unsafe { ffi::adw_carousel_prepend(self.to_glib_none().0, child.as_ref().to_glib_none().0); } } #[doc(alias = "adw_carousel_remove")] pub fn remove(&self, child: &impl IsA) { unsafe { ffi::adw_carousel_remove(self.to_glib_none().0, child.as_ref().to_glib_none().0); } } #[doc(alias = "adw_carousel_reorder")] pub fn reorder(&self, child: &impl IsA, position: i32) { unsafe { ffi::adw_carousel_reorder( self.to_glib_none().0, child.as_ref().to_glib_none().0, position, ); } } #[doc(alias = "adw_carousel_scroll_to")] pub fn scroll_to(&self, widget: &impl IsA, animate: bool) { unsafe { ffi::adw_carousel_scroll_to( self.to_glib_none().0, widget.as_ref().to_glib_none().0, animate.into_glib(), ); } } #[doc(alias = "adw_carousel_set_allow_long_swipes")] #[doc(alias = "allow-long-swipes")] pub fn set_allow_long_swipes(&self, allow_long_swipes: bool) { unsafe { ffi::adw_carousel_set_allow_long_swipes( self.to_glib_none().0, allow_long_swipes.into_glib(), ); } } #[doc(alias = "adw_carousel_set_allow_mouse_drag")] #[doc(alias = "allow-mouse-drag")] pub fn set_allow_mouse_drag(&self, allow_mouse_drag: bool) { unsafe { ffi::adw_carousel_set_allow_mouse_drag( self.to_glib_none().0, allow_mouse_drag.into_glib(), ); } } #[doc(alias = "adw_carousel_set_allow_scroll_wheel")] #[doc(alias = "allow-scroll-wheel")] pub fn set_allow_scroll_wheel(&self, allow_scroll_wheel: bool) { unsafe { ffi::adw_carousel_set_allow_scroll_wheel( self.to_glib_none().0, allow_scroll_wheel.into_glib(), ); } } #[doc(alias = "adw_carousel_set_interactive")] #[doc(alias = "interactive")] pub fn set_interactive(&self, interactive: bool) { unsafe { ffi::adw_carousel_set_interactive(self.to_glib_none().0, interactive.into_glib()); } } #[doc(alias = "adw_carousel_set_reveal_duration")] #[doc(alias = "reveal-duration")] pub fn set_reveal_duration(&self, reveal_duration: u32) { unsafe { ffi::adw_carousel_set_reveal_duration(self.to_glib_none().0, reveal_duration); } } #[doc(alias = "adw_carousel_set_scroll_params")] #[doc(alias = "scroll-params")] pub fn set_scroll_params(&self, params: &SpringParams) { unsafe { ffi::adw_carousel_set_scroll_params(self.to_glib_none().0, params.to_glib_none().0); } } #[doc(alias = "adw_carousel_set_spacing")] #[doc(alias = "spacing")] pub fn set_spacing(&self, spacing: u32) { unsafe { ffi::adw_carousel_set_spacing(self.to_glib_none().0, spacing); } } #[doc(alias = "page-changed")] pub fn connect_page_changed(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn page_changed_trampoline( this: *mut ffi::AdwCarousel, index: std::ffi::c_uint, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), index) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"page-changed".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( page_changed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "allow-long-swipes")] pub fn connect_allow_long_swipes_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_allow_long_swipes_trampoline( this: *mut ffi::AdwCarousel, _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 _, c"notify::allow-long-swipes".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_allow_long_swipes_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "allow-mouse-drag")] pub fn connect_allow_mouse_drag_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_allow_mouse_drag_trampoline( this: *mut ffi::AdwCarousel, _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 _, c"notify::allow-mouse-drag".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_allow_mouse_drag_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "allow-scroll-wheel")] pub fn connect_allow_scroll_wheel_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_allow_scroll_wheel_trampoline( this: *mut ffi::AdwCarousel, _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 _, c"notify::allow-scroll-wheel".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_allow_scroll_wheel_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "interactive")] pub fn connect_interactive_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_interactive_trampoline( this: *mut ffi::AdwCarousel, _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 _, c"notify::interactive".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_interactive_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "n-pages")] pub fn connect_n_pages_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_n_pages_trampoline( this: *mut ffi::AdwCarousel, _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 _, c"notify::n-pages".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 = "position")] pub fn connect_position_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_position_trampoline( this: *mut ffi::AdwCarousel, _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 _, c"notify::position".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_position_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "reveal-duration")] pub fn connect_reveal_duration_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_reveal_duration_trampoline( this: *mut ffi::AdwCarousel, _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 _, c"notify::reveal-duration".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_reveal_duration_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "scroll-params")] pub fn connect_scroll_params_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_scroll_params_trampoline( this: *mut ffi::AdwCarousel, _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 _, c"notify::scroll-params".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_scroll_params_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "spacing")] pub fn connect_spacing_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_spacing_trampoline( this: *mut ffi::AdwCarousel, _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 _, c"notify::spacing".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_spacing_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for Carousel { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Carousel`] 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 CarouselBuilder { builder: glib::object::ObjectBuilder<'static, Carousel>, } impl CarouselBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn allow_long_swipes(self, allow_long_swipes: bool) -> Self { Self { builder: self .builder .property("allow-long-swipes", allow_long_swipes), } } pub fn allow_mouse_drag(self, allow_mouse_drag: bool) -> Self { Self { builder: self.builder.property("allow-mouse-drag", allow_mouse_drag), } } pub fn allow_scroll_wheel(self, allow_scroll_wheel: bool) -> Self { Self { builder: self .builder .property("allow-scroll-wheel", allow_scroll_wheel), } } pub fn interactive(self, interactive: bool) -> Self { Self { builder: self.builder.property("interactive", interactive), } } pub fn reveal_duration(self, reveal_duration: u32) -> Self { Self { builder: self.builder.property("reveal-duration", reveal_duration), } } pub fn scroll_params(self, scroll_params: &SpringParams) -> Self { Self { builder: self .builder .property("scroll-params", scroll_params.clone()), } } pub fn spacing(self, spacing: u32) -> Self { Self { builder: self.builder.property("spacing", spacing), } } 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 orientation(self, orientation: gtk::Orientation) -> Self { Self { builder: self.builder.property("orientation", orientation), } } // rustdoc-stripper-ignore-next /// Build the [`Carousel`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Carousel { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/carousel_indicator_dots.rs000064400000000000000000000220361046102023000207450ustar 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, Carousel}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwCarouselIndicatorDots")] pub struct CarouselIndicatorDots(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable; match fn { type_ => || ffi::adw_carousel_indicator_dots_get_type(), } } impl CarouselIndicatorDots { #[doc(alias = "adw_carousel_indicator_dots_new")] pub fn new() -> CarouselIndicatorDots { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_carousel_indicator_dots_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`CarouselIndicatorDots`] objects. /// /// This method returns an instance of [`CarouselIndicatorDotsBuilder`](crate::builders::CarouselIndicatorDotsBuilder) which can be used to create [`CarouselIndicatorDots`] objects. pub fn builder() -> CarouselIndicatorDotsBuilder { CarouselIndicatorDotsBuilder::new() } #[doc(alias = "adw_carousel_indicator_dots_get_carousel")] #[doc(alias = "get_carousel")] pub fn carousel(&self) -> Option { unsafe { from_glib_none(ffi::adw_carousel_indicator_dots_get_carousel( self.to_glib_none().0, )) } } #[doc(alias = "adw_carousel_indicator_dots_set_carousel")] #[doc(alias = "carousel")] pub fn set_carousel(&self, carousel: Option<&Carousel>) { unsafe { ffi::adw_carousel_indicator_dots_set_carousel( self.to_glib_none().0, carousel.to_glib_none().0, ); } } #[doc(alias = "carousel")] pub fn connect_carousel_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_carousel_trampoline( this: *mut ffi::AdwCarouselIndicatorDots, _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 _, c"notify::carousel".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_carousel_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for CarouselIndicatorDots { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`CarouselIndicatorDots`] 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 CarouselIndicatorDotsBuilder { builder: glib::object::ObjectBuilder<'static, CarouselIndicatorDots>, } impl CarouselIndicatorDotsBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn carousel(self, carousel: &Carousel) -> Self { Self { builder: self.builder.property("carousel", carousel.clone()), } } 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 orientation(self, orientation: gtk::Orientation) -> Self { Self { builder: self.builder.property("orientation", orientation), } } // rustdoc-stripper-ignore-next /// Build the [`CarouselIndicatorDots`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> CarouselIndicatorDots { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/carousel_indicator_lines.rs000064400000000000000000000221451046102023000211070ustar 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, Carousel}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwCarouselIndicatorLines")] pub struct CarouselIndicatorLines(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable; match fn { type_ => || ffi::adw_carousel_indicator_lines_get_type(), } } impl CarouselIndicatorLines { #[doc(alias = "adw_carousel_indicator_lines_new")] pub fn new() -> CarouselIndicatorLines { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_carousel_indicator_lines_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`CarouselIndicatorLines`] objects. /// /// This method returns an instance of [`CarouselIndicatorLinesBuilder`](crate::builders::CarouselIndicatorLinesBuilder) which can be used to create [`CarouselIndicatorLines`] objects. pub fn builder() -> CarouselIndicatorLinesBuilder { CarouselIndicatorLinesBuilder::new() } #[doc(alias = "adw_carousel_indicator_lines_get_carousel")] #[doc(alias = "get_carousel")] pub fn carousel(&self) -> Option { unsafe { from_glib_none(ffi::adw_carousel_indicator_lines_get_carousel( self.to_glib_none().0, )) } } #[doc(alias = "adw_carousel_indicator_lines_set_carousel")] #[doc(alias = "carousel")] pub fn set_carousel(&self, carousel: Option<&Carousel>) { unsafe { ffi::adw_carousel_indicator_lines_set_carousel( self.to_glib_none().0, carousel.to_glib_none().0, ); } } #[doc(alias = "carousel")] pub fn connect_carousel_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_carousel_trampoline< F: Fn(&CarouselIndicatorLines) + 'static, >( this: *mut ffi::AdwCarouselIndicatorLines, _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 _, c"notify::carousel".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_carousel_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for CarouselIndicatorLines { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`CarouselIndicatorLines`] 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 CarouselIndicatorLinesBuilder { builder: glib::object::ObjectBuilder<'static, CarouselIndicatorLines>, } impl CarouselIndicatorLinesBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn carousel(self, carousel: &Carousel) -> Self { Self { builder: self.builder.property("carousel", carousel.clone()), } } 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 orientation(self, orientation: gtk::Orientation) -> Self { Self { builder: self.builder.property("orientation", orientation), } } // rustdoc-stripper-ignore-next /// Build the [`CarouselIndicatorLines`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> CarouselIndicatorLines { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/clamp.rs000064400000000000000000000327561046102023000151510ustar 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; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] use crate::LengthUnit; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwClamp")] pub struct Clamp(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable; match fn { type_ => || ffi::adw_clamp_get_type(), } } impl Clamp { #[doc(alias = "adw_clamp_new")] pub fn new() -> Clamp { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_clamp_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Clamp`] objects. /// /// This method returns an instance of [`ClampBuilder`](crate::builders::ClampBuilder) which can be used to create [`Clamp`] objects. pub fn builder() -> ClampBuilder { ClampBuilder::new() } #[doc(alias = "adw_clamp_get_child")] #[doc(alias = "get_child")] pub fn child(&self) -> Option { unsafe { from_glib_none(ffi::adw_clamp_get_child(self.to_glib_none().0)) } } #[doc(alias = "adw_clamp_get_maximum_size")] #[doc(alias = "get_maximum_size")] #[doc(alias = "maximum-size")] pub fn maximum_size(&self) -> i32 { unsafe { ffi::adw_clamp_get_maximum_size(self.to_glib_none().0) } } #[doc(alias = "adw_clamp_get_tightening_threshold")] #[doc(alias = "get_tightening_threshold")] #[doc(alias = "tightening-threshold")] pub fn tightening_threshold(&self) -> i32 { unsafe { ffi::adw_clamp_get_tightening_threshold(self.to_glib_none().0) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_clamp_get_unit")] #[doc(alias = "get_unit")] pub fn unit(&self) -> LengthUnit { unsafe { from_glib(ffi::adw_clamp_get_unit(self.to_glib_none().0)) } } #[doc(alias = "adw_clamp_set_child")] #[doc(alias = "child")] pub fn set_child(&self, child: Option<&impl IsA>) { unsafe { ffi::adw_clamp_set_child( self.to_glib_none().0, child.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_clamp_set_maximum_size")] #[doc(alias = "maximum-size")] pub fn set_maximum_size(&self, maximum_size: i32) { unsafe { ffi::adw_clamp_set_maximum_size(self.to_glib_none().0, maximum_size); } } #[doc(alias = "adw_clamp_set_tightening_threshold")] #[doc(alias = "tightening-threshold")] pub fn set_tightening_threshold(&self, tightening_threshold: i32) { unsafe { ffi::adw_clamp_set_tightening_threshold(self.to_glib_none().0, tightening_threshold); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_clamp_set_unit")] #[doc(alias = "unit")] pub fn set_unit(&self, unit: LengthUnit) { unsafe { ffi::adw_clamp_set_unit(self.to_glib_none().0, unit.into_glib()); } } #[doc(alias = "child")] pub fn connect_child_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_child_trampoline( this: *mut ffi::AdwClamp, _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 _, c"notify::child".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_child_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "maximum-size")] pub fn connect_maximum_size_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_maximum_size_trampoline( this: *mut ffi::AdwClamp, _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 _, c"notify::maximum-size".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_maximum_size_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "tightening-threshold")] pub fn connect_tightening_threshold_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_tightening_threshold_trampoline( this: *mut ffi::AdwClamp, _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 _, c"notify::tightening-threshold".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_tightening_threshold_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "unit")] pub fn connect_unit_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_unit_trampoline( this: *mut ffi::AdwClamp, _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 _, c"notify::unit".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_unit_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for Clamp { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Clamp`] 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 ClampBuilder { builder: glib::object::ObjectBuilder<'static, Clamp>, } impl ClampBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn child(self, child: &impl IsA) -> Self { Self { builder: self.builder.property("child", child.clone().upcast()), } } pub fn maximum_size(self, maximum_size: i32) -> Self { Self { builder: self.builder.property("maximum-size", maximum_size), } } pub fn tightening_threshold(self, tightening_threshold: i32) -> Self { Self { builder: self .builder .property("tightening-threshold", tightening_threshold), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn unit(self, unit: LengthUnit) -> Self { Self { builder: self.builder.property("unit", unit), } } 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 orientation(self, orientation: gtk::Orientation) -> Self { Self { builder: self.builder.property("orientation", orientation), } } // rustdoc-stripper-ignore-next /// Build the [`Clamp`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Clamp { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/clamp_layout.rs000064400000000000000000000165211046102023000165360ustar 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; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] use crate::LengthUnit; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwClampLayout")] pub struct ClampLayout(Object) @extends gtk::LayoutManager, @implements gtk::Orientable; match fn { type_ => || ffi::adw_clamp_layout_get_type(), } } impl ClampLayout { #[doc(alias = "adw_clamp_layout_new")] pub fn new() -> ClampLayout { assert_initialized_main_thread!(); unsafe { gtk::LayoutManager::from_glib_full(ffi::adw_clamp_layout_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`ClampLayout`] objects. /// /// This method returns an instance of [`ClampLayoutBuilder`](crate::builders::ClampLayoutBuilder) which can be used to create [`ClampLayout`] objects. pub fn builder() -> ClampLayoutBuilder { ClampLayoutBuilder::new() } #[doc(alias = "adw_clamp_layout_get_maximum_size")] #[doc(alias = "get_maximum_size")] #[doc(alias = "maximum-size")] pub fn maximum_size(&self) -> i32 { unsafe { ffi::adw_clamp_layout_get_maximum_size(self.to_glib_none().0) } } #[doc(alias = "adw_clamp_layout_get_tightening_threshold")] #[doc(alias = "get_tightening_threshold")] #[doc(alias = "tightening-threshold")] pub fn tightening_threshold(&self) -> i32 { unsafe { ffi::adw_clamp_layout_get_tightening_threshold(self.to_glib_none().0) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_clamp_layout_get_unit")] #[doc(alias = "get_unit")] pub fn unit(&self) -> LengthUnit { unsafe { from_glib(ffi::adw_clamp_layout_get_unit(self.to_glib_none().0)) } } #[doc(alias = "adw_clamp_layout_set_maximum_size")] #[doc(alias = "maximum-size")] pub fn set_maximum_size(&self, maximum_size: i32) { unsafe { ffi::adw_clamp_layout_set_maximum_size(self.to_glib_none().0, maximum_size); } } #[doc(alias = "adw_clamp_layout_set_tightening_threshold")] #[doc(alias = "tightening-threshold")] pub fn set_tightening_threshold(&self, tightening_threshold: i32) { unsafe { ffi::adw_clamp_layout_set_tightening_threshold( self.to_glib_none().0, tightening_threshold, ); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_clamp_layout_set_unit")] #[doc(alias = "unit")] pub fn set_unit(&self, unit: LengthUnit) { unsafe { ffi::adw_clamp_layout_set_unit(self.to_glib_none().0, unit.into_glib()); } } #[doc(alias = "maximum-size")] pub fn connect_maximum_size_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_maximum_size_trampoline( this: *mut ffi::AdwClampLayout, _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 _, c"notify::maximum-size".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_maximum_size_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "tightening-threshold")] pub fn connect_tightening_threshold_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_tightening_threshold_trampoline< F: Fn(&ClampLayout) + 'static, >( this: *mut ffi::AdwClampLayout, _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 _, c"notify::tightening-threshold".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_tightening_threshold_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "unit")] pub fn connect_unit_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_unit_trampoline( this: *mut ffi::AdwClampLayout, _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 _, c"notify::unit".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_unit_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for ClampLayout { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`ClampLayout`] 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 ClampLayoutBuilder { builder: glib::object::ObjectBuilder<'static, ClampLayout>, } impl ClampLayoutBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn maximum_size(self, maximum_size: i32) -> Self { Self { builder: self.builder.property("maximum-size", maximum_size), } } pub fn tightening_threshold(self, tightening_threshold: i32) -> Self { Self { builder: self .builder .property("tightening-threshold", tightening_threshold), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn unit(self, unit: LengthUnit) -> Self { Self { builder: self.builder.property("unit", unit), } } pub fn orientation(self, orientation: gtk::Orientation) -> Self { Self { builder: self.builder.property("orientation", orientation), } } // rustdoc-stripper-ignore-next /// Build the [`ClampLayout`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> ClampLayout { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/clamp_scrollable.rs000064400000000000000000000355701046102023000173500ustar 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; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] use crate::LengthUnit; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwClampScrollable")] pub struct ClampScrollable(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable, gtk::Scrollable; match fn { type_ => || ffi::adw_clamp_scrollable_get_type(), } } impl ClampScrollable { #[doc(alias = "adw_clamp_scrollable_new")] pub fn new() -> ClampScrollable { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_clamp_scrollable_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`ClampScrollable`] objects. /// /// This method returns an instance of [`ClampScrollableBuilder`](crate::builders::ClampScrollableBuilder) which can be used to create [`ClampScrollable`] objects. pub fn builder() -> ClampScrollableBuilder { ClampScrollableBuilder::new() } #[doc(alias = "adw_clamp_scrollable_get_child")] #[doc(alias = "get_child")] pub fn child(&self) -> Option { unsafe { from_glib_none(ffi::adw_clamp_scrollable_get_child(self.to_glib_none().0)) } } #[doc(alias = "adw_clamp_scrollable_get_maximum_size")] #[doc(alias = "get_maximum_size")] #[doc(alias = "maximum-size")] pub fn maximum_size(&self) -> i32 { unsafe { ffi::adw_clamp_scrollable_get_maximum_size(self.to_glib_none().0) } } #[doc(alias = "adw_clamp_scrollable_get_tightening_threshold")] #[doc(alias = "get_tightening_threshold")] #[doc(alias = "tightening-threshold")] pub fn tightening_threshold(&self) -> i32 { unsafe { ffi::adw_clamp_scrollable_get_tightening_threshold(self.to_glib_none().0) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_clamp_scrollable_get_unit")] #[doc(alias = "get_unit")] pub fn unit(&self) -> LengthUnit { unsafe { from_glib(ffi::adw_clamp_scrollable_get_unit(self.to_glib_none().0)) } } #[doc(alias = "adw_clamp_scrollable_set_child")] #[doc(alias = "child")] pub fn set_child(&self, child: Option<&impl IsA>) { unsafe { ffi::adw_clamp_scrollable_set_child( self.to_glib_none().0, child.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_clamp_scrollable_set_maximum_size")] #[doc(alias = "maximum-size")] pub fn set_maximum_size(&self, maximum_size: i32) { unsafe { ffi::adw_clamp_scrollable_set_maximum_size(self.to_glib_none().0, maximum_size); } } #[doc(alias = "adw_clamp_scrollable_set_tightening_threshold")] #[doc(alias = "tightening-threshold")] pub fn set_tightening_threshold(&self, tightening_threshold: i32) { unsafe { ffi::adw_clamp_scrollable_set_tightening_threshold( self.to_glib_none().0, tightening_threshold, ); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_clamp_scrollable_set_unit")] #[doc(alias = "unit")] pub fn set_unit(&self, unit: LengthUnit) { unsafe { ffi::adw_clamp_scrollable_set_unit(self.to_glib_none().0, unit.into_glib()); } } #[doc(alias = "child")] pub fn connect_child_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_child_trampoline( this: *mut ffi::AdwClampScrollable, _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 _, c"notify::child".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_child_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "maximum-size")] pub fn connect_maximum_size_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_maximum_size_trampoline( this: *mut ffi::AdwClampScrollable, _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 _, c"notify::maximum-size".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_maximum_size_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "tightening-threshold")] pub fn connect_tightening_threshold_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_tightening_threshold_trampoline< F: Fn(&ClampScrollable) + 'static, >( this: *mut ffi::AdwClampScrollable, _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 _, c"notify::tightening-threshold".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_tightening_threshold_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "unit")] pub fn connect_unit_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_unit_trampoline( this: *mut ffi::AdwClampScrollable, _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 _, c"notify::unit".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_unit_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for ClampScrollable { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`ClampScrollable`] 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 ClampScrollableBuilder { builder: glib::object::ObjectBuilder<'static, ClampScrollable>, } impl ClampScrollableBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn child(self, child: &impl IsA) -> Self { Self { builder: self.builder.property("child", child.clone().upcast()), } } pub fn maximum_size(self, maximum_size: i32) -> Self { Self { builder: self.builder.property("maximum-size", maximum_size), } } pub fn tightening_threshold(self, tightening_threshold: i32) -> Self { Self { builder: self .builder .property("tightening-threshold", tightening_threshold), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn unit(self, unit: LengthUnit) -> Self { Self { builder: self.builder.property("unit", unit), } } 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 orientation(self, orientation: gtk::Orientation) -> Self { Self { builder: self.builder.property("orientation", orientation), } } 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 [`ClampScrollable`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> ClampScrollable { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/combo_row.rs000064400000000000000000000677711046102023000160500ustar 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, ActionRow, PreferencesRow}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwComboRow")] pub struct ComboRow(Object) @extends ActionRow, PreferencesRow, gtk::ListBoxRow, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Actionable; match fn { type_ => || ffi::adw_combo_row_get_type(), } } impl ComboRow { pub const NONE: Option<&'static ComboRow> = None; #[doc(alias = "adw_combo_row_new")] pub fn new() -> ComboRow { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_combo_row_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`ComboRow`] objects. /// /// This method returns an instance of [`ComboRowBuilder`](crate::builders::ComboRowBuilder) which can be used to create [`ComboRow`] objects. pub fn builder() -> ComboRowBuilder { ComboRowBuilder::new() } } impl Default for ComboRow { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`ComboRow`] 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 ComboRowBuilder { builder: glib::object::ObjectBuilder<'static, ComboRow>, } impl ComboRowBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn enable_search(self, enable_search: bool) -> Self { Self { builder: self.builder.property("enable-search", enable_search), } } pub fn expression(self, expression: impl AsRef) -> Self { Self { builder: self .builder .property("expression", expression.as_ref().clone()), } } pub fn factory(self, factory: &impl IsA) -> Self { Self { builder: self.builder.property("factory", factory.clone().upcast()), } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub fn header_factory(self, header_factory: &impl IsA) -> Self { Self { builder: self .builder .property("header-factory", header_factory.clone().upcast()), } } pub fn list_factory(self, list_factory: &impl IsA) -> Self { Self { builder: self .builder .property("list-factory", list_factory.clone().upcast()), } } pub fn model(self, model: &impl IsA) -> Self { Self { builder: self.builder.property("model", model.clone().upcast()), } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub fn search_match_mode(self, search_match_mode: gtk::StringFilterMatchMode) -> Self { Self { builder: self .builder .property("search-match-mode", search_match_mode), } } pub fn selected(self, selected: u32) -> Self { Self { builder: self.builder.property("selected", selected), } } pub fn use_subtitle(self, use_subtitle: bool) -> Self { Self { builder: self.builder.property("use-subtitle", use_subtitle), } } pub fn activatable_widget(self, activatable_widget: &impl IsA) -> Self { Self { builder: self .builder .property("activatable-widget", activatable_widget.clone().upcast()), } } #[cfg_attr(feature = "v1_3", deprecated = "Since 1.3")] pub fn icon_name(self, icon_name: impl Into) -> Self { Self { builder: self.builder.property("icon-name", icon_name.into()), } } pub fn subtitle(self, subtitle: impl Into) -> Self { Self { builder: self.builder.property("subtitle", subtitle.into()), } } pub fn subtitle_lines(self, subtitle_lines: i32) -> Self { Self { builder: self.builder.property("subtitle-lines", subtitle_lines), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn subtitle_selectable(self, subtitle_selectable: bool) -> Self { Self { builder: self .builder .property("subtitle-selectable", subtitle_selectable), } } pub fn title_lines(self, title_lines: i32) -> Self { Self { builder: self.builder.property("title-lines", title_lines), } } pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub fn title_selectable(self, title_selectable: bool) -> Self { Self { builder: self.builder.property("title-selectable", title_selectable), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn use_markup(self, use_markup: bool) -> Self { Self { builder: self.builder.property("use-markup", use_markup), } } pub fn use_underline(self, use_underline: bool) -> Self { Self { builder: self.builder.property("use-underline", use_underline), } } pub fn activatable(self, activatable: bool) -> Self { Self { builder: self.builder.property("activatable", activatable), } } pub fn child(self, child: &impl IsA) -> Self { Self { builder: self.builder.property("child", child.clone().upcast()), } } pub fn selectable(self, selectable: bool) -> Self { Self { builder: self.builder.property("selectable", selectable), } } 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 action_name(self, action_name: impl Into) -> Self { Self { builder: self.builder.property("action-name", action_name.into()), } } pub fn action_target(self, action_target: &glib::Variant) -> Self { Self { builder: self .builder .property("action-target", action_target.clone()), } } // rustdoc-stripper-ignore-next /// Build the [`ComboRow`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> ComboRow { assert_initialized_main_thread!(); self.builder.build() } } pub trait ComboRowExt: IsA + 'static { #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_combo_row_get_enable_search")] #[doc(alias = "get_enable_search")] #[doc(alias = "enable-search")] fn enables_search(&self) -> bool { unsafe { from_glib(ffi::adw_combo_row_get_enable_search( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_combo_row_get_expression")] #[doc(alias = "get_expression")] fn expression(&self) -> Option { unsafe { from_glib_none(ffi::adw_combo_row_get_expression( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_combo_row_get_factory")] #[doc(alias = "get_factory")] fn factory(&self) -> Option { unsafe { from_glib_none(ffi::adw_combo_row_get_factory( self.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "adw_combo_row_get_header_factory")] #[doc(alias = "get_header_factory")] #[doc(alias = "header-factory")] fn header_factory(&self) -> Option { unsafe { from_glib_none(ffi::adw_combo_row_get_header_factory( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_combo_row_get_list_factory")] #[doc(alias = "get_list_factory")] #[doc(alias = "list-factory")] fn list_factory(&self) -> Option { unsafe { from_glib_none(ffi::adw_combo_row_get_list_factory( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_combo_row_get_model")] #[doc(alias = "get_model")] fn model(&self) -> Option { unsafe { from_glib_none(ffi::adw_combo_row_get_model(self.as_ref().to_glib_none().0)) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "adw_combo_row_get_search_match_mode")] #[doc(alias = "get_search_match_mode")] #[doc(alias = "search-match-mode")] fn search_match_mode(&self) -> gtk::StringFilterMatchMode { unsafe { from_glib(ffi::adw_combo_row_get_search_match_mode( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_combo_row_get_selected")] #[doc(alias = "get_selected")] fn selected(&self) -> u32 { unsafe { ffi::adw_combo_row_get_selected(self.as_ref().to_glib_none().0) } } #[doc(alias = "adw_combo_row_get_selected_item")] #[doc(alias = "get_selected_item")] #[doc(alias = "selected-item")] fn selected_item(&self) -> Option { unsafe { from_glib_none(ffi::adw_combo_row_get_selected_item( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_combo_row_get_use_subtitle")] #[doc(alias = "get_use_subtitle")] #[doc(alias = "use-subtitle")] fn uses_subtitle(&self) -> bool { unsafe { from_glib(ffi::adw_combo_row_get_use_subtitle( self.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_combo_row_set_enable_search")] #[doc(alias = "enable-search")] fn set_enable_search(&self, enable_search: bool) { unsafe { ffi::adw_combo_row_set_enable_search( self.as_ref().to_glib_none().0, enable_search.into_glib(), ); } } #[doc(alias = "adw_combo_row_set_expression")] #[doc(alias = "expression")] fn set_expression(&self, expression: Option>) { unsafe { ffi::adw_combo_row_set_expression( self.as_ref().to_glib_none().0, expression.as_ref().map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_combo_row_set_factory")] #[doc(alias = "factory")] fn set_factory(&self, factory: Option<&impl IsA>) { unsafe { ffi::adw_combo_row_set_factory( self.as_ref().to_glib_none().0, factory.map(|p| p.as_ref()).to_glib_none().0, ); } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "adw_combo_row_set_header_factory")] #[doc(alias = "header-factory")] fn set_header_factory(&self, factory: Option<&impl IsA>) { unsafe { ffi::adw_combo_row_set_header_factory( self.as_ref().to_glib_none().0, factory.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_combo_row_set_list_factory")] #[doc(alias = "list-factory")] fn set_list_factory(&self, factory: Option<&impl IsA>) { unsafe { ffi::adw_combo_row_set_list_factory( self.as_ref().to_glib_none().0, factory.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_combo_row_set_model")] #[doc(alias = "model")] fn set_model(&self, model: Option<&impl IsA>) { unsafe { ffi::adw_combo_row_set_model( self.as_ref().to_glib_none().0, model.map(|p| p.as_ref()).to_glib_none().0, ); } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "adw_combo_row_set_search_match_mode")] #[doc(alias = "search-match-mode")] fn set_search_match_mode(&self, search_match_mode: gtk::StringFilterMatchMode) { unsafe { ffi::adw_combo_row_set_search_match_mode( self.as_ref().to_glib_none().0, search_match_mode.into_glib(), ); } } #[doc(alias = "adw_combo_row_set_selected")] #[doc(alias = "selected")] fn set_selected(&self, position: u32) { unsafe { ffi::adw_combo_row_set_selected(self.as_ref().to_glib_none().0, position); } } #[doc(alias = "adw_combo_row_set_use_subtitle")] #[doc(alias = "use-subtitle")] fn set_use_subtitle(&self, use_subtitle: bool) { unsafe { ffi::adw_combo_row_set_use_subtitle( self.as_ref().to_glib_none().0, use_subtitle.into_glib(), ); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "enable-search")] fn connect_enable_search_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_enable_search_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwComboRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ComboRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::enable-search".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_enable_search_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "expression")] fn connect_expression_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_expression_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwComboRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ComboRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::expression".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_expression_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "factory")] fn connect_factory_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_factory_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwComboRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ComboRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::factory".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_factory_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "header-factory")] fn connect_header_factory_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_header_factory_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwComboRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ComboRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::header-factory".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_header_factory_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "list-factory")] fn connect_list_factory_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_list_factory_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwComboRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ComboRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::list-factory".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_list_factory_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "model")] fn connect_model_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_model_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwComboRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ComboRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::model".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_model_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "search-match-mode")] fn connect_search_match_mode_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_search_match_mode_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwComboRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ComboRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::search-match-mode".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_search_match_mode_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "selected")] fn connect_selected_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_selected_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwComboRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ComboRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::selected".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_selected_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "selected-item")] fn connect_selected_item_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_selected_item_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwComboRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ComboRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::selected-item".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_selected_item_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "use-subtitle")] fn connect_use_subtitle_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_use_subtitle_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwComboRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ComboRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::use-subtitle".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_use_subtitle_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> ComboRowExt for O {} libadwaita-0.7.2/src/auto/dialog.rs000064400000000000000000000673211046102023000153100ustar 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, Breakpoint, DialogPresentationMode}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwDialog")] pub struct Dialog(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::ShortcutManager; match fn { type_ => || ffi::adw_dialog_get_type(), } } impl Dialog { pub const NONE: Option<&'static Dialog> = None; #[doc(alias = "adw_dialog_new")] pub fn new() -> Dialog { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::adw_dialog_new()) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Dialog`] objects. /// /// This method returns an instance of [`DialogBuilder`](crate::builders::DialogBuilder) which can be used to create [`Dialog`] objects. pub fn builder() -> DialogBuilder { DialogBuilder::new() } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] impl Default for Dialog { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Dialog`] 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 DialogBuilder { builder: glib::object::ObjectBuilder<'static, Dialog>, } impl DialogBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn can_close(self, can_close: bool) -> Self { Self { builder: self.builder.property("can-close", can_close), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn child(self, child: &impl IsA) -> Self { Self { builder: self.builder.property("child", child.clone().upcast()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn content_height(self, content_height: i32) -> Self { Self { builder: self.builder.property("content-height", content_height), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn content_width(self, content_width: i32) -> Self { Self { builder: self.builder.property("content-width", content_width), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn default_widget(self, default_widget: &impl IsA) -> Self { Self { builder: self .builder .property("default-widget", default_widget.clone().upcast()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn focus_widget(self, focus_widget: &impl IsA) -> Self { Self { builder: self .builder .property("focus-widget", focus_widget.clone().upcast()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn follows_content_size(self, follows_content_size: bool) -> Self { Self { builder: self .builder .property("follows-content-size", follows_content_size), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn presentation_mode(self, presentation_mode: DialogPresentationMode) -> Self { Self { builder: self .builder .property("presentation-mode", presentation_mode), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } 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 [`Dialog`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Dialog { assert_initialized_main_thread!(); self.builder.build() } } pub trait AdwDialogExt: IsA

+ 'static { #[doc(alias = "adw_dialog_add_breakpoint")] fn add_breakpoint(&self, breakpoint: Breakpoint) { unsafe { ffi::adw_dialog_add_breakpoint( self.as_ref().to_glib_none().0, breakpoint.into_glib_ptr(), ); } } #[doc(alias = "adw_dialog_close")] fn close(&self) -> bool { unsafe { from_glib(ffi::adw_dialog_close(self.as_ref().to_glib_none().0)) } } #[doc(alias = "adw_dialog_force_close")] fn force_close(&self) { unsafe { ffi::adw_dialog_force_close(self.as_ref().to_glib_none().0); } } #[doc(alias = "adw_dialog_get_can_close")] #[doc(alias = "get_can_close")] #[doc(alias = "can-close")] fn can_close(&self) -> bool { unsafe { from_glib(ffi::adw_dialog_get_can_close( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_dialog_get_child")] #[doc(alias = "get_child")] fn child(&self) -> Option { unsafe { from_glib_none(ffi::adw_dialog_get_child(self.as_ref().to_glib_none().0)) } } #[doc(alias = "adw_dialog_get_content_height")] #[doc(alias = "get_content_height")] #[doc(alias = "content-height")] fn content_height(&self) -> i32 { unsafe { ffi::adw_dialog_get_content_height(self.as_ref().to_glib_none().0) } } #[doc(alias = "adw_dialog_get_content_width")] #[doc(alias = "get_content_width")] #[doc(alias = "content-width")] fn content_width(&self) -> i32 { unsafe { ffi::adw_dialog_get_content_width(self.as_ref().to_glib_none().0) } } #[doc(alias = "adw_dialog_get_current_breakpoint")] #[doc(alias = "get_current_breakpoint")] #[doc(alias = "current-breakpoint")] fn current_breakpoint(&self) -> Option { unsafe { from_glib_none(ffi::adw_dialog_get_current_breakpoint( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_dialog_get_default_widget")] #[doc(alias = "get_default_widget")] #[doc(alias = "default-widget")] fn default_widget(&self) -> Option { unsafe { from_glib_none(ffi::adw_dialog_get_default_widget( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_dialog_get_focus")] #[doc(alias = "get_focus")] #[doc(alias = "focus-widget")] fn focus(&self) -> Option { unsafe { from_glib_none(ffi::adw_dialog_get_focus(self.as_ref().to_glib_none().0)) } } #[doc(alias = "adw_dialog_get_follows_content_size")] #[doc(alias = "get_follows_content_size")] #[doc(alias = "follows-content-size")] fn follows_content_size(&self) -> bool { unsafe { from_glib(ffi::adw_dialog_get_follows_content_size( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_dialog_get_presentation_mode")] #[doc(alias = "get_presentation_mode")] #[doc(alias = "presentation-mode")] fn presentation_mode(&self) -> DialogPresentationMode { unsafe { from_glib(ffi::adw_dialog_get_presentation_mode( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_dialog_get_title")] #[doc(alias = "get_title")] fn title(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_dialog_get_title(self.as_ref().to_glib_none().0)) } } #[doc(alias = "adw_dialog_present")] fn present(&self, parent: Option<&impl IsA>) { unsafe { ffi::adw_dialog_present( self.as_ref().to_glib_none().0, parent.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_dialog_set_can_close")] #[doc(alias = "can-close")] fn set_can_close(&self, can_close: bool) { unsafe { ffi::adw_dialog_set_can_close(self.as_ref().to_glib_none().0, can_close.into_glib()); } } #[doc(alias = "adw_dialog_set_child")] #[doc(alias = "child")] fn set_child(&self, child: Option<&impl IsA>) { unsafe { ffi::adw_dialog_set_child( self.as_ref().to_glib_none().0, child.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_dialog_set_content_height")] #[doc(alias = "content-height")] fn set_content_height(&self, content_height: i32) { unsafe { ffi::adw_dialog_set_content_height(self.as_ref().to_glib_none().0, content_height); } } #[doc(alias = "adw_dialog_set_content_width")] #[doc(alias = "content-width")] fn set_content_width(&self, content_width: i32) { unsafe { ffi::adw_dialog_set_content_width(self.as_ref().to_glib_none().0, content_width); } } #[doc(alias = "adw_dialog_set_default_widget")] #[doc(alias = "default-widget")] fn set_default_widget(&self, default_widget: Option<&impl IsA>) { unsafe { ffi::adw_dialog_set_default_widget( self.as_ref().to_glib_none().0, default_widget.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_dialog_set_focus")] #[doc(alias = "focus-widget")] fn set_focus(&self, focus: Option<&impl IsA>) { unsafe { ffi::adw_dialog_set_focus( self.as_ref().to_glib_none().0, focus.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_dialog_set_follows_content_size")] #[doc(alias = "follows-content-size")] fn set_follows_content_size(&self, follows_content_size: bool) { unsafe { ffi::adw_dialog_set_follows_content_size( self.as_ref().to_glib_none().0, follows_content_size.into_glib(), ); } } #[doc(alias = "adw_dialog_set_presentation_mode")] #[doc(alias = "presentation-mode")] fn set_presentation_mode(&self, presentation_mode: DialogPresentationMode) { unsafe { ffi::adw_dialog_set_presentation_mode( self.as_ref().to_glib_none().0, presentation_mode.into_glib(), ); } } #[doc(alias = "adw_dialog_set_title")] #[doc(alias = "title")] fn set_title(&self, title: &str) { unsafe { ffi::adw_dialog_set_title(self.as_ref().to_glib_none().0, title.to_glib_none().0); } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "close-attempt")] fn connect_close_attempt(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn close_attempt_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwDialog, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Dialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"close-attempt".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( close_attempt_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "closed")] fn connect_closed(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn closed_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwDialog, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Dialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"closed".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( closed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "can-close")] fn connect_can_close_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_can_close_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Dialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::can-close".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_can_close_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "child")] fn connect_child_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_child_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Dialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::child".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_child_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "content-height")] fn connect_content_height_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_content_height_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Dialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::content-height".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_content_height_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "content-width")] fn connect_content_width_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_content_width_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Dialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::content-width".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_content_width_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "current-breakpoint")] fn connect_current_breakpoint_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_current_breakpoint_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Dialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::current-breakpoint".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_current_breakpoint_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "default-widget")] fn connect_default_widget_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_default_widget_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Dialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::default-widget".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_default_widget_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "focus-widget")] fn connect_focus_widget_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_focus_widget_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Dialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::focus-widget".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_focus_widget_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "follows-content-size")] fn connect_follows_content_size_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_follows_content_size_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Dialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::follows-content-size".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_follows_content_size_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "presentation-mode")] fn connect_presentation_mode_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_presentation_mode_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Dialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::presentation-mode".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_presentation_mode_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "title")] fn connect_title_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Dialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::title".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> AdwDialogExt for O {} libadwaita-0.7.2/src/auto/entry_row.rs000064400000000000000000000673441046102023000161060ustar 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, PreferencesRow}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwEntryRow")] pub struct EntryRow(Object) @extends PreferencesRow, gtk::ListBoxRow, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Actionable, gtk::Editable; match fn { type_ => || ffi::adw_entry_row_get_type(), } } impl EntryRow { pub const NONE: Option<&'static EntryRow> = None; #[doc(alias = "adw_entry_row_new")] pub fn new() -> EntryRow { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_entry_row_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`EntryRow`] objects. /// /// This method returns an instance of [`EntryRowBuilder`](crate::builders::EntryRowBuilder) which can be used to create [`EntryRow`] objects. pub fn builder() -> EntryRowBuilder { EntryRowBuilder::new() } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] impl Default for EntryRow { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`EntryRow`] 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 EntryRowBuilder { builder: glib::object::ObjectBuilder<'static, EntryRow>, } impl EntryRowBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn activates_default(self, activates_default: bool) -> Self { Self { builder: self .builder .property("activates-default", activates_default), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn attributes(self, attributes: &pango::AttrList) -> Self { Self { builder: self.builder.property("attributes", attributes.clone()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn enable_emoji_completion(self, enable_emoji_completion: bool) -> Self { Self { builder: self .builder .property("enable-emoji-completion", enable_emoji_completion), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn input_hints(self, input_hints: gtk::InputHints) -> Self { Self { builder: self.builder.property("input-hints", input_hints), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn input_purpose(self, input_purpose: gtk::InputPurpose) -> Self { Self { builder: self.builder.property("input-purpose", input_purpose), } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub fn max_length(self, max_length: i32) -> Self { Self { builder: self.builder.property("max-length", max_length), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn show_apply_button(self, show_apply_button: bool) -> Self { Self { builder: self .builder .property("show-apply-button", show_apply_button), } } pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub fn title_selectable(self, title_selectable: bool) -> Self { Self { builder: self.builder.property("title-selectable", title_selectable), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn use_markup(self, use_markup: bool) -> Self { Self { builder: self.builder.property("use-markup", use_markup), } } pub fn use_underline(self, use_underline: bool) -> Self { Self { builder: self.builder.property("use-underline", use_underline), } } pub fn activatable(self, activatable: bool) -> Self { Self { builder: self.builder.property("activatable", activatable), } } pub fn child(self, child: &impl IsA) -> Self { Self { builder: self.builder.property("child", child.clone().upcast()), } } pub fn selectable(self, selectable: bool) -> Self { Self { builder: self.builder.property("selectable", selectable), } } 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 action_name(self, action_name: impl Into) -> Self { Self { builder: self.builder.property("action-name", action_name.into()), } } pub fn action_target(self, action_target: &glib::Variant) -> Self { Self { builder: self .builder .property("action-target", action_target.clone()), } } pub fn editable(self, editable: bool) -> Self { Self { builder: self.builder.property("editable", editable), } } pub fn enable_undo(self, enable_undo: bool) -> Self { Self { builder: self.builder.property("enable-undo", enable_undo), } } pub fn max_width_chars(self, max_width_chars: i32) -> Self { Self { builder: self.builder.property("max-width-chars", max_width_chars), } } pub fn text(self, text: impl Into) -> Self { Self { builder: self.builder.property("text", text.into()), } } pub fn width_chars(self, width_chars: i32) -> Self { Self { builder: self.builder.property("width-chars", width_chars), } } pub fn xalign(self, xalign: f32) -> Self { Self { builder: self.builder.property("xalign", xalign), } } // rustdoc-stripper-ignore-next /// Build the [`EntryRow`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> EntryRow { assert_initialized_main_thread!(); self.builder.build() } } pub trait EntryRowExt: IsA + 'static { #[doc(alias = "adw_entry_row_add_prefix")] fn add_prefix(&self, widget: &impl IsA) { unsafe { ffi::adw_entry_row_add_prefix( self.as_ref().to_glib_none().0, widget.as_ref().to_glib_none().0, ); } } #[doc(alias = "adw_entry_row_add_suffix")] fn add_suffix(&self, widget: &impl IsA) { unsafe { ffi::adw_entry_row_add_suffix( self.as_ref().to_glib_none().0, widget.as_ref().to_glib_none().0, ); } } #[doc(alias = "adw_entry_row_get_activates_default")] #[doc(alias = "get_activates_default")] #[doc(alias = "activates-default")] fn activates_default(&self) -> bool { unsafe { from_glib(ffi::adw_entry_row_get_activates_default( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_entry_row_get_attributes")] #[doc(alias = "get_attributes")] fn attributes(&self) -> Option { unsafe { from_glib_full(ffi::adw_entry_row_get_attributes( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_entry_row_get_enable_emoji_completion")] #[doc(alias = "get_enable_emoji_completion")] #[doc(alias = "enable-emoji-completion")] fn enables_emoji_completion(&self) -> bool { unsafe { from_glib(ffi::adw_entry_row_get_enable_emoji_completion( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_entry_row_get_input_hints")] #[doc(alias = "get_input_hints")] #[doc(alias = "input-hints")] fn input_hints(&self) -> gtk::InputHints { unsafe { from_glib(ffi::adw_entry_row_get_input_hints( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_entry_row_get_input_purpose")] #[doc(alias = "get_input_purpose")] #[doc(alias = "input-purpose")] fn input_purpose(&self) -> gtk::InputPurpose { unsafe { from_glib(ffi::adw_entry_row_get_input_purpose( self.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "adw_entry_row_get_max_length")] #[doc(alias = "get_max_length")] #[doc(alias = "max-length")] fn max_length(&self) -> i32 { unsafe { ffi::adw_entry_row_get_max_length(self.as_ref().to_glib_none().0) } } #[doc(alias = "adw_entry_row_get_show_apply_button")] #[doc(alias = "get_show_apply_button")] #[doc(alias = "show-apply-button")] fn shows_apply_button(&self) -> bool { unsafe { from_glib(ffi::adw_entry_row_get_show_apply_button( self.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "adw_entry_row_get_text_length")] #[doc(alias = "get_text_length")] #[doc(alias = "text-length")] fn text_length(&self) -> u32 { unsafe { ffi::adw_entry_row_get_text_length(self.as_ref().to_glib_none().0) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_entry_row_grab_focus_without_selecting")] fn grab_focus_without_selecting(&self) -> bool { unsafe { from_glib(ffi::adw_entry_row_grab_focus_without_selecting( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_entry_row_remove")] fn remove(&self, widget: &impl IsA) { unsafe { ffi::adw_entry_row_remove( self.as_ref().to_glib_none().0, widget.as_ref().to_glib_none().0, ); } } #[doc(alias = "adw_entry_row_set_activates_default")] #[doc(alias = "activates-default")] fn set_activates_default(&self, activates: bool) { unsafe { ffi::adw_entry_row_set_activates_default( self.as_ref().to_glib_none().0, activates.into_glib(), ); } } #[doc(alias = "adw_entry_row_set_attributes")] #[doc(alias = "attributes")] fn set_attributes(&self, attributes: Option<&pango::AttrList>) { unsafe { ffi::adw_entry_row_set_attributes( self.as_ref().to_glib_none().0, attributes.to_glib_none().0, ); } } #[doc(alias = "adw_entry_row_set_enable_emoji_completion")] #[doc(alias = "enable-emoji-completion")] fn set_enable_emoji_completion(&self, enable_emoji_completion: bool) { unsafe { ffi::adw_entry_row_set_enable_emoji_completion( self.as_ref().to_glib_none().0, enable_emoji_completion.into_glib(), ); } } #[doc(alias = "adw_entry_row_set_input_hints")] #[doc(alias = "input-hints")] fn set_input_hints(&self, hints: gtk::InputHints) { unsafe { ffi::adw_entry_row_set_input_hints(self.as_ref().to_glib_none().0, hints.into_glib()); } } #[doc(alias = "adw_entry_row_set_input_purpose")] #[doc(alias = "input-purpose")] fn set_input_purpose(&self, purpose: gtk::InputPurpose) { unsafe { ffi::adw_entry_row_set_input_purpose( self.as_ref().to_glib_none().0, purpose.into_glib(), ); } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "adw_entry_row_set_max_length")] #[doc(alias = "max-length")] fn set_max_length(&self, max_length: i32) { unsafe { ffi::adw_entry_row_set_max_length(self.as_ref().to_glib_none().0, max_length); } } #[doc(alias = "adw_entry_row_set_show_apply_button")] #[doc(alias = "show-apply-button")] fn set_show_apply_button(&self, show_apply_button: bool) { unsafe { ffi::adw_entry_row_set_show_apply_button( self.as_ref().to_glib_none().0, show_apply_button.into_glib(), ); } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "apply")] fn connect_apply(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn apply_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwEntryRow, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(EntryRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"apply".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( apply_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "entry-activated")] fn connect_entry_activated(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn entry_activated_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwEntryRow, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(EntryRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"entry-activated".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( entry_activated_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "activates-default")] fn connect_activates_default_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_activates_default_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwEntryRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(EntryRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::activates-default".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_activates_default_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "attributes")] fn connect_attributes_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_attributes_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwEntryRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(EntryRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::attributes".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_attributes_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "enable-emoji-completion")] fn connect_enable_emoji_completion_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_enable_emoji_completion_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwEntryRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(EntryRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::enable-emoji-completion".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_enable_emoji_completion_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "input-hints")] fn connect_input_hints_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_input_hints_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwEntryRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(EntryRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::input-hints".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_input_hints_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "input-purpose")] fn connect_input_purpose_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_input_purpose_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwEntryRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(EntryRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::input-purpose".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_input_purpose_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "max-length")] fn connect_max_length_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_max_length_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwEntryRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(EntryRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::max-length".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_max_length_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "show-apply-button")] fn connect_show_apply_button_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_show_apply_button_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwEntryRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(EntryRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::show-apply-button".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_show_apply_button_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "text-length")] fn connect_text_length_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_text_length_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwEntryRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(EntryRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::text-length".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_text_length_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> EntryRowExt for O {} libadwaita-0.7.2/src/auto/enum_list_item.rs000064400000000000000000000074271046102023000170670ustar 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 = "AdwEnumListItem")] pub struct EnumListItem(Object); match fn { type_ => || ffi::adw_enum_list_item_get_type(), } } impl EnumListItem { #[doc(alias = "adw_enum_list_item_get_name")] #[doc(alias = "get_name")] pub fn name(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_enum_list_item_get_name(self.to_glib_none().0)) } } #[doc(alias = "adw_enum_list_item_get_nick")] #[doc(alias = "get_nick")] pub fn nick(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_enum_list_item_get_nick(self.to_glib_none().0)) } } #[doc(alias = "adw_enum_list_item_get_value")] #[doc(alias = "get_value")] pub fn value(&self) -> i32 { unsafe { ffi::adw_enum_list_item_get_value(self.to_glib_none().0) } } #[doc(alias = "name")] pub fn connect_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_name_trampoline( this: *mut ffi::AdwEnumListItem, _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 _, c"notify::name".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "nick")] pub fn connect_nick_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_nick_trampoline( this: *mut ffi::AdwEnumListItem, _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 _, c"notify::nick".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_nick_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "value")] pub fn connect_value_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_value_trampoline( this: *mut ffi::AdwEnumListItem, _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 _, c"notify::value".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_value_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl std::fmt::Display for EnumListItem { #[inline] fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(&self.name()) } } libadwaita-0.7.2/src/auto/enum_list_model.rs000064400000000000000000000023331046102023000172200ustar 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! { #[doc(alias = "AdwEnumListModel")] pub struct EnumListModel(Object) @implements gio::ListModel; match fn { type_ => || ffi::adw_enum_list_model_get_type(), } } impl EnumListModel { #[doc(alias = "adw_enum_list_model_new")] pub fn new(enum_type: glib::types::Type) -> EnumListModel { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::adw_enum_list_model_new(enum_type.into_glib())) } } #[doc(alias = "adw_enum_list_model_find_position")] pub fn find_position(&self, value: i32) -> u32 { unsafe { ffi::adw_enum_list_model_find_position(self.to_glib_none().0, value) } } #[doc(alias = "adw_enum_list_model_get_enum_type")] #[doc(alias = "get_enum_type")] #[doc(alias = "enum-type")] pub fn enum_type(&self) -> glib::types::Type { unsafe { from_glib(ffi::adw_enum_list_model_get_enum_type( self.to_glib_none().0, )) } } } libadwaita-0.7.2/src/auto/enums.rs000064400000000000000000002430741046102023000152010ustar 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::*}; #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwAccentColor")] pub enum AccentColor { #[doc(alias = "ADW_ACCENT_COLOR_BLUE")] Blue, #[doc(alias = "ADW_ACCENT_COLOR_TEAL")] Teal, #[doc(alias = "ADW_ACCENT_COLOR_GREEN")] Green, #[doc(alias = "ADW_ACCENT_COLOR_YELLOW")] Yellow, #[doc(alias = "ADW_ACCENT_COLOR_ORANGE")] Orange, #[doc(alias = "ADW_ACCENT_COLOR_RED")] Red, #[doc(alias = "ADW_ACCENT_COLOR_PINK")] Pink, #[doc(alias = "ADW_ACCENT_COLOR_PURPLE")] Purple, #[doc(alias = "ADW_ACCENT_COLOR_SLATE")] Slate, #[doc(hidden)] __Unknown(i32), } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] impl AccentColor { #[doc(alias = "adw_accent_color_to_rgba")] pub fn to_rgba(self) -> gdk::RGBA { assert_initialized_main_thread!(); unsafe { let mut rgba = gdk::RGBA::uninitialized(); ffi::adw_accent_color_to_rgba(self.into_glib(), rgba.to_glib_none_mut().0); rgba } } #[doc(alias = "adw_accent_color_to_standalone_rgba")] pub fn to_standalone_rgba(self, dark: bool) -> gdk::RGBA { assert_initialized_main_thread!(); unsafe { let mut rgba = gdk::RGBA::uninitialized(); ffi::adw_accent_color_to_standalone_rgba( self.into_glib(), dark.into_glib(), rgba.to_glib_none_mut().0, ); rgba } } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(hidden)] impl IntoGlib for AccentColor { type GlibType = ffi::AdwAccentColor; #[inline] fn into_glib(self) -> ffi::AdwAccentColor { match self { Self::Blue => ffi::ADW_ACCENT_COLOR_BLUE, Self::Teal => ffi::ADW_ACCENT_COLOR_TEAL, Self::Green => ffi::ADW_ACCENT_COLOR_GREEN, Self::Yellow => ffi::ADW_ACCENT_COLOR_YELLOW, Self::Orange => ffi::ADW_ACCENT_COLOR_ORANGE, Self::Red => ffi::ADW_ACCENT_COLOR_RED, Self::Pink => ffi::ADW_ACCENT_COLOR_PINK, Self::Purple => ffi::ADW_ACCENT_COLOR_PURPLE, Self::Slate => ffi::ADW_ACCENT_COLOR_SLATE, Self::__Unknown(value) => value, } } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(hidden)] impl FromGlib for AccentColor { #[inline] unsafe fn from_glib(value: ffi::AdwAccentColor) -> Self { skip_assert_initialized!(); match value { ffi::ADW_ACCENT_COLOR_BLUE => Self::Blue, ffi::ADW_ACCENT_COLOR_TEAL => Self::Teal, ffi::ADW_ACCENT_COLOR_GREEN => Self::Green, ffi::ADW_ACCENT_COLOR_YELLOW => Self::Yellow, ffi::ADW_ACCENT_COLOR_ORANGE => Self::Orange, ffi::ADW_ACCENT_COLOR_RED => Self::Red, ffi::ADW_ACCENT_COLOR_PINK => Self::Pink, ffi::ADW_ACCENT_COLOR_PURPLE => Self::Purple, ffi::ADW_ACCENT_COLOR_SLATE => Self::Slate, value => Self::__Unknown(value), } } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] impl StaticType for AccentColor { #[inline] #[doc(alias = "adw_accent_color_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_accent_color_get_type()) } } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] impl glib::HasParamSpec for AccentColor { 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 } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] impl glib::value::ValueType for AccentColor { type Type = Self; } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] unsafe impl<'a> glib::value::FromValue<'a> for AccentColor { 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)) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] impl ToValue for AccentColor { #[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() } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] impl From for glib::Value { #[inline] fn from(v: AccentColor) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwAnimationState")] pub enum AnimationState { #[doc(alias = "ADW_ANIMATION_IDLE")] Idle, #[doc(alias = "ADW_ANIMATION_PAUSED")] Paused, #[doc(alias = "ADW_ANIMATION_PLAYING")] Playing, #[doc(alias = "ADW_ANIMATION_FINISHED")] Finished, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for AnimationState { type GlibType = ffi::AdwAnimationState; #[inline] fn into_glib(self) -> ffi::AdwAnimationState { match self { Self::Idle => ffi::ADW_ANIMATION_IDLE, Self::Paused => ffi::ADW_ANIMATION_PAUSED, Self::Playing => ffi::ADW_ANIMATION_PLAYING, Self::Finished => ffi::ADW_ANIMATION_FINISHED, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for AnimationState { #[inline] unsafe fn from_glib(value: ffi::AdwAnimationState) -> Self { skip_assert_initialized!(); match value { ffi::ADW_ANIMATION_IDLE => Self::Idle, ffi::ADW_ANIMATION_PAUSED => Self::Paused, ffi::ADW_ANIMATION_PLAYING => Self::Playing, ffi::ADW_ANIMATION_FINISHED => Self::Finished, value => Self::__Unknown(value), } } } impl StaticType for AnimationState { #[inline] #[doc(alias = "adw_animation_state_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_animation_state_get_type()) } } } impl glib::HasParamSpec for AnimationState { 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 AnimationState { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for AnimationState { 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 AnimationState { #[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: AnimationState) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwBannerButtonStyle")] pub enum BannerButtonStyle { #[doc(alias = "ADW_BANNER_BUTTON_DEFAULT")] Default, #[doc(alias = "ADW_BANNER_BUTTON_SUGGESTED")] Suggested, #[doc(hidden)] __Unknown(i32), } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(hidden)] impl IntoGlib for BannerButtonStyle { type GlibType = ffi::AdwBannerButtonStyle; #[inline] fn into_glib(self) -> ffi::AdwBannerButtonStyle { match self { Self::Default => ffi::ADW_BANNER_BUTTON_DEFAULT, Self::Suggested => ffi::ADW_BANNER_BUTTON_SUGGESTED, Self::__Unknown(value) => value, } } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(hidden)] impl FromGlib for BannerButtonStyle { #[inline] unsafe fn from_glib(value: ffi::AdwBannerButtonStyle) -> Self { skip_assert_initialized!(); match value { ffi::ADW_BANNER_BUTTON_DEFAULT => Self::Default, ffi::ADW_BANNER_BUTTON_SUGGESTED => Self::Suggested, value => Self::__Unknown(value), } } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl StaticType for BannerButtonStyle { #[inline] #[doc(alias = "adw_banner_button_style_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_banner_button_style_get_type()) } } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl glib::HasParamSpec for BannerButtonStyle { 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 } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl glib::value::ValueType for BannerButtonStyle { type Type = Self; } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] unsafe impl<'a> glib::value::FromValue<'a> for BannerButtonStyle { 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)) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl ToValue for BannerButtonStyle { #[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() } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl From for glib::Value { #[inline] fn from(v: BannerButtonStyle) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwBreakpointConditionLengthType")] pub enum BreakpointConditionLengthType { #[doc(alias = "ADW_BREAKPOINT_CONDITION_MIN_WIDTH")] MinWidth, #[doc(alias = "ADW_BREAKPOINT_CONDITION_MAX_WIDTH")] MaxWidth, #[doc(alias = "ADW_BREAKPOINT_CONDITION_MIN_HEIGHT")] MinHeight, #[doc(alias = "ADW_BREAKPOINT_CONDITION_MAX_HEIGHT")] MaxHeight, #[doc(hidden)] __Unknown(i32), } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(hidden)] impl IntoGlib for BreakpointConditionLengthType { type GlibType = ffi::AdwBreakpointConditionLengthType; #[inline] fn into_glib(self) -> ffi::AdwBreakpointConditionLengthType { match self { Self::MinWidth => ffi::ADW_BREAKPOINT_CONDITION_MIN_WIDTH, Self::MaxWidth => ffi::ADW_BREAKPOINT_CONDITION_MAX_WIDTH, Self::MinHeight => ffi::ADW_BREAKPOINT_CONDITION_MIN_HEIGHT, Self::MaxHeight => ffi::ADW_BREAKPOINT_CONDITION_MAX_HEIGHT, Self::__Unknown(value) => value, } } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(hidden)] impl FromGlib for BreakpointConditionLengthType { #[inline] unsafe fn from_glib(value: ffi::AdwBreakpointConditionLengthType) -> Self { skip_assert_initialized!(); match value { ffi::ADW_BREAKPOINT_CONDITION_MIN_WIDTH => Self::MinWidth, ffi::ADW_BREAKPOINT_CONDITION_MAX_WIDTH => Self::MaxWidth, ffi::ADW_BREAKPOINT_CONDITION_MIN_HEIGHT => Self::MinHeight, ffi::ADW_BREAKPOINT_CONDITION_MAX_HEIGHT => Self::MaxHeight, value => Self::__Unknown(value), } } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl StaticType for BreakpointConditionLengthType { #[inline] #[doc(alias = "adw_breakpoint_condition_length_type_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_breakpoint_condition_length_type_get_type()) } } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl glib::HasParamSpec for BreakpointConditionLengthType { 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 } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl glib::value::ValueType for BreakpointConditionLengthType { type Type = Self; } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] unsafe impl<'a> glib::value::FromValue<'a> for BreakpointConditionLengthType { 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)) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl ToValue for BreakpointConditionLengthType { #[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() } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl From for glib::Value { #[inline] fn from(v: BreakpointConditionLengthType) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwBreakpointConditionRatioType")] pub enum BreakpointConditionRatioType { #[doc(alias = "ADW_BREAKPOINT_CONDITION_MIN_ASPECT_RATIO")] MinAspectRatio, #[doc(alias = "ADW_BREAKPOINT_CONDITION_MAX_ASPECT_RATIO")] MaxAspectRatio, #[doc(hidden)] __Unknown(i32), } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(hidden)] impl IntoGlib for BreakpointConditionRatioType { type GlibType = ffi::AdwBreakpointConditionRatioType; #[inline] fn into_glib(self) -> ffi::AdwBreakpointConditionRatioType { match self { Self::MinAspectRatio => ffi::ADW_BREAKPOINT_CONDITION_MIN_ASPECT_RATIO, Self::MaxAspectRatio => ffi::ADW_BREAKPOINT_CONDITION_MAX_ASPECT_RATIO, Self::__Unknown(value) => value, } } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(hidden)] impl FromGlib for BreakpointConditionRatioType { #[inline] unsafe fn from_glib(value: ffi::AdwBreakpointConditionRatioType) -> Self { skip_assert_initialized!(); match value { ffi::ADW_BREAKPOINT_CONDITION_MIN_ASPECT_RATIO => Self::MinAspectRatio, ffi::ADW_BREAKPOINT_CONDITION_MAX_ASPECT_RATIO => Self::MaxAspectRatio, value => Self::__Unknown(value), } } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl StaticType for BreakpointConditionRatioType { #[inline] #[doc(alias = "adw_breakpoint_condition_ratio_type_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_breakpoint_condition_ratio_type_get_type()) } } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl glib::HasParamSpec for BreakpointConditionRatioType { 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 } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl glib::value::ValueType for BreakpointConditionRatioType { type Type = Self; } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] unsafe impl<'a> glib::value::FromValue<'a> for BreakpointConditionRatioType { 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)) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl ToValue for BreakpointConditionRatioType { #[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() } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl From for glib::Value { #[inline] fn from(v: BreakpointConditionRatioType) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwCenteringPolicy")] pub enum CenteringPolicy { #[doc(alias = "ADW_CENTERING_POLICY_LOOSE")] Loose, #[doc(alias = "ADW_CENTERING_POLICY_STRICT")] Strict, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for CenteringPolicy { type GlibType = ffi::AdwCenteringPolicy; #[inline] fn into_glib(self) -> ffi::AdwCenteringPolicy { match self { Self::Loose => ffi::ADW_CENTERING_POLICY_LOOSE, Self::Strict => ffi::ADW_CENTERING_POLICY_STRICT, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for CenteringPolicy { #[inline] unsafe fn from_glib(value: ffi::AdwCenteringPolicy) -> Self { skip_assert_initialized!(); match value { ffi::ADW_CENTERING_POLICY_LOOSE => Self::Loose, ffi::ADW_CENTERING_POLICY_STRICT => Self::Strict, value => Self::__Unknown(value), } } } impl StaticType for CenteringPolicy { #[inline] #[doc(alias = "adw_centering_policy_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_centering_policy_get_type()) } } } impl glib::HasParamSpec for CenteringPolicy { 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 CenteringPolicy { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for CenteringPolicy { 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 CenteringPolicy { #[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: CenteringPolicy) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwColorScheme")] pub enum ColorScheme { #[doc(alias = "ADW_COLOR_SCHEME_DEFAULT")] Default, #[doc(alias = "ADW_COLOR_SCHEME_FORCE_LIGHT")] ForceLight, #[doc(alias = "ADW_COLOR_SCHEME_PREFER_LIGHT")] PreferLight, #[doc(alias = "ADW_COLOR_SCHEME_PREFER_DARK")] PreferDark, #[doc(alias = "ADW_COLOR_SCHEME_FORCE_DARK")] ForceDark, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for ColorScheme { type GlibType = ffi::AdwColorScheme; #[inline] fn into_glib(self) -> ffi::AdwColorScheme { match self { Self::Default => ffi::ADW_COLOR_SCHEME_DEFAULT, Self::ForceLight => ffi::ADW_COLOR_SCHEME_FORCE_LIGHT, Self::PreferLight => ffi::ADW_COLOR_SCHEME_PREFER_LIGHT, Self::PreferDark => ffi::ADW_COLOR_SCHEME_PREFER_DARK, Self::ForceDark => ffi::ADW_COLOR_SCHEME_FORCE_DARK, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for ColorScheme { #[inline] unsafe fn from_glib(value: ffi::AdwColorScheme) -> Self { skip_assert_initialized!(); match value { ffi::ADW_COLOR_SCHEME_DEFAULT => Self::Default, ffi::ADW_COLOR_SCHEME_FORCE_LIGHT => Self::ForceLight, ffi::ADW_COLOR_SCHEME_PREFER_LIGHT => Self::PreferLight, ffi::ADW_COLOR_SCHEME_PREFER_DARK => Self::PreferDark, ffi::ADW_COLOR_SCHEME_FORCE_DARK => Self::ForceDark, value => Self::__Unknown(value), } } } impl StaticType for ColorScheme { #[inline] #[doc(alias = "adw_color_scheme_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_color_scheme_get_type()) } } } impl glib::HasParamSpec for ColorScheme { 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 ColorScheme { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for ColorScheme { 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 ColorScheme { #[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: ColorScheme) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwDialogPresentationMode")] pub enum DialogPresentationMode { #[doc(alias = "ADW_DIALOG_AUTO")] Auto, #[doc(alias = "ADW_DIALOG_FLOATING")] Floating, #[doc(alias = "ADW_DIALOG_BOTTOM_SHEET")] BottomSheet, #[doc(hidden)] __Unknown(i32), } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(hidden)] impl IntoGlib for DialogPresentationMode { type GlibType = ffi::AdwDialogPresentationMode; #[inline] fn into_glib(self) -> ffi::AdwDialogPresentationMode { match self { Self::Auto => ffi::ADW_DIALOG_AUTO, Self::Floating => ffi::ADW_DIALOG_FLOATING, Self::BottomSheet => ffi::ADW_DIALOG_BOTTOM_SHEET, Self::__Unknown(value) => value, } } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(hidden)] impl FromGlib for DialogPresentationMode { #[inline] unsafe fn from_glib(value: ffi::AdwDialogPresentationMode) -> Self { skip_assert_initialized!(); match value { ffi::ADW_DIALOG_AUTO => Self::Auto, ffi::ADW_DIALOG_FLOATING => Self::Floating, ffi::ADW_DIALOG_BOTTOM_SHEET => Self::BottomSheet, value => Self::__Unknown(value), } } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] impl StaticType for DialogPresentationMode { #[inline] #[doc(alias = "adw_dialog_presentation_mode_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_dialog_presentation_mode_get_type()) } } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] impl glib::HasParamSpec for DialogPresentationMode { 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 } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] impl glib::value::ValueType for DialogPresentationMode { type Type = Self; } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] unsafe impl<'a> glib::value::FromValue<'a> for DialogPresentationMode { 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)) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] impl ToValue for DialogPresentationMode { #[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() } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] impl From for glib::Value { #[inline] fn from(v: DialogPresentationMode) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwEasing")] pub enum Easing { #[doc(alias = "ADW_LINEAR")] Linear, #[doc(alias = "ADW_EASE_IN_QUAD")] EaseInQuad, #[doc(alias = "ADW_EASE_OUT_QUAD")] EaseOutQuad, #[doc(alias = "ADW_EASE_IN_OUT_QUAD")] EaseInOutQuad, #[doc(alias = "ADW_EASE_IN_CUBIC")] EaseInCubic, #[doc(alias = "ADW_EASE_OUT_CUBIC")] EaseOutCubic, #[doc(alias = "ADW_EASE_IN_OUT_CUBIC")] EaseInOutCubic, #[doc(alias = "ADW_EASE_IN_QUART")] EaseInQuart, #[doc(alias = "ADW_EASE_OUT_QUART")] EaseOutQuart, #[doc(alias = "ADW_EASE_IN_OUT_QUART")] EaseInOutQuart, #[doc(alias = "ADW_EASE_IN_QUINT")] EaseInQuint, #[doc(alias = "ADW_EASE_OUT_QUINT")] EaseOutQuint, #[doc(alias = "ADW_EASE_IN_OUT_QUINT")] EaseInOutQuint, #[doc(alias = "ADW_EASE_IN_SINE")] EaseInSine, #[doc(alias = "ADW_EASE_OUT_SINE")] EaseOutSine, #[doc(alias = "ADW_EASE_IN_OUT_SINE")] EaseInOutSine, #[doc(alias = "ADW_EASE_IN_EXPO")] EaseInExpo, #[doc(alias = "ADW_EASE_OUT_EXPO")] EaseOutExpo, #[doc(alias = "ADW_EASE_IN_OUT_EXPO")] EaseInOutExpo, #[doc(alias = "ADW_EASE_IN_CIRC")] EaseInCirc, #[doc(alias = "ADW_EASE_OUT_CIRC")] EaseOutCirc, #[doc(alias = "ADW_EASE_IN_OUT_CIRC")] EaseInOutCirc, #[doc(alias = "ADW_EASE_IN_ELASTIC")] EaseInElastic, #[doc(alias = "ADW_EASE_OUT_ELASTIC")] EaseOutElastic, #[doc(alias = "ADW_EASE_IN_OUT_ELASTIC")] EaseInOutElastic, #[doc(alias = "ADW_EASE_IN_BACK")] EaseInBack, #[doc(alias = "ADW_EASE_OUT_BACK")] EaseOutBack, #[doc(alias = "ADW_EASE_IN_OUT_BACK")] EaseInOutBack, #[doc(alias = "ADW_EASE_IN_BOUNCE")] EaseInBounce, #[doc(alias = "ADW_EASE_OUT_BOUNCE")] EaseOutBounce, #[doc(alias = "ADW_EASE_IN_OUT_BOUNCE")] EaseInOutBounce, #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "ADW_EASE")] Ease, #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "ADW_EASE_IN")] EaseIn, #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "ADW_EASE_OUT")] EaseOut, #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "ADW_EASE_IN_OUT")] EaseInOut, #[doc(hidden)] __Unknown(i32), } impl Easing { #[doc(alias = "adw_easing_ease")] pub fn ease(self, value: f64) -> f64 { assert_initialized_main_thread!(); unsafe { ffi::adw_easing_ease(self.into_glib(), value) } } } #[doc(hidden)] impl IntoGlib for Easing { type GlibType = ffi::AdwEasing; fn into_glib(self) -> ffi::AdwEasing { match self { Self::Linear => ffi::ADW_LINEAR, Self::EaseInQuad => ffi::ADW_EASE_IN_QUAD, Self::EaseOutQuad => ffi::ADW_EASE_OUT_QUAD, Self::EaseInOutQuad => ffi::ADW_EASE_IN_OUT_QUAD, Self::EaseInCubic => ffi::ADW_EASE_IN_CUBIC, Self::EaseOutCubic => ffi::ADW_EASE_OUT_CUBIC, Self::EaseInOutCubic => ffi::ADW_EASE_IN_OUT_CUBIC, Self::EaseInQuart => ffi::ADW_EASE_IN_QUART, Self::EaseOutQuart => ffi::ADW_EASE_OUT_QUART, Self::EaseInOutQuart => ffi::ADW_EASE_IN_OUT_QUART, Self::EaseInQuint => ffi::ADW_EASE_IN_QUINT, Self::EaseOutQuint => ffi::ADW_EASE_OUT_QUINT, Self::EaseInOutQuint => ffi::ADW_EASE_IN_OUT_QUINT, Self::EaseInSine => ffi::ADW_EASE_IN_SINE, Self::EaseOutSine => ffi::ADW_EASE_OUT_SINE, Self::EaseInOutSine => ffi::ADW_EASE_IN_OUT_SINE, Self::EaseInExpo => ffi::ADW_EASE_IN_EXPO, Self::EaseOutExpo => ffi::ADW_EASE_OUT_EXPO, Self::EaseInOutExpo => ffi::ADW_EASE_IN_OUT_EXPO, Self::EaseInCirc => ffi::ADW_EASE_IN_CIRC, Self::EaseOutCirc => ffi::ADW_EASE_OUT_CIRC, Self::EaseInOutCirc => ffi::ADW_EASE_IN_OUT_CIRC, Self::EaseInElastic => ffi::ADW_EASE_IN_ELASTIC, Self::EaseOutElastic => ffi::ADW_EASE_OUT_ELASTIC, Self::EaseInOutElastic => ffi::ADW_EASE_IN_OUT_ELASTIC, Self::EaseInBack => ffi::ADW_EASE_IN_BACK, Self::EaseOutBack => ffi::ADW_EASE_OUT_BACK, Self::EaseInOutBack => ffi::ADW_EASE_IN_OUT_BACK, Self::EaseInBounce => ffi::ADW_EASE_IN_BOUNCE, Self::EaseOutBounce => ffi::ADW_EASE_OUT_BOUNCE, Self::EaseInOutBounce => ffi::ADW_EASE_IN_OUT_BOUNCE, #[cfg(feature = "v1_7")] Self::Ease => ffi::ADW_EASE, #[cfg(feature = "v1_7")] Self::EaseIn => ffi::ADW_EASE_IN, #[cfg(feature = "v1_7")] Self::EaseOut => ffi::ADW_EASE_OUT, #[cfg(feature = "v1_7")] Self::EaseInOut => ffi::ADW_EASE_IN_OUT, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for Easing { unsafe fn from_glib(value: ffi::AdwEasing) -> Self { skip_assert_initialized!(); match value { ffi::ADW_LINEAR => Self::Linear, ffi::ADW_EASE_IN_QUAD => Self::EaseInQuad, ffi::ADW_EASE_OUT_QUAD => Self::EaseOutQuad, ffi::ADW_EASE_IN_OUT_QUAD => Self::EaseInOutQuad, ffi::ADW_EASE_IN_CUBIC => Self::EaseInCubic, ffi::ADW_EASE_OUT_CUBIC => Self::EaseOutCubic, ffi::ADW_EASE_IN_OUT_CUBIC => Self::EaseInOutCubic, ffi::ADW_EASE_IN_QUART => Self::EaseInQuart, ffi::ADW_EASE_OUT_QUART => Self::EaseOutQuart, ffi::ADW_EASE_IN_OUT_QUART => Self::EaseInOutQuart, ffi::ADW_EASE_IN_QUINT => Self::EaseInQuint, ffi::ADW_EASE_OUT_QUINT => Self::EaseOutQuint, ffi::ADW_EASE_IN_OUT_QUINT => Self::EaseInOutQuint, ffi::ADW_EASE_IN_SINE => Self::EaseInSine, ffi::ADW_EASE_OUT_SINE => Self::EaseOutSine, ffi::ADW_EASE_IN_OUT_SINE => Self::EaseInOutSine, ffi::ADW_EASE_IN_EXPO => Self::EaseInExpo, ffi::ADW_EASE_OUT_EXPO => Self::EaseOutExpo, ffi::ADW_EASE_IN_OUT_EXPO => Self::EaseInOutExpo, ffi::ADW_EASE_IN_CIRC => Self::EaseInCirc, ffi::ADW_EASE_OUT_CIRC => Self::EaseOutCirc, ffi::ADW_EASE_IN_OUT_CIRC => Self::EaseInOutCirc, ffi::ADW_EASE_IN_ELASTIC => Self::EaseInElastic, ffi::ADW_EASE_OUT_ELASTIC => Self::EaseOutElastic, ffi::ADW_EASE_IN_OUT_ELASTIC => Self::EaseInOutElastic, ffi::ADW_EASE_IN_BACK => Self::EaseInBack, ffi::ADW_EASE_OUT_BACK => Self::EaseOutBack, ffi::ADW_EASE_IN_OUT_BACK => Self::EaseInOutBack, ffi::ADW_EASE_IN_BOUNCE => Self::EaseInBounce, ffi::ADW_EASE_OUT_BOUNCE => Self::EaseOutBounce, ffi::ADW_EASE_IN_OUT_BOUNCE => Self::EaseInOutBounce, #[cfg(feature = "v1_7")] ffi::ADW_EASE => Self::Ease, #[cfg(feature = "v1_7")] ffi::ADW_EASE_IN => Self::EaseIn, #[cfg(feature = "v1_7")] ffi::ADW_EASE_OUT => Self::EaseOut, #[cfg(feature = "v1_7")] ffi::ADW_EASE_IN_OUT => Self::EaseInOut, value => Self::__Unknown(value), } } } impl StaticType for Easing { #[inline] #[doc(alias = "adw_easing_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_easing_get_type()) } } } impl glib::HasParamSpec for Easing { 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 Easing { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for Easing { 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 Easing { #[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: Easing) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwFlapFoldPolicy")] pub enum FlapFoldPolicy { #[doc(alias = "ADW_FLAP_FOLD_POLICY_NEVER")] Never, #[doc(alias = "ADW_FLAP_FOLD_POLICY_ALWAYS")] Always, #[doc(alias = "ADW_FLAP_FOLD_POLICY_AUTO")] Auto, #[doc(hidden)] __Unknown(i32), } #[allow(deprecated)] #[doc(hidden)] impl IntoGlib for FlapFoldPolicy { type GlibType = ffi::AdwFlapFoldPolicy; #[inline] fn into_glib(self) -> ffi::AdwFlapFoldPolicy { match self { Self::Never => ffi::ADW_FLAP_FOLD_POLICY_NEVER, Self::Always => ffi::ADW_FLAP_FOLD_POLICY_ALWAYS, Self::Auto => ffi::ADW_FLAP_FOLD_POLICY_AUTO, Self::__Unknown(value) => value, } } } #[allow(deprecated)] #[doc(hidden)] impl FromGlib for FlapFoldPolicy { #[inline] unsafe fn from_glib(value: ffi::AdwFlapFoldPolicy) -> Self { skip_assert_initialized!(); match value { ffi::ADW_FLAP_FOLD_POLICY_NEVER => Self::Never, ffi::ADW_FLAP_FOLD_POLICY_ALWAYS => Self::Always, ffi::ADW_FLAP_FOLD_POLICY_AUTO => Self::Auto, value => Self::__Unknown(value), } } } #[allow(deprecated)] impl StaticType for FlapFoldPolicy { #[inline] #[doc(alias = "adw_flap_fold_policy_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_flap_fold_policy_get_type()) } } } #[allow(deprecated)] impl glib::HasParamSpec for FlapFoldPolicy { 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 } } #[allow(deprecated)] impl glib::value::ValueType for FlapFoldPolicy { type Type = Self; } #[allow(deprecated)] unsafe impl<'a> glib::value::FromValue<'a> for FlapFoldPolicy { 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)) } } #[allow(deprecated)] impl ToValue for FlapFoldPolicy { #[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() } } #[allow(deprecated)] impl From for glib::Value { #[inline] fn from(v: FlapFoldPolicy) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwFlapTransitionType")] pub enum FlapTransitionType { #[doc(alias = "ADW_FLAP_TRANSITION_TYPE_OVER")] Over, #[doc(alias = "ADW_FLAP_TRANSITION_TYPE_UNDER")] Under, #[doc(alias = "ADW_FLAP_TRANSITION_TYPE_SLIDE")] Slide, #[doc(hidden)] __Unknown(i32), } #[allow(deprecated)] #[doc(hidden)] impl IntoGlib for FlapTransitionType { type GlibType = ffi::AdwFlapTransitionType; #[inline] fn into_glib(self) -> ffi::AdwFlapTransitionType { match self { Self::Over => ffi::ADW_FLAP_TRANSITION_TYPE_OVER, Self::Under => ffi::ADW_FLAP_TRANSITION_TYPE_UNDER, Self::Slide => ffi::ADW_FLAP_TRANSITION_TYPE_SLIDE, Self::__Unknown(value) => value, } } } #[allow(deprecated)] #[doc(hidden)] impl FromGlib for FlapTransitionType { #[inline] unsafe fn from_glib(value: ffi::AdwFlapTransitionType) -> Self { skip_assert_initialized!(); match value { ffi::ADW_FLAP_TRANSITION_TYPE_OVER => Self::Over, ffi::ADW_FLAP_TRANSITION_TYPE_UNDER => Self::Under, ffi::ADW_FLAP_TRANSITION_TYPE_SLIDE => Self::Slide, value => Self::__Unknown(value), } } } #[allow(deprecated)] impl StaticType for FlapTransitionType { #[inline] #[doc(alias = "adw_flap_transition_type_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_flap_transition_type_get_type()) } } } #[allow(deprecated)] impl glib::HasParamSpec for FlapTransitionType { 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 } } #[allow(deprecated)] impl glib::value::ValueType for FlapTransitionType { type Type = Self; } #[allow(deprecated)] unsafe impl<'a> glib::value::FromValue<'a> for FlapTransitionType { 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)) } } #[allow(deprecated)] impl ToValue for FlapTransitionType { #[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() } } #[allow(deprecated)] impl From for glib::Value { #[inline] fn from(v: FlapTransitionType) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwFoldThresholdPolicy")] pub enum FoldThresholdPolicy { #[doc(alias = "ADW_FOLD_THRESHOLD_POLICY_MINIMUM")] Minimum, #[doc(alias = "ADW_FOLD_THRESHOLD_POLICY_NATURAL")] Natural, #[doc(hidden)] __Unknown(i32), } #[allow(deprecated)] #[doc(hidden)] impl IntoGlib for FoldThresholdPolicy { type GlibType = ffi::AdwFoldThresholdPolicy; #[inline] fn into_glib(self) -> ffi::AdwFoldThresholdPolicy { match self { Self::Minimum => ffi::ADW_FOLD_THRESHOLD_POLICY_MINIMUM, Self::Natural => ffi::ADW_FOLD_THRESHOLD_POLICY_NATURAL, Self::__Unknown(value) => value, } } } #[allow(deprecated)] #[doc(hidden)] impl FromGlib for FoldThresholdPolicy { #[inline] unsafe fn from_glib(value: ffi::AdwFoldThresholdPolicy) -> Self { skip_assert_initialized!(); match value { ffi::ADW_FOLD_THRESHOLD_POLICY_MINIMUM => Self::Minimum, ffi::ADW_FOLD_THRESHOLD_POLICY_NATURAL => Self::Natural, value => Self::__Unknown(value), } } } #[allow(deprecated)] impl StaticType for FoldThresholdPolicy { #[inline] #[doc(alias = "adw_fold_threshold_policy_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_fold_threshold_policy_get_type()) } } } #[allow(deprecated)] impl glib::HasParamSpec for FoldThresholdPolicy { 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 } } #[allow(deprecated)] impl glib::value::ValueType for FoldThresholdPolicy { type Type = Self; } #[allow(deprecated)] unsafe impl<'a> glib::value::FromValue<'a> for FoldThresholdPolicy { 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)) } } #[allow(deprecated)] impl ToValue for FoldThresholdPolicy { #[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() } } #[allow(deprecated)] impl From for glib::Value { #[inline] fn from(v: FoldThresholdPolicy) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwInlineViewSwitcherDisplayMode")] pub enum InlineViewSwitcherDisplayMode { #[doc(alias = "ADW_INLINE_VIEW_SWITCHER_LABELS")] Labels, #[doc(alias = "ADW_INLINE_VIEW_SWITCHER_ICONS")] Icons, #[doc(alias = "ADW_INLINE_VIEW_SWITCHER_BOTH")] Both, #[doc(hidden)] __Unknown(i32), } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(hidden)] impl IntoGlib for InlineViewSwitcherDisplayMode { type GlibType = ffi::AdwInlineViewSwitcherDisplayMode; #[inline] fn into_glib(self) -> ffi::AdwInlineViewSwitcherDisplayMode { match self { Self::Labels => ffi::ADW_INLINE_VIEW_SWITCHER_LABELS, Self::Icons => ffi::ADW_INLINE_VIEW_SWITCHER_ICONS, Self::Both => ffi::ADW_INLINE_VIEW_SWITCHER_BOTH, Self::__Unknown(value) => value, } } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(hidden)] impl FromGlib for InlineViewSwitcherDisplayMode { #[inline] unsafe fn from_glib(value: ffi::AdwInlineViewSwitcherDisplayMode) -> Self { skip_assert_initialized!(); match value { ffi::ADW_INLINE_VIEW_SWITCHER_LABELS => Self::Labels, ffi::ADW_INLINE_VIEW_SWITCHER_ICONS => Self::Icons, ffi::ADW_INLINE_VIEW_SWITCHER_BOTH => Self::Both, value => Self::__Unknown(value), } } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl StaticType for InlineViewSwitcherDisplayMode { #[inline] #[doc(alias = "adw_inline_view_switcher_display_mode_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_inline_view_switcher_display_mode_get_type()) } } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl glib::HasParamSpec for InlineViewSwitcherDisplayMode { 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 } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl glib::value::ValueType for InlineViewSwitcherDisplayMode { type Type = Self; } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] unsafe impl<'a> glib::value::FromValue<'a> for InlineViewSwitcherDisplayMode { 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)) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl ToValue for InlineViewSwitcherDisplayMode { #[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() } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl From for glib::Value { #[inline] fn from(v: InlineViewSwitcherDisplayMode) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwJustifyMode")] pub enum JustifyMode { #[doc(alias = "ADW_JUSTIFY_NONE")] None, #[doc(alias = "ADW_JUSTIFY_FILL")] Fill, #[doc(alias = "ADW_JUSTIFY_SPREAD")] Spread, #[doc(hidden)] __Unknown(i32), } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(hidden)] impl IntoGlib for JustifyMode { type GlibType = ffi::AdwJustifyMode; #[inline] fn into_glib(self) -> ffi::AdwJustifyMode { match self { Self::None => ffi::ADW_JUSTIFY_NONE, Self::Fill => ffi::ADW_JUSTIFY_FILL, Self::Spread => ffi::ADW_JUSTIFY_SPREAD, Self::__Unknown(value) => value, } } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(hidden)] impl FromGlib for JustifyMode { #[inline] unsafe fn from_glib(value: ffi::AdwJustifyMode) -> Self { skip_assert_initialized!(); match value { ffi::ADW_JUSTIFY_NONE => Self::None, ffi::ADW_JUSTIFY_FILL => Self::Fill, ffi::ADW_JUSTIFY_SPREAD => Self::Spread, value => Self::__Unknown(value), } } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl StaticType for JustifyMode { #[inline] #[doc(alias = "adw_justify_mode_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_justify_mode_get_type()) } } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl glib::HasParamSpec for JustifyMode { 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 } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl glib::value::ValueType for JustifyMode { type Type = Self; } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] unsafe impl<'a> glib::value::FromValue<'a> for JustifyMode { 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)) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl ToValue for JustifyMode { #[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() } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl From for glib::Value { #[inline] fn from(v: JustifyMode) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwLeafletTransitionType")] pub enum LeafletTransitionType { #[doc(alias = "ADW_LEAFLET_TRANSITION_TYPE_OVER")] Over, #[doc(alias = "ADW_LEAFLET_TRANSITION_TYPE_UNDER")] Under, #[doc(alias = "ADW_LEAFLET_TRANSITION_TYPE_SLIDE")] Slide, #[doc(hidden)] __Unknown(i32), } #[allow(deprecated)] #[doc(hidden)] impl IntoGlib for LeafletTransitionType { type GlibType = ffi::AdwLeafletTransitionType; #[inline] fn into_glib(self) -> ffi::AdwLeafletTransitionType { match self { Self::Over => ffi::ADW_LEAFLET_TRANSITION_TYPE_OVER, Self::Under => ffi::ADW_LEAFLET_TRANSITION_TYPE_UNDER, Self::Slide => ffi::ADW_LEAFLET_TRANSITION_TYPE_SLIDE, Self::__Unknown(value) => value, } } } #[allow(deprecated)] #[doc(hidden)] impl FromGlib for LeafletTransitionType { #[inline] unsafe fn from_glib(value: ffi::AdwLeafletTransitionType) -> Self { skip_assert_initialized!(); match value { ffi::ADW_LEAFLET_TRANSITION_TYPE_OVER => Self::Over, ffi::ADW_LEAFLET_TRANSITION_TYPE_UNDER => Self::Under, ffi::ADW_LEAFLET_TRANSITION_TYPE_SLIDE => Self::Slide, value => Self::__Unknown(value), } } } #[allow(deprecated)] impl StaticType for LeafletTransitionType { #[inline] #[doc(alias = "adw_leaflet_transition_type_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_leaflet_transition_type_get_type()) } } } #[allow(deprecated)] impl glib::HasParamSpec for LeafletTransitionType { 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 } } #[allow(deprecated)] impl glib::value::ValueType for LeafletTransitionType { type Type = Self; } #[allow(deprecated)] unsafe impl<'a> glib::value::FromValue<'a> for LeafletTransitionType { 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)) } } #[allow(deprecated)] impl ToValue for LeafletTransitionType { #[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() } } #[allow(deprecated)] impl From for glib::Value { #[inline] fn from(v: LeafletTransitionType) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwLengthUnit")] pub enum LengthUnit { #[doc(alias = "ADW_LENGTH_UNIT_PX")] Px, #[doc(alias = "ADW_LENGTH_UNIT_PT")] Pt, #[doc(alias = "ADW_LENGTH_UNIT_SP")] Sp, #[doc(hidden)] __Unknown(i32), } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl LengthUnit { #[doc(alias = "adw_length_unit_from_px")] pub fn from_px(self, value: f64, settings: Option<>k::Settings>) -> f64 { assert_initialized_main_thread!(); unsafe { ffi::adw_length_unit_from_px(self.into_glib(), value, settings.to_glib_none().0) } } #[doc(alias = "adw_length_unit_to_px")] pub fn to_px(self, value: f64, settings: Option<>k::Settings>) -> f64 { assert_initialized_main_thread!(); unsafe { ffi::adw_length_unit_to_px(self.into_glib(), value, settings.to_glib_none().0) } } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(hidden)] impl IntoGlib for LengthUnit { type GlibType = ffi::AdwLengthUnit; #[inline] fn into_glib(self) -> ffi::AdwLengthUnit { match self { Self::Px => ffi::ADW_LENGTH_UNIT_PX, Self::Pt => ffi::ADW_LENGTH_UNIT_PT, Self::Sp => ffi::ADW_LENGTH_UNIT_SP, Self::__Unknown(value) => value, } } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(hidden)] impl FromGlib for LengthUnit { #[inline] unsafe fn from_glib(value: ffi::AdwLengthUnit) -> Self { skip_assert_initialized!(); match value { ffi::ADW_LENGTH_UNIT_PX => Self::Px, ffi::ADW_LENGTH_UNIT_PT => Self::Pt, ffi::ADW_LENGTH_UNIT_SP => Self::Sp, value => Self::__Unknown(value), } } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl StaticType for LengthUnit { #[inline] #[doc(alias = "adw_length_unit_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_length_unit_get_type()) } } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl glib::HasParamSpec for LengthUnit { 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 } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl glib::value::ValueType for LengthUnit { type Type = Self; } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] unsafe impl<'a> glib::value::FromValue<'a> for LengthUnit { 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)) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl ToValue for LengthUnit { #[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() } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl From for glib::Value { #[inline] fn from(v: LengthUnit) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwNavigationDirection")] pub enum NavigationDirection { #[doc(alias = "ADW_NAVIGATION_DIRECTION_BACK")] Back, #[doc(alias = "ADW_NAVIGATION_DIRECTION_FORWARD")] Forward, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for NavigationDirection { type GlibType = ffi::AdwNavigationDirection; #[inline] fn into_glib(self) -> ffi::AdwNavigationDirection { match self { Self::Back => ffi::ADW_NAVIGATION_DIRECTION_BACK, Self::Forward => ffi::ADW_NAVIGATION_DIRECTION_FORWARD, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for NavigationDirection { #[inline] unsafe fn from_glib(value: ffi::AdwNavigationDirection) -> Self { skip_assert_initialized!(); match value { ffi::ADW_NAVIGATION_DIRECTION_BACK => Self::Back, ffi::ADW_NAVIGATION_DIRECTION_FORWARD => Self::Forward, value => Self::__Unknown(value), } } } impl StaticType for NavigationDirection { #[inline] #[doc(alias = "adw_navigation_direction_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_navigation_direction_get_type()) } } } impl glib::HasParamSpec for NavigationDirection { 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 NavigationDirection { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for NavigationDirection { 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 NavigationDirection { #[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: NavigationDirection) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwPackDirection")] pub enum PackDirection { #[doc(alias = "ADW_PACK_START_TO_END")] StartToEnd, #[doc(alias = "ADW_PACK_END_TO_START")] EndToStart, #[doc(hidden)] __Unknown(i32), } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(hidden)] impl IntoGlib for PackDirection { type GlibType = ffi::AdwPackDirection; #[inline] fn into_glib(self) -> ffi::AdwPackDirection { match self { Self::StartToEnd => ffi::ADW_PACK_START_TO_END, Self::EndToStart => ffi::ADW_PACK_END_TO_START, Self::__Unknown(value) => value, } } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(hidden)] impl FromGlib for PackDirection { #[inline] unsafe fn from_glib(value: ffi::AdwPackDirection) -> Self { skip_assert_initialized!(); match value { ffi::ADW_PACK_START_TO_END => Self::StartToEnd, ffi::ADW_PACK_END_TO_START => Self::EndToStart, value => Self::__Unknown(value), } } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl StaticType for PackDirection { #[inline] #[doc(alias = "adw_pack_direction_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_pack_direction_get_type()) } } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl glib::HasParamSpec for PackDirection { 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 } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl glib::value::ValueType for PackDirection { type Type = Self; } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] unsafe impl<'a> glib::value::FromValue<'a> for PackDirection { 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)) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl ToValue for PackDirection { #[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() } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl From for glib::Value { #[inline] fn from(v: PackDirection) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwResponseAppearance")] pub enum ResponseAppearance { #[doc(alias = "ADW_RESPONSE_DEFAULT")] Default, #[doc(alias = "ADW_RESPONSE_SUGGESTED")] Suggested, #[doc(alias = "ADW_RESPONSE_DESTRUCTIVE")] Destructive, #[doc(hidden)] __Unknown(i32), } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(hidden)] impl IntoGlib for ResponseAppearance { type GlibType = ffi::AdwResponseAppearance; #[inline] fn into_glib(self) -> ffi::AdwResponseAppearance { match self { Self::Default => ffi::ADW_RESPONSE_DEFAULT, Self::Suggested => ffi::ADW_RESPONSE_SUGGESTED, Self::Destructive => ffi::ADW_RESPONSE_DESTRUCTIVE, Self::__Unknown(value) => value, } } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(hidden)] impl FromGlib for ResponseAppearance { #[inline] unsafe fn from_glib(value: ffi::AdwResponseAppearance) -> Self { skip_assert_initialized!(); match value { ffi::ADW_RESPONSE_DEFAULT => Self::Default, ffi::ADW_RESPONSE_SUGGESTED => Self::Suggested, ffi::ADW_RESPONSE_DESTRUCTIVE => Self::Destructive, value => Self::__Unknown(value), } } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] impl StaticType for ResponseAppearance { #[inline] #[doc(alias = "adw_response_appearance_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_response_appearance_get_type()) } } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] impl glib::HasParamSpec for ResponseAppearance { 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 } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] impl glib::value::ValueType for ResponseAppearance { type Type = Self; } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] unsafe impl<'a> glib::value::FromValue<'a> for ResponseAppearance { 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)) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] impl ToValue for ResponseAppearance { #[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() } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] impl From for glib::Value { #[inline] fn from(v: ResponseAppearance) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwSqueezerTransitionType")] pub enum SqueezerTransitionType { #[doc(alias = "ADW_SQUEEZER_TRANSITION_TYPE_NONE")] None, #[doc(alias = "ADW_SQUEEZER_TRANSITION_TYPE_CROSSFADE")] Crossfade, #[doc(hidden)] __Unknown(i32), } #[allow(deprecated)] #[doc(hidden)] impl IntoGlib for SqueezerTransitionType { type GlibType = ffi::AdwSqueezerTransitionType; #[inline] fn into_glib(self) -> ffi::AdwSqueezerTransitionType { match self { Self::None => ffi::ADW_SQUEEZER_TRANSITION_TYPE_NONE, Self::Crossfade => ffi::ADW_SQUEEZER_TRANSITION_TYPE_CROSSFADE, Self::__Unknown(value) => value, } } } #[allow(deprecated)] #[doc(hidden)] impl FromGlib for SqueezerTransitionType { #[inline] unsafe fn from_glib(value: ffi::AdwSqueezerTransitionType) -> Self { skip_assert_initialized!(); match value { ffi::ADW_SQUEEZER_TRANSITION_TYPE_NONE => Self::None, ffi::ADW_SQUEEZER_TRANSITION_TYPE_CROSSFADE => Self::Crossfade, value => Self::__Unknown(value), } } } #[allow(deprecated)] impl StaticType for SqueezerTransitionType { #[inline] #[doc(alias = "adw_squeezer_transition_type_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_squeezer_transition_type_get_type()) } } } #[allow(deprecated)] impl glib::HasParamSpec for SqueezerTransitionType { 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 } } #[allow(deprecated)] impl glib::value::ValueType for SqueezerTransitionType { type Type = Self; } #[allow(deprecated)] unsafe impl<'a> glib::value::FromValue<'a> for SqueezerTransitionType { 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)) } } #[allow(deprecated)] impl ToValue for SqueezerTransitionType { #[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() } } #[allow(deprecated)] impl From for glib::Value { #[inline] fn from(v: SqueezerTransitionType) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwToastPriority")] pub enum ToastPriority { #[doc(alias = "ADW_TOAST_PRIORITY_NORMAL")] Normal, #[doc(alias = "ADW_TOAST_PRIORITY_HIGH")] High, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for ToastPriority { type GlibType = ffi::AdwToastPriority; #[inline] fn into_glib(self) -> ffi::AdwToastPriority { match self { Self::Normal => ffi::ADW_TOAST_PRIORITY_NORMAL, Self::High => ffi::ADW_TOAST_PRIORITY_HIGH, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for ToastPriority { #[inline] unsafe fn from_glib(value: ffi::AdwToastPriority) -> Self { skip_assert_initialized!(); match value { ffi::ADW_TOAST_PRIORITY_NORMAL => Self::Normal, ffi::ADW_TOAST_PRIORITY_HIGH => Self::High, value => Self::__Unknown(value), } } } impl StaticType for ToastPriority { #[inline] #[doc(alias = "adw_toast_priority_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_toast_priority_get_type()) } } } impl glib::HasParamSpec for ToastPriority { 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 ToastPriority { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for ToastPriority { 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 ToastPriority { #[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: ToastPriority) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwToolbarStyle")] pub enum ToolbarStyle { #[doc(alias = "ADW_TOOLBAR_FLAT")] Flat, #[doc(alias = "ADW_TOOLBAR_RAISED")] Raised, #[doc(alias = "ADW_TOOLBAR_RAISED_BORDER")] RaisedBorder, #[doc(hidden)] __Unknown(i32), } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(hidden)] impl IntoGlib for ToolbarStyle { type GlibType = ffi::AdwToolbarStyle; #[inline] fn into_glib(self) -> ffi::AdwToolbarStyle { match self { Self::Flat => ffi::ADW_TOOLBAR_FLAT, Self::Raised => ffi::ADW_TOOLBAR_RAISED, Self::RaisedBorder => ffi::ADW_TOOLBAR_RAISED_BORDER, Self::__Unknown(value) => value, } } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(hidden)] impl FromGlib for ToolbarStyle { #[inline] unsafe fn from_glib(value: ffi::AdwToolbarStyle) -> Self { skip_assert_initialized!(); match value { ffi::ADW_TOOLBAR_FLAT => Self::Flat, ffi::ADW_TOOLBAR_RAISED => Self::Raised, ffi::ADW_TOOLBAR_RAISED_BORDER => Self::RaisedBorder, value => Self::__Unknown(value), } } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl StaticType for ToolbarStyle { #[inline] #[doc(alias = "adw_toolbar_style_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_toolbar_style_get_type()) } } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl glib::HasParamSpec for ToolbarStyle { 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 } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl glib::value::ValueType for ToolbarStyle { type Type = Self; } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] unsafe impl<'a> glib::value::FromValue<'a> for ToolbarStyle { 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)) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl ToValue for ToolbarStyle { #[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() } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl From for glib::Value { #[inline] fn from(v: ToolbarStyle) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwViewSwitcherPolicy")] pub enum ViewSwitcherPolicy { #[doc(alias = "ADW_VIEW_SWITCHER_POLICY_NARROW")] Narrow, #[doc(alias = "ADW_VIEW_SWITCHER_POLICY_WIDE")] Wide, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for ViewSwitcherPolicy { type GlibType = ffi::AdwViewSwitcherPolicy; #[inline] fn into_glib(self) -> ffi::AdwViewSwitcherPolicy { match self { Self::Narrow => ffi::ADW_VIEW_SWITCHER_POLICY_NARROW, Self::Wide => ffi::ADW_VIEW_SWITCHER_POLICY_WIDE, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for ViewSwitcherPolicy { #[inline] unsafe fn from_glib(value: ffi::AdwViewSwitcherPolicy) -> Self { skip_assert_initialized!(); match value { ffi::ADW_VIEW_SWITCHER_POLICY_NARROW => Self::Narrow, ffi::ADW_VIEW_SWITCHER_POLICY_WIDE => Self::Wide, value => Self::__Unknown(value), } } } impl StaticType for ViewSwitcherPolicy { #[inline] #[doc(alias = "adw_view_switcher_policy_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_view_switcher_policy_get_type()) } } } impl glib::HasParamSpec for ViewSwitcherPolicy { 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 ViewSwitcherPolicy { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for ViewSwitcherPolicy { 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 ViewSwitcherPolicy { #[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: ViewSwitcherPolicy) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "AdwWrapPolicy")] pub enum WrapPolicy { #[doc(alias = "ADW_WRAP_MINIMUM")] Minimum, #[doc(alias = "ADW_WRAP_NATURAL")] Natural, #[doc(hidden)] __Unknown(i32), } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(hidden)] impl IntoGlib for WrapPolicy { type GlibType = ffi::AdwWrapPolicy; #[inline] fn into_glib(self) -> ffi::AdwWrapPolicy { match self { Self::Minimum => ffi::ADW_WRAP_MINIMUM, Self::Natural => ffi::ADW_WRAP_NATURAL, Self::__Unknown(value) => value, } } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(hidden)] impl FromGlib for WrapPolicy { #[inline] unsafe fn from_glib(value: ffi::AdwWrapPolicy) -> Self { skip_assert_initialized!(); match value { ffi::ADW_WRAP_MINIMUM => Self::Minimum, ffi::ADW_WRAP_NATURAL => Self::Natural, value => Self::__Unknown(value), } } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl StaticType for WrapPolicy { #[inline] #[doc(alias = "adw_wrap_policy_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_wrap_policy_get_type()) } } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl glib::HasParamSpec for WrapPolicy { 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 } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl glib::value::ValueType for WrapPolicy { type Type = Self; } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] unsafe impl<'a> glib::value::FromValue<'a> for WrapPolicy { 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)) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl ToValue for WrapPolicy { #[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() } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl From for glib::Value { #[inline] fn from(v: WrapPolicy) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } libadwaita-0.7.2/src/auto/expander_row.rs000064400000000000000000000570441046102023000165470ustar 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 #![allow(deprecated)] use crate::{ffi, PreferencesRow}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwExpanderRow")] pub struct ExpanderRow(Object) @extends PreferencesRow, gtk::ListBoxRow, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Actionable; match fn { type_ => || ffi::adw_expander_row_get_type(), } } impl ExpanderRow { pub const NONE: Option<&'static ExpanderRow> = None; #[doc(alias = "adw_expander_row_new")] pub fn new() -> ExpanderRow { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_expander_row_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`ExpanderRow`] objects. /// /// This method returns an instance of [`ExpanderRowBuilder`](crate::builders::ExpanderRowBuilder) which can be used to create [`ExpanderRow`] objects. pub fn builder() -> ExpanderRowBuilder { ExpanderRowBuilder::new() } } impl Default for ExpanderRow { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`ExpanderRow`] 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 ExpanderRowBuilder { builder: glib::object::ObjectBuilder<'static, ExpanderRow>, } impl ExpanderRowBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn enable_expansion(self, enable_expansion: bool) -> Self { Self { builder: self.builder.property("enable-expansion", enable_expansion), } } pub fn expanded(self, expanded: bool) -> Self { Self { builder: self.builder.property("expanded", expanded), } } #[cfg_attr(feature = "v1_3", deprecated = "Since 1.3")] pub fn icon_name(self, icon_name: impl Into) -> Self { Self { builder: self.builder.property("icon-name", icon_name.into()), } } pub fn show_enable_switch(self, show_enable_switch: bool) -> Self { Self { builder: self .builder .property("show-enable-switch", show_enable_switch), } } pub fn subtitle(self, subtitle: impl Into) -> Self { Self { builder: self.builder.property("subtitle", subtitle.into()), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn subtitle_lines(self, subtitle_lines: i32) -> Self { Self { builder: self.builder.property("subtitle-lines", subtitle_lines), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn title_lines(self, title_lines: i32) -> Self { Self { builder: self.builder.property("title-lines", title_lines), } } pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub fn title_selectable(self, title_selectable: bool) -> Self { Self { builder: self.builder.property("title-selectable", title_selectable), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn use_markup(self, use_markup: bool) -> Self { Self { builder: self.builder.property("use-markup", use_markup), } } pub fn use_underline(self, use_underline: bool) -> Self { Self { builder: self.builder.property("use-underline", use_underline), } } pub fn activatable(self, activatable: bool) -> Self { Self { builder: self.builder.property("activatable", activatable), } } pub fn child(self, child: &impl IsA) -> Self { Self { builder: self.builder.property("child", child.clone().upcast()), } } pub fn selectable(self, selectable: bool) -> Self { Self { builder: self.builder.property("selectable", selectable), } } 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 action_name(self, action_name: impl Into) -> Self { Self { builder: self.builder.property("action-name", action_name.into()), } } pub fn action_target(self, action_target: &glib::Variant) -> Self { Self { builder: self .builder .property("action-target", action_target.clone()), } } // rustdoc-stripper-ignore-next /// Build the [`ExpanderRow`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> ExpanderRow { assert_initialized_main_thread!(); self.builder.build() } } pub trait ExpanderRowExt: IsA + 'static { #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_expander_row_add_action")] fn add_action(&self, widget: &impl IsA) { unsafe { ffi::adw_expander_row_add_action( self.as_ref().to_glib_none().0, widget.as_ref().to_glib_none().0, ); } } #[doc(alias = "adw_expander_row_add_prefix")] fn add_prefix(&self, widget: &impl IsA) { unsafe { ffi::adw_expander_row_add_prefix( self.as_ref().to_glib_none().0, widget.as_ref().to_glib_none().0, ); } } #[doc(alias = "adw_expander_row_add_row")] fn add_row(&self, child: &impl IsA) { unsafe { ffi::adw_expander_row_add_row( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, ); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_expander_row_add_suffix")] fn add_suffix(&self, widget: &impl IsA) { unsafe { ffi::adw_expander_row_add_suffix( self.as_ref().to_glib_none().0, widget.as_ref().to_glib_none().0, ); } } #[doc(alias = "adw_expander_row_get_enable_expansion")] #[doc(alias = "get_enable_expansion")] #[doc(alias = "enable-expansion")] fn enables_expansion(&self) -> bool { unsafe { from_glib(ffi::adw_expander_row_get_enable_expansion( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_expander_row_get_expanded")] #[doc(alias = "get_expanded")] #[doc(alias = "expanded")] fn is_expanded(&self) -> bool { unsafe { from_glib(ffi::adw_expander_row_get_expanded( self.as_ref().to_glib_none().0, )) } } #[cfg_attr(feature = "v1_3", deprecated = "Since 1.3")] #[allow(deprecated)] #[doc(alias = "adw_expander_row_get_icon_name")] #[doc(alias = "get_icon_name")] #[doc(alias = "icon-name")] fn icon_name(&self) -> Option { unsafe { from_glib_none(ffi::adw_expander_row_get_icon_name( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_expander_row_get_show_enable_switch")] #[doc(alias = "get_show_enable_switch")] #[doc(alias = "show-enable-switch")] fn shows_enable_switch(&self) -> bool { unsafe { from_glib(ffi::adw_expander_row_get_show_enable_switch( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_expander_row_get_subtitle")] #[doc(alias = "get_subtitle")] fn subtitle(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_expander_row_get_subtitle( self.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_expander_row_get_subtitle_lines")] #[doc(alias = "get_subtitle_lines")] #[doc(alias = "subtitle-lines")] fn subtitle_lines(&self) -> i32 { unsafe { ffi::adw_expander_row_get_subtitle_lines(self.as_ref().to_glib_none().0) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_expander_row_get_title_lines")] #[doc(alias = "get_title_lines")] #[doc(alias = "title-lines")] fn title_lines(&self) -> i32 { unsafe { ffi::adw_expander_row_get_title_lines(self.as_ref().to_glib_none().0) } } #[doc(alias = "adw_expander_row_remove")] fn remove(&self, child: &impl IsA) { unsafe { ffi::adw_expander_row_remove( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, ); } } #[doc(alias = "adw_expander_row_set_enable_expansion")] #[doc(alias = "enable-expansion")] fn set_enable_expansion(&self, enable_expansion: bool) { unsafe { ffi::adw_expander_row_set_enable_expansion( self.as_ref().to_glib_none().0, enable_expansion.into_glib(), ); } } #[doc(alias = "adw_expander_row_set_expanded")] #[doc(alias = "expanded")] fn set_expanded(&self, expanded: bool) { unsafe { ffi::adw_expander_row_set_expanded( self.as_ref().to_glib_none().0, expanded.into_glib(), ); } } #[cfg_attr(feature = "v1_3", deprecated = "Since 1.3")] #[allow(deprecated)] #[doc(alias = "adw_expander_row_set_icon_name")] #[doc(alias = "icon-name")] fn set_icon_name(&self, icon_name: Option<&str>) { unsafe { ffi::adw_expander_row_set_icon_name( self.as_ref().to_glib_none().0, icon_name.to_glib_none().0, ); } } #[doc(alias = "adw_expander_row_set_show_enable_switch")] #[doc(alias = "show-enable-switch")] fn set_show_enable_switch(&self, show_enable_switch: bool) { unsafe { ffi::adw_expander_row_set_show_enable_switch( self.as_ref().to_glib_none().0, show_enable_switch.into_glib(), ); } } #[doc(alias = "adw_expander_row_set_subtitle")] #[doc(alias = "subtitle")] fn set_subtitle(&self, subtitle: &str) { unsafe { ffi::adw_expander_row_set_subtitle( self.as_ref().to_glib_none().0, subtitle.to_glib_none().0, ); } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_expander_row_set_subtitle_lines")] #[doc(alias = "subtitle-lines")] fn set_subtitle_lines(&self, subtitle_lines: i32) { unsafe { ffi::adw_expander_row_set_subtitle_lines( self.as_ref().to_glib_none().0, subtitle_lines, ); } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_expander_row_set_title_lines")] #[doc(alias = "title-lines")] fn set_title_lines(&self, title_lines: i32) { unsafe { ffi::adw_expander_row_set_title_lines(self.as_ref().to_glib_none().0, title_lines); } } #[doc(alias = "enable-expansion")] fn connect_enable_expansion_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_enable_expansion_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwExpanderRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ExpanderRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::enable-expansion".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_enable_expansion_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "expanded")] fn connect_expanded_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_expanded_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwExpanderRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ExpanderRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::expanded".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_expanded_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_3", deprecated = "Since 1.3")] #[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::AdwExpanderRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ExpanderRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::icon-name".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 = "show-enable-switch")] fn connect_show_enable_switch_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_show_enable_switch_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwExpanderRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ExpanderRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::show-enable-switch".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_show_enable_switch_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "subtitle")] fn connect_subtitle_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_subtitle_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwExpanderRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ExpanderRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::subtitle".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_subtitle_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "subtitle-lines")] fn connect_subtitle_lines_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_subtitle_lines_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwExpanderRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ExpanderRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::subtitle-lines".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_subtitle_lines_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "title-lines")] fn connect_title_lines_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_lines_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwExpanderRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ExpanderRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::title-lines".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_title_lines_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> ExpanderRowExt for O {} libadwaita-0.7.2/src/auto/flags.rs000064400000000000000000000116261046102023000151420ustar 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; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] use glib::{bitflags::bitflags, prelude::*, translate::*}; #[cfg(feature = "v1_2")] bitflags! { #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[doc(alias = "AdwTabViewShortcuts")] pub struct TabViewShortcuts: u32 { #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_NONE")] const NONE = ffi::ADW_TAB_VIEW_SHORTCUT_NONE as _; #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_CONTROL_TAB")] const CONTROL_TAB = ffi::ADW_TAB_VIEW_SHORTCUT_CONTROL_TAB as _; #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_TAB")] const CONTROL_SHIFT_TAB = ffi::ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_TAB as _; #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_CONTROL_PAGE_UP")] const CONTROL_PAGE_UP = ffi::ADW_TAB_VIEW_SHORTCUT_CONTROL_PAGE_UP as _; #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_CONTROL_PAGE_DOWN")] const CONTROL_PAGE_DOWN = ffi::ADW_TAB_VIEW_SHORTCUT_CONTROL_PAGE_DOWN as _; #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_CONTROL_HOME")] const CONTROL_HOME = ffi::ADW_TAB_VIEW_SHORTCUT_CONTROL_HOME as _; #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_CONTROL_END")] const CONTROL_END = ffi::ADW_TAB_VIEW_SHORTCUT_CONTROL_END as _; #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_PAGE_UP")] const CONTROL_SHIFT_PAGE_UP = ffi::ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_PAGE_UP as _; #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_PAGE_DOWN")] const CONTROL_SHIFT_PAGE_DOWN = ffi::ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_PAGE_DOWN as _; #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_HOME")] const CONTROL_SHIFT_HOME = ffi::ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_HOME as _; #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_END")] const CONTROL_SHIFT_END = ffi::ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_END as _; #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_ALT_DIGITS")] const ALT_DIGITS = ffi::ADW_TAB_VIEW_SHORTCUT_ALT_DIGITS as _; #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_ALT_ZERO")] const ALT_ZERO = ffi::ADW_TAB_VIEW_SHORTCUT_ALT_ZERO as _; #[doc(alias = "ADW_TAB_VIEW_SHORTCUT_ALL_SHORTCUTS")] const ALL_SHORTCUTS = ffi::ADW_TAB_VIEW_SHORTCUT_ALL_SHORTCUTS as _; } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(hidden)] impl IntoGlib for TabViewShortcuts { type GlibType = ffi::AdwTabViewShortcuts; #[inline] fn into_glib(self) -> ffi::AdwTabViewShortcuts { self.bits() } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(hidden)] impl FromGlib for TabViewShortcuts { #[inline] unsafe fn from_glib(value: ffi::AdwTabViewShortcuts) -> Self { skip_assert_initialized!(); Self::from_bits_truncate(value) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] impl StaticType for TabViewShortcuts { #[inline] #[doc(alias = "adw_tab_view_shortcuts_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::adw_tab_view_shortcuts_get_type()) } } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] impl glib::HasParamSpec for TabViewShortcuts { type ParamSpec = glib::ParamSpecFlags; type SetValue = Self; type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] impl glib::value::ValueType for TabViewShortcuts { type Type = Self; } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] unsafe impl<'a> glib::value::FromValue<'a> for TabViewShortcuts { 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)) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] impl ToValue for TabViewShortcuts { #[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() } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] impl From for glib::Value { #[inline] fn from(v: TabViewShortcuts) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } libadwaita-0.7.2/src/auto/flap.rs000064400000000000000000001062401046102023000147650ustar 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 #![allow(deprecated)] use crate::{ ffi, FlapFoldPolicy, FlapTransitionType, FoldThresholdPolicy, SpringParams, Swipeable, }; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwFlap")] pub struct Flap(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, Swipeable, gtk::Orientable; match fn { type_ => || ffi::adw_flap_get_type(), } } impl Flap { #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_new")] pub fn new() -> Flap { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_flap_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Flap`] objects. /// /// This method returns an instance of [`FlapBuilder`](crate::builders::FlapBuilder) which can be used to create [`Flap`] objects. pub fn builder() -> FlapBuilder { FlapBuilder::new() } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_get_content")] #[doc(alias = "get_content")] pub fn content(&self) -> Option { unsafe { from_glib_none(ffi::adw_flap_get_content(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_get_flap")] #[doc(alias = "get_flap")] pub fn flap(&self) -> Option { unsafe { from_glib_none(ffi::adw_flap_get_flap(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_get_flap_position")] #[doc(alias = "get_flap_position")] #[doc(alias = "flap-position")] pub fn flap_position(&self) -> gtk::PackType { unsafe { from_glib(ffi::adw_flap_get_flap_position(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_get_fold_duration")] #[doc(alias = "get_fold_duration")] #[doc(alias = "fold-duration")] pub fn fold_duration(&self) -> u32 { unsafe { ffi::adw_flap_get_fold_duration(self.to_glib_none().0) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_get_fold_policy")] #[doc(alias = "get_fold_policy")] #[doc(alias = "fold-policy")] pub fn fold_policy(&self) -> FlapFoldPolicy { unsafe { from_glib(ffi::adw_flap_get_fold_policy(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_get_fold_threshold_policy")] #[doc(alias = "get_fold_threshold_policy")] #[doc(alias = "fold-threshold-policy")] pub fn fold_threshold_policy(&self) -> FoldThresholdPolicy { unsafe { from_glib(ffi::adw_flap_get_fold_threshold_policy( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_get_folded")] #[doc(alias = "get_folded")] #[doc(alias = "folded")] pub fn is_folded(&self) -> bool { unsafe { from_glib(ffi::adw_flap_get_folded(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_get_locked")] #[doc(alias = "get_locked")] #[doc(alias = "locked")] pub fn is_locked(&self) -> bool { unsafe { from_glib(ffi::adw_flap_get_locked(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_get_modal")] #[doc(alias = "get_modal")] #[doc(alias = "modal")] pub fn is_modal(&self) -> bool { unsafe { from_glib(ffi::adw_flap_get_modal(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_get_reveal_flap")] #[doc(alias = "get_reveal_flap")] #[doc(alias = "reveal-flap")] pub fn reveals_flap(&self) -> bool { unsafe { from_glib(ffi::adw_flap_get_reveal_flap(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_get_reveal_params")] #[doc(alias = "get_reveal_params")] #[doc(alias = "reveal-params")] pub fn reveal_params(&self) -> SpringParams { unsafe { from_glib_full(ffi::adw_flap_get_reveal_params(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_get_reveal_progress")] #[doc(alias = "get_reveal_progress")] #[doc(alias = "reveal-progress")] pub fn reveal_progress(&self) -> f64 { unsafe { ffi::adw_flap_get_reveal_progress(self.to_glib_none().0) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_get_separator")] #[doc(alias = "get_separator")] pub fn separator(&self) -> Option { unsafe { from_glib_none(ffi::adw_flap_get_separator(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_get_swipe_to_close")] #[doc(alias = "get_swipe_to_close")] #[doc(alias = "swipe-to-close")] pub fn is_swipe_to_close(&self) -> bool { unsafe { from_glib(ffi::adw_flap_get_swipe_to_close(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_get_swipe_to_open")] #[doc(alias = "get_swipe_to_open")] #[doc(alias = "swipe-to-open")] pub fn is_swipe_to_open(&self) -> bool { unsafe { from_glib(ffi::adw_flap_get_swipe_to_open(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_get_transition_type")] #[doc(alias = "get_transition_type")] #[doc(alias = "transition-type")] pub fn transition_type(&self) -> FlapTransitionType { unsafe { from_glib(ffi::adw_flap_get_transition_type(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_set_content")] #[doc(alias = "content")] pub fn set_content(&self, content: Option<&impl IsA>) { unsafe { ffi::adw_flap_set_content( self.to_glib_none().0, content.map(|p| p.as_ref()).to_glib_none().0, ); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_set_flap")] #[doc(alias = "flap")] pub fn set_flap(&self, flap: Option<&impl IsA>) { unsafe { ffi::adw_flap_set_flap( self.to_glib_none().0, flap.map(|p| p.as_ref()).to_glib_none().0, ); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_set_flap_position")] #[doc(alias = "flap-position")] pub fn set_flap_position(&self, position: gtk::PackType) { unsafe { ffi::adw_flap_set_flap_position(self.to_glib_none().0, position.into_glib()); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_set_fold_duration")] #[doc(alias = "fold-duration")] pub fn set_fold_duration(&self, duration: u32) { unsafe { ffi::adw_flap_set_fold_duration(self.to_glib_none().0, duration); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_set_fold_policy")] #[doc(alias = "fold-policy")] pub fn set_fold_policy(&self, policy: FlapFoldPolicy) { unsafe { ffi::adw_flap_set_fold_policy(self.to_glib_none().0, policy.into_glib()); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_set_fold_threshold_policy")] #[doc(alias = "fold-threshold-policy")] pub fn set_fold_threshold_policy(&self, policy: FoldThresholdPolicy) { unsafe { ffi::adw_flap_set_fold_threshold_policy(self.to_glib_none().0, policy.into_glib()); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_set_locked")] #[doc(alias = "locked")] pub fn set_locked(&self, locked: bool) { unsafe { ffi::adw_flap_set_locked(self.to_glib_none().0, locked.into_glib()); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_set_modal")] #[doc(alias = "modal")] pub fn set_modal(&self, modal: bool) { unsafe { ffi::adw_flap_set_modal(self.to_glib_none().0, modal.into_glib()); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_set_reveal_flap")] #[doc(alias = "reveal-flap")] pub fn set_reveal_flap(&self, reveal_flap: bool) { unsafe { ffi::adw_flap_set_reveal_flap(self.to_glib_none().0, reveal_flap.into_glib()); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_set_reveal_params")] #[doc(alias = "reveal-params")] pub fn set_reveal_params(&self, params: &SpringParams) { unsafe { ffi::adw_flap_set_reveal_params(self.to_glib_none().0, params.to_glib_none().0); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_set_separator")] #[doc(alias = "separator")] pub fn set_separator(&self, separator: Option<&impl IsA>) { unsafe { ffi::adw_flap_set_separator( self.to_glib_none().0, separator.map(|p| p.as_ref()).to_glib_none().0, ); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_set_swipe_to_close")] #[doc(alias = "swipe-to-close")] pub fn set_swipe_to_close(&self, swipe_to_close: bool) { unsafe { ffi::adw_flap_set_swipe_to_close(self.to_glib_none().0, swipe_to_close.into_glib()); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_set_swipe_to_open")] #[doc(alias = "swipe-to-open")] pub fn set_swipe_to_open(&self, swipe_to_open: bool) { unsafe { ffi::adw_flap_set_swipe_to_open(self.to_glib_none().0, swipe_to_open.into_glib()); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_flap_set_transition_type")] #[doc(alias = "transition-type")] pub fn set_transition_type(&self, transition_type: FlapTransitionType) { unsafe { ffi::adw_flap_set_transition_type(self.to_glib_none().0, transition_type.into_glib()); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "content")] pub fn connect_content_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_content_trampoline( this: *mut ffi::AdwFlap, _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 _, c"notify::content".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_content_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "flap")] pub fn connect_flap_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_flap_trampoline( this: *mut ffi::AdwFlap, _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 _, c"notify::flap".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_flap_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "flap-position")] pub fn connect_flap_position_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_flap_position_trampoline( this: *mut ffi::AdwFlap, _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 _, c"notify::flap-position".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_flap_position_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "fold-duration")] pub fn connect_fold_duration_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_fold_duration_trampoline( this: *mut ffi::AdwFlap, _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 _, c"notify::fold-duration".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_fold_duration_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "fold-policy")] pub fn connect_fold_policy_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_fold_policy_trampoline( this: *mut ffi::AdwFlap, _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 _, c"notify::fold-policy".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_fold_policy_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "fold-threshold-policy")] pub fn connect_fold_threshold_policy_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_fold_threshold_policy_trampoline( this: *mut ffi::AdwFlap, _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 _, c"notify::fold-threshold-policy".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_fold_threshold_policy_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "folded")] pub fn connect_folded_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_folded_trampoline( this: *mut ffi::AdwFlap, _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 _, c"notify::folded".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_folded_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "locked")] pub fn connect_locked_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_locked_trampoline( this: *mut ffi::AdwFlap, _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 _, c"notify::locked".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_locked_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "modal")] pub fn connect_modal_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_modal_trampoline( this: *mut ffi::AdwFlap, _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 _, c"notify::modal".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_modal_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "reveal-flap")] pub fn connect_reveal_flap_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_reveal_flap_trampoline( this: *mut ffi::AdwFlap, _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 _, c"notify::reveal-flap".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_reveal_flap_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "reveal-params")] pub fn connect_reveal_params_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_reveal_params_trampoline( this: *mut ffi::AdwFlap, _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 _, c"notify::reveal-params".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_reveal_params_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "reveal-progress")] pub fn connect_reveal_progress_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_reveal_progress_trampoline( this: *mut ffi::AdwFlap, _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 _, c"notify::reveal-progress".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_reveal_progress_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "separator")] pub fn connect_separator_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_separator_trampoline( this: *mut ffi::AdwFlap, _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 _, c"notify::separator".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_separator_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "swipe-to-close")] pub fn connect_swipe_to_close_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_swipe_to_close_trampoline( this: *mut ffi::AdwFlap, _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 _, c"notify::swipe-to-close".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_swipe_to_close_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "swipe-to-open")] pub fn connect_swipe_to_open_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_swipe_to_open_trampoline( this: *mut ffi::AdwFlap, _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 _, c"notify::swipe-to-open".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_swipe_to_open_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "transition-type")] pub fn connect_transition_type_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_transition_type_trampoline( this: *mut ffi::AdwFlap, _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 _, c"notify::transition-type".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_transition_type_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for Flap { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Flap`] 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 FlapBuilder { builder: glib::object::ObjectBuilder<'static, Flap>, } impl FlapBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn content(self, content: &impl IsA) -> Self { Self { builder: self.builder.property("content", content.clone().upcast()), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn flap(self, flap: &impl IsA) -> Self { Self { builder: self.builder.property("flap", flap.clone().upcast()), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn flap_position(self, flap_position: gtk::PackType) -> Self { Self { builder: self.builder.property("flap-position", flap_position), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn fold_duration(self, fold_duration: u32) -> Self { Self { builder: self.builder.property("fold-duration", fold_duration), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn fold_policy(self, fold_policy: FlapFoldPolicy) -> Self { Self { builder: self.builder.property("fold-policy", fold_policy), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn fold_threshold_policy(self, fold_threshold_policy: FoldThresholdPolicy) -> Self { Self { builder: self .builder .property("fold-threshold-policy", fold_threshold_policy), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn locked(self, locked: bool) -> Self { Self { builder: self.builder.property("locked", locked), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn modal(self, modal: bool) -> Self { Self { builder: self.builder.property("modal", modal), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn reveal_flap(self, reveal_flap: bool) -> Self { Self { builder: self.builder.property("reveal-flap", reveal_flap), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn reveal_params(self, reveal_params: &SpringParams) -> Self { Self { builder: self .builder .property("reveal-params", reveal_params.clone()), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn separator(self, separator: &impl IsA) -> Self { Self { builder: self .builder .property("separator", separator.clone().upcast()), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn swipe_to_close(self, swipe_to_close: bool) -> Self { Self { builder: self.builder.property("swipe-to-close", swipe_to_close), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn swipe_to_open(self, swipe_to_open: bool) -> Self { Self { builder: self.builder.property("swipe-to-open", swipe_to_open), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn transition_type(self, transition_type: FlapTransitionType) -> Self { Self { builder: self.builder.property("transition-type", transition_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), } } pub fn orientation(self, orientation: gtk::Orientation) -> Self { Self { builder: self.builder.property("orientation", orientation), } } // rustdoc-stripper-ignore-next /// Build the [`Flap`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Flap { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/functions.rs000064400000000000000000000036011046102023000160500ustar 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::*}; #[doc(alias = "adw_get_enable_animations")] #[doc(alias = "get_enable_animations")] pub fn is_animations_enabled(widget: &impl IsA) -> bool { assert_initialized_main_thread!(); unsafe { from_glib(ffi::adw_get_enable_animations( widget.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_get_major_version")] #[doc(alias = "get_major_version")] pub fn major_version() -> u32 { assert_initialized_main_thread!(); unsafe { ffi::adw_get_major_version() } } #[doc(alias = "adw_get_micro_version")] #[doc(alias = "get_micro_version")] pub fn micro_version() -> u32 { assert_initialized_main_thread!(); unsafe { ffi::adw_get_micro_version() } } #[doc(alias = "adw_get_minor_version")] #[doc(alias = "get_minor_version")] pub fn minor_version() -> u32 { assert_initialized_main_thread!(); unsafe { ffi::adw_get_minor_version() } } #[doc(alias = "adw_is_initialized")] pub fn is_initialized() -> bool { assert_initialized_main_thread!(); unsafe { from_glib(ffi::adw_is_initialized()) } } #[doc(alias = "adw_lerp")] pub fn lerp(a: f64, b: f64, t: f64) -> f64 { assert_initialized_main_thread!(); unsafe { ffi::adw_lerp(a, b, t) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "adw_rgba_to_standalone")] pub fn rgba_to_standalone(rgba: &gdk::RGBA, dark: bool) -> gdk::RGBA { assert_initialized_main_thread!(); unsafe { let mut standalone_rgba = gdk::RGBA::uninitialized(); ffi::adw_rgba_to_standalone( rgba.to_glib_none().0, dark.into_glib(), standalone_rgba.to_glib_none_mut().0, ); standalone_rgba } } libadwaita-0.7.2/src/auto/header_bar.rs000064400000000000000000000511751046102023000161250ustar 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, CenteringPolicy}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwHeaderBar")] pub struct HeaderBar(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_header_bar_get_type(), } } impl HeaderBar { #[doc(alias = "adw_header_bar_new")] pub fn new() -> HeaderBar { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_header_bar_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`HeaderBar`] objects. /// /// This method returns an instance of [`HeaderBarBuilder`](crate::builders::HeaderBarBuilder) which can be used to create [`HeaderBar`] objects. pub fn builder() -> HeaderBarBuilder { HeaderBarBuilder::new() } #[doc(alias = "adw_header_bar_get_centering_policy")] #[doc(alias = "get_centering_policy")] #[doc(alias = "centering-policy")] pub fn centering_policy(&self) -> CenteringPolicy { unsafe { from_glib(ffi::adw_header_bar_get_centering_policy( self.to_glib_none().0, )) } } #[doc(alias = "adw_header_bar_get_decoration_layout")] #[doc(alias = "get_decoration_layout")] #[doc(alias = "decoration-layout")] pub fn decoration_layout(&self) -> Option { unsafe { from_glib_none(ffi::adw_header_bar_get_decoration_layout( self.to_glib_none().0, )) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_header_bar_get_show_back_button")] #[doc(alias = "get_show_back_button")] #[doc(alias = "show-back-button")] pub fn shows_back_button(&self) -> bool { unsafe { from_glib(ffi::adw_header_bar_get_show_back_button( self.to_glib_none().0, )) } } #[doc(alias = "adw_header_bar_get_show_end_title_buttons")] #[doc(alias = "get_show_end_title_buttons")] #[doc(alias = "show-end-title-buttons")] pub fn shows_end_title_buttons(&self) -> bool { unsafe { from_glib(ffi::adw_header_bar_get_show_end_title_buttons( self.to_glib_none().0, )) } } #[doc(alias = "adw_header_bar_get_show_start_title_buttons")] #[doc(alias = "get_show_start_title_buttons")] #[doc(alias = "show-start-title-buttons")] pub fn shows_start_title_buttons(&self) -> bool { unsafe { from_glib(ffi::adw_header_bar_get_show_start_title_buttons( self.to_glib_none().0, )) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_header_bar_get_show_title")] #[doc(alias = "get_show_title")] #[doc(alias = "show-title")] pub fn shows_title(&self) -> bool { unsafe { from_glib(ffi::adw_header_bar_get_show_title(self.to_glib_none().0)) } } #[doc(alias = "adw_header_bar_get_title_widget")] #[doc(alias = "get_title_widget")] #[doc(alias = "title-widget")] pub fn title_widget(&self) -> Option { unsafe { from_glib_none(ffi::adw_header_bar_get_title_widget(self.to_glib_none().0)) } } #[doc(alias = "adw_header_bar_pack_end")] pub fn pack_end(&self, child: &impl IsA) { unsafe { ffi::adw_header_bar_pack_end(self.to_glib_none().0, child.as_ref().to_glib_none().0); } } #[doc(alias = "adw_header_bar_pack_start")] pub fn pack_start(&self, child: &impl IsA) { unsafe { ffi::adw_header_bar_pack_start(self.to_glib_none().0, child.as_ref().to_glib_none().0); } } #[doc(alias = "adw_header_bar_remove")] pub fn remove(&self, child: &impl IsA) { unsafe { ffi::adw_header_bar_remove(self.to_glib_none().0, child.as_ref().to_glib_none().0); } } #[doc(alias = "adw_header_bar_set_centering_policy")] #[doc(alias = "centering-policy")] pub fn set_centering_policy(&self, centering_policy: CenteringPolicy) { unsafe { ffi::adw_header_bar_set_centering_policy( self.to_glib_none().0, centering_policy.into_glib(), ); } } #[doc(alias = "adw_header_bar_set_decoration_layout")] #[doc(alias = "decoration-layout")] pub fn set_decoration_layout(&self, layout: Option<&str>) { unsafe { ffi::adw_header_bar_set_decoration_layout( self.to_glib_none().0, layout.to_glib_none().0, ); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_header_bar_set_show_back_button")] #[doc(alias = "show-back-button")] pub fn set_show_back_button(&self, show_back_button: bool) { unsafe { ffi::adw_header_bar_set_show_back_button( self.to_glib_none().0, show_back_button.into_glib(), ); } } #[doc(alias = "adw_header_bar_set_show_end_title_buttons")] #[doc(alias = "show-end-title-buttons")] pub fn set_show_end_title_buttons(&self, setting: bool) { unsafe { ffi::adw_header_bar_set_show_end_title_buttons( self.to_glib_none().0, setting.into_glib(), ); } } #[doc(alias = "adw_header_bar_set_show_start_title_buttons")] #[doc(alias = "show-start-title-buttons")] pub fn set_show_start_title_buttons(&self, setting: bool) { unsafe { ffi::adw_header_bar_set_show_start_title_buttons( self.to_glib_none().0, setting.into_glib(), ); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_header_bar_set_show_title")] #[doc(alias = "show-title")] pub fn set_show_title(&self, show_title: bool) { unsafe { ffi::adw_header_bar_set_show_title(self.to_glib_none().0, show_title.into_glib()); } } #[doc(alias = "adw_header_bar_set_title_widget")] #[doc(alias = "title-widget")] pub fn set_title_widget(&self, title_widget: Option<&impl IsA>) { unsafe { ffi::adw_header_bar_set_title_widget( self.to_glib_none().0, title_widget.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "centering-policy")] pub fn connect_centering_policy_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_centering_policy_trampoline( this: *mut ffi::AdwHeaderBar, _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 _, c"notify::centering-policy".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_centering_policy_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "decoration-layout")] pub fn connect_decoration_layout_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_decoration_layout_trampoline( this: *mut ffi::AdwHeaderBar, _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 _, c"notify::decoration-layout".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_decoration_layout_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "show-back-button")] pub fn connect_show_back_button_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_show_back_button_trampoline( this: *mut ffi::AdwHeaderBar, _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 _, c"notify::show-back-button".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_show_back_button_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "show-end-title-buttons")] pub fn connect_show_end_title_buttons_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_show_end_title_buttons_trampoline< F: Fn(&HeaderBar) + 'static, >( this: *mut ffi::AdwHeaderBar, _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 _, c"notify::show-end-title-buttons".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_show_end_title_buttons_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "show-start-title-buttons")] pub fn connect_show_start_title_buttons_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_show_start_title_buttons_trampoline< F: Fn(&HeaderBar) + 'static, >( this: *mut ffi::AdwHeaderBar, _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 _, c"notify::show-start-title-buttons".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_show_start_title_buttons_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "show-title")] pub fn connect_show_title_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_show_title_trampoline( this: *mut ffi::AdwHeaderBar, _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 _, c"notify::show-title".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_show_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "title-widget")] pub fn connect_title_widget_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_widget_trampoline( this: *mut ffi::AdwHeaderBar, _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 _, c"notify::title-widget".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_title_widget_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for HeaderBar { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`HeaderBar`] 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 HeaderBarBuilder { builder: glib::object::ObjectBuilder<'static, HeaderBar>, } impl HeaderBarBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn centering_policy(self, centering_policy: CenteringPolicy) -> Self { Self { builder: self.builder.property("centering-policy", centering_policy), } } pub fn decoration_layout(self, decoration_layout: impl Into) -> Self { Self { builder: self .builder .property("decoration-layout", decoration_layout.into()), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn show_back_button(self, show_back_button: bool) -> Self { Self { builder: self.builder.property("show-back-button", show_back_button), } } pub fn show_end_title_buttons(self, show_end_title_buttons: bool) -> Self { Self { builder: self .builder .property("show-end-title-buttons", show_end_title_buttons), } } pub fn show_start_title_buttons(self, show_start_title_buttons: bool) -> Self { Self { builder: self .builder .property("show-start-title-buttons", show_start_title_buttons), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn show_title(self, show_title: bool) -> Self { Self { builder: self.builder.property("show-title", show_title), } } pub fn title_widget(self, title_widget: &impl IsA) -> Self { Self { builder: self .builder .property("title-widget", title_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 [`HeaderBar`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> HeaderBar { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/inline_view_switcher.rs000064400000000000000000000352441046102023000202700ustar 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, InlineViewSwitcherDisplayMode, ViewStack}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwInlineViewSwitcher")] pub struct InlineViewSwitcher(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable; match fn { type_ => || ffi::adw_inline_view_switcher_get_type(), } } impl InlineViewSwitcher { #[doc(alias = "adw_inline_view_switcher_new")] pub fn new() -> InlineViewSwitcher { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_inline_view_switcher_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`InlineViewSwitcher`] objects. /// /// This method returns an instance of [`InlineViewSwitcherBuilder`](crate::builders::InlineViewSwitcherBuilder) which can be used to create [`InlineViewSwitcher`] objects. pub fn builder() -> InlineViewSwitcherBuilder { InlineViewSwitcherBuilder::new() } #[doc(alias = "adw_inline_view_switcher_get_can_shrink")] #[doc(alias = "get_can_shrink")] #[doc(alias = "can-shrink")] pub fn can_shrink(&self) -> bool { unsafe { from_glib(ffi::adw_inline_view_switcher_get_can_shrink( self.to_glib_none().0, )) } } #[doc(alias = "adw_inline_view_switcher_get_display_mode")] #[doc(alias = "get_display_mode")] #[doc(alias = "display-mode")] pub fn display_mode(&self) -> InlineViewSwitcherDisplayMode { unsafe { from_glib(ffi::adw_inline_view_switcher_get_display_mode( self.to_glib_none().0, )) } } #[doc(alias = "adw_inline_view_switcher_get_homogeneous")] #[doc(alias = "get_homogeneous")] #[doc(alias = "homogeneous")] pub fn is_homogeneous(&self) -> bool { unsafe { from_glib(ffi::adw_inline_view_switcher_get_homogeneous( self.to_glib_none().0, )) } } #[doc(alias = "adw_inline_view_switcher_get_stack")] #[doc(alias = "get_stack")] pub fn stack(&self) -> Option { unsafe { from_glib_none(ffi::adw_inline_view_switcher_get_stack( self.to_glib_none().0, )) } } #[doc(alias = "adw_inline_view_switcher_set_can_shrink")] #[doc(alias = "can-shrink")] pub fn set_can_shrink(&self, can_shrink: bool) { unsafe { ffi::adw_inline_view_switcher_set_can_shrink( self.to_glib_none().0, can_shrink.into_glib(), ); } } #[doc(alias = "adw_inline_view_switcher_set_display_mode")] #[doc(alias = "display-mode")] pub fn set_display_mode(&self, mode: InlineViewSwitcherDisplayMode) { unsafe { ffi::adw_inline_view_switcher_set_display_mode(self.to_glib_none().0, mode.into_glib()); } } #[doc(alias = "adw_inline_view_switcher_set_homogeneous")] #[doc(alias = "homogeneous")] pub fn set_homogeneous(&self, homogeneous: bool) { unsafe { ffi::adw_inline_view_switcher_set_homogeneous( self.to_glib_none().0, homogeneous.into_glib(), ); } } #[doc(alias = "adw_inline_view_switcher_set_stack")] #[doc(alias = "stack")] pub fn set_stack(&self, stack: Option<&ViewStack>) { unsafe { ffi::adw_inline_view_switcher_set_stack(self.to_glib_none().0, stack.to_glib_none().0); } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "can-shrink")] pub fn connect_can_shrink_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_can_shrink_trampoline( this: *mut ffi::AdwInlineViewSwitcher, _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 _, c"notify::can-shrink".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_can_shrink_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "display-mode")] pub fn connect_display_mode_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_display_mode_trampoline< F: Fn(&InlineViewSwitcher) + 'static, >( this: *mut ffi::AdwInlineViewSwitcher, _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 _, c"notify::display-mode".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_display_mode_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "homogeneous")] pub fn connect_homogeneous_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_homogeneous_trampoline( this: *mut ffi::AdwInlineViewSwitcher, _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 _, c"notify::homogeneous".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_homogeneous_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "stack")] pub fn connect_stack_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_stack_trampoline( this: *mut ffi::AdwInlineViewSwitcher, _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 _, c"notify::stack".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_stack_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl Default for InlineViewSwitcher { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`InlineViewSwitcher`] 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 InlineViewSwitcherBuilder { builder: glib::object::ObjectBuilder<'static, InlineViewSwitcher>, } impl InlineViewSwitcherBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn can_shrink(self, can_shrink: bool) -> Self { Self { builder: self.builder.property("can-shrink", can_shrink), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn display_mode(self, display_mode: InlineViewSwitcherDisplayMode) -> Self { Self { builder: self.builder.property("display-mode", display_mode), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn homogeneous(self, homogeneous: bool) -> Self { Self { builder: self.builder.property("homogeneous", homogeneous), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn stack(self, stack: &ViewStack) -> Self { Self { builder: self.builder.property("stack", stack.clone()), } } 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 orientation(self, orientation: gtk::Orientation) -> Self { Self { builder: self.builder.property("orientation", orientation), } } // rustdoc-stripper-ignore-next /// Build the [`InlineViewSwitcher`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> InlineViewSwitcher { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/layout.rs000064400000000000000000000044321046102023000153600ustar 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 = "AdwLayout")] pub struct Layout(Object) @implements gtk::Buildable; match fn { type_ => || ffi::adw_layout_get_type(), } } impl Layout { #[doc(alias = "adw_layout_new")] pub fn new(content: &impl IsA) -> Layout { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::adw_layout_new(content.as_ref().to_glib_none().0)) } } #[doc(alias = "adw_layout_get_content")] #[doc(alias = "get_content")] pub fn content(&self) -> gtk::Widget { unsafe { from_glib_none(ffi::adw_layout_get_content(self.to_glib_none().0)) } } #[doc(alias = "adw_layout_get_name")] #[doc(alias = "get_name")] pub fn name(&self) -> Option { unsafe { from_glib_none(ffi::adw_layout_get_name(self.to_glib_none().0)) } } #[doc(alias = "adw_layout_set_name")] #[doc(alias = "name")] pub fn set_name(&self, name: Option<&str>) { unsafe { ffi::adw_layout_set_name(self.to_glib_none().0, name.to_glib_none().0); } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "name")] pub fn connect_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_name_trampoline( this: *mut ffi::AdwLayout, _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 _, c"notify::name".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } libadwaita-0.7.2/src/auto/layout_slot.rs000064400000000000000000000167411046102023000164270ustar 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 = "AdwLayoutSlot")] pub struct LayoutSlot(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_layout_slot_get_type(), } } impl LayoutSlot { #[doc(alias = "adw_layout_slot_new")] pub fn new(id: &str) -> LayoutSlot { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_layout_slot_new(id.to_glib_none().0)).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`LayoutSlot`] objects. /// /// This method returns an instance of [`LayoutSlotBuilder`](crate::builders::LayoutSlotBuilder) which can be used to create [`LayoutSlot`] objects. pub fn builder() -> LayoutSlotBuilder { LayoutSlotBuilder::new() } #[doc(alias = "adw_layout_slot_get_slot_id")] #[doc(alias = "get_slot_id")] #[doc(alias = "id")] pub fn slot_id(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_layout_slot_get_slot_id(self.to_glib_none().0)) } } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] impl Default for LayoutSlot { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`LayoutSlot`] 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 LayoutSlotBuilder { builder: glib::object::ObjectBuilder<'static, LayoutSlot>, } impl LayoutSlotBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub fn id(self, id: impl Into) -> Self { Self { builder: self.builder.property("id", id.into()), } } 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 [`LayoutSlot`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> LayoutSlot { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/leaflet.rs000064400000000000000000001060041046102023000154550ustar 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 #![allow(deprecated)] use crate::{ ffi, FoldThresholdPolicy, LeafletPage, LeafletTransitionType, NavigationDirection, SpringParams, Swipeable, }; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwLeaflet")] pub struct Leaflet(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, Swipeable, gtk::Orientable; match fn { type_ => || ffi::adw_leaflet_get_type(), } } impl Leaflet { #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_new")] pub fn new() -> Leaflet { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_leaflet_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Leaflet`] objects. /// /// This method returns an instance of [`LeafletBuilder`](crate::builders::LeafletBuilder) which can be used to create [`Leaflet`] objects. pub fn builder() -> LeafletBuilder { LeafletBuilder::new() } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_append")] pub fn append(&self, child: &impl IsA) -> LeafletPage { unsafe { from_glib_none(ffi::adw_leaflet_append( self.to_glib_none().0, child.as_ref().to_glib_none().0, )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_get_adjacent_child")] #[doc(alias = "get_adjacent_child")] pub fn adjacent_child(&self, direction: NavigationDirection) -> Option { unsafe { from_glib_none(ffi::adw_leaflet_get_adjacent_child( self.to_glib_none().0, direction.into_glib(), )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_get_can_navigate_back")] #[doc(alias = "get_can_navigate_back")] #[doc(alias = "can-navigate-back")] pub fn can_navigate_back(&self) -> bool { unsafe { from_glib(ffi::adw_leaflet_get_can_navigate_back( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_get_can_navigate_forward")] #[doc(alias = "get_can_navigate_forward")] #[doc(alias = "can-navigate-forward")] pub fn can_navigate_forward(&self) -> bool { unsafe { from_glib(ffi::adw_leaflet_get_can_navigate_forward( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_get_can_unfold")] #[doc(alias = "get_can_unfold")] #[doc(alias = "can-unfold")] pub fn can_unfold(&self) -> bool { unsafe { from_glib(ffi::adw_leaflet_get_can_unfold(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_get_child_by_name")] #[doc(alias = "get_child_by_name")] pub fn child_by_name(&self, name: &str) -> Option { unsafe { from_glib_none(ffi::adw_leaflet_get_child_by_name( self.to_glib_none().0, name.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_get_child_transition_params")] #[doc(alias = "get_child_transition_params")] #[doc(alias = "child-transition-params")] pub fn child_transition_params(&self) -> SpringParams { unsafe { from_glib_full(ffi::adw_leaflet_get_child_transition_params( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_get_child_transition_running")] #[doc(alias = "get_child_transition_running")] #[doc(alias = "child-transition-running")] pub fn is_child_transition_running(&self) -> bool { unsafe { from_glib(ffi::adw_leaflet_get_child_transition_running( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_get_fold_threshold_policy")] #[doc(alias = "get_fold_threshold_policy")] #[doc(alias = "fold-threshold-policy")] pub fn fold_threshold_policy(&self) -> FoldThresholdPolicy { unsafe { from_glib(ffi::adw_leaflet_get_fold_threshold_policy( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_get_folded")] #[doc(alias = "get_folded")] #[doc(alias = "folded")] pub fn is_folded(&self) -> bool { unsafe { from_glib(ffi::adw_leaflet_get_folded(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_get_homogeneous")] #[doc(alias = "get_homogeneous")] #[doc(alias = "homogeneous")] pub fn is_homogeneous(&self) -> bool { unsafe { from_glib(ffi::adw_leaflet_get_homogeneous(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_get_mode_transition_duration")] #[doc(alias = "get_mode_transition_duration")] #[doc(alias = "mode-transition-duration")] pub fn mode_transition_duration(&self) -> u32 { unsafe { ffi::adw_leaflet_get_mode_transition_duration(self.to_glib_none().0) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_get_page")] #[doc(alias = "get_page")] pub fn page(&self, child: &impl IsA) -> LeafletPage { unsafe { from_glib_none(ffi::adw_leaflet_get_page( self.to_glib_none().0, child.as_ref().to_glib_none().0, )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_get_pages")] #[doc(alias = "get_pages")] pub fn pages(&self) -> gtk::SelectionModel { unsafe { from_glib_full(ffi::adw_leaflet_get_pages(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_get_transition_type")] #[doc(alias = "get_transition_type")] #[doc(alias = "transition-type")] pub fn transition_type(&self) -> LeafletTransitionType { unsafe { from_glib(ffi::adw_leaflet_get_transition_type(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_get_visible_child")] #[doc(alias = "get_visible_child")] #[doc(alias = "visible-child")] pub fn visible_child(&self) -> Option { unsafe { from_glib_none(ffi::adw_leaflet_get_visible_child(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_get_visible_child_name")] #[doc(alias = "get_visible_child_name")] #[doc(alias = "visible-child-name")] pub fn visible_child_name(&self) -> Option { unsafe { from_glib_none(ffi::adw_leaflet_get_visible_child_name( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_insert_child_after")] pub fn insert_child_after( &self, child: &impl IsA, sibling: Option<&impl IsA>, ) -> LeafletPage { unsafe { from_glib_none(ffi::adw_leaflet_insert_child_after( self.to_glib_none().0, child.as_ref().to_glib_none().0, sibling.map(|p| p.as_ref()).to_glib_none().0, )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_navigate")] pub fn navigate(&self, direction: NavigationDirection) -> bool { unsafe { from_glib(ffi::adw_leaflet_navigate( self.to_glib_none().0, direction.into_glib(), )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_prepend")] pub fn prepend(&self, child: &impl IsA) -> LeafletPage { unsafe { from_glib_none(ffi::adw_leaflet_prepend( self.to_glib_none().0, child.as_ref().to_glib_none().0, )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_remove")] pub fn remove(&self, child: &impl IsA) { unsafe { ffi::adw_leaflet_remove(self.to_glib_none().0, child.as_ref().to_glib_none().0); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_reorder_child_after")] pub fn reorder_child_after( &self, child: &impl IsA, sibling: Option<&impl IsA>, ) { unsafe { ffi::adw_leaflet_reorder_child_after( self.to_glib_none().0, child.as_ref().to_glib_none().0, sibling.map(|p| p.as_ref()).to_glib_none().0, ); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_set_can_navigate_back")] #[doc(alias = "can-navigate-back")] pub fn set_can_navigate_back(&self, can_navigate_back: bool) { unsafe { ffi::adw_leaflet_set_can_navigate_back( self.to_glib_none().0, can_navigate_back.into_glib(), ); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_set_can_navigate_forward")] #[doc(alias = "can-navigate-forward")] pub fn set_can_navigate_forward(&self, can_navigate_forward: bool) { unsafe { ffi::adw_leaflet_set_can_navigate_forward( self.to_glib_none().0, can_navigate_forward.into_glib(), ); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_set_can_unfold")] #[doc(alias = "can-unfold")] pub fn set_can_unfold(&self, can_unfold: bool) { unsafe { ffi::adw_leaflet_set_can_unfold(self.to_glib_none().0, can_unfold.into_glib()); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_set_child_transition_params")] #[doc(alias = "child-transition-params")] pub fn set_child_transition_params(&self, params: &SpringParams) { unsafe { ffi::adw_leaflet_set_child_transition_params( self.to_glib_none().0, params.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_set_fold_threshold_policy")] #[doc(alias = "fold-threshold-policy")] pub fn set_fold_threshold_policy(&self, policy: FoldThresholdPolicy) { unsafe { ffi::adw_leaflet_set_fold_threshold_policy(self.to_glib_none().0, policy.into_glib()); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_set_homogeneous")] #[doc(alias = "homogeneous")] pub fn set_homogeneous(&self, homogeneous: bool) { unsafe { ffi::adw_leaflet_set_homogeneous(self.to_glib_none().0, homogeneous.into_glib()); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_set_mode_transition_duration")] #[doc(alias = "mode-transition-duration")] pub fn set_mode_transition_duration(&self, duration: u32) { unsafe { ffi::adw_leaflet_set_mode_transition_duration(self.to_glib_none().0, duration); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_set_transition_type")] #[doc(alias = "transition-type")] pub fn set_transition_type(&self, transition: LeafletTransitionType) { unsafe { ffi::adw_leaflet_set_transition_type(self.to_glib_none().0, transition.into_glib()); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_set_visible_child")] #[doc(alias = "visible-child")] pub fn set_visible_child(&self, visible_child: &impl IsA) { unsafe { ffi::adw_leaflet_set_visible_child( self.to_glib_none().0, visible_child.as_ref().to_glib_none().0, ); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_set_visible_child_name")] #[doc(alias = "visible-child-name")] pub fn set_visible_child_name(&self, name: &str) { unsafe { ffi::adw_leaflet_set_visible_child_name(self.to_glib_none().0, name.to_glib_none().0); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "can-navigate-back")] pub fn connect_can_navigate_back_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_can_navigate_back_trampoline( this: *mut ffi::AdwLeaflet, _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 _, c"notify::can-navigate-back".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_can_navigate_back_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "can-navigate-forward")] pub fn connect_can_navigate_forward_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_can_navigate_forward_trampoline( this: *mut ffi::AdwLeaflet, _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 _, c"notify::can-navigate-forward".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_can_navigate_forward_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "can-unfold")] pub fn connect_can_unfold_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_can_unfold_trampoline( this: *mut ffi::AdwLeaflet, _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 _, c"notify::can-unfold".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_can_unfold_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "child-transition-params")] pub fn connect_child_transition_params_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_child_transition_params_trampoline< F: Fn(&Leaflet) + 'static, >( this: *mut ffi::AdwLeaflet, _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 _, c"notify::child-transition-params".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_child_transition_params_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "child-transition-running")] pub fn connect_child_transition_running_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_child_transition_running_trampoline< F: Fn(&Leaflet) + 'static, >( this: *mut ffi::AdwLeaflet, _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 _, c"notify::child-transition-running".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_child_transition_running_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "fold-threshold-policy")] pub fn connect_fold_threshold_policy_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_fold_threshold_policy_trampoline( this: *mut ffi::AdwLeaflet, _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 _, c"notify::fold-threshold-policy".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_fold_threshold_policy_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "folded")] pub fn connect_folded_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_folded_trampoline( this: *mut ffi::AdwLeaflet, _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 _, c"notify::folded".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_folded_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "homogeneous")] pub fn connect_homogeneous_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_homogeneous_trampoline( this: *mut ffi::AdwLeaflet, _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 _, c"notify::homogeneous".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_homogeneous_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "mode-transition-duration")] pub fn connect_mode_transition_duration_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_mode_transition_duration_trampoline< F: Fn(&Leaflet) + 'static, >( this: *mut ffi::AdwLeaflet, _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 _, c"notify::mode-transition-duration".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_mode_transition_duration_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "pages")] pub fn connect_pages_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_pages_trampoline( this: *mut ffi::AdwLeaflet, _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 _, c"notify::pages".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_pages_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "transition-type")] pub fn connect_transition_type_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_transition_type_trampoline( this: *mut ffi::AdwLeaflet, _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 _, c"notify::transition-type".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_transition_type_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "visible-child")] pub fn connect_visible_child_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_visible_child_trampoline( this: *mut ffi::AdwLeaflet, _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 _, c"notify::visible-child".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_visible_child_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "visible-child-name")] pub fn connect_visible_child_name_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_visible_child_name_trampoline( this: *mut ffi::AdwLeaflet, _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 _, c"notify::visible-child-name".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_visible_child_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for Leaflet { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Leaflet`] 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 LeafletBuilder { builder: glib::object::ObjectBuilder<'static, Leaflet>, } impl LeafletBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn can_navigate_back(self, can_navigate_back: bool) -> Self { Self { builder: self .builder .property("can-navigate-back", can_navigate_back), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn can_navigate_forward(self, can_navigate_forward: bool) -> Self { Self { builder: self .builder .property("can-navigate-forward", can_navigate_forward), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn can_unfold(self, can_unfold: bool) -> Self { Self { builder: self.builder.property("can-unfold", can_unfold), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn child_transition_params(self, child_transition_params: &SpringParams) -> Self { Self { builder: self .builder .property("child-transition-params", child_transition_params.clone()), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn fold_threshold_policy(self, fold_threshold_policy: FoldThresholdPolicy) -> Self { Self { builder: self .builder .property("fold-threshold-policy", fold_threshold_policy), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn homogeneous(self, homogeneous: bool) -> Self { Self { builder: self.builder.property("homogeneous", homogeneous), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn mode_transition_duration(self, mode_transition_duration: u32) -> Self { Self { builder: self .builder .property("mode-transition-duration", mode_transition_duration), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn transition_type(self, transition_type: LeafletTransitionType) -> Self { Self { builder: self.builder.property("transition-type", transition_type), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn visible_child(self, visible_child: &impl IsA) -> Self { Self { builder: self .builder .property("visible-child", visible_child.clone().upcast()), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn visible_child_name(self, visible_child_name: impl Into) -> Self { Self { builder: self .builder .property("visible-child-name", visible_child_name.into()), } } 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 orientation(self, orientation: gtk::Orientation) -> Self { Self { builder: self.builder.property("orientation", orientation), } } // rustdoc-stripper-ignore-next /// Build the [`Leaflet`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Leaflet { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/leaflet_page.rs000064400000000000000000000077061046102023000164620ustar 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 #![allow(deprecated)] use crate::ffi; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwLeafletPage")] pub struct LeafletPage(Object); match fn { type_ => || ffi::adw_leaflet_page_get_type(), } } impl LeafletPage { #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_page_get_child")] #[doc(alias = "get_child")] pub fn child(&self) -> gtk::Widget { unsafe { from_glib_none(ffi::adw_leaflet_page_get_child(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_page_get_name")] #[doc(alias = "get_name")] pub fn name(&self) -> Option { unsafe { from_glib_none(ffi::adw_leaflet_page_get_name(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_page_get_navigatable")] #[doc(alias = "get_navigatable")] #[doc(alias = "navigatable")] pub fn is_navigatable(&self) -> bool { unsafe { from_glib(ffi::adw_leaflet_page_get_navigatable(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_page_set_name")] #[doc(alias = "name")] pub fn set_name(&self, name: Option<&str>) { unsafe { ffi::adw_leaflet_page_set_name(self.to_glib_none().0, name.to_glib_none().0); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_leaflet_page_set_navigatable")] #[doc(alias = "navigatable")] pub fn set_navigatable(&self, navigatable: bool) { unsafe { ffi::adw_leaflet_page_set_navigatable(self.to_glib_none().0, navigatable.into_glib()); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "name")] pub fn connect_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_name_trampoline( this: *mut ffi::AdwLeafletPage, _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 _, c"notify::name".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "navigatable")] pub fn connect_navigatable_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_navigatable_trampoline( this: *mut ffi::AdwLeafletPage, _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 _, c"notify::navigatable".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_navigatable_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } libadwaita-0.7.2/src/auto/message_dialog.rs000064400000000000000000001015171046102023000170100ustar 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 #![allow(deprecated)] use crate::{ffi, ResponseAppearance}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwMessageDialog")] pub struct MessageDialog(Object) @extends gtk::Window, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Native, gtk::Root, gtk::ShortcutManager; match fn { type_ => || ffi::adw_message_dialog_get_type(), } } impl MessageDialog { pub const NONE: Option<&'static MessageDialog> = None; #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_new")] pub fn new( parent: Option<&impl IsA>, heading: Option<&str>, body: Option<&str>, ) -> MessageDialog { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_message_dialog_new( parent.map(|p| p.as_ref()).to_glib_none().0, heading.to_glib_none().0, body.to_glib_none().0, )) .unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`MessageDialog`] objects. /// /// This method returns an instance of [`MessageDialogBuilder`](crate::builders::MessageDialogBuilder) which can be used to create [`MessageDialog`] objects. pub fn builder() -> MessageDialogBuilder { MessageDialogBuilder::new() } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] impl Default for MessageDialog { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`MessageDialog`] 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 MessageDialogBuilder { builder: glib::object::ObjectBuilder<'static, MessageDialog>, } impl MessageDialogBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn body(self, body: impl Into) -> Self { Self { builder: self.builder.property("body", body.into()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn body_use_markup(self, body_use_markup: bool) -> Self { Self { builder: self.builder.property("body-use-markup", body_use_markup), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn close_response(self, close_response: impl Into) -> Self { Self { builder: self .builder .property("close-response", close_response.into()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn default_response(self, default_response: impl Into) -> Self { Self { builder: self .builder .property("default-response", default_response.into()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn extra_child(self, extra_child: &impl IsA) -> Self { Self { builder: self .builder .property("extra-child", extra_child.clone().upcast()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn heading(self, heading: impl Into) -> Self { Self { builder: self.builder.property("heading", heading.into()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn heading_use_markup(self, heading_use_markup: bool) -> Self { Self { builder: self .builder .property("heading-use-markup", heading_use_markup), } } pub fn application(self, application: &impl IsA) -> Self { Self { builder: self .builder .property("application", application.clone().upcast()), } } pub fn decorated(self, decorated: bool) -> Self { Self { builder: self.builder.property("decorated", decorated), } } pub fn default_height(self, default_height: i32) -> Self { Self { builder: self.builder.property("default-height", default_height), } } pub fn default_widget(self, default_widget: &impl IsA) -> Self { Self { builder: self .builder .property("default-widget", default_widget.clone().upcast()), } } pub fn default_width(self, default_width: i32) -> Self { Self { builder: self.builder.property("default-width", default_width), } } pub fn deletable(self, deletable: bool) -> Self { Self { builder: self.builder.property("deletable", deletable), } } pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self { Self { builder: self .builder .property("destroy-with-parent", destroy_with_parent), } } pub fn display(self, display: &gdk::Display) -> Self { Self { builder: self.builder.property("display", display.clone()), } } pub fn focus_visible(self, focus_visible: bool) -> Self { Self { builder: self.builder.property("focus-visible", focus_visible), } } pub fn focus_widget(self, focus_widget: &impl IsA) -> Self { Self { builder: self .builder .property("focus-widget", focus_widget.clone().upcast()), } } pub fn fullscreened(self, fullscreened: bool) -> Self { Self { builder: self.builder.property("fullscreened", fullscreened), } } #[cfg(feature = "gtk_v4_2")] #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_2")))] pub fn handle_menubar_accel(self, handle_menubar_accel: bool) -> Self { Self { builder: self .builder .property("handle-menubar-accel", handle_menubar_accel), } } pub fn hide_on_close(self, hide_on_close: bool) -> Self { Self { builder: self.builder.property("hide-on-close", hide_on_close), } } pub fn icon_name(self, icon_name: impl Into) -> Self { Self { builder: self.builder.property("icon-name", icon_name.into()), } } pub fn maximized(self, maximized: bool) -> Self { Self { builder: self.builder.property("maximized", maximized), } } pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self { Self { builder: self .builder .property("mnemonics-visible", mnemonics_visible), } } pub fn modal(self, modal: bool) -> Self { Self { builder: self.builder.property("modal", modal), } } pub fn resizable(self, resizable: bool) -> Self { Self { builder: self.builder.property("resizable", resizable), } } pub fn startup_id(self, startup_id: impl Into) -> Self { Self { builder: self.builder.property("startup-id", startup_id.into()), } } pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } #[cfg(feature = "gtk_v4_6")] #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_6")))] pub fn titlebar(self, titlebar: &impl IsA) -> Self { Self { builder: self.builder.property("titlebar", titlebar.clone().upcast()), } } pub fn transient_for(self, transient_for: &impl IsA) -> Self { Self { builder: self .builder .property("transient-for", transient_for.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 [`MessageDialog`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> MessageDialog { assert_initialized_main_thread!(); self.builder.build() } } pub trait MessageDialogExt: IsA + 'static { #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_add_response")] fn add_response(&self, id: &str, label: &str) { unsafe { ffi::adw_message_dialog_add_response( self.as_ref().to_glib_none().0, id.to_glib_none().0, label.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_get_body")] #[doc(alias = "get_body")] fn body(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_message_dialog_get_body( self.as_ref().to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_get_body_use_markup")] #[doc(alias = "get_body_use_markup")] #[doc(alias = "body-use-markup")] fn is_body_use_markup(&self) -> bool { unsafe { from_glib(ffi::adw_message_dialog_get_body_use_markup( self.as_ref().to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_get_close_response")] #[doc(alias = "get_close_response")] #[doc(alias = "close-response")] fn close_response(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_message_dialog_get_close_response( self.as_ref().to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_get_default_response")] #[doc(alias = "get_default_response")] #[doc(alias = "default-response")] fn default_response(&self) -> Option { unsafe { from_glib_none(ffi::adw_message_dialog_get_default_response( self.as_ref().to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_get_extra_child")] #[doc(alias = "get_extra_child")] #[doc(alias = "extra-child")] fn extra_child(&self) -> Option { unsafe { from_glib_none(ffi::adw_message_dialog_get_extra_child( self.as_ref().to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_get_heading")] #[doc(alias = "get_heading")] fn heading(&self) -> Option { unsafe { from_glib_none(ffi::adw_message_dialog_get_heading( self.as_ref().to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_get_heading_use_markup")] #[doc(alias = "get_heading_use_markup")] #[doc(alias = "heading-use-markup")] fn is_heading_use_markup(&self) -> bool { unsafe { from_glib(ffi::adw_message_dialog_get_heading_use_markup( self.as_ref().to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_get_response_appearance")] #[doc(alias = "get_response_appearance")] fn response_appearance(&self, response: &str) -> ResponseAppearance { unsafe { from_glib(ffi::adw_message_dialog_get_response_appearance( self.as_ref().to_glib_none().0, response.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_get_response_enabled")] #[doc(alias = "get_response_enabled")] fn is_response_enabled(&self, response: &str) -> bool { unsafe { from_glib(ffi::adw_message_dialog_get_response_enabled( self.as_ref().to_glib_none().0, response.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_has_response")] fn has_response(&self, response: &str) -> bool { unsafe { from_glib(ffi::adw_message_dialog_has_response( self.as_ref().to_glib_none().0, response.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_remove_response")] fn remove_response(&self, id: &str) { unsafe { ffi::adw_message_dialog_remove_response( self.as_ref().to_glib_none().0, id.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_response")] fn response(&self, response: &str) { unsafe { ffi::adw_message_dialog_response( self.as_ref().to_glib_none().0, response.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_set_body")] #[doc(alias = "body")] fn set_body(&self, body: &str) { unsafe { ffi::adw_message_dialog_set_body(self.as_ref().to_glib_none().0, body.to_glib_none().0); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_set_body_use_markup")] #[doc(alias = "body-use-markup")] fn set_body_use_markup(&self, use_markup: bool) { unsafe { ffi::adw_message_dialog_set_body_use_markup( self.as_ref().to_glib_none().0, use_markup.into_glib(), ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_set_close_response")] #[doc(alias = "close-response")] fn set_close_response(&self, response: &str) { unsafe { ffi::adw_message_dialog_set_close_response( self.as_ref().to_glib_none().0, response.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_set_default_response")] #[doc(alias = "default-response")] fn set_default_response(&self, response: Option<&str>) { unsafe { ffi::adw_message_dialog_set_default_response( self.as_ref().to_glib_none().0, response.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_set_extra_child")] #[doc(alias = "extra-child")] fn set_extra_child(&self, child: Option<&impl IsA>) { unsafe { ffi::adw_message_dialog_set_extra_child( self.as_ref().to_glib_none().0, child.map(|p| p.as_ref()).to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_set_heading")] #[doc(alias = "heading")] fn set_heading(&self, heading: Option<&str>) { unsafe { ffi::adw_message_dialog_set_heading( self.as_ref().to_glib_none().0, heading.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_set_heading_use_markup")] #[doc(alias = "heading-use-markup")] fn set_heading_use_markup(&self, use_markup: bool) { unsafe { ffi::adw_message_dialog_set_heading_use_markup( self.as_ref().to_glib_none().0, use_markup.into_glib(), ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_set_response_appearance")] fn set_response_appearance(&self, response: &str, appearance: ResponseAppearance) { unsafe { ffi::adw_message_dialog_set_response_appearance( self.as_ref().to_glib_none().0, response.to_glib_none().0, appearance.into_glib(), ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_set_response_enabled")] fn set_response_enabled(&self, response: &str, enabled: bool) { unsafe { ffi::adw_message_dialog_set_response_enabled( self.as_ref().to_glib_none().0, response.to_glib_none().0, enabled.into_glib(), ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_message_dialog_set_response_label")] fn set_response_label(&self, response: &str, label: &str) { unsafe { ffi::adw_message_dialog_set_response_label( self.as_ref().to_glib_none().0, response.to_glib_none().0, label.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "response")] fn connect_response( &self, detail: Option<&str>, f: F, ) -> SignalHandlerId { unsafe extern "C" fn response_trampoline< P: IsA, F: Fn(&P, &str) + 'static, >( this: *mut ffi::AdwMessageDialog, response: *mut std::ffi::c_char, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( MessageDialog::from_glib_borrow(this).unsafe_cast_ref(), &glib::GString::from_glib_borrow(response), ) } unsafe { let f: Box_ = Box_::new(f); let detailed_signal_name = detail.map(|name| format!("response::{name}\0")); let signal_name: &[u8] = detailed_signal_name .as_ref() .map_or(&b"response\0"[..], |n| n.as_bytes()); connect_raw( self.as_ptr() as *mut _, signal_name.as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( response_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "body")] fn connect_body_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_body_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwMessageDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(MessageDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::body".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_body_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "body-use-markup")] fn connect_body_use_markup_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_body_use_markup_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwMessageDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(MessageDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::body-use-markup".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_body_use_markup_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "close-response")] fn connect_close_response_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_close_response_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwMessageDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(MessageDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::close-response".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_close_response_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "default-response")] fn connect_default_response_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_default_response_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwMessageDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(MessageDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::default-response".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_default_response_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "extra-child")] fn connect_extra_child_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_extra_child_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwMessageDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(MessageDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::extra-child".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_extra_child_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "heading")] fn connect_heading_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_heading_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwMessageDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(MessageDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::heading".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_heading_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "heading-use-markup")] fn connect_heading_use_markup_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_heading_use_markup_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwMessageDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(MessageDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::heading-use-markup".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_heading_use_markup_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> MessageDialogExt for O {} libadwaita-0.7.2/src/auto/mod.rs000064400000000000000000000520201046102023000146160ustar 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 #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] mod about_dialog; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub use self::about_dialog::AboutDialog; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] mod about_window; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub use self::about_window::AboutWindow; mod action_row; pub use self::action_row::ActionRow; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] mod alert_dialog; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub use self::alert_dialog::AlertDialog; mod animation; pub use self::animation::Animation; mod animation_target; pub use self::animation_target::AnimationTarget; mod application; pub use self::application::Application; mod application_window; pub use self::application_window::ApplicationWindow; mod avatar; pub use self::avatar::Avatar; #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] mod banner; #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub use self::banner::Banner; mod bin; pub use self::bin::Bin; #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] mod bottom_sheet; #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub use self::bottom_sheet::BottomSheet; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] mod breakpoint; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use self::breakpoint::Breakpoint; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] mod breakpoint_bin; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use self::breakpoint_bin::BreakpointBin; mod button_content; pub use self::button_content::ButtonContent; #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] mod button_row; #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub use self::button_row::ButtonRow; mod callback_animation_target; pub use self::callback_animation_target::CallbackAnimationTarget; mod carousel; pub use self::carousel::Carousel; mod carousel_indicator_dots; pub use self::carousel_indicator_dots::CarouselIndicatorDots; mod carousel_indicator_lines; pub use self::carousel_indicator_lines::CarouselIndicatorLines; mod clamp; pub use self::clamp::Clamp; mod clamp_layout; pub use self::clamp_layout::ClampLayout; mod clamp_scrollable; pub use self::clamp_scrollable::ClampScrollable; mod combo_row; pub use self::combo_row::ComboRow; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] mod dialog; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub use self::dialog::Dialog; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] mod entry_row; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub use self::entry_row::EntryRow; mod enum_list_item; pub use self::enum_list_item::EnumListItem; mod enum_list_model; pub use self::enum_list_model::EnumListModel; mod expander_row; pub use self::expander_row::ExpanderRow; #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] mod flap; #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub use self::flap::Flap; mod header_bar; pub use self::header_bar::HeaderBar; #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] mod inline_view_switcher; #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub use self::inline_view_switcher::InlineViewSwitcher; #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] mod layout; #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub use self::layout::Layout; #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] mod layout_slot; #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub use self::layout_slot::LayoutSlot; #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] mod leaflet; #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub use self::leaflet::Leaflet; #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] mod leaflet_page; #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub use self::leaflet_page::LeafletPage; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] mod message_dialog; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub use self::message_dialog::MessageDialog; #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] mod multi_layout_view; #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub use self::multi_layout_view::MultiLayoutView; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] mod navigation_page; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use self::navigation_page::NavigationPage; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] mod navigation_split_view; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use self::navigation_split_view::NavigationSplitView; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] mod navigation_view; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use self::navigation_view::NavigationView; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] mod overlay_split_view; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use self::overlay_split_view::OverlaySplitView; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] mod password_entry_row; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub use self::password_entry_row::PasswordEntryRow; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] mod preferences_dialog; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub use self::preferences_dialog::PreferencesDialog; mod preferences_group; pub use self::preferences_group::PreferencesGroup; mod preferences_page; pub use self::preferences_page::PreferencesPage; mod preferences_row; pub use self::preferences_row::PreferencesRow; #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] mod preferences_window; #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub use self::preferences_window::PreferencesWindow; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] mod property_animation_target; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub use self::property_animation_target::PropertyAnimationTarget; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] mod spin_row; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use self::spin_row::SpinRow; #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] mod spinner; #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub use self::spinner::Spinner; #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] mod spinner_paintable; #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub use self::spinner_paintable::SpinnerPaintable; mod split_button; pub use self::split_button::SplitButton; mod spring_animation; pub use self::spring_animation::SpringAnimation; #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] mod squeezer; #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub use self::squeezer::Squeezer; #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] mod squeezer_page; #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub use self::squeezer_page::SqueezerPage; mod status_page; pub use self::status_page::StatusPage; mod style_manager; pub use self::style_manager::StyleManager; mod swipe_tracker; pub use self::swipe_tracker::SwipeTracker; mod swipeable; pub use self::swipeable::Swipeable; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] mod switch_row; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use self::switch_row::SwitchRow; mod tab_bar; pub use self::tab_bar::TabBar; #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] mod tab_button; #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub use self::tab_button::TabButton; #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] mod tab_overview; #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub use self::tab_overview::TabOverview; mod tab_page; pub use self::tab_page::TabPage; mod tab_view; pub use self::tab_view::TabView; mod timed_animation; pub use self::timed_animation::TimedAnimation; mod toast; pub use self::toast::Toast; mod toast_overlay; pub use self::toast_overlay::ToastOverlay; #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] mod toggle; #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub use self::toggle::Toggle; #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] mod toggle_group; #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub use self::toggle_group::ToggleGroup; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] mod toolbar_view; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use self::toolbar_view::ToolbarView; mod view_stack; pub use self::view_stack::ViewStack; mod view_stack_page; pub use self::view_stack_page::ViewStackPage; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] mod view_stack_pages; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use self::view_stack_pages::ViewStackPages; mod view_switcher; pub use self::view_switcher::ViewSwitcher; mod view_switcher_bar; pub use self::view_switcher_bar::ViewSwitcherBar; #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] mod view_switcher_title; #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub use self::view_switcher_title::ViewSwitcherTitle; mod window; pub use self::window::Window; mod window_title; pub use self::window_title::WindowTitle; #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] mod wrap_box; #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub use self::wrap_box::WrapBox; #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] mod wrap_layout; #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub use self::wrap_layout::WrapLayout; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] mod breakpoint_condition; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use self::breakpoint_condition::BreakpointCondition; mod spring_params; pub use self::spring_params::SpringParams; mod enums; #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub use self::enums::AccentColor; pub use self::enums::AnimationState; #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub use self::enums::BannerButtonStyle; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use self::enums::BreakpointConditionLengthType; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use self::enums::BreakpointConditionRatioType; pub use self::enums::CenteringPolicy; pub use self::enums::ColorScheme; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub use self::enums::DialogPresentationMode; pub use self::enums::Easing; #[allow(deprecated)] pub use self::enums::FlapFoldPolicy; #[allow(deprecated)] pub use self::enums::FlapTransitionType; #[allow(deprecated)] pub use self::enums::FoldThresholdPolicy; #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub use self::enums::InlineViewSwitcherDisplayMode; #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub use self::enums::JustifyMode; #[allow(deprecated)] pub use self::enums::LeafletTransitionType; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use self::enums::LengthUnit; pub use self::enums::NavigationDirection; #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub use self::enums::PackDirection; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub use self::enums::ResponseAppearance; #[allow(deprecated)] pub use self::enums::SqueezerTransitionType; pub use self::enums::ToastPriority; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use self::enums::ToolbarStyle; pub use self::enums::ViewSwitcherPolicy; #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub use self::enums::WrapPolicy; mod flags; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub use self::flags::TabViewShortcuts; pub(crate) mod functions; pub(crate) mod traits { pub use super::action_row::ActionRowExt; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub use super::alert_dialog::AlertDialogExt; pub use super::animation::AnimationExt; pub use super::application::AdwApplicationExt; pub use super::application_window::AdwApplicationWindowExt; pub use super::bin::BinExt; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use super::breakpoint_bin::BreakpointBinExt; pub use super::combo_row::ComboRowExt; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub use super::dialog::AdwDialogExt; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub use super::entry_row::EntryRowExt; pub use super::expander_row::ExpanderRowExt; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub use super::message_dialog::MessageDialogExt; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use super::navigation_page::NavigationPageExt; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub use super::preferences_dialog::PreferencesDialogExt; pub use super::preferences_group::PreferencesGroupExt; pub use super::preferences_page::PreferencesPageExt; pub use super::preferences_row::PreferencesRowExt; #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub use super::preferences_window::PreferencesWindowExt; pub use super::swipeable::SwipeableExt; pub use super::window::AdwWindowExt; } pub(crate) mod builders { #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub use super::about_dialog::AboutDialogBuilder; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub use super::about_window::AboutWindowBuilder; pub use super::action_row::ActionRowBuilder; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub use super::alert_dialog::AlertDialogBuilder; pub use super::application::ApplicationBuilder; pub use super::application_window::ApplicationWindowBuilder; pub use super::avatar::AvatarBuilder; #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub use super::banner::BannerBuilder; pub use super::bin::BinBuilder; #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub use super::bottom_sheet::BottomSheetBuilder; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use super::breakpoint_bin::BreakpointBinBuilder; pub use super::button_content::ButtonContentBuilder; #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub use super::button_row::ButtonRowBuilder; pub use super::carousel::CarouselBuilder; pub use super::carousel_indicator_dots::CarouselIndicatorDotsBuilder; pub use super::carousel_indicator_lines::CarouselIndicatorLinesBuilder; pub use super::clamp::ClampBuilder; pub use super::clamp_layout::ClampLayoutBuilder; pub use super::clamp_scrollable::ClampScrollableBuilder; pub use super::combo_row::ComboRowBuilder; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub use super::dialog::DialogBuilder; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub use super::entry_row::EntryRowBuilder; pub use super::expander_row::ExpanderRowBuilder; #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub use super::flap::FlapBuilder; pub use super::header_bar::HeaderBarBuilder; #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub use super::inline_view_switcher::InlineViewSwitcherBuilder; #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub use super::layout_slot::LayoutSlotBuilder; #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub use super::leaflet::LeafletBuilder; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub use super::message_dialog::MessageDialogBuilder; #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub use super::multi_layout_view::MultiLayoutViewBuilder; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use super::navigation_page::NavigationPageBuilder; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use super::navigation_split_view::NavigationSplitViewBuilder; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use super::navigation_view::NavigationViewBuilder; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use super::overlay_split_view::OverlaySplitViewBuilder; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub use super::password_entry_row::PasswordEntryRowBuilder; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub use super::preferences_dialog::PreferencesDialogBuilder; pub use super::preferences_group::PreferencesGroupBuilder; pub use super::preferences_page::PreferencesPageBuilder; pub use super::preferences_row::PreferencesRowBuilder; #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub use super::preferences_window::PreferencesWindowBuilder; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use super::spin_row::SpinRowBuilder; #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub use super::spinner::SpinnerBuilder; pub use super::split_button::SplitButtonBuilder; pub use super::spring_animation::SpringAnimationBuilder; #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub use super::squeezer::SqueezerBuilder; pub use super::status_page::StatusPageBuilder; pub use super::swipe_tracker::SwipeTrackerBuilder; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use super::switch_row::SwitchRowBuilder; pub use super::tab_bar::TabBarBuilder; #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub use super::tab_button::TabButtonBuilder; #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub use super::tab_overview::TabOverviewBuilder; pub use super::tab_view::TabViewBuilder; pub use super::timed_animation::TimedAnimationBuilder; pub use super::toast::ToastBuilder; #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub use super::toggle::ToggleBuilder; #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub use super::toggle_group::ToggleGroupBuilder; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use super::toolbar_view::ToolbarViewBuilder; pub use super::view_stack::ViewStackBuilder; pub use super::view_switcher::ViewSwitcherBuilder; pub use super::view_switcher_bar::ViewSwitcherBarBuilder; #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub use super::view_switcher_title::ViewSwitcherTitleBuilder; pub use super::window::WindowBuilder; pub use super::window_title::WindowTitleBuilder; #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub use super::wrap_box::WrapBoxBuilder; #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub use super::wrap_layout::WrapLayoutBuilder; } libadwaita-0.7.2/src/auto/multi_layout_view.rs000064400000000000000000000302461046102023000176260ustar 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, Layout}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwMultiLayoutView")] pub struct MultiLayoutView(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_multi_layout_view_get_type(), } } impl MultiLayoutView { #[doc(alias = "adw_multi_layout_view_new")] pub fn new() -> MultiLayoutView { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_multi_layout_view_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`MultiLayoutView`] objects. /// /// This method returns an instance of [`MultiLayoutViewBuilder`](crate::builders::MultiLayoutViewBuilder) which can be used to create [`MultiLayoutView`] objects. pub fn builder() -> MultiLayoutViewBuilder { MultiLayoutViewBuilder::new() } #[doc(alias = "adw_multi_layout_view_add_layout")] pub fn add_layout(&self, layout: Layout) { unsafe { ffi::adw_multi_layout_view_add_layout(self.to_glib_none().0, layout.into_glib_ptr()); } } #[doc(alias = "adw_multi_layout_view_get_child")] #[doc(alias = "get_child")] pub fn child(&self, id: &str) -> Option { unsafe { from_glib_none(ffi::adw_multi_layout_view_get_child( self.to_glib_none().0, id.to_glib_none().0, )) } } #[doc(alias = "adw_multi_layout_view_get_layout")] #[doc(alias = "get_layout")] pub fn layout(&self) -> Option { unsafe { from_glib_none(ffi::adw_multi_layout_view_get_layout(self.to_glib_none().0)) } } #[doc(alias = "adw_multi_layout_view_get_layout_by_name")] #[doc(alias = "get_layout_by_name")] pub fn layout_by_name(&self, name: &str) -> Option { unsafe { from_glib_none(ffi::adw_multi_layout_view_get_layout_by_name( self.to_glib_none().0, name.to_glib_none().0, )) } } #[doc(alias = "adw_multi_layout_view_get_layout_name")] #[doc(alias = "get_layout_name")] #[doc(alias = "layout-name")] pub fn layout_name(&self) -> Option { unsafe { from_glib_none(ffi::adw_multi_layout_view_get_layout_name( self.to_glib_none().0, )) } } #[doc(alias = "adw_multi_layout_view_remove_layout")] pub fn remove_layout(&self, layout: &Layout) { unsafe { ffi::adw_multi_layout_view_remove_layout( self.to_glib_none().0, layout.to_glib_none().0, ); } } #[doc(alias = "adw_multi_layout_view_set_child")] pub fn set_child(&self, id: &str, child: &impl IsA) { unsafe { ffi::adw_multi_layout_view_set_child( self.to_glib_none().0, id.to_glib_none().0, child.as_ref().to_glib_none().0, ); } } #[doc(alias = "adw_multi_layout_view_set_layout")] #[doc(alias = "layout")] pub fn set_layout(&self, layout: &Layout) { unsafe { ffi::adw_multi_layout_view_set_layout(self.to_glib_none().0, layout.to_glib_none().0); } } #[doc(alias = "adw_multi_layout_view_set_layout_name")] #[doc(alias = "layout-name")] pub fn set_layout_name(&self, name: &str) { unsafe { ffi::adw_multi_layout_view_set_layout_name( self.to_glib_none().0, name.to_glib_none().0, ); } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "layout")] pub fn connect_layout_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_layout_trampoline( this: *mut ffi::AdwMultiLayoutView, _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 _, c"notify::layout".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_layout_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "layout-name")] pub fn connect_layout_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_layout_name_trampoline( this: *mut ffi::AdwMultiLayoutView, _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 _, c"notify::layout-name".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_layout_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] impl Default for MultiLayoutView { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`MultiLayoutView`] 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 MultiLayoutViewBuilder { builder: glib::object::ObjectBuilder<'static, MultiLayoutView>, } impl MultiLayoutViewBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub fn layout(self, layout: &Layout) -> Self { Self { builder: self.builder.property("layout", layout.clone()), } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub fn layout_name(self, layout_name: impl Into) -> Self { Self { builder: self.builder.property("layout-name", layout_name.into()), } } 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 [`MultiLayoutView`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> MultiLayoutView { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/navigation_page.rs000064400000000000000000000451461046102023000172050ustar 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 = "AdwNavigationPage")] pub struct NavigationPage(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_navigation_page_get_type(), } } impl NavigationPage { pub const NONE: Option<&'static NavigationPage> = None; #[doc(alias = "adw_navigation_page_new")] pub fn new(child: &impl IsA, title: &str) -> NavigationPage { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::adw_navigation_page_new( child.as_ref().to_glib_none().0, title.to_glib_none().0, )) } } #[doc(alias = "adw_navigation_page_new_with_tag")] #[doc(alias = "new_with_tag")] pub fn with_tag(child: &impl IsA, title: &str, tag: &str) -> NavigationPage { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::adw_navigation_page_new_with_tag( child.as_ref().to_glib_none().0, title.to_glib_none().0, tag.to_glib_none().0, )) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`NavigationPage`] objects. /// /// This method returns an instance of [`NavigationPageBuilder`](crate::builders::NavigationPageBuilder) which can be used to create [`NavigationPage`] objects. pub fn builder() -> NavigationPageBuilder { NavigationPageBuilder::new() } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl Default for NavigationPage { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`NavigationPage`] 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 NavigationPageBuilder { builder: glib::object::ObjectBuilder<'static, NavigationPage>, } impl NavigationPageBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn can_pop(self, can_pop: bool) -> Self { Self { builder: self.builder.property("can-pop", can_pop), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn child(self, child: &impl IsA) -> Self { Self { builder: self.builder.property("child", child.clone().upcast()), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn tag(self, tag: impl Into) -> Self { Self { builder: self.builder.property("tag", tag.into()), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } 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 [`NavigationPage`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> NavigationPage { assert_initialized_main_thread!(); self.builder.build() } } pub trait NavigationPageExt: IsA + 'static { #[doc(alias = "adw_navigation_page_get_can_pop")] #[doc(alias = "get_can_pop")] #[doc(alias = "can-pop")] fn can_pop(&self) -> bool { unsafe { from_glib(ffi::adw_navigation_page_get_can_pop( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_navigation_page_get_child")] #[doc(alias = "get_child")] fn child(&self) -> Option { unsafe { from_glib_none(ffi::adw_navigation_page_get_child( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_navigation_page_get_tag")] #[doc(alias = "get_tag")] fn tag(&self) -> Option { unsafe { from_glib_none(ffi::adw_navigation_page_get_tag( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_navigation_page_get_title")] #[doc(alias = "get_title")] fn title(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_navigation_page_get_title( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_navigation_page_set_can_pop")] #[doc(alias = "can-pop")] fn set_can_pop(&self, can_pop: bool) { unsafe { ffi::adw_navigation_page_set_can_pop( self.as_ref().to_glib_none().0, can_pop.into_glib(), ); } } #[doc(alias = "adw_navigation_page_set_child")] #[doc(alias = "child")] fn set_child(&self, child: Option<&impl IsA>) { unsafe { ffi::adw_navigation_page_set_child( self.as_ref().to_glib_none().0, child.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_navigation_page_set_tag")] #[doc(alias = "tag")] fn set_tag(&self, tag: Option<&str>) { unsafe { ffi::adw_navigation_page_set_tag(self.as_ref().to_glib_none().0, tag.to_glib_none().0); } } #[doc(alias = "adw_navigation_page_set_title")] #[doc(alias = "title")] fn set_title(&self, title: &str) { unsafe { ffi::adw_navigation_page_set_title( self.as_ref().to_glib_none().0, title.to_glib_none().0, ); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "hidden")] fn connect_hidden(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn hidden_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwNavigationPage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(NavigationPage::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"hidden".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( hidden_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "hiding")] fn connect_hiding(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn hiding_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwNavigationPage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(NavigationPage::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"hiding".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( hiding_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "showing")] fn connect_showing(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn showing_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwNavigationPage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(NavigationPage::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"showing".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( showing_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "shown")] fn connect_shown(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn shown_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwNavigationPage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(NavigationPage::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"shown".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( shown_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "can-pop")] fn connect_can_pop_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_can_pop_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwNavigationPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(NavigationPage::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::can-pop".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_can_pop_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "child")] fn connect_child_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_child_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwNavigationPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(NavigationPage::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::child".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_child_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "tag")] fn connect_tag_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_tag_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwNavigationPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(NavigationPage::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::tag".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_tag_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[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::AdwNavigationPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(NavigationPage::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::title".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> NavigationPageExt for O {} libadwaita-0.7.2/src/auto/navigation_split_view.rs000064400000000000000000000612051046102023000204500ustar 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, LengthUnit, NavigationPage}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwNavigationSplitView")] pub struct NavigationSplitView(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_navigation_split_view_get_type(), } } impl NavigationSplitView { #[doc(alias = "adw_navigation_split_view_new")] pub fn new() -> NavigationSplitView { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_navigation_split_view_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`NavigationSplitView`] objects. /// /// This method returns an instance of [`NavigationSplitViewBuilder`](crate::builders::NavigationSplitViewBuilder) which can be used to create [`NavigationSplitView`] objects. pub fn builder() -> NavigationSplitViewBuilder { NavigationSplitViewBuilder::new() } #[doc(alias = "adw_navigation_split_view_get_collapsed")] #[doc(alias = "get_collapsed")] #[doc(alias = "collapsed")] pub fn is_collapsed(&self) -> bool { unsafe { from_glib(ffi::adw_navigation_split_view_get_collapsed( self.to_glib_none().0, )) } } #[doc(alias = "adw_navigation_split_view_get_content")] #[doc(alias = "get_content")] pub fn content(&self) -> Option { unsafe { from_glib_none(ffi::adw_navigation_split_view_get_content( self.to_glib_none().0, )) } } #[doc(alias = "adw_navigation_split_view_get_max_sidebar_width")] #[doc(alias = "get_max_sidebar_width")] #[doc(alias = "max-sidebar-width")] pub fn max_sidebar_width(&self) -> f64 { unsafe { ffi::adw_navigation_split_view_get_max_sidebar_width(self.to_glib_none().0) } } #[doc(alias = "adw_navigation_split_view_get_min_sidebar_width")] #[doc(alias = "get_min_sidebar_width")] #[doc(alias = "min-sidebar-width")] pub fn min_sidebar_width(&self) -> f64 { unsafe { ffi::adw_navigation_split_view_get_min_sidebar_width(self.to_glib_none().0) } } #[doc(alias = "adw_navigation_split_view_get_show_content")] #[doc(alias = "get_show_content")] #[doc(alias = "show-content")] pub fn shows_content(&self) -> bool { unsafe { from_glib(ffi::adw_navigation_split_view_get_show_content( self.to_glib_none().0, )) } } #[doc(alias = "adw_navigation_split_view_get_sidebar")] #[doc(alias = "get_sidebar")] pub fn sidebar(&self) -> Option { unsafe { from_glib_none(ffi::adw_navigation_split_view_get_sidebar( self.to_glib_none().0, )) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_navigation_split_view_get_sidebar_position")] #[doc(alias = "get_sidebar_position")] #[doc(alias = "sidebar-position")] pub fn sidebar_position(&self) -> gtk::PackType { unsafe { from_glib(ffi::adw_navigation_split_view_get_sidebar_position( self.to_glib_none().0, )) } } #[doc(alias = "adw_navigation_split_view_get_sidebar_width_fraction")] #[doc(alias = "get_sidebar_width_fraction")] #[doc(alias = "sidebar-width-fraction")] pub fn sidebar_width_fraction(&self) -> f64 { unsafe { ffi::adw_navigation_split_view_get_sidebar_width_fraction(self.to_glib_none().0) } } #[doc(alias = "adw_navigation_split_view_get_sidebar_width_unit")] #[doc(alias = "get_sidebar_width_unit")] #[doc(alias = "sidebar-width-unit")] pub fn sidebar_width_unit(&self) -> LengthUnit { unsafe { from_glib(ffi::adw_navigation_split_view_get_sidebar_width_unit( self.to_glib_none().0, )) } } #[doc(alias = "adw_navigation_split_view_set_collapsed")] #[doc(alias = "collapsed")] pub fn set_collapsed(&self, collapsed: bool) { unsafe { ffi::adw_navigation_split_view_set_collapsed( self.to_glib_none().0, collapsed.into_glib(), ); } } #[doc(alias = "adw_navigation_split_view_set_content")] #[doc(alias = "content")] pub fn set_content(&self, content: Option<&impl IsA>) { unsafe { ffi::adw_navigation_split_view_set_content( self.to_glib_none().0, content.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_navigation_split_view_set_max_sidebar_width")] #[doc(alias = "max-sidebar-width")] pub fn set_max_sidebar_width(&self, width: f64) { unsafe { ffi::adw_navigation_split_view_set_max_sidebar_width(self.to_glib_none().0, width); } } #[doc(alias = "adw_navigation_split_view_set_min_sidebar_width")] #[doc(alias = "min-sidebar-width")] pub fn set_min_sidebar_width(&self, width: f64) { unsafe { ffi::adw_navigation_split_view_set_min_sidebar_width(self.to_glib_none().0, width); } } #[doc(alias = "adw_navigation_split_view_set_show_content")] #[doc(alias = "show-content")] pub fn set_show_content(&self, show_content: bool) { unsafe { ffi::adw_navigation_split_view_set_show_content( self.to_glib_none().0, show_content.into_glib(), ); } } #[doc(alias = "adw_navigation_split_view_set_sidebar")] #[doc(alias = "sidebar")] pub fn set_sidebar(&self, sidebar: Option<&impl IsA>) { unsafe { ffi::adw_navigation_split_view_set_sidebar( self.to_glib_none().0, sidebar.map(|p| p.as_ref()).to_glib_none().0, ); } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_navigation_split_view_set_sidebar_position")] #[doc(alias = "sidebar-position")] pub fn set_sidebar_position(&self, position: gtk::PackType) { unsafe { ffi::adw_navigation_split_view_set_sidebar_position( self.to_glib_none().0, position.into_glib(), ); } } #[doc(alias = "adw_navigation_split_view_set_sidebar_width_fraction")] #[doc(alias = "sidebar-width-fraction")] pub fn set_sidebar_width_fraction(&self, fraction: f64) { unsafe { ffi::adw_navigation_split_view_set_sidebar_width_fraction( self.to_glib_none().0, fraction, ); } } #[doc(alias = "adw_navigation_split_view_set_sidebar_width_unit")] #[doc(alias = "sidebar-width-unit")] pub fn set_sidebar_width_unit(&self, unit: LengthUnit) { unsafe { ffi::adw_navigation_split_view_set_sidebar_width_unit( self.to_glib_none().0, unit.into_glib(), ); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "collapsed")] pub fn connect_collapsed_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_collapsed_trampoline( this: *mut ffi::AdwNavigationSplitView, _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 _, c"notify::collapsed".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_collapsed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "content")] pub fn connect_content_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_content_trampoline( this: *mut ffi::AdwNavigationSplitView, _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 _, c"notify::content".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_content_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "max-sidebar-width")] pub fn connect_max_sidebar_width_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_max_sidebar_width_trampoline< F: Fn(&NavigationSplitView) + 'static, >( this: *mut ffi::AdwNavigationSplitView, _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 _, c"notify::max-sidebar-width".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_max_sidebar_width_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "min-sidebar-width")] pub fn connect_min_sidebar_width_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_min_sidebar_width_trampoline< F: Fn(&NavigationSplitView) + 'static, >( this: *mut ffi::AdwNavigationSplitView, _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 _, c"notify::min-sidebar-width".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_min_sidebar_width_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "show-content")] pub fn connect_show_content_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_show_content_trampoline< F: Fn(&NavigationSplitView) + 'static, >( this: *mut ffi::AdwNavigationSplitView, _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 _, c"notify::show-content".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_show_content_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "sidebar")] pub fn connect_sidebar_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_sidebar_trampoline( this: *mut ffi::AdwNavigationSplitView, _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 _, c"notify::sidebar".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_sidebar_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "sidebar-position")] pub fn connect_sidebar_position_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_sidebar_position_trampoline< F: Fn(&NavigationSplitView) + 'static, >( this: *mut ffi::AdwNavigationSplitView, _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 _, c"notify::sidebar-position".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_sidebar_position_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "sidebar-width-fraction")] pub fn connect_sidebar_width_fraction_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_sidebar_width_fraction_trampoline< F: Fn(&NavigationSplitView) + 'static, >( this: *mut ffi::AdwNavigationSplitView, _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 _, c"notify::sidebar-width-fraction".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_sidebar_width_fraction_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "sidebar-width-unit")] pub fn connect_sidebar_width_unit_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_sidebar_width_unit_trampoline< F: Fn(&NavigationSplitView) + 'static, >( this: *mut ffi::AdwNavigationSplitView, _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 _, c"notify::sidebar-width-unit".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_sidebar_width_unit_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl Default for NavigationSplitView { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`NavigationSplitView`] 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 NavigationSplitViewBuilder { builder: glib::object::ObjectBuilder<'static, NavigationSplitView>, } impl NavigationSplitViewBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn collapsed(self, collapsed: bool) -> Self { Self { builder: self.builder.property("collapsed", collapsed), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn content(self, content: &impl IsA) -> Self { Self { builder: self.builder.property("content", content.clone().upcast()), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn max_sidebar_width(self, max_sidebar_width: f64) -> Self { Self { builder: self .builder .property("max-sidebar-width", max_sidebar_width), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn min_sidebar_width(self, min_sidebar_width: f64) -> Self { Self { builder: self .builder .property("min-sidebar-width", min_sidebar_width), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn show_content(self, show_content: bool) -> Self { Self { builder: self.builder.property("show-content", show_content), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn sidebar(self, sidebar: &impl IsA) -> Self { Self { builder: self.builder.property("sidebar", sidebar.clone().upcast()), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn sidebar_position(self, sidebar_position: gtk::PackType) -> Self { Self { builder: self.builder.property("sidebar-position", sidebar_position), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn sidebar_width_fraction(self, sidebar_width_fraction: f64) -> Self { Self { builder: self .builder .property("sidebar-width-fraction", sidebar_width_fraction), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn sidebar_width_unit(self, sidebar_width_unit: LengthUnit) -> Self { Self { builder: self .builder .property("sidebar-width-unit", sidebar_width_unit), } } 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 [`NavigationSplitView`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> NavigationSplitView { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/navigation_view.rs000064400000000000000000000634351046102023000172440ustar 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, NavigationPage, Swipeable}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwNavigationView")] pub struct NavigationView(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, Swipeable; match fn { type_ => || ffi::adw_navigation_view_get_type(), } } impl NavigationView { #[doc(alias = "adw_navigation_view_new")] pub fn new() -> NavigationView { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_navigation_view_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`NavigationView`] objects. /// /// This method returns an instance of [`NavigationViewBuilder`](crate::builders::NavigationViewBuilder) which can be used to create [`NavigationView`] objects. pub fn builder() -> NavigationViewBuilder { NavigationViewBuilder::new() } #[doc(alias = "adw_navigation_view_add")] pub fn add(&self, page: &impl IsA) { unsafe { ffi::adw_navigation_view_add(self.to_glib_none().0, page.as_ref().to_glib_none().0); } } #[doc(alias = "adw_navigation_view_find_page")] pub fn find_page(&self, tag: &str) -> Option { unsafe { from_glib_none(ffi::adw_navigation_view_find_page( self.to_glib_none().0, tag.to_glib_none().0, )) } } #[doc(alias = "adw_navigation_view_get_animate_transitions")] #[doc(alias = "get_animate_transitions")] #[doc(alias = "animate-transitions")] pub fn is_animate_transitions(&self) -> bool { unsafe { from_glib(ffi::adw_navigation_view_get_animate_transitions( self.to_glib_none().0, )) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_navigation_view_get_hhomogeneous")] #[doc(alias = "get_hhomogeneous")] #[doc(alias = "hhomogeneous")] pub fn is_hhomogeneous(&self) -> bool { unsafe { from_glib(ffi::adw_navigation_view_get_hhomogeneous( self.to_glib_none().0, )) } } #[doc(alias = "adw_navigation_view_get_navigation_stack")] #[doc(alias = "get_navigation_stack")] #[doc(alias = "navigation-stack")] pub fn navigation_stack(&self) -> gio::ListModel { unsafe { from_glib_full(ffi::adw_navigation_view_get_navigation_stack( self.to_glib_none().0, )) } } #[doc(alias = "adw_navigation_view_get_pop_on_escape")] #[doc(alias = "get_pop_on_escape")] #[doc(alias = "pop-on-escape")] pub fn is_pop_on_escape(&self) -> bool { unsafe { from_glib(ffi::adw_navigation_view_get_pop_on_escape( self.to_glib_none().0, )) } } #[doc(alias = "adw_navigation_view_get_previous_page")] #[doc(alias = "get_previous_page")] pub fn previous_page(&self, page: &impl IsA) -> Option { unsafe { from_glib_none(ffi::adw_navigation_view_get_previous_page( self.to_glib_none().0, page.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_navigation_view_get_vhomogeneous")] #[doc(alias = "get_vhomogeneous")] #[doc(alias = "vhomogeneous")] pub fn is_vhomogeneous(&self) -> bool { unsafe { from_glib(ffi::adw_navigation_view_get_vhomogeneous( self.to_glib_none().0, )) } } #[doc(alias = "adw_navigation_view_get_visible_page")] #[doc(alias = "get_visible_page")] #[doc(alias = "visible-page")] pub fn visible_page(&self) -> Option { unsafe { from_glib_none(ffi::adw_navigation_view_get_visible_page( self.to_glib_none().0, )) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_navigation_view_get_visible_page_tag")] #[doc(alias = "get_visible_page_tag")] #[doc(alias = "visible-page-tag")] pub fn visible_page_tag(&self) -> Option { unsafe { from_glib_none(ffi::adw_navigation_view_get_visible_page_tag( self.to_glib_none().0, )) } } #[doc(alias = "adw_navigation_view_pop")] pub fn pop(&self) -> bool { unsafe { from_glib(ffi::adw_navigation_view_pop(self.to_glib_none().0)) } } #[doc(alias = "adw_navigation_view_pop_to_page")] pub fn pop_to_page(&self, page: &impl IsA) -> bool { unsafe { from_glib(ffi::adw_navigation_view_pop_to_page( self.to_glib_none().0, page.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_navigation_view_pop_to_tag")] pub fn pop_to_tag(&self, tag: &str) -> bool { unsafe { from_glib(ffi::adw_navigation_view_pop_to_tag( self.to_glib_none().0, tag.to_glib_none().0, )) } } #[doc(alias = "adw_navigation_view_push")] pub fn push(&self, page: &impl IsA) { unsafe { ffi::adw_navigation_view_push(self.to_glib_none().0, page.as_ref().to_glib_none().0); } } #[doc(alias = "adw_navigation_view_push_by_tag")] pub fn push_by_tag(&self, tag: &str) { unsafe { ffi::adw_navigation_view_push_by_tag(self.to_glib_none().0, tag.to_glib_none().0); } } #[doc(alias = "adw_navigation_view_remove")] pub fn remove(&self, page: &impl IsA) { unsafe { ffi::adw_navigation_view_remove(self.to_glib_none().0, page.as_ref().to_glib_none().0); } } #[doc(alias = "adw_navigation_view_replace")] pub fn replace(&self, pages: &[NavigationPage]) { let n_pages = pages.len() as _; unsafe { ffi::adw_navigation_view_replace( self.to_glib_none().0, pages.to_glib_none().0, n_pages, ); } } #[doc(alias = "adw_navigation_view_replace_with_tags")] pub fn replace_with_tags(&self, tags: &[&str]) { let n_tags = tags.len() as _; unsafe { ffi::adw_navigation_view_replace_with_tags( self.to_glib_none().0, tags.to_glib_none().0, n_tags, ); } } #[doc(alias = "adw_navigation_view_set_animate_transitions")] #[doc(alias = "animate-transitions")] pub fn set_animate_transitions(&self, animate_transitions: bool) { unsafe { ffi::adw_navigation_view_set_animate_transitions( self.to_glib_none().0, animate_transitions.into_glib(), ); } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_navigation_view_set_hhomogeneous")] #[doc(alias = "hhomogeneous")] pub fn set_hhomogeneous(&self, hhomogeneous: bool) { unsafe { ffi::adw_navigation_view_set_hhomogeneous( self.to_glib_none().0, hhomogeneous.into_glib(), ); } } #[doc(alias = "adw_navigation_view_set_pop_on_escape")] #[doc(alias = "pop-on-escape")] pub fn set_pop_on_escape(&self, pop_on_escape: bool) { unsafe { ffi::adw_navigation_view_set_pop_on_escape( self.to_glib_none().0, pop_on_escape.into_glib(), ); } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_navigation_view_set_vhomogeneous")] #[doc(alias = "vhomogeneous")] pub fn set_vhomogeneous(&self, vhomogeneous: bool) { unsafe { ffi::adw_navigation_view_set_vhomogeneous( self.to_glib_none().0, vhomogeneous.into_glib(), ); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "get-next-page")] pub fn connect_get_next_page Option + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn get_next_page_trampoline< F: Fn(&NavigationView) -> Option + 'static, >( this: *mut ffi::AdwNavigationView, f: glib::ffi::gpointer, ) -> *mut ffi::AdwNavigationPage { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)).to_glib_full() } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"get-next-page".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( get_next_page_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "popped")] pub fn connect_popped(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn popped_trampoline< F: Fn(&NavigationView, &NavigationPage) + 'static, >( this: *mut ffi::AdwNavigationView, page: *mut ffi::AdwNavigationPage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(page)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"popped".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( popped_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "pushed")] pub fn connect_pushed(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn pushed_trampoline( this: *mut ffi::AdwNavigationView, 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 _, c"pushed".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( pushed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "replaced")] pub fn connect_replaced(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn replaced_trampoline( this: *mut ffi::AdwNavigationView, 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 _, c"replaced".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( replaced_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "animate-transitions")] pub fn connect_animate_transitions_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_animate_transitions_trampoline< F: Fn(&NavigationView) + 'static, >( this: *mut ffi::AdwNavigationView, _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 _, c"notify::animate-transitions".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_animate_transitions_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "hhomogeneous")] pub fn connect_hhomogeneous_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_hhomogeneous_trampoline( this: *mut ffi::AdwNavigationView, _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 _, c"notify::hhomogeneous".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_hhomogeneous_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "navigation-stack")] pub fn connect_navigation_stack_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_navigation_stack_trampoline< F: Fn(&NavigationView) + 'static, >( this: *mut ffi::AdwNavigationView, _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 _, c"notify::navigation-stack".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_navigation_stack_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "pop-on-escape")] pub fn connect_pop_on_escape_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_pop_on_escape_trampoline( this: *mut ffi::AdwNavigationView, _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 _, c"notify::pop-on-escape".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_pop_on_escape_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "vhomogeneous")] pub fn connect_vhomogeneous_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_vhomogeneous_trampoline( this: *mut ffi::AdwNavigationView, _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 _, c"notify::vhomogeneous".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_vhomogeneous_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "visible-page")] pub fn connect_visible_page_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_visible_page_trampoline( this: *mut ffi::AdwNavigationView, _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 _, c"notify::visible-page".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_visible_page_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "visible-page-tag")] pub fn connect_visible_page_tag_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_visible_page_tag_trampoline< F: Fn(&NavigationView) + 'static, >( this: *mut ffi::AdwNavigationView, _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 _, c"notify::visible-page-tag".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_visible_page_tag_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl Default for NavigationView { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`NavigationView`] 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 NavigationViewBuilder { builder: glib::object::ObjectBuilder<'static, NavigationView>, } impl NavigationViewBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn animate_transitions(self, animate_transitions: bool) -> Self { Self { builder: self .builder .property("animate-transitions", animate_transitions), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn hhomogeneous(self, hhomogeneous: bool) -> Self { Self { builder: self.builder.property("hhomogeneous", hhomogeneous), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn pop_on_escape(self, pop_on_escape: bool) -> Self { Self { builder: self.builder.property("pop-on-escape", pop_on_escape), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn vhomogeneous(self, vhomogeneous: bool) -> Self { Self { builder: self.builder.property("vhomogeneous", vhomogeneous), } } 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 [`NavigationView`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> NavigationView { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/overlay_split_view.rs000064400000000000000000000741151046102023000177760ustar 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, LengthUnit, Swipeable}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwOverlaySplitView")] pub struct OverlaySplitView(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, Swipeable; match fn { type_ => || ffi::adw_overlay_split_view_get_type(), } } impl OverlaySplitView { #[doc(alias = "adw_overlay_split_view_new")] pub fn new() -> OverlaySplitView { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_overlay_split_view_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`OverlaySplitView`] objects. /// /// This method returns an instance of [`OverlaySplitViewBuilder`](crate::builders::OverlaySplitViewBuilder) which can be used to create [`OverlaySplitView`] objects. pub fn builder() -> OverlaySplitViewBuilder { OverlaySplitViewBuilder::new() } #[doc(alias = "adw_overlay_split_view_get_collapsed")] #[doc(alias = "get_collapsed")] #[doc(alias = "collapsed")] pub fn is_collapsed(&self) -> bool { unsafe { from_glib(ffi::adw_overlay_split_view_get_collapsed( self.to_glib_none().0, )) } } #[doc(alias = "adw_overlay_split_view_get_content")] #[doc(alias = "get_content")] pub fn content(&self) -> Option { unsafe { from_glib_none(ffi::adw_overlay_split_view_get_content( self.to_glib_none().0, )) } } #[doc(alias = "adw_overlay_split_view_get_enable_hide_gesture")] #[doc(alias = "get_enable_hide_gesture")] #[doc(alias = "enable-hide-gesture")] pub fn enables_hide_gesture(&self) -> bool { unsafe { from_glib(ffi::adw_overlay_split_view_get_enable_hide_gesture( self.to_glib_none().0, )) } } #[doc(alias = "adw_overlay_split_view_get_enable_show_gesture")] #[doc(alias = "get_enable_show_gesture")] #[doc(alias = "enable-show-gesture")] pub fn enables_show_gesture(&self) -> bool { unsafe { from_glib(ffi::adw_overlay_split_view_get_enable_show_gesture( self.to_glib_none().0, )) } } #[doc(alias = "adw_overlay_split_view_get_max_sidebar_width")] #[doc(alias = "get_max_sidebar_width")] #[doc(alias = "max-sidebar-width")] pub fn max_sidebar_width(&self) -> f64 { unsafe { ffi::adw_overlay_split_view_get_max_sidebar_width(self.to_glib_none().0) } } #[doc(alias = "adw_overlay_split_view_get_min_sidebar_width")] #[doc(alias = "get_min_sidebar_width")] #[doc(alias = "min-sidebar-width")] pub fn min_sidebar_width(&self) -> f64 { unsafe { ffi::adw_overlay_split_view_get_min_sidebar_width(self.to_glib_none().0) } } #[doc(alias = "adw_overlay_split_view_get_pin_sidebar")] #[doc(alias = "get_pin_sidebar")] #[doc(alias = "pin-sidebar")] pub fn is_pin_sidebar(&self) -> bool { unsafe { from_glib(ffi::adw_overlay_split_view_get_pin_sidebar( self.to_glib_none().0, )) } } #[doc(alias = "adw_overlay_split_view_get_show_sidebar")] #[doc(alias = "get_show_sidebar")] #[doc(alias = "show-sidebar")] pub fn shows_sidebar(&self) -> bool { unsafe { from_glib(ffi::adw_overlay_split_view_get_show_sidebar( self.to_glib_none().0, )) } } #[doc(alias = "adw_overlay_split_view_get_sidebar")] #[doc(alias = "get_sidebar")] pub fn sidebar(&self) -> Option { unsafe { from_glib_none(ffi::adw_overlay_split_view_get_sidebar( self.to_glib_none().0, )) } } #[doc(alias = "adw_overlay_split_view_get_sidebar_position")] #[doc(alias = "get_sidebar_position")] #[doc(alias = "sidebar-position")] pub fn sidebar_position(&self) -> gtk::PackType { unsafe { from_glib(ffi::adw_overlay_split_view_get_sidebar_position( self.to_glib_none().0, )) } } #[doc(alias = "adw_overlay_split_view_get_sidebar_width_fraction")] #[doc(alias = "get_sidebar_width_fraction")] #[doc(alias = "sidebar-width-fraction")] pub fn sidebar_width_fraction(&self) -> f64 { unsafe { ffi::adw_overlay_split_view_get_sidebar_width_fraction(self.to_glib_none().0) } } #[doc(alias = "adw_overlay_split_view_get_sidebar_width_unit")] #[doc(alias = "get_sidebar_width_unit")] #[doc(alias = "sidebar-width-unit")] pub fn sidebar_width_unit(&self) -> LengthUnit { unsafe { from_glib(ffi::adw_overlay_split_view_get_sidebar_width_unit( self.to_glib_none().0, )) } } #[doc(alias = "adw_overlay_split_view_set_collapsed")] #[doc(alias = "collapsed")] pub fn set_collapsed(&self, collapsed: bool) { unsafe { ffi::adw_overlay_split_view_set_collapsed(self.to_glib_none().0, collapsed.into_glib()); } } #[doc(alias = "adw_overlay_split_view_set_content")] #[doc(alias = "content")] pub fn set_content(&self, content: Option<&impl IsA>) { unsafe { ffi::adw_overlay_split_view_set_content( self.to_glib_none().0, content.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_overlay_split_view_set_enable_hide_gesture")] #[doc(alias = "enable-hide-gesture")] pub fn set_enable_hide_gesture(&self, enable_hide_gesture: bool) { unsafe { ffi::adw_overlay_split_view_set_enable_hide_gesture( self.to_glib_none().0, enable_hide_gesture.into_glib(), ); } } #[doc(alias = "adw_overlay_split_view_set_enable_show_gesture")] #[doc(alias = "enable-show-gesture")] pub fn set_enable_show_gesture(&self, enable_show_gesture: bool) { unsafe { ffi::adw_overlay_split_view_set_enable_show_gesture( self.to_glib_none().0, enable_show_gesture.into_glib(), ); } } #[doc(alias = "adw_overlay_split_view_set_max_sidebar_width")] #[doc(alias = "max-sidebar-width")] pub fn set_max_sidebar_width(&self, width: f64) { unsafe { ffi::adw_overlay_split_view_set_max_sidebar_width(self.to_glib_none().0, width); } } #[doc(alias = "adw_overlay_split_view_set_min_sidebar_width")] #[doc(alias = "min-sidebar-width")] pub fn set_min_sidebar_width(&self, width: f64) { unsafe { ffi::adw_overlay_split_view_set_min_sidebar_width(self.to_glib_none().0, width); } } #[doc(alias = "adw_overlay_split_view_set_pin_sidebar")] #[doc(alias = "pin-sidebar")] pub fn set_pin_sidebar(&self, pin_sidebar: bool) { unsafe { ffi::adw_overlay_split_view_set_pin_sidebar( self.to_glib_none().0, pin_sidebar.into_glib(), ); } } #[doc(alias = "adw_overlay_split_view_set_show_sidebar")] #[doc(alias = "show-sidebar")] pub fn set_show_sidebar(&self, show_sidebar: bool) { unsafe { ffi::adw_overlay_split_view_set_show_sidebar( self.to_glib_none().0, show_sidebar.into_glib(), ); } } #[doc(alias = "adw_overlay_split_view_set_sidebar")] #[doc(alias = "sidebar")] pub fn set_sidebar(&self, sidebar: Option<&impl IsA>) { unsafe { ffi::adw_overlay_split_view_set_sidebar( self.to_glib_none().0, sidebar.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_overlay_split_view_set_sidebar_position")] #[doc(alias = "sidebar-position")] pub fn set_sidebar_position(&self, position: gtk::PackType) { unsafe { ffi::adw_overlay_split_view_set_sidebar_position( self.to_glib_none().0, position.into_glib(), ); } } #[doc(alias = "adw_overlay_split_view_set_sidebar_width_fraction")] #[doc(alias = "sidebar-width-fraction")] pub fn set_sidebar_width_fraction(&self, fraction: f64) { unsafe { ffi::adw_overlay_split_view_set_sidebar_width_fraction(self.to_glib_none().0, fraction); } } #[doc(alias = "adw_overlay_split_view_set_sidebar_width_unit")] #[doc(alias = "sidebar-width-unit")] pub fn set_sidebar_width_unit(&self, unit: LengthUnit) { unsafe { ffi::adw_overlay_split_view_set_sidebar_width_unit( self.to_glib_none().0, unit.into_glib(), ); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "collapsed")] pub fn connect_collapsed_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_collapsed_trampoline( this: *mut ffi::AdwOverlaySplitView, _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 _, c"notify::collapsed".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_collapsed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "content")] pub fn connect_content_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_content_trampoline( this: *mut ffi::AdwOverlaySplitView, _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 _, c"notify::content".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_content_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "enable-hide-gesture")] pub fn connect_enable_hide_gesture_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_enable_hide_gesture_trampoline< F: Fn(&OverlaySplitView) + 'static, >( this: *mut ffi::AdwOverlaySplitView, _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 _, c"notify::enable-hide-gesture".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_enable_hide_gesture_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "enable-show-gesture")] pub fn connect_enable_show_gesture_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_enable_show_gesture_trampoline< F: Fn(&OverlaySplitView) + 'static, >( this: *mut ffi::AdwOverlaySplitView, _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 _, c"notify::enable-show-gesture".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_enable_show_gesture_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "max-sidebar-width")] pub fn connect_max_sidebar_width_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_max_sidebar_width_trampoline< F: Fn(&OverlaySplitView) + 'static, >( this: *mut ffi::AdwOverlaySplitView, _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 _, c"notify::max-sidebar-width".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_max_sidebar_width_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "min-sidebar-width")] pub fn connect_min_sidebar_width_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_min_sidebar_width_trampoline< F: Fn(&OverlaySplitView) + 'static, >( this: *mut ffi::AdwOverlaySplitView, _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 _, c"notify::min-sidebar-width".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_min_sidebar_width_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "pin-sidebar")] pub fn connect_pin_sidebar_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_pin_sidebar_trampoline( this: *mut ffi::AdwOverlaySplitView, _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 _, c"notify::pin-sidebar".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_pin_sidebar_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "show-sidebar")] pub fn connect_show_sidebar_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_show_sidebar_trampoline( this: *mut ffi::AdwOverlaySplitView, _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 _, c"notify::show-sidebar".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_show_sidebar_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "sidebar")] pub fn connect_sidebar_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_sidebar_trampoline( this: *mut ffi::AdwOverlaySplitView, _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 _, c"notify::sidebar".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_sidebar_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "sidebar-position")] pub fn connect_sidebar_position_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_sidebar_position_trampoline< F: Fn(&OverlaySplitView) + 'static, >( this: *mut ffi::AdwOverlaySplitView, _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 _, c"notify::sidebar-position".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_sidebar_position_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "sidebar-width-fraction")] pub fn connect_sidebar_width_fraction_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_sidebar_width_fraction_trampoline< F: Fn(&OverlaySplitView) + 'static, >( this: *mut ffi::AdwOverlaySplitView, _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 _, c"notify::sidebar-width-fraction".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_sidebar_width_fraction_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "sidebar-width-unit")] pub fn connect_sidebar_width_unit_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_sidebar_width_unit_trampoline< F: Fn(&OverlaySplitView) + 'static, >( this: *mut ffi::AdwOverlaySplitView, _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 _, c"notify::sidebar-width-unit".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_sidebar_width_unit_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl Default for OverlaySplitView { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`OverlaySplitView`] 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 OverlaySplitViewBuilder { builder: glib::object::ObjectBuilder<'static, OverlaySplitView>, } impl OverlaySplitViewBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn collapsed(self, collapsed: bool) -> Self { Self { builder: self.builder.property("collapsed", collapsed), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn content(self, content: &impl IsA) -> Self { Self { builder: self.builder.property("content", content.clone().upcast()), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn enable_hide_gesture(self, enable_hide_gesture: bool) -> Self { Self { builder: self .builder .property("enable-hide-gesture", enable_hide_gesture), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn enable_show_gesture(self, enable_show_gesture: bool) -> Self { Self { builder: self .builder .property("enable-show-gesture", enable_show_gesture), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn max_sidebar_width(self, max_sidebar_width: f64) -> Self { Self { builder: self .builder .property("max-sidebar-width", max_sidebar_width), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn min_sidebar_width(self, min_sidebar_width: f64) -> Self { Self { builder: self .builder .property("min-sidebar-width", min_sidebar_width), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn pin_sidebar(self, pin_sidebar: bool) -> Self { Self { builder: self.builder.property("pin-sidebar", pin_sidebar), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn show_sidebar(self, show_sidebar: bool) -> Self { Self { builder: self.builder.property("show-sidebar", show_sidebar), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn sidebar(self, sidebar: &impl IsA) -> Self { Self { builder: self.builder.property("sidebar", sidebar.clone().upcast()), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn sidebar_position(self, sidebar_position: gtk::PackType) -> Self { Self { builder: self.builder.property("sidebar-position", sidebar_position), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn sidebar_width_fraction(self, sidebar_width_fraction: f64) -> Self { Self { builder: self .builder .property("sidebar-width-fraction", sidebar_width_fraction), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn sidebar_width_unit(self, sidebar_width_unit: LengthUnit) -> Self { Self { builder: self .builder .property("sidebar-width-unit", sidebar_width_unit), } } 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 [`OverlaySplitView`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> OverlaySplitView { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/password_entry_row.rs000064400000000000000000000272751046102023000200270ustar 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, EntryRow, PreferencesRow}; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "AdwPasswordEntryRow")] pub struct PasswordEntryRow(Object) @extends EntryRow, PreferencesRow, gtk::ListBoxRow, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Actionable, gtk::Editable; match fn { type_ => || ffi::adw_password_entry_row_get_type(), } } impl PasswordEntryRow { #[doc(alias = "adw_password_entry_row_new")] pub fn new() -> PasswordEntryRow { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_password_entry_row_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`PasswordEntryRow`] objects. /// /// This method returns an instance of [`PasswordEntryRowBuilder`](crate::builders::PasswordEntryRowBuilder) which can be used to create [`PasswordEntryRow`] objects. pub fn builder() -> PasswordEntryRowBuilder { PasswordEntryRowBuilder::new() } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] impl Default for PasswordEntryRow { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`PasswordEntryRow`] 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 PasswordEntryRowBuilder { builder: glib::object::ObjectBuilder<'static, PasswordEntryRow>, } impl PasswordEntryRowBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn activates_default(self, activates_default: bool) -> Self { Self { builder: self .builder .property("activates-default", activates_default), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn attributes(self, attributes: &pango::AttrList) -> Self { Self { builder: self.builder.property("attributes", attributes.clone()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn enable_emoji_completion(self, enable_emoji_completion: bool) -> Self { Self { builder: self .builder .property("enable-emoji-completion", enable_emoji_completion), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn input_hints(self, input_hints: gtk::InputHints) -> Self { Self { builder: self.builder.property("input-hints", input_hints), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn input_purpose(self, input_purpose: gtk::InputPurpose) -> Self { Self { builder: self.builder.property("input-purpose", input_purpose), } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub fn max_length(self, max_length: i32) -> Self { Self { builder: self.builder.property("max-length", max_length), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn show_apply_button(self, show_apply_button: bool) -> Self { Self { builder: self .builder .property("show-apply-button", show_apply_button), } } pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub fn title_selectable(self, title_selectable: bool) -> Self { Self { builder: self.builder.property("title-selectable", title_selectable), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn use_markup(self, use_markup: bool) -> Self { Self { builder: self.builder.property("use-markup", use_markup), } } pub fn use_underline(self, use_underline: bool) -> Self { Self { builder: self.builder.property("use-underline", use_underline), } } pub fn activatable(self, activatable: bool) -> Self { Self { builder: self.builder.property("activatable", activatable), } } pub fn child(self, child: &impl IsA) -> Self { Self { builder: self.builder.property("child", child.clone().upcast()), } } pub fn selectable(self, selectable: bool) -> Self { Self { builder: self.builder.property("selectable", selectable), } } 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 action_name(self, action_name: impl Into) -> Self { Self { builder: self.builder.property("action-name", action_name.into()), } } pub fn action_target(self, action_target: &glib::Variant) -> Self { Self { builder: self .builder .property("action-target", action_target.clone()), } } pub fn editable(self, editable: bool) -> Self { Self { builder: self.builder.property("editable", editable), } } pub fn enable_undo(self, enable_undo: bool) -> Self { Self { builder: self.builder.property("enable-undo", enable_undo), } } pub fn max_width_chars(self, max_width_chars: i32) -> Self { Self { builder: self.builder.property("max-width-chars", max_width_chars), } } pub fn text(self, text: impl Into) -> Self { Self { builder: self.builder.property("text", text.into()), } } pub fn width_chars(self, width_chars: i32) -> Self { Self { builder: self.builder.property("width-chars", width_chars), } } pub fn xalign(self, xalign: f32) -> Self { Self { builder: self.builder.property("xalign", xalign), } } // rustdoc-stripper-ignore-next /// Build the [`PasswordEntryRow`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> PasswordEntryRow { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/preferences_dialog.rs000064400000000000000000000427051046102023000176700ustar 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, Dialog, DialogPresentationMode, NavigationPage, PreferencesPage, Toast}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwPreferencesDialog")] pub struct PreferencesDialog(Object) @extends Dialog, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::ShortcutManager; match fn { type_ => || ffi::adw_preferences_dialog_get_type(), } } impl PreferencesDialog { pub const NONE: Option<&'static PreferencesDialog> = None; #[doc(alias = "adw_preferences_dialog_new")] pub fn new() -> PreferencesDialog { assert_initialized_main_thread!(); unsafe { Dialog::from_glib_none(ffi::adw_preferences_dialog_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`PreferencesDialog`] objects. /// /// This method returns an instance of [`PreferencesDialogBuilder`](crate::builders::PreferencesDialogBuilder) which can be used to create [`PreferencesDialog`] objects. pub fn builder() -> PreferencesDialogBuilder { PreferencesDialogBuilder::new() } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] impl Default for PreferencesDialog { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`PreferencesDialog`] 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 PreferencesDialogBuilder { builder: glib::object::ObjectBuilder<'static, PreferencesDialog>, } impl PreferencesDialogBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn search_enabled(self, search_enabled: bool) -> Self { Self { builder: self.builder.property("search-enabled", search_enabled), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn visible_page(self, visible_page: &impl IsA) -> Self { Self { builder: self .builder .property("visible-page", visible_page.clone().upcast()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn visible_page_name(self, visible_page_name: impl Into) -> Self { Self { builder: self .builder .property("visible-page-name", visible_page_name.into()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn can_close(self, can_close: bool) -> Self { Self { builder: self.builder.property("can-close", can_close), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn child(self, child: &impl IsA) -> Self { Self { builder: self.builder.property("child", child.clone().upcast()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn content_height(self, content_height: i32) -> Self { Self { builder: self.builder.property("content-height", content_height), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn content_width(self, content_width: i32) -> Self { Self { builder: self.builder.property("content-width", content_width), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn default_widget(self, default_widget: &impl IsA) -> Self { Self { builder: self .builder .property("default-widget", default_widget.clone().upcast()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn focus_widget(self, focus_widget: &impl IsA) -> Self { Self { builder: self .builder .property("focus-widget", focus_widget.clone().upcast()), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn follows_content_size(self, follows_content_size: bool) -> Self { Self { builder: self .builder .property("follows-content-size", follows_content_size), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn presentation_mode(self, presentation_mode: DialogPresentationMode) -> Self { Self { builder: self .builder .property("presentation-mode", presentation_mode), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } 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 [`PreferencesDialog`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> PreferencesDialog { assert_initialized_main_thread!(); self.builder.build() } } pub trait PreferencesDialogExt: IsA + 'static { #[doc(alias = "adw_preferences_dialog_add")] fn add(&self, page: &impl IsA) { unsafe { ffi::adw_preferences_dialog_add( self.as_ref().to_glib_none().0, page.as_ref().to_glib_none().0, ); } } #[doc(alias = "adw_preferences_dialog_add_toast")] fn add_toast(&self, toast: Toast) { unsafe { ffi::adw_preferences_dialog_add_toast( self.as_ref().to_glib_none().0, toast.into_glib_ptr(), ); } } #[doc(alias = "adw_preferences_dialog_get_search_enabled")] #[doc(alias = "get_search_enabled")] #[doc(alias = "search-enabled")] fn is_search_enabled(&self) -> bool { unsafe { from_glib(ffi::adw_preferences_dialog_get_search_enabled( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_preferences_dialog_get_visible_page")] #[doc(alias = "get_visible_page")] #[doc(alias = "visible-page")] fn visible_page(&self) -> Option { unsafe { from_glib_none(ffi::adw_preferences_dialog_get_visible_page( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_preferences_dialog_get_visible_page_name")] #[doc(alias = "get_visible_page_name")] #[doc(alias = "visible-page-name")] fn visible_page_name(&self) -> Option { unsafe { from_glib_none(ffi::adw_preferences_dialog_get_visible_page_name( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_preferences_dialog_pop_subpage")] fn pop_subpage(&self) -> bool { unsafe { from_glib(ffi::adw_preferences_dialog_pop_subpage( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_preferences_dialog_push_subpage")] fn push_subpage(&self, page: &impl IsA) { unsafe { ffi::adw_preferences_dialog_push_subpage( self.as_ref().to_glib_none().0, page.as_ref().to_glib_none().0, ); } } #[doc(alias = "adw_preferences_dialog_remove")] fn remove(&self, page: &impl IsA) { unsafe { ffi::adw_preferences_dialog_remove( self.as_ref().to_glib_none().0, page.as_ref().to_glib_none().0, ); } } #[doc(alias = "adw_preferences_dialog_set_search_enabled")] #[doc(alias = "search-enabled")] fn set_search_enabled(&self, search_enabled: bool) { unsafe { ffi::adw_preferences_dialog_set_search_enabled( self.as_ref().to_glib_none().0, search_enabled.into_glib(), ); } } #[doc(alias = "adw_preferences_dialog_set_visible_page")] #[doc(alias = "visible-page")] fn set_visible_page(&self, page: &impl IsA) { unsafe { ffi::adw_preferences_dialog_set_visible_page( self.as_ref().to_glib_none().0, page.as_ref().to_glib_none().0, ); } } #[doc(alias = "adw_preferences_dialog_set_visible_page_name")] #[doc(alias = "visible-page-name")] fn set_visible_page_name(&self, name: &str) { unsafe { ffi::adw_preferences_dialog_set_visible_page_name( self.as_ref().to_glib_none().0, name.to_glib_none().0, ); } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "search-enabled")] fn connect_search_enabled_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_search_enabled_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwPreferencesDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::search-enabled".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_search_enabled_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "visible-page")] fn connect_visible_page_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_visible_page_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwPreferencesDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::visible-page".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_visible_page_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "visible-page-name")] fn connect_visible_page_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_visible_page_name_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwPreferencesDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::visible-page-name".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_visible_page_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> PreferencesDialogExt for O {} libadwaita-0.7.2/src/auto/preferences_group.rs000064400000000000000000000371601046102023000175640ustar 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 = "AdwPreferencesGroup")] pub struct PreferencesGroup(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_preferences_group_get_type(), } } impl PreferencesGroup { pub const NONE: Option<&'static PreferencesGroup> = None; #[doc(alias = "adw_preferences_group_new")] pub fn new() -> PreferencesGroup { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_preferences_group_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`PreferencesGroup`] objects. /// /// This method returns an instance of [`PreferencesGroupBuilder`](crate::builders::PreferencesGroupBuilder) which can be used to create [`PreferencesGroup`] objects. pub fn builder() -> PreferencesGroupBuilder { PreferencesGroupBuilder::new() } } impl Default for PreferencesGroup { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`PreferencesGroup`] 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 PreferencesGroupBuilder { builder: glib::object::ObjectBuilder<'static, PreferencesGroup>, } impl PreferencesGroupBuilder { 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()), } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub fn header_suffix(self, header_suffix: &impl IsA) -> Self { Self { builder: self .builder .property("header-suffix", header_suffix.clone().upcast()), } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub fn separate_rows(self, separate_rows: bool) -> Self { Self { builder: self.builder.property("separate-rows", separate_rows), } } pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } 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 [`PreferencesGroup`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> PreferencesGroup { assert_initialized_main_thread!(); self.builder.build() } } pub trait PreferencesGroupExt: IsA + 'static { #[doc(alias = "adw_preferences_group_add")] fn add(&self, child: &impl IsA) { unsafe { ffi::adw_preferences_group_add( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, ); } } #[doc(alias = "adw_preferences_group_get_description")] #[doc(alias = "get_description")] fn description(&self) -> Option { unsafe { from_glib_none(ffi::adw_preferences_group_get_description( self.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "adw_preferences_group_get_header_suffix")] #[doc(alias = "get_header_suffix")] #[doc(alias = "header-suffix")] fn header_suffix(&self) -> Option { unsafe { from_glib_none(ffi::adw_preferences_group_get_header_suffix( self.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "adw_preferences_group_get_separate_rows")] #[doc(alias = "get_separate_rows")] #[doc(alias = "separate-rows")] fn is_separate_rows(&self) -> bool { unsafe { from_glib(ffi::adw_preferences_group_get_separate_rows( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_preferences_group_get_title")] #[doc(alias = "get_title")] fn title(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_preferences_group_get_title( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_preferences_group_remove")] fn remove(&self, child: &impl IsA) { unsafe { ffi::adw_preferences_group_remove( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, ); } } #[doc(alias = "adw_preferences_group_set_description")] #[doc(alias = "description")] fn set_description(&self, description: Option<&str>) { unsafe { ffi::adw_preferences_group_set_description( self.as_ref().to_glib_none().0, description.to_glib_none().0, ); } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "adw_preferences_group_set_header_suffix")] #[doc(alias = "header-suffix")] fn set_header_suffix(&self, suffix: Option<&impl IsA>) { unsafe { ffi::adw_preferences_group_set_header_suffix( self.as_ref().to_glib_none().0, suffix.map(|p| p.as_ref()).to_glib_none().0, ); } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "adw_preferences_group_set_separate_rows")] #[doc(alias = "separate-rows")] fn set_separate_rows(&self, separate_rows: bool) { unsafe { ffi::adw_preferences_group_set_separate_rows( self.as_ref().to_glib_none().0, separate_rows.into_glib(), ); } } #[doc(alias = "adw_preferences_group_set_title")] #[doc(alias = "title")] fn set_title(&self, title: &str) { unsafe { ffi::adw_preferences_group_set_title( self.as_ref().to_glib_none().0, title.to_glib_none().0, ); } } #[doc(alias = "description")] fn connect_description_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_description_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwPreferencesGroup, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesGroup::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::description".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_description_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "header-suffix")] fn connect_header_suffix_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_header_suffix_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwPreferencesGroup, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesGroup::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::header-suffix".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_header_suffix_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "separate-rows")] fn connect_separate_rows_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_separate_rows_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwPreferencesGroup, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesGroup::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::separate-rows".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_separate_rows_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::AdwPreferencesGroup, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesGroup::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::title".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> PreferencesGroupExt for O {} libadwaita-0.7.2/src/auto/preferences_page.rs000064400000000000000000000504531046102023000173440ustar 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 #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] use crate::Banner; use crate::{ffi, PreferencesGroup}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwPreferencesPage")] pub struct PreferencesPage(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_preferences_page_get_type(), } } impl PreferencesPage { pub const NONE: Option<&'static PreferencesPage> = None; #[doc(alias = "adw_preferences_page_new")] pub fn new() -> PreferencesPage { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_preferences_page_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`PreferencesPage`] objects. /// /// This method returns an instance of [`PreferencesPageBuilder`](crate::builders::PreferencesPageBuilder) which can be used to create [`PreferencesPage`] objects. pub fn builder() -> PreferencesPageBuilder { PreferencesPageBuilder::new() } } impl Default for PreferencesPage { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`PreferencesPage`] 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 PreferencesPageBuilder { builder: glib::object::ObjectBuilder<'static, PreferencesPage>, } impl PreferencesPageBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn banner(self, banner: &Banner) -> Self { Self { builder: self.builder.property("banner", banner.clone()), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn description(self, description: impl Into) -> Self { Self { builder: self.builder.property("description", description.into()), } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] pub fn description_centered(self, description_centered: bool) -> Self { Self { builder: self .builder .property("description-centered", description_centered), } } pub fn icon_name(self, icon_name: impl Into) -> Self { Self { builder: self.builder.property("icon-name", icon_name.into()), } } pub fn name(self, name: impl Into) -> Self { Self { builder: self.builder.property("name", name.into()), } } pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } pub fn use_underline(self, use_underline: bool) -> Self { Self { builder: self.builder.property("use-underline", use_underline), } } 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 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 [`PreferencesPage`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> PreferencesPage { assert_initialized_main_thread!(); self.builder.build() } } pub trait PreferencesPageExt: IsA + 'static { #[doc(alias = "adw_preferences_page_add")] fn add(&self, group: &impl IsA) { unsafe { ffi::adw_preferences_page_add( self.as_ref().to_glib_none().0, group.as_ref().to_glib_none().0, ); } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_preferences_page_get_banner")] #[doc(alias = "get_banner")] fn banner(&self) -> Option { unsafe { from_glib_none(ffi::adw_preferences_page_get_banner( self.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_preferences_page_get_description")] #[doc(alias = "get_description")] fn description(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_preferences_page_get_description( self.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "adw_preferences_page_get_description_centered")] #[doc(alias = "get_description_centered")] #[doc(alias = "description-centered")] fn is_description_centered(&self) -> bool { unsafe { from_glib(ffi::adw_preferences_page_get_description_centered( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_preferences_page_get_icon_name")] #[doc(alias = "get_icon_name")] #[doc(alias = "icon-name")] fn icon_name(&self) -> Option { unsafe { from_glib_none(ffi::adw_preferences_page_get_icon_name( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_preferences_page_get_name")] #[doc(alias = "get_name")] fn name(&self) -> Option { unsafe { from_glib_none(ffi::adw_preferences_page_get_name( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_preferences_page_get_title")] #[doc(alias = "get_title")] fn title(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_preferences_page_get_title( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_preferences_page_get_use_underline")] #[doc(alias = "get_use_underline")] #[doc(alias = "use-underline")] fn uses_underline(&self) -> bool { unsafe { from_glib(ffi::adw_preferences_page_get_use_underline( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_preferences_page_remove")] fn remove(&self, group: &impl IsA) { unsafe { ffi::adw_preferences_page_remove( self.as_ref().to_glib_none().0, group.as_ref().to_glib_none().0, ); } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_preferences_page_scroll_to_top")] fn scroll_to_top(&self) { unsafe { ffi::adw_preferences_page_scroll_to_top(self.as_ref().to_glib_none().0); } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_preferences_page_set_banner")] #[doc(alias = "banner")] fn set_banner(&self, banner: Option<&Banner>) { unsafe { ffi::adw_preferences_page_set_banner( self.as_ref().to_glib_none().0, banner.to_glib_none().0, ); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_preferences_page_set_description")] #[doc(alias = "description")] fn set_description(&self, description: &str) { unsafe { ffi::adw_preferences_page_set_description( self.as_ref().to_glib_none().0, description.to_glib_none().0, ); } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "adw_preferences_page_set_description_centered")] #[doc(alias = "description-centered")] fn set_description_centered(&self, centered: bool) { unsafe { ffi::adw_preferences_page_set_description_centered( self.as_ref().to_glib_none().0, centered.into_glib(), ); } } #[doc(alias = "adw_preferences_page_set_icon_name")] #[doc(alias = "icon-name")] fn set_icon_name(&self, icon_name: Option<&str>) { unsafe { ffi::adw_preferences_page_set_icon_name( self.as_ref().to_glib_none().0, icon_name.to_glib_none().0, ); } } #[doc(alias = "adw_preferences_page_set_name")] #[doc(alias = "name")] fn set_name(&self, name: Option<&str>) { unsafe { ffi::adw_preferences_page_set_name( self.as_ref().to_glib_none().0, name.to_glib_none().0, ); } } #[doc(alias = "adw_preferences_page_set_title")] #[doc(alias = "title")] fn set_title(&self, title: &str) { unsafe { ffi::adw_preferences_page_set_title( self.as_ref().to_glib_none().0, title.to_glib_none().0, ); } } #[doc(alias = "adw_preferences_page_set_use_underline")] #[doc(alias = "use-underline")] fn set_use_underline(&self, use_underline: bool) { unsafe { ffi::adw_preferences_page_set_use_underline( self.as_ref().to_glib_none().0, use_underline.into_glib(), ); } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "banner")] fn connect_banner_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_banner_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwPreferencesPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesPage::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::banner".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_banner_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "description")] fn connect_description_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_description_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwPreferencesPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesPage::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::description".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_description_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "description-centered")] fn connect_description_centered_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_description_centered_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwPreferencesPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesPage::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::description-centered".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_description_centered_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::AdwPreferencesPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesPage::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::icon-name".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 = "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::AdwPreferencesPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesPage::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::title".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "use-underline")] fn connect_use_underline_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_use_underline_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwPreferencesPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesPage::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::use-underline".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_use_underline_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> PreferencesPageExt for O {} libadwaita-0.7.2/src/auto/preferences_row.rs000064400000000000000000000373611046102023000172420ustar 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 = "AdwPreferencesRow")] pub struct PreferencesRow(Object) @extends gtk::ListBoxRow, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Actionable; match fn { type_ => || ffi::adw_preferences_row_get_type(), } } impl PreferencesRow { pub const NONE: Option<&'static PreferencesRow> = None; #[doc(alias = "adw_preferences_row_new")] pub fn new() -> PreferencesRow { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_preferences_row_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`PreferencesRow`] objects. /// /// This method returns an instance of [`PreferencesRowBuilder`](crate::builders::PreferencesRowBuilder) which can be used to create [`PreferencesRow`] objects. pub fn builder() -> PreferencesRowBuilder { PreferencesRowBuilder::new() } } impl Default for PreferencesRow { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`PreferencesRow`] 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 PreferencesRowBuilder { builder: glib::object::ObjectBuilder<'static, PreferencesRow>, } impl PreferencesRowBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub fn title_selectable(self, title_selectable: bool) -> Self { Self { builder: self.builder.property("title-selectable", title_selectable), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn use_markup(self, use_markup: bool) -> Self { Self { builder: self.builder.property("use-markup", use_markup), } } pub fn use_underline(self, use_underline: bool) -> Self { Self { builder: self.builder.property("use-underline", use_underline), } } pub fn activatable(self, activatable: bool) -> Self { Self { builder: self.builder.property("activatable", activatable), } } pub fn child(self, child: &impl IsA) -> Self { Self { builder: self.builder.property("child", child.clone().upcast()), } } pub fn selectable(self, selectable: bool) -> Self { Self { builder: self.builder.property("selectable", selectable), } } 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 action_name(self, action_name: impl Into) -> Self { Self { builder: self.builder.property("action-name", action_name.into()), } } pub fn action_target(self, action_target: &glib::Variant) -> Self { Self { builder: self .builder .property("action-target", action_target.clone()), } } // rustdoc-stripper-ignore-next /// Build the [`PreferencesRow`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> PreferencesRow { assert_initialized_main_thread!(); self.builder.build() } } pub trait PreferencesRowExt: IsA + 'static { #[doc(alias = "adw_preferences_row_get_title")] #[doc(alias = "get_title")] fn title(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_preferences_row_get_title( self.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "adw_preferences_row_get_title_selectable")] #[doc(alias = "get_title_selectable")] #[doc(alias = "title-selectable")] fn is_title_selectable(&self) -> bool { unsafe { from_glib(ffi::adw_preferences_row_get_title_selectable( self.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "adw_preferences_row_get_use_markup")] #[doc(alias = "get_use_markup")] #[doc(alias = "use-markup")] fn uses_markup(&self) -> bool { unsafe { from_glib(ffi::adw_preferences_row_get_use_markup( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_preferences_row_get_use_underline")] #[doc(alias = "get_use_underline")] #[doc(alias = "use-underline")] fn uses_underline(&self) -> bool { unsafe { from_glib(ffi::adw_preferences_row_get_use_underline( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_preferences_row_set_title")] #[doc(alias = "title")] fn set_title(&self, title: &str) { unsafe { ffi::adw_preferences_row_set_title( self.as_ref().to_glib_none().0, title.to_glib_none().0, ); } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "adw_preferences_row_set_title_selectable")] #[doc(alias = "title-selectable")] fn set_title_selectable(&self, title_selectable: bool) { unsafe { ffi::adw_preferences_row_set_title_selectable( self.as_ref().to_glib_none().0, title_selectable.into_glib(), ); } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "adw_preferences_row_set_use_markup")] #[doc(alias = "use-markup")] fn set_use_markup(&self, use_markup: bool) { unsafe { ffi::adw_preferences_row_set_use_markup( self.as_ref().to_glib_none().0, use_markup.into_glib(), ); } } #[doc(alias = "adw_preferences_row_set_use_underline")] #[doc(alias = "use-underline")] fn set_use_underline(&self, use_underline: bool) { unsafe { ffi::adw_preferences_row_set_use_underline( self.as_ref().to_glib_none().0, use_underline.into_glib(), ); } } #[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::AdwPreferencesRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::title".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "title-selectable")] fn connect_title_selectable_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_selectable_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwPreferencesRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::title-selectable".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_title_selectable_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "use-markup")] fn connect_use_markup_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_use_markup_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwPreferencesRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::use-markup".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_use_markup_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "use-underline")] fn connect_use_underline_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_use_underline_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwPreferencesRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::use-underline".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_use_underline_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> PreferencesRowExt for O {} libadwaita-0.7.2/src/auto/preferences_window.rs000064400000000000000000000571301046102023000177360ustar 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 #![allow(deprecated)] #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] use crate::NavigationPage; use crate::{ffi, PreferencesPage, Toast, Window}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwPreferencesWindow")] pub struct PreferencesWindow(Object) @extends Window, gtk::Window, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Native, gtk::Root, gtk::ShortcutManager; match fn { type_ => || ffi::adw_preferences_window_get_type(), } } impl PreferencesWindow { pub const NONE: Option<&'static PreferencesWindow> = None; #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_preferences_window_new")] pub fn new() -> PreferencesWindow { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_preferences_window_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`PreferencesWindow`] objects. /// /// This method returns an instance of [`PreferencesWindowBuilder`](crate::builders::PreferencesWindowBuilder) which can be used to create [`PreferencesWindow`] objects. pub fn builder() -> PreferencesWindowBuilder { PreferencesWindowBuilder::new() } } impl Default for PreferencesWindow { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`PreferencesWindow`] 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 PreferencesWindowBuilder { builder: glib::object::ObjectBuilder<'static, PreferencesWindow>, } impl PreferencesWindowBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn can_navigate_back(self, can_navigate_back: bool) -> Self { Self { builder: self .builder .property("can-navigate-back", can_navigate_back), } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn search_enabled(self, search_enabled: bool) -> Self { Self { builder: self.builder.property("search-enabled", search_enabled), } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn visible_page(self, visible_page: &impl IsA) -> Self { Self { builder: self .builder .property("visible-page", visible_page.clone().upcast()), } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] pub fn visible_page_name(self, visible_page_name: impl Into) -> Self { Self { builder: self .builder .property("visible-page-name", visible_page_name.into()), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn adaptive_preview(self, adaptive_preview: bool) -> Self { Self { builder: self.builder.property("adaptive-preview", adaptive_preview), } } pub fn content(self, content: &impl IsA) -> Self { Self { builder: self.builder.property("content", content.clone().upcast()), } } pub fn application(self, application: &impl IsA) -> Self { Self { builder: self .builder .property("application", application.clone().upcast()), } } pub fn decorated(self, decorated: bool) -> Self { Self { builder: self.builder.property("decorated", decorated), } } pub fn default_height(self, default_height: i32) -> Self { Self { builder: self.builder.property("default-height", default_height), } } pub fn default_widget(self, default_widget: &impl IsA) -> Self { Self { builder: self .builder .property("default-widget", default_widget.clone().upcast()), } } pub fn default_width(self, default_width: i32) -> Self { Self { builder: self.builder.property("default-width", default_width), } } pub fn deletable(self, deletable: bool) -> Self { Self { builder: self.builder.property("deletable", deletable), } } pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self { Self { builder: self .builder .property("destroy-with-parent", destroy_with_parent), } } pub fn display(self, display: &gdk::Display) -> Self { Self { builder: self.builder.property("display", display.clone()), } } pub fn focus_visible(self, focus_visible: bool) -> Self { Self { builder: self.builder.property("focus-visible", focus_visible), } } pub fn focus_widget(self, focus_widget: &impl IsA) -> Self { Self { builder: self .builder .property("focus-widget", focus_widget.clone().upcast()), } } pub fn fullscreened(self, fullscreened: bool) -> Self { Self { builder: self.builder.property("fullscreened", fullscreened), } } #[cfg(feature = "gtk_v4_2")] #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_2")))] pub fn handle_menubar_accel(self, handle_menubar_accel: bool) -> Self { Self { builder: self .builder .property("handle-menubar-accel", handle_menubar_accel), } } pub fn hide_on_close(self, hide_on_close: bool) -> Self { Self { builder: self.builder.property("hide-on-close", hide_on_close), } } pub fn icon_name(self, icon_name: impl Into) -> Self { Self { builder: self.builder.property("icon-name", icon_name.into()), } } pub fn maximized(self, maximized: bool) -> Self { Self { builder: self.builder.property("maximized", maximized), } } pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self { Self { builder: self .builder .property("mnemonics-visible", mnemonics_visible), } } pub fn modal(self, modal: bool) -> Self { Self { builder: self.builder.property("modal", modal), } } pub fn resizable(self, resizable: bool) -> Self { Self { builder: self.builder.property("resizable", resizable), } } pub fn startup_id(self, startup_id: impl Into) -> Self { Self { builder: self.builder.property("startup-id", startup_id.into()), } } pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } #[cfg(feature = "gtk_v4_6")] #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_6")))] pub fn titlebar(self, titlebar: &impl IsA) -> Self { Self { builder: self.builder.property("titlebar", titlebar.clone().upcast()), } } pub fn transient_for(self, transient_for: &impl IsA) -> Self { Self { builder: self .builder .property("transient-for", transient_for.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 [`PreferencesWindow`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> PreferencesWindow { assert_initialized_main_thread!(); self.builder.build() } } pub trait PreferencesWindowExt: IsA + 'static { #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_preferences_window_add")] fn add(&self, page: &impl IsA) { unsafe { ffi::adw_preferences_window_add( self.as_ref().to_glib_none().0, page.as_ref().to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_preferences_window_add_toast")] fn add_toast(&self, toast: Toast) { unsafe { ffi::adw_preferences_window_add_toast( self.as_ref().to_glib_none().0, toast.into_glib_ptr(), ); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_preferences_window_close_subpage")] fn close_subpage(&self) { unsafe { ffi::adw_preferences_window_close_subpage(self.as_ref().to_glib_none().0); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_preferences_window_get_can_navigate_back")] #[doc(alias = "get_can_navigate_back")] #[doc(alias = "can-navigate-back")] fn can_navigate_back(&self) -> bool { unsafe { from_glib(ffi::adw_preferences_window_get_can_navigate_back( self.as_ref().to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_preferences_window_get_search_enabled")] #[doc(alias = "get_search_enabled")] #[doc(alias = "search-enabled")] fn is_search_enabled(&self) -> bool { unsafe { from_glib(ffi::adw_preferences_window_get_search_enabled( self.as_ref().to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_preferences_window_get_visible_page")] #[doc(alias = "get_visible_page")] #[doc(alias = "visible-page")] fn visible_page(&self) -> Option { unsafe { from_glib_none(ffi::adw_preferences_window_get_visible_page( self.as_ref().to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_preferences_window_get_visible_page_name")] #[doc(alias = "get_visible_page_name")] #[doc(alias = "visible-page-name")] fn visible_page_name(&self) -> Option { unsafe { from_glib_none(ffi::adw_preferences_window_get_visible_page_name( self.as_ref().to_glib_none().0, )) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[allow(deprecated)] #[doc(alias = "adw_preferences_window_pop_subpage")] fn pop_subpage(&self) -> bool { unsafe { from_glib(ffi::adw_preferences_window_pop_subpage( self.as_ref().to_glib_none().0, )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_preferences_window_present_subpage")] fn present_subpage(&self, subpage: &impl IsA) { unsafe { ffi::adw_preferences_window_present_subpage( self.as_ref().to_glib_none().0, subpage.as_ref().to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[allow(deprecated)] #[doc(alias = "adw_preferences_window_push_subpage")] fn push_subpage(&self, page: &impl IsA) { unsafe { ffi::adw_preferences_window_push_subpage( self.as_ref().to_glib_none().0, page.as_ref().to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_preferences_window_remove")] fn remove(&self, page: &impl IsA) { unsafe { ffi::adw_preferences_window_remove( self.as_ref().to_glib_none().0, page.as_ref().to_glib_none().0, ); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_preferences_window_set_can_navigate_back")] #[doc(alias = "can-navigate-back")] fn set_can_navigate_back(&self, can_navigate_back: bool) { unsafe { ffi::adw_preferences_window_set_can_navigate_back( self.as_ref().to_glib_none().0, can_navigate_back.into_glib(), ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_preferences_window_set_search_enabled")] #[doc(alias = "search-enabled")] fn set_search_enabled(&self, search_enabled: bool) { unsafe { ffi::adw_preferences_window_set_search_enabled( self.as_ref().to_glib_none().0, search_enabled.into_glib(), ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_preferences_window_set_visible_page")] #[doc(alias = "visible-page")] fn set_visible_page(&self, page: &impl IsA) { unsafe { ffi::adw_preferences_window_set_visible_page( self.as_ref().to_glib_none().0, page.as_ref().to_glib_none().0, ); } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[allow(deprecated)] #[doc(alias = "adw_preferences_window_set_visible_page_name")] #[doc(alias = "visible-page-name")] fn set_visible_page_name(&self, name: &str) { unsafe { ffi::adw_preferences_window_set_visible_page_name( self.as_ref().to_glib_none().0, name.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "can-navigate-back")] fn connect_can_navigate_back_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_can_navigate_back_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwPreferencesWindow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesWindow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::can-navigate-back".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_can_navigate_back_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[doc(alias = "search-enabled")] fn connect_search_enabled_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_search_enabled_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwPreferencesWindow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesWindow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::search-enabled".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_search_enabled_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[doc(alias = "visible-page")] fn connect_visible_page_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_visible_page_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwPreferencesWindow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesWindow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::visible-page".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_visible_page_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_6", deprecated = "Since 1.6")] #[doc(alias = "visible-page-name")] fn connect_visible_page_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_visible_page_name_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwPreferencesWindow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesWindow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::visible-page-name".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_visible_page_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> PreferencesWindowExt for O {} libadwaita-0.7.2/src/auto/property_animation_target.rs000064400000000000000000000041721046102023000213350ustar 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, AnimationTarget}; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "AdwPropertyAnimationTarget")] pub struct PropertyAnimationTarget(Object) @extends AnimationTarget; match fn { type_ => || ffi::adw_property_animation_target_get_type(), } } impl PropertyAnimationTarget { #[doc(alias = "adw_property_animation_target_new")] pub fn new(object: &impl IsA, property_name: &str) -> PropertyAnimationTarget { assert_initialized_main_thread!(); unsafe { AnimationTarget::from_glib_full(ffi::adw_property_animation_target_new( object.as_ref().to_glib_none().0, property_name.to_glib_none().0, )) .unsafe_cast() } } #[doc(alias = "adw_property_animation_target_new_for_pspec")] #[doc(alias = "new_for_pspec")] pub fn for_pspec( object: &impl IsA, pspec: impl AsRef, ) -> PropertyAnimationTarget { assert_initialized_main_thread!(); unsafe { AnimationTarget::from_glib_full(ffi::adw_property_animation_target_new_for_pspec( object.as_ref().to_glib_none().0, pspec.as_ref().to_glib_none().0, )) .unsafe_cast() } } #[doc(alias = "adw_property_animation_target_get_object")] #[doc(alias = "get_object")] pub fn object(&self) -> glib::Object { unsafe { from_glib_none(ffi::adw_property_animation_target_get_object( self.to_glib_none().0, )) } } #[doc(alias = "adw_property_animation_target_get_pspec")] #[doc(alias = "get_pspec")] pub fn pspec(&self) -> glib::ParamSpec { unsafe { from_glib_none(ffi::adw_property_animation_target_get_pspec( self.to_glib_none().0, )) } } } libadwaita-0.7.2/src/auto/spin_row.rs000064400000000000000000000662531046102023000157140ustar 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, ActionRow, PreferencesRow}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwSpinRow")] pub struct SpinRow(Object) @extends ActionRow, PreferencesRow, gtk::ListBoxRow, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Actionable, gtk::Editable; match fn { type_ => || ffi::adw_spin_row_get_type(), } } impl SpinRow { #[doc(alias = "adw_spin_row_new")] pub fn new( adjustment: Option<&impl IsA>, climb_rate: f64, digits: u32, ) -> SpinRow { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_spin_row_new( adjustment.map(|p| p.as_ref()).to_glib_none().0, climb_rate, digits, )) .unsafe_cast() } } #[doc(alias = "adw_spin_row_new_with_range")] #[doc(alias = "new_with_range")] pub fn with_range(min: f64, max: f64, step: f64) -> SpinRow { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_spin_row_new_with_range(min, max, step)) .unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`SpinRow`] objects. /// /// This method returns an instance of [`SpinRowBuilder`](crate::builders::SpinRowBuilder) which can be used to create [`SpinRow`] objects. pub fn builder() -> SpinRowBuilder { SpinRowBuilder::new() } #[doc(alias = "adw_spin_row_configure")] pub fn configure( &self, adjustment: Option<&impl IsA>, climb_rate: f64, digits: u32, ) { unsafe { ffi::adw_spin_row_configure( self.to_glib_none().0, adjustment.map(|p| p.as_ref()).to_glib_none().0, climb_rate, digits, ); } } #[doc(alias = "adw_spin_row_get_adjustment")] #[doc(alias = "get_adjustment")] pub fn adjustment(&self) -> gtk::Adjustment { unsafe { from_glib_none(ffi::adw_spin_row_get_adjustment(self.to_glib_none().0)) } } #[doc(alias = "adw_spin_row_get_climb_rate")] #[doc(alias = "get_climb_rate")] #[doc(alias = "climb-rate")] pub fn climb_rate(&self) -> f64 { unsafe { ffi::adw_spin_row_get_climb_rate(self.to_glib_none().0) } } #[doc(alias = "adw_spin_row_get_digits")] #[doc(alias = "get_digits")] pub fn digits(&self) -> u32 { unsafe { ffi::adw_spin_row_get_digits(self.to_glib_none().0) } } #[doc(alias = "adw_spin_row_get_numeric")] #[doc(alias = "get_numeric")] #[doc(alias = "numeric")] pub fn is_numeric(&self) -> bool { unsafe { from_glib(ffi::adw_spin_row_get_numeric(self.to_glib_none().0)) } } #[doc(alias = "adw_spin_row_get_snap_to_ticks")] #[doc(alias = "get_snap_to_ticks")] #[doc(alias = "snap-to-ticks")] pub fn snaps_to_ticks(&self) -> bool { unsafe { from_glib(ffi::adw_spin_row_get_snap_to_ticks(self.to_glib_none().0)) } } #[doc(alias = "adw_spin_row_get_update_policy")] #[doc(alias = "get_update_policy")] #[doc(alias = "update-policy")] pub fn update_policy(&self) -> gtk::SpinButtonUpdatePolicy { unsafe { from_glib(ffi::adw_spin_row_get_update_policy(self.to_glib_none().0)) } } #[doc(alias = "adw_spin_row_get_value")] #[doc(alias = "get_value")] pub fn value(&self) -> f64 { unsafe { ffi::adw_spin_row_get_value(self.to_glib_none().0) } } #[doc(alias = "adw_spin_row_get_wrap")] #[doc(alias = "get_wrap")] #[doc(alias = "wrap")] pub fn wraps(&self) -> bool { unsafe { from_glib(ffi::adw_spin_row_get_wrap(self.to_glib_none().0)) } } #[doc(alias = "adw_spin_row_set_adjustment")] #[doc(alias = "adjustment")] pub fn set_adjustment(&self, adjustment: Option<&impl IsA>) { unsafe { ffi::adw_spin_row_set_adjustment( self.to_glib_none().0, adjustment.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_spin_row_set_climb_rate")] #[doc(alias = "climb-rate")] pub fn set_climb_rate(&self, climb_rate: f64) { unsafe { ffi::adw_spin_row_set_climb_rate(self.to_glib_none().0, climb_rate); } } #[doc(alias = "adw_spin_row_set_digits")] #[doc(alias = "digits")] pub fn set_digits(&self, digits: u32) { unsafe { ffi::adw_spin_row_set_digits(self.to_glib_none().0, digits); } } #[doc(alias = "adw_spin_row_set_numeric")] #[doc(alias = "numeric")] pub fn set_numeric(&self, numeric: bool) { unsafe { ffi::adw_spin_row_set_numeric(self.to_glib_none().0, numeric.into_glib()); } } #[doc(alias = "adw_spin_row_set_range")] pub fn set_range(&self, min: f64, max: f64) { unsafe { ffi::adw_spin_row_set_range(self.to_glib_none().0, min, max); } } #[doc(alias = "adw_spin_row_set_snap_to_ticks")] #[doc(alias = "snap-to-ticks")] pub fn set_snap_to_ticks(&self, snap_to_ticks: bool) { unsafe { ffi::adw_spin_row_set_snap_to_ticks(self.to_glib_none().0, snap_to_ticks.into_glib()); } } #[doc(alias = "adw_spin_row_set_update_policy")] #[doc(alias = "update-policy")] pub fn set_update_policy(&self, policy: gtk::SpinButtonUpdatePolicy) { unsafe { ffi::adw_spin_row_set_update_policy(self.to_glib_none().0, policy.into_glib()); } } #[doc(alias = "adw_spin_row_set_value")] #[doc(alias = "value")] pub fn set_value(&self, value: f64) { unsafe { ffi::adw_spin_row_set_value(self.to_glib_none().0, value); } } #[doc(alias = "adw_spin_row_set_wrap")] #[doc(alias = "wrap")] pub fn set_wrap(&self, wrap: bool) { unsafe { ffi::adw_spin_row_set_wrap(self.to_glib_none().0, wrap.into_glib()); } } #[doc(alias = "adw_spin_row_update")] pub fn update(&self) { unsafe { ffi::adw_spin_row_update(self.to_glib_none().0); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "output")] pub fn connect_output bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn output_trampoline bool + 'static>( this: *mut ffi::AdwSpinRow, f: glib::ffi::gpointer, ) -> glib::ffi::gboolean { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)).into_glib() } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"output".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( output_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "wrapped")] pub fn connect_wrapped(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn wrapped_trampoline( this: *mut ffi::AdwSpinRow, 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 _, c"wrapped".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( wrapped_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adjustment")] pub fn connect_adjustment_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_adjustment_trampoline( this: *mut ffi::AdwSpinRow, _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 _, c"notify::adjustment".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_adjustment_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "climb-rate")] pub fn connect_climb_rate_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_climb_rate_trampoline( this: *mut ffi::AdwSpinRow, _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 _, c"notify::climb-rate".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_climb_rate_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "digits")] pub fn connect_digits_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_digits_trampoline( this: *mut ffi::AdwSpinRow, _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 _, c"notify::digits".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_digits_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "numeric")] pub fn connect_numeric_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_numeric_trampoline( this: *mut ffi::AdwSpinRow, _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 _, c"notify::numeric".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_numeric_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "snap-to-ticks")] pub fn connect_snap_to_ticks_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_snap_to_ticks_trampoline( this: *mut ffi::AdwSpinRow, _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 _, c"notify::snap-to-ticks".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_snap_to_ticks_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "update-policy")] pub fn connect_update_policy_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_update_policy_trampoline( this: *mut ffi::AdwSpinRow, _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 _, c"notify::update-policy".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_update_policy_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "value")] pub fn connect_value_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_value_trampoline( this: *mut ffi::AdwSpinRow, _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 _, c"notify::value".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_value_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "wrap")] pub fn connect_wrap_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_wrap_trampoline( this: *mut ffi::AdwSpinRow, _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 _, c"notify::wrap".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_wrap_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl Default for SpinRow { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`SpinRow`] 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 SpinRowBuilder { builder: glib::object::ObjectBuilder<'static, SpinRow>, } impl SpinRowBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn adjustment(self, adjustment: &impl IsA) -> Self { Self { builder: self .builder .property("adjustment", adjustment.clone().upcast()), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn climb_rate(self, climb_rate: f64) -> Self { Self { builder: self.builder.property("climb-rate", climb_rate), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn digits(self, digits: u32) -> Self { Self { builder: self.builder.property("digits", digits), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn numeric(self, numeric: bool) -> Self { Self { builder: self.builder.property("numeric", numeric), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn snap_to_ticks(self, snap_to_ticks: bool) -> Self { Self { builder: self.builder.property("snap-to-ticks", snap_to_ticks), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn update_policy(self, update_policy: gtk::SpinButtonUpdatePolicy) -> Self { Self { builder: self.builder.property("update-policy", update_policy), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn value(self, value: f64) -> Self { Self { builder: self.builder.property("value", value), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn wrap(self, wrap: bool) -> Self { Self { builder: self.builder.property("wrap", wrap), } } pub fn activatable_widget(self, activatable_widget: &impl IsA) -> Self { Self { builder: self .builder .property("activatable-widget", activatable_widget.clone().upcast()), } } #[cfg_attr(feature = "v1_3", deprecated = "Since 1.3")] pub fn icon_name(self, icon_name: impl Into) -> Self { Self { builder: self.builder.property("icon-name", icon_name.into()), } } pub fn subtitle(self, subtitle: impl Into) -> Self { Self { builder: self.builder.property("subtitle", subtitle.into()), } } pub fn subtitle_lines(self, subtitle_lines: i32) -> Self { Self { builder: self.builder.property("subtitle-lines", subtitle_lines), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn subtitle_selectable(self, subtitle_selectable: bool) -> Self { Self { builder: self .builder .property("subtitle-selectable", subtitle_selectable), } } pub fn title_lines(self, title_lines: i32) -> Self { Self { builder: self.builder.property("title-lines", title_lines), } } pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub fn title_selectable(self, title_selectable: bool) -> Self { Self { builder: self.builder.property("title-selectable", title_selectable), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn use_markup(self, use_markup: bool) -> Self { Self { builder: self.builder.property("use-markup", use_markup), } } pub fn use_underline(self, use_underline: bool) -> Self { Self { builder: self.builder.property("use-underline", use_underline), } } pub fn activatable(self, activatable: bool) -> Self { Self { builder: self.builder.property("activatable", activatable), } } pub fn child(self, child: &impl IsA) -> Self { Self { builder: self.builder.property("child", child.clone().upcast()), } } pub fn selectable(self, selectable: bool) -> Self { Self { builder: self.builder.property("selectable", selectable), } } 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 action_name(self, action_name: impl Into) -> Self { Self { builder: self.builder.property("action-name", action_name.into()), } } pub fn action_target(self, action_target: &glib::Variant) -> Self { Self { builder: self .builder .property("action-target", action_target.clone()), } } pub fn editable(self, editable: bool) -> Self { Self { builder: self.builder.property("editable", editable), } } pub fn enable_undo(self, enable_undo: bool) -> Self { Self { builder: self.builder.property("enable-undo", enable_undo), } } pub fn max_width_chars(self, max_width_chars: i32) -> Self { Self { builder: self.builder.property("max-width-chars", max_width_chars), } } pub fn text(self, text: impl Into) -> Self { Self { builder: self.builder.property("text", text.into()), } } pub fn width_chars(self, width_chars: i32) -> Self { Self { builder: self.builder.property("width-chars", width_chars), } } pub fn xalign(self, xalign: f32) -> Self { Self { builder: self.builder.property("xalign", xalign), } } // rustdoc-stripper-ignore-next /// Build the [`SpinRow`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> SpinRow { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/spinner.rs000064400000000000000000000155571046102023000155330ustar 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 = "AdwSpinner")] pub struct Spinner(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_spinner_get_type(), } } impl Spinner { #[doc(alias = "adw_spinner_new")] pub fn new() -> Spinner { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_spinner_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Spinner`] objects. /// /// This method returns an instance of [`SpinnerBuilder`](crate::builders::SpinnerBuilder) which can be used to create [`Spinner`] objects. pub fn builder() -> SpinnerBuilder { SpinnerBuilder::new() } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] impl Default for Spinner { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Spinner`] 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 SpinnerBuilder { builder: glib::object::ObjectBuilder<'static, Spinner>, } impl SpinnerBuilder { 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 [`Spinner`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Spinner { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/spinner_paintable.rs000064400000000000000000000046251046102023000175440ustar 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 = "AdwSpinnerPaintable")] pub struct SpinnerPaintable(Object) @implements gdk::Paintable; match fn { type_ => || ffi::adw_spinner_paintable_get_type(), } } impl SpinnerPaintable { #[doc(alias = "adw_spinner_paintable_new")] pub fn new(widget: Option<&impl IsA>) -> SpinnerPaintable { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::adw_spinner_paintable_new( widget.map(|p| p.as_ref()).to_glib_none().0, )) } } #[doc(alias = "adw_spinner_paintable_get_widget")] #[doc(alias = "get_widget")] pub fn widget(&self) -> Option { unsafe { from_glib_none(ffi::adw_spinner_paintable_get_widget(self.to_glib_none().0)) } } #[doc(alias = "adw_spinner_paintable_set_widget")] #[doc(alias = "widget")] pub fn set_widget(&self, widget: Option<&impl IsA>) { unsafe { ffi::adw_spinner_paintable_set_widget( self.to_glib_none().0, widget.map(|p| p.as_ref()).to_glib_none().0, ); } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "widget")] pub fn connect_widget_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_widget_trampoline( this: *mut ffi::AdwSpinnerPaintable, _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 _, c"notify::widget".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_widget_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } libadwaita-0.7.2/src/auto/split_button.rs000064400000000000000000000605701046102023000165760ustar 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 = "AdwSplitButton")] pub struct SplitButton(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Actionable; match fn { type_ => || ffi::adw_split_button_get_type(), } } impl SplitButton { #[doc(alias = "adw_split_button_new")] pub fn new() -> SplitButton { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_split_button_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`SplitButton`] objects. /// /// This method returns an instance of [`SplitButtonBuilder`](crate::builders::SplitButtonBuilder) which can be used to create [`SplitButton`] objects. pub fn builder() -> SplitButtonBuilder { SplitButtonBuilder::new() } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_split_button_get_can_shrink")] #[doc(alias = "get_can_shrink")] #[doc(alias = "can-shrink")] pub fn can_shrink(&self) -> bool { unsafe { from_glib(ffi::adw_split_button_get_can_shrink(self.to_glib_none().0)) } } #[doc(alias = "adw_split_button_get_child")] #[doc(alias = "get_child")] pub fn child(&self) -> Option { unsafe { from_glib_none(ffi::adw_split_button_get_child(self.to_glib_none().0)) } } #[doc(alias = "adw_split_button_get_direction")] #[doc(alias = "get_direction")] pub fn direction(&self) -> gtk::ArrowType { unsafe { from_glib(ffi::adw_split_button_get_direction(self.to_glib_none().0)) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "adw_split_button_get_dropdown_tooltip")] #[doc(alias = "get_dropdown_tooltip")] #[doc(alias = "dropdown-tooltip")] pub fn dropdown_tooltip(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_split_button_get_dropdown_tooltip( self.to_glib_none().0, )) } } #[doc(alias = "adw_split_button_get_icon_name")] #[doc(alias = "get_icon_name")] #[doc(alias = "icon-name")] pub fn icon_name(&self) -> Option { unsafe { from_glib_none(ffi::adw_split_button_get_icon_name(self.to_glib_none().0)) } } #[doc(alias = "adw_split_button_get_label")] #[doc(alias = "get_label")] pub fn label(&self) -> Option { unsafe { from_glib_none(ffi::adw_split_button_get_label(self.to_glib_none().0)) } } #[doc(alias = "adw_split_button_get_menu_model")] #[doc(alias = "get_menu_model")] #[doc(alias = "menu-model")] pub fn menu_model(&self) -> Option { unsafe { from_glib_none(ffi::adw_split_button_get_menu_model(self.to_glib_none().0)) } } #[doc(alias = "adw_split_button_get_popover")] #[doc(alias = "get_popover")] pub fn popover(&self) -> Option { unsafe { from_glib_none(ffi::adw_split_button_get_popover(self.to_glib_none().0)) } } #[doc(alias = "adw_split_button_get_use_underline")] #[doc(alias = "get_use_underline")] #[doc(alias = "use-underline")] pub fn uses_underline(&self) -> bool { unsafe { from_glib(ffi::adw_split_button_get_use_underline( self.to_glib_none().0, )) } } #[doc(alias = "adw_split_button_popdown")] pub fn popdown(&self) { unsafe { ffi::adw_split_button_popdown(self.to_glib_none().0); } } #[doc(alias = "adw_split_button_popup")] pub fn popup(&self) { unsafe { ffi::adw_split_button_popup(self.to_glib_none().0); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_split_button_set_can_shrink")] #[doc(alias = "can-shrink")] pub fn set_can_shrink(&self, can_shrink: bool) { unsafe { ffi::adw_split_button_set_can_shrink(self.to_glib_none().0, can_shrink.into_glib()); } } #[doc(alias = "adw_split_button_set_child")] #[doc(alias = "child")] pub fn set_child(&self, child: Option<&impl IsA>) { unsafe { ffi::adw_split_button_set_child( self.to_glib_none().0, child.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_split_button_set_direction")] #[doc(alias = "direction")] pub fn set_direction(&self, direction: gtk::ArrowType) { unsafe { ffi::adw_split_button_set_direction(self.to_glib_none().0, direction.into_glib()); } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "adw_split_button_set_dropdown_tooltip")] #[doc(alias = "dropdown-tooltip")] pub fn set_dropdown_tooltip(&self, tooltip: &str) { unsafe { ffi::adw_split_button_set_dropdown_tooltip( self.to_glib_none().0, tooltip.to_glib_none().0, ); } } #[doc(alias = "adw_split_button_set_icon_name")] #[doc(alias = "icon-name")] pub fn set_icon_name(&self, icon_name: &str) { unsafe { ffi::adw_split_button_set_icon_name(self.to_glib_none().0, icon_name.to_glib_none().0); } } #[doc(alias = "adw_split_button_set_label")] #[doc(alias = "label")] pub fn set_label(&self, label: &str) { unsafe { ffi::adw_split_button_set_label(self.to_glib_none().0, label.to_glib_none().0); } } #[doc(alias = "adw_split_button_set_menu_model")] #[doc(alias = "menu-model")] pub fn set_menu_model(&self, menu_model: Option<&impl IsA>) { unsafe { ffi::adw_split_button_set_menu_model( self.to_glib_none().0, menu_model.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_split_button_set_popover")] #[doc(alias = "popover")] pub fn set_popover(&self, popover: Option<&impl IsA>) { unsafe { ffi::adw_split_button_set_popover( self.to_glib_none().0, popover.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_split_button_set_use_underline")] #[doc(alias = "use-underline")] pub fn set_use_underline(&self, use_underline: bool) { unsafe { ffi::adw_split_button_set_use_underline( self.to_glib_none().0, use_underline.into_glib(), ); } } #[doc(alias = "activate")] pub fn connect_activate(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn activate_trampoline( this: *mut ffi::AdwSplitButton, 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 _, c"activate".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( activate_trampoline:: as *const (), )), Box_::into_raw(f), ) } } pub fn emit_activate(&self) { self.emit_by_name::<()>("activate", &[]); } #[doc(alias = "clicked")] pub fn connect_clicked(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn clicked_trampoline( this: *mut ffi::AdwSplitButton, 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 _, c"clicked".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( clicked_trampoline:: as *const (), )), Box_::into_raw(f), ) } } pub fn emit_clicked(&self) { self.emit_by_name::<()>("clicked", &[]); } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "can-shrink")] pub fn connect_can_shrink_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_can_shrink_trampoline( this: *mut ffi::AdwSplitButton, _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 _, c"notify::can-shrink".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_can_shrink_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "child")] pub fn connect_child_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_child_trampoline( this: *mut ffi::AdwSplitButton, _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 _, c"notify::child".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_child_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "direction")] pub fn connect_direction_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_direction_trampoline( this: *mut ffi::AdwSplitButton, _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 _, c"notify::direction".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_direction_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "dropdown-tooltip")] pub fn connect_dropdown_tooltip_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_dropdown_tooltip_trampoline( this: *mut ffi::AdwSplitButton, _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 _, c"notify::dropdown-tooltip".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_dropdown_tooltip_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::AdwSplitButton, _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 _, c"notify::icon-name".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 = "label")] pub fn connect_label_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_label_trampoline( this: *mut ffi::AdwSplitButton, _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 _, c"notify::label".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_label_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "menu-model")] pub fn connect_menu_model_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_menu_model_trampoline( this: *mut ffi::AdwSplitButton, _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 _, c"notify::menu-model".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_menu_model_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "popover")] pub fn connect_popover_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_popover_trampoline( this: *mut ffi::AdwSplitButton, _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 _, c"notify::popover".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_popover_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "use-underline")] pub fn connect_use_underline_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_use_underline_trampoline( this: *mut ffi::AdwSplitButton, _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 _, c"notify::use-underline".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_use_underline_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for SplitButton { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`SplitButton`] 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 SplitButtonBuilder { builder: glib::object::ObjectBuilder<'static, SplitButton>, } impl SplitButtonBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn can_shrink(self, can_shrink: bool) -> Self { Self { builder: self.builder.property("can-shrink", can_shrink), } } pub fn child(self, child: &impl IsA) -> Self { Self { builder: self.builder.property("child", child.clone().upcast()), } } pub fn direction(self, direction: gtk::ArrowType) -> Self { Self { builder: self.builder.property("direction", direction), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn dropdown_tooltip(self, dropdown_tooltip: impl Into) -> Self { Self { builder: self .builder .property("dropdown-tooltip", dropdown_tooltip.into()), } } pub fn icon_name(self, icon_name: impl Into) -> Self { Self { builder: self.builder.property("icon-name", icon_name.into()), } } pub fn label(self, label: impl Into) -> Self { Self { builder: self.builder.property("label", label.into()), } } pub fn menu_model(self, menu_model: &impl IsA) -> Self { Self { builder: self .builder .property("menu-model", menu_model.clone().upcast()), } } pub fn popover(self, popover: &impl IsA) -> Self { Self { builder: self.builder.property("popover", popover.clone().upcast()), } } pub fn use_underline(self, use_underline: bool) -> Self { Self { builder: self.builder.property("use-underline", use_underline), } } 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 action_name(self, action_name: impl Into) -> Self { Self { builder: self.builder.property("action-name", action_name.into()), } } pub fn action_target(self, action_target: &glib::Variant) -> Self { Self { builder: self .builder .property("action-target", action_target.clone()), } } // rustdoc-stripper-ignore-next /// Build the [`SplitButton`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> SplitButton { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/spring_animation.rs000064400000000000000000000365361046102023000174160ustar 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, Animation, AnimationTarget, SpringParams}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwSpringAnimation")] pub struct SpringAnimation(Object) @extends Animation; match fn { type_ => || ffi::adw_spring_animation_get_type(), } } impl SpringAnimation { #[doc(alias = "adw_spring_animation_new")] pub fn new( widget: &impl IsA, from: f64, to: f64, spring_params: SpringParams, target: impl IsA, ) -> SpringAnimation { skip_assert_initialized!(); unsafe { Animation::from_glib_none(ffi::adw_spring_animation_new( widget.as_ref().to_glib_none().0, from, to, spring_params.into_glib_ptr(), target.upcast().into_glib_ptr(), )) .unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`SpringAnimation`] objects. /// /// This method returns an instance of [`SpringAnimationBuilder`](crate::builders::SpringAnimationBuilder) which can be used to create [`SpringAnimation`] objects. pub fn builder() -> SpringAnimationBuilder { SpringAnimationBuilder::new() } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_spring_animation_calculate_value")] pub fn calculate_value(&self, time: u32) -> f64 { unsafe { ffi::adw_spring_animation_calculate_value(self.to_glib_none().0, time) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_spring_animation_calculate_velocity")] pub fn calculate_velocity(&self, time: u32) -> f64 { unsafe { ffi::adw_spring_animation_calculate_velocity(self.to_glib_none().0, time) } } #[doc(alias = "adw_spring_animation_get_clamp")] #[doc(alias = "get_clamp")] #[doc(alias = "clamp")] pub fn is_clamp(&self) -> bool { unsafe { from_glib(ffi::adw_spring_animation_get_clamp(self.to_glib_none().0)) } } #[doc(alias = "adw_spring_animation_get_epsilon")] #[doc(alias = "get_epsilon")] pub fn epsilon(&self) -> f64 { unsafe { ffi::adw_spring_animation_get_epsilon(self.to_glib_none().0) } } #[doc(alias = "adw_spring_animation_get_estimated_duration")] #[doc(alias = "get_estimated_duration")] #[doc(alias = "estimated-duration")] pub fn estimated_duration(&self) -> u32 { unsafe { ffi::adw_spring_animation_get_estimated_duration(self.to_glib_none().0) } } #[doc(alias = "adw_spring_animation_get_initial_velocity")] #[doc(alias = "get_initial_velocity")] #[doc(alias = "initial-velocity")] pub fn initial_velocity(&self) -> f64 { unsafe { ffi::adw_spring_animation_get_initial_velocity(self.to_glib_none().0) } } #[doc(alias = "adw_spring_animation_get_spring_params")] #[doc(alias = "get_spring_params")] #[doc(alias = "spring-params")] pub fn spring_params(&self) -> SpringParams { unsafe { from_glib_none(ffi::adw_spring_animation_get_spring_params( self.to_glib_none().0, )) } } #[doc(alias = "adw_spring_animation_get_value_from")] #[doc(alias = "get_value_from")] #[doc(alias = "value-from")] pub fn value_from(&self) -> f64 { unsafe { ffi::adw_spring_animation_get_value_from(self.to_glib_none().0) } } #[doc(alias = "adw_spring_animation_get_value_to")] #[doc(alias = "get_value_to")] #[doc(alias = "value-to")] pub fn value_to(&self) -> f64 { unsafe { ffi::adw_spring_animation_get_value_to(self.to_glib_none().0) } } #[doc(alias = "adw_spring_animation_get_velocity")] #[doc(alias = "get_velocity")] pub fn velocity(&self) -> f64 { unsafe { ffi::adw_spring_animation_get_velocity(self.to_glib_none().0) } } #[doc(alias = "adw_spring_animation_set_clamp")] #[doc(alias = "clamp")] pub fn set_clamp(&self, clamp: bool) { unsafe { ffi::adw_spring_animation_set_clamp(self.to_glib_none().0, clamp.into_glib()); } } #[doc(alias = "adw_spring_animation_set_epsilon")] #[doc(alias = "epsilon")] pub fn set_epsilon(&self, epsilon: f64) { unsafe { ffi::adw_spring_animation_set_epsilon(self.to_glib_none().0, epsilon); } } #[doc(alias = "adw_spring_animation_set_initial_velocity")] #[doc(alias = "initial-velocity")] pub fn set_initial_velocity(&self, velocity: f64) { unsafe { ffi::adw_spring_animation_set_initial_velocity(self.to_glib_none().0, velocity); } } #[doc(alias = "adw_spring_animation_set_spring_params")] #[doc(alias = "spring-params")] pub fn set_spring_params(&self, spring_params: &SpringParams) { unsafe { ffi::adw_spring_animation_set_spring_params( self.to_glib_none().0, spring_params.to_glib_none().0, ); } } #[doc(alias = "adw_spring_animation_set_value_from")] #[doc(alias = "value-from")] pub fn set_value_from(&self, value: f64) { unsafe { ffi::adw_spring_animation_set_value_from(self.to_glib_none().0, value); } } #[doc(alias = "adw_spring_animation_set_value_to")] #[doc(alias = "value-to")] pub fn set_value_to(&self, value: f64) { unsafe { ffi::adw_spring_animation_set_value_to(self.to_glib_none().0, value); } } #[doc(alias = "clamp")] pub fn connect_clamp_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_clamp_trampoline( this: *mut ffi::AdwSpringAnimation, _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 _, c"notify::clamp".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_clamp_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "epsilon")] pub fn connect_epsilon_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_epsilon_trampoline( this: *mut ffi::AdwSpringAnimation, _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 _, c"notify::epsilon".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_epsilon_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "estimated-duration")] pub fn connect_estimated_duration_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_estimated_duration_trampoline< F: Fn(&SpringAnimation) + 'static, >( this: *mut ffi::AdwSpringAnimation, _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 _, c"notify::estimated-duration".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_estimated_duration_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "initial-velocity")] pub fn connect_initial_velocity_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_initial_velocity_trampoline< F: Fn(&SpringAnimation) + 'static, >( this: *mut ffi::AdwSpringAnimation, _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 _, c"notify::initial-velocity".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_initial_velocity_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "spring-params")] pub fn connect_spring_params_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_spring_params_trampoline( this: *mut ffi::AdwSpringAnimation, _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 _, c"notify::spring-params".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_spring_params_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "value-from")] pub fn connect_value_from_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_value_from_trampoline( this: *mut ffi::AdwSpringAnimation, _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 _, c"notify::value-from".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_value_from_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "value-to")] pub fn connect_value_to_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_value_to_trampoline( this: *mut ffi::AdwSpringAnimation, _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 _, c"notify::value-to".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_value_to_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "velocity")] pub fn connect_velocity_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_velocity_trampoline( this: *mut ffi::AdwSpringAnimation, _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 _, c"notify::velocity".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_velocity_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for SpringAnimation { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`SpringAnimation`] 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 SpringAnimationBuilder { builder: glib::object::ObjectBuilder<'static, SpringAnimation>, } impl SpringAnimationBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn clamp(self, clamp: bool) -> Self { Self { builder: self.builder.property("clamp", clamp), } } pub fn epsilon(self, epsilon: f64) -> Self { Self { builder: self.builder.property("epsilon", epsilon), } } pub fn initial_velocity(self, initial_velocity: f64) -> Self { Self { builder: self.builder.property("initial-velocity", initial_velocity), } } pub fn spring_params(self, spring_params: &SpringParams) -> Self { Self { builder: self .builder .property("spring-params", spring_params.clone()), } } pub fn value_from(self, value_from: f64) -> Self { Self { builder: self.builder.property("value-from", value_from), } } pub fn value_to(self, value_to: f64) -> Self { Self { builder: self.builder.property("value-to", value_to), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn follow_enable_animations_setting(self, follow_enable_animations_setting: bool) -> Self { Self { builder: self.builder.property( "follow-enable-animations-setting", follow_enable_animations_setting, ), } } pub fn target(self, target: &impl IsA) -> Self { Self { builder: self.builder.property("target", target.clone().upcast()), } } pub fn widget(self, widget: &impl IsA) -> Self { Self { builder: self.builder.property("widget", widget.clone().upcast()), } } // rustdoc-stripper-ignore-next /// Build the [`SpringAnimation`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> SpringAnimation { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/spring_params.rs000064400000000000000000000035761046102023000167200ustar 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 SpringParams(Shared); match fn { ref => |ptr| ffi::adw_spring_params_ref(ptr), unref => |ptr| ffi::adw_spring_params_unref(ptr), type_ => || ffi::adw_spring_params_get_type(), } } impl SpringParams { #[doc(alias = "adw_spring_params_new")] pub fn new(damping_ratio: f64, mass: f64, stiffness: f64) -> SpringParams { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::adw_spring_params_new(damping_ratio, mass, stiffness)) } } #[doc(alias = "adw_spring_params_new_full")] pub fn new_full(damping: f64, mass: f64, stiffness: f64) -> SpringParams { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::adw_spring_params_new_full(damping, mass, stiffness)) } } #[doc(alias = "adw_spring_params_get_damping")] #[doc(alias = "get_damping")] pub fn damping(&self) -> f64 { unsafe { ffi::adw_spring_params_get_damping(self.to_glib_none().0) } } #[doc(alias = "adw_spring_params_get_damping_ratio")] #[doc(alias = "get_damping_ratio")] pub fn damping_ratio(&self) -> f64 { unsafe { ffi::adw_spring_params_get_damping_ratio(self.to_glib_none().0) } } #[doc(alias = "adw_spring_params_get_mass")] #[doc(alias = "get_mass")] pub fn mass(&self) -> f64 { unsafe { ffi::adw_spring_params_get_mass(self.to_glib_none().0) } } #[doc(alias = "adw_spring_params_get_stiffness")] #[doc(alias = "get_stiffness")] pub fn stiffness(&self) -> f64 { unsafe { ffi::adw_spring_params_get_stiffness(self.to_glib_none().0) } } } libadwaita-0.7.2/src/auto/squeezer.rs000064400000000000000000000662361046102023000157200ustar 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 #![allow(deprecated)] use crate::{ffi, FoldThresholdPolicy, SqueezerPage, SqueezerTransitionType}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwSqueezer")] pub struct Squeezer(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable; match fn { type_ => || ffi::adw_squeezer_get_type(), } } impl Squeezer { #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_new")] pub fn new() -> Squeezer { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_squeezer_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Squeezer`] objects. /// /// This method returns an instance of [`SqueezerBuilder`](crate::builders::SqueezerBuilder) which can be used to create [`Squeezer`] objects. pub fn builder() -> SqueezerBuilder { SqueezerBuilder::new() } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_add")] pub fn add(&self, child: &impl IsA) -> SqueezerPage { unsafe { from_glib_none(ffi::adw_squeezer_add( self.to_glib_none().0, child.as_ref().to_glib_none().0, )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_get_allow_none")] #[doc(alias = "get_allow_none")] #[doc(alias = "allow-none")] pub fn allows_none(&self) -> bool { unsafe { from_glib(ffi::adw_squeezer_get_allow_none(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_get_homogeneous")] #[doc(alias = "get_homogeneous")] #[doc(alias = "homogeneous")] pub fn is_homogeneous(&self) -> bool { unsafe { from_glib(ffi::adw_squeezer_get_homogeneous(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_get_interpolate_size")] #[doc(alias = "get_interpolate_size")] #[doc(alias = "interpolate-size")] pub fn is_interpolate_size(&self) -> bool { unsafe { from_glib(ffi::adw_squeezer_get_interpolate_size( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_get_page")] #[doc(alias = "get_page")] pub fn page(&self, child: &impl IsA) -> SqueezerPage { unsafe { from_glib_none(ffi::adw_squeezer_get_page( self.to_glib_none().0, child.as_ref().to_glib_none().0, )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_get_pages")] #[doc(alias = "get_pages")] pub fn pages(&self) -> gtk::SelectionModel { unsafe { from_glib_full(ffi::adw_squeezer_get_pages(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_get_switch_threshold_policy")] #[doc(alias = "get_switch_threshold_policy")] #[doc(alias = "switch-threshold-policy")] pub fn switch_threshold_policy(&self) -> FoldThresholdPolicy { unsafe { from_glib(ffi::adw_squeezer_get_switch_threshold_policy( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_get_transition_duration")] #[doc(alias = "get_transition_duration")] #[doc(alias = "transition-duration")] pub fn transition_duration(&self) -> u32 { unsafe { ffi::adw_squeezer_get_transition_duration(self.to_glib_none().0) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_get_transition_running")] #[doc(alias = "get_transition_running")] #[doc(alias = "transition-running")] pub fn is_transition_running(&self) -> bool { unsafe { from_glib(ffi::adw_squeezer_get_transition_running( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_get_transition_type")] #[doc(alias = "get_transition_type")] #[doc(alias = "transition-type")] pub fn transition_type(&self) -> SqueezerTransitionType { unsafe { from_glib(ffi::adw_squeezer_get_transition_type(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_get_visible_child")] #[doc(alias = "get_visible_child")] #[doc(alias = "visible-child")] pub fn visible_child(&self) -> Option { unsafe { from_glib_none(ffi::adw_squeezer_get_visible_child(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_get_xalign")] #[doc(alias = "get_xalign")] pub fn xalign(&self) -> f32 { unsafe { ffi::adw_squeezer_get_xalign(self.to_glib_none().0) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_get_yalign")] #[doc(alias = "get_yalign")] pub fn yalign(&self) -> f32 { unsafe { ffi::adw_squeezer_get_yalign(self.to_glib_none().0) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_remove")] pub fn remove(&self, child: &impl IsA) { unsafe { ffi::adw_squeezer_remove(self.to_glib_none().0, child.as_ref().to_glib_none().0); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_set_allow_none")] #[doc(alias = "allow-none")] pub fn set_allow_none(&self, allow_none: bool) { unsafe { ffi::adw_squeezer_set_allow_none(self.to_glib_none().0, allow_none.into_glib()); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_set_homogeneous")] #[doc(alias = "homogeneous")] pub fn set_homogeneous(&self, homogeneous: bool) { unsafe { ffi::adw_squeezer_set_homogeneous(self.to_glib_none().0, homogeneous.into_glib()); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_set_interpolate_size")] #[doc(alias = "interpolate-size")] pub fn set_interpolate_size(&self, interpolate_size: bool) { unsafe { ffi::adw_squeezer_set_interpolate_size( self.to_glib_none().0, interpolate_size.into_glib(), ); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_set_switch_threshold_policy")] #[doc(alias = "switch-threshold-policy")] pub fn set_switch_threshold_policy(&self, policy: FoldThresholdPolicy) { unsafe { ffi::adw_squeezer_set_switch_threshold_policy( self.to_glib_none().0, policy.into_glib(), ); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_set_transition_duration")] #[doc(alias = "transition-duration")] pub fn set_transition_duration(&self, duration: u32) { unsafe { ffi::adw_squeezer_set_transition_duration(self.to_glib_none().0, duration); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_set_transition_type")] #[doc(alias = "transition-type")] pub fn set_transition_type(&self, transition: SqueezerTransitionType) { unsafe { ffi::adw_squeezer_set_transition_type(self.to_glib_none().0, transition.into_glib()); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_set_xalign")] #[doc(alias = "xalign")] pub fn set_xalign(&self, xalign: f32) { unsafe { ffi::adw_squeezer_set_xalign(self.to_glib_none().0, xalign); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_set_yalign")] #[doc(alias = "yalign")] pub fn set_yalign(&self, yalign: f32) { unsafe { ffi::adw_squeezer_set_yalign(self.to_glib_none().0, yalign); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "allow-none")] pub fn connect_allow_none_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_allow_none_trampoline( this: *mut ffi::AdwSqueezer, _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 _, c"notify::allow-none".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_allow_none_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "homogeneous")] pub fn connect_homogeneous_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_homogeneous_trampoline( this: *mut ffi::AdwSqueezer, _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 _, c"notify::homogeneous".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_homogeneous_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "interpolate-size")] pub fn connect_interpolate_size_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_interpolate_size_trampoline( this: *mut ffi::AdwSqueezer, _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 _, c"notify::interpolate-size".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_interpolate_size_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "pages")] pub fn connect_pages_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_pages_trampoline( this: *mut ffi::AdwSqueezer, _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 _, c"notify::pages".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_pages_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "switch-threshold-policy")] pub fn connect_switch_threshold_policy_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_switch_threshold_policy_trampoline< F: Fn(&Squeezer) + 'static, >( this: *mut ffi::AdwSqueezer, _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 _, c"notify::switch-threshold-policy".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_switch_threshold_policy_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "transition-duration")] pub fn connect_transition_duration_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_transition_duration_trampoline( this: *mut ffi::AdwSqueezer, _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 _, c"notify::transition-duration".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_transition_duration_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "transition-running")] pub fn connect_transition_running_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_transition_running_trampoline( this: *mut ffi::AdwSqueezer, _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 _, c"notify::transition-running".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_transition_running_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "transition-type")] pub fn connect_transition_type_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_transition_type_trampoline( this: *mut ffi::AdwSqueezer, _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 _, c"notify::transition-type".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_transition_type_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "visible-child")] pub fn connect_visible_child_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_visible_child_trampoline( this: *mut ffi::AdwSqueezer, _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 _, c"notify::visible-child".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_visible_child_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "xalign")] pub fn connect_xalign_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_xalign_trampoline( this: *mut ffi::AdwSqueezer, _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 _, c"notify::xalign".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_xalign_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "yalign")] pub fn connect_yalign_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_yalign_trampoline( this: *mut ffi::AdwSqueezer, _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 _, c"notify::yalign".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_yalign_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for Squeezer { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Squeezer`] 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 SqueezerBuilder { builder: glib::object::ObjectBuilder<'static, Squeezer>, } impl SqueezerBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn allow_none(self, allow_none: bool) -> Self { Self { builder: self.builder.property("allow-none", allow_none), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn homogeneous(self, homogeneous: bool) -> Self { Self { builder: self.builder.property("homogeneous", homogeneous), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn interpolate_size(self, interpolate_size: bool) -> Self { Self { builder: self.builder.property("interpolate-size", interpolate_size), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn switch_threshold_policy(self, switch_threshold_policy: FoldThresholdPolicy) -> Self { Self { builder: self .builder .property("switch-threshold-policy", switch_threshold_policy), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn transition_duration(self, transition_duration: u32) -> Self { Self { builder: self .builder .property("transition-duration", transition_duration), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn transition_type(self, transition_type: SqueezerTransitionType) -> Self { Self { builder: self.builder.property("transition-type", transition_type), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn xalign(self, xalign: f32) -> Self { Self { builder: self.builder.property("xalign", xalign), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn yalign(self, yalign: f32) -> Self { Self { builder: self.builder.property("yalign", yalign), } } 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 orientation(self, orientation: gtk::Orientation) -> Self { Self { builder: self.builder.property("orientation", orientation), } } // rustdoc-stripper-ignore-next /// Build the [`Squeezer`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Squeezer { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/squeezer_page.rs000064400000000000000000000046201046102023000167010ustar 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 #![allow(deprecated)] use crate::ffi; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwSqueezerPage")] pub struct SqueezerPage(Object); match fn { type_ => || ffi::adw_squeezer_page_get_type(), } } impl SqueezerPage { #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_page_get_child")] #[doc(alias = "get_child")] pub fn child(&self) -> gtk::Widget { unsafe { from_glib_none(ffi::adw_squeezer_page_get_child(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_page_get_enabled")] #[doc(alias = "get_enabled")] #[doc(alias = "enabled")] pub fn is_enabled(&self) -> bool { unsafe { from_glib(ffi::adw_squeezer_page_get_enabled(self.to_glib_none().0)) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_squeezer_page_set_enabled")] #[doc(alias = "enabled")] pub fn set_enabled(&self, enabled: bool) { unsafe { ffi::adw_squeezer_page_set_enabled(self.to_glib_none().0, enabled.into_glib()); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "enabled")] pub fn connect_enabled_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_enabled_trampoline( this: *mut ffi::AdwSqueezerPage, _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 _, c"notify::enabled".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_enabled_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } libadwaita-0.7.2/src/auto/status_page.rs000064400000000000000000000353451046102023000163710ustar 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 = "AdwStatusPage")] pub struct StatusPage(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_status_page_get_type(), } } impl StatusPage { #[doc(alias = "adw_status_page_new")] pub fn new() -> StatusPage { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_status_page_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`StatusPage`] objects. /// /// This method returns an instance of [`StatusPageBuilder`](crate::builders::StatusPageBuilder) which can be used to create [`StatusPage`] objects. pub fn builder() -> StatusPageBuilder { StatusPageBuilder::new() } #[doc(alias = "adw_status_page_get_child")] #[doc(alias = "get_child")] pub fn child(&self) -> Option { unsafe { from_glib_none(ffi::adw_status_page_get_child(self.to_glib_none().0)) } } #[doc(alias = "adw_status_page_get_description")] #[doc(alias = "get_description")] pub fn description(&self) -> Option { unsafe { from_glib_none(ffi::adw_status_page_get_description(self.to_glib_none().0)) } } #[doc(alias = "adw_status_page_get_icon_name")] #[doc(alias = "get_icon_name")] #[doc(alias = "icon-name")] pub fn icon_name(&self) -> Option { unsafe { from_glib_none(ffi::adw_status_page_get_icon_name(self.to_glib_none().0)) } } #[doc(alias = "adw_status_page_get_paintable")] #[doc(alias = "get_paintable")] pub fn paintable(&self) -> Option { unsafe { from_glib_none(ffi::adw_status_page_get_paintable(self.to_glib_none().0)) } } #[doc(alias = "adw_status_page_get_title")] #[doc(alias = "get_title")] pub fn title(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_status_page_get_title(self.to_glib_none().0)) } } #[doc(alias = "adw_status_page_set_child")] #[doc(alias = "child")] pub fn set_child(&self, child: Option<&impl IsA>) { unsafe { ffi::adw_status_page_set_child( self.to_glib_none().0, child.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_status_page_set_description")] #[doc(alias = "description")] pub fn set_description(&self, description: Option<&str>) { unsafe { ffi::adw_status_page_set_description( self.to_glib_none().0, description.to_glib_none().0, ); } } #[doc(alias = "adw_status_page_set_icon_name")] #[doc(alias = "icon-name")] pub fn set_icon_name(&self, icon_name: Option<&str>) { unsafe { ffi::adw_status_page_set_icon_name(self.to_glib_none().0, icon_name.to_glib_none().0); } } #[doc(alias = "adw_status_page_set_paintable")] #[doc(alias = "paintable")] pub fn set_paintable(&self, paintable: Option<&impl IsA>) { unsafe { ffi::adw_status_page_set_paintable( self.to_glib_none().0, paintable.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_status_page_set_title")] #[doc(alias = "title")] pub fn set_title(&self, title: &str) { unsafe { ffi::adw_status_page_set_title(self.to_glib_none().0, title.to_glib_none().0); } } #[doc(alias = "child")] pub fn connect_child_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_child_trampoline( this: *mut ffi::AdwStatusPage, _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 _, c"notify::child".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_child_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::AdwStatusPage, _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 _, c"notify::description".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_description_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::AdwStatusPage, _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 _, c"notify::icon-name".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")] pub fn connect_paintable_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_paintable_trampoline( this: *mut ffi::AdwStatusPage, _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 _, c"notify::paintable".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_paintable_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "title")] pub fn connect_title_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_trampoline( this: *mut ffi::AdwStatusPage, _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 _, c"notify::title".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for StatusPage { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`StatusPage`] 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 StatusPageBuilder { builder: glib::object::ObjectBuilder<'static, StatusPage>, } impl StatusPageBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn child(self, child: &impl IsA) -> Self { Self { builder: self.builder.property("child", child.clone().upcast()), } } pub fn description(self, description: impl Into) -> Self { Self { builder: self.builder.property("description", description.into()), } } 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 title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } 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 [`StatusPage`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> StatusPage { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/style_manager.rs000064400000000000000000000335271046102023000167040ustar 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 #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] use crate::AccentColor; use crate::{ffi, ColorScheme}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwStyleManager")] pub struct StyleManager(Object); match fn { type_ => || ffi::adw_style_manager_get_type(), } } impl StyleManager { #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "adw_style_manager_get_accent_color")] #[doc(alias = "get_accent_color")] #[doc(alias = "accent-color")] pub fn accent_color(&self) -> AccentColor { unsafe { from_glib(ffi::adw_style_manager_get_accent_color( self.to_glib_none().0, )) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "adw_style_manager_get_accent_color_rgba")] #[doc(alias = "get_accent_color_rgba")] #[doc(alias = "accent-color-rgba")] pub fn accent_color_rgba(&self) -> gdk::RGBA { unsafe { from_glib_full(ffi::adw_style_manager_get_accent_color_rgba( self.to_glib_none().0, )) } } #[doc(alias = "adw_style_manager_get_color_scheme")] #[doc(alias = "get_color_scheme")] #[doc(alias = "color-scheme")] pub fn color_scheme(&self) -> ColorScheme { unsafe { from_glib(ffi::adw_style_manager_get_color_scheme( self.to_glib_none().0, )) } } #[doc(alias = "adw_style_manager_get_dark")] #[doc(alias = "get_dark")] #[doc(alias = "dark")] pub fn is_dark(&self) -> bool { unsafe { from_glib(ffi::adw_style_manager_get_dark(self.to_glib_none().0)) } } #[doc(alias = "adw_style_manager_get_display")] #[doc(alias = "get_display")] pub fn display(&self) -> Option { unsafe { from_glib_none(ffi::adw_style_manager_get_display(self.to_glib_none().0)) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_style_manager_get_document_font_name")] #[doc(alias = "get_document_font_name")] #[doc(alias = "document-font-name")] pub fn document_font_name(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_style_manager_get_document_font_name( self.to_glib_none().0, )) } } #[doc(alias = "adw_style_manager_get_high_contrast")] #[doc(alias = "get_high_contrast")] #[doc(alias = "high-contrast")] pub fn is_high_contrast(&self) -> bool { unsafe { from_glib(ffi::adw_style_manager_get_high_contrast( self.to_glib_none().0, )) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_style_manager_get_monospace_font_name")] #[doc(alias = "get_monospace_font_name")] #[doc(alias = "monospace-font-name")] pub fn monospace_font_name(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_style_manager_get_monospace_font_name( self.to_glib_none().0, )) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "adw_style_manager_get_system_supports_accent_colors")] #[doc(alias = "get_system_supports_accent_colors")] #[doc(alias = "system-supports-accent-colors")] pub fn is_system_supports_accent_colors(&self) -> bool { unsafe { from_glib(ffi::adw_style_manager_get_system_supports_accent_colors( self.to_glib_none().0, )) } } #[doc(alias = "adw_style_manager_get_system_supports_color_schemes")] #[doc(alias = "get_system_supports_color_schemes")] #[doc(alias = "system-supports-color-schemes")] pub fn system_supports_color_schemes(&self) -> bool { unsafe { from_glib(ffi::adw_style_manager_get_system_supports_color_schemes( self.to_glib_none().0, )) } } #[doc(alias = "adw_style_manager_set_color_scheme")] #[doc(alias = "color-scheme")] pub fn set_color_scheme(&self, color_scheme: ColorScheme) { unsafe { ffi::adw_style_manager_set_color_scheme( self.to_glib_none().0, color_scheme.into_glib(), ); } } #[doc(alias = "adw_style_manager_get_default")] #[doc(alias = "get_default")] #[allow(clippy::should_implement_trait)] pub fn default() -> StyleManager { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::adw_style_manager_get_default()) } } #[doc(alias = "adw_style_manager_get_for_display")] #[doc(alias = "get_for_display")] pub fn for_display(display: &gdk::Display) -> StyleManager { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::adw_style_manager_get_for_display( display.to_glib_none().0, )) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "accent-color")] pub fn connect_accent_color_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_accent_color_trampoline( this: *mut ffi::AdwStyleManager, _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 _, c"notify::accent-color".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_accent_color_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "accent-color-rgba")] pub fn connect_accent_color_rgba_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_accent_color_rgba_trampoline( this: *mut ffi::AdwStyleManager, _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 _, c"notify::accent-color-rgba".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_accent_color_rgba_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "color-scheme")] pub fn connect_color_scheme_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_color_scheme_trampoline( this: *mut ffi::AdwStyleManager, _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 _, c"notify::color-scheme".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_color_scheme_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "dark")] pub fn connect_dark_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_dark_trampoline( this: *mut ffi::AdwStyleManager, _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 _, c"notify::dark".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_dark_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "document-font-name")] pub fn connect_document_font_name_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_document_font_name_trampoline< F: Fn(&StyleManager) + 'static, >( this: *mut ffi::AdwStyleManager, _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 _, c"notify::document-font-name".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_document_font_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "high-contrast")] pub fn connect_high_contrast_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_high_contrast_trampoline( this: *mut ffi::AdwStyleManager, _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 _, c"notify::high-contrast".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_high_contrast_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "monospace-font-name")] pub fn connect_monospace_font_name_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_monospace_font_name_trampoline< F: Fn(&StyleManager) + 'static, >( this: *mut ffi::AdwStyleManager, _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 _, c"notify::monospace-font-name".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_monospace_font_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))] #[doc(alias = "system-supports-accent-colors")] pub fn connect_system_supports_accent_colors_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_system_supports_accent_colors_trampoline< F: Fn(&StyleManager) + 'static, >( this: *mut ffi::AdwStyleManager, _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 _, c"notify::system-supports-accent-colors".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_system_supports_accent_colors_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "system-supports-color-schemes")] pub fn connect_system_supports_color_schemes_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_system_supports_color_schemes_trampoline< F: Fn(&StyleManager) + 'static, >( this: *mut ffi::AdwStyleManager, _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 _, c"notify::system-supports-color-schemes".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_system_supports_color_schemes_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } libadwaita-0.7.2/src/auto/swipe_tracker.rs000064400000000000000000000462221046102023000167100ustar 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, NavigationDirection, Swipeable}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwSwipeTracker")] pub struct SwipeTracker(Object) @implements gtk::Orientable; match fn { type_ => || ffi::adw_swipe_tracker_get_type(), } } impl SwipeTracker { #[doc(alias = "adw_swipe_tracker_new")] pub fn new(swipeable: &impl IsA) -> SwipeTracker { skip_assert_initialized!(); unsafe { from_glib_full(ffi::adw_swipe_tracker_new( swipeable.as_ref().to_glib_none().0, )) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`SwipeTracker`] objects. /// /// This method returns an instance of [`SwipeTrackerBuilder`](crate::builders::SwipeTrackerBuilder) which can be used to create [`SwipeTracker`] objects. pub fn builder() -> SwipeTrackerBuilder { SwipeTrackerBuilder::new() } #[doc(alias = "adw_swipe_tracker_get_allow_long_swipes")] #[doc(alias = "get_allow_long_swipes")] #[doc(alias = "allow-long-swipes")] pub fn allows_long_swipes(&self) -> bool { unsafe { from_glib(ffi::adw_swipe_tracker_get_allow_long_swipes( self.to_glib_none().0, )) } } #[doc(alias = "adw_swipe_tracker_get_allow_mouse_drag")] #[doc(alias = "get_allow_mouse_drag")] #[doc(alias = "allow-mouse-drag")] pub fn allows_mouse_drag(&self) -> bool { unsafe { from_glib(ffi::adw_swipe_tracker_get_allow_mouse_drag( self.to_glib_none().0, )) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "adw_swipe_tracker_get_allow_window_handle")] #[doc(alias = "get_allow_window_handle")] #[doc(alias = "allow-window-handle")] pub fn allows_window_handle(&self) -> bool { unsafe { from_glib(ffi::adw_swipe_tracker_get_allow_window_handle( self.to_glib_none().0, )) } } #[doc(alias = "adw_swipe_tracker_get_enabled")] #[doc(alias = "get_enabled")] #[doc(alias = "enabled")] pub fn is_enabled(&self) -> bool { unsafe { from_glib(ffi::adw_swipe_tracker_get_enabled(self.to_glib_none().0)) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_swipe_tracker_get_lower_overshoot")] #[doc(alias = "get_lower_overshoot")] #[doc(alias = "lower-overshoot")] pub fn is_lower_overshoot(&self) -> bool { unsafe { from_glib(ffi::adw_swipe_tracker_get_lower_overshoot( self.to_glib_none().0, )) } } #[doc(alias = "adw_swipe_tracker_get_reversed")] #[doc(alias = "get_reversed")] #[doc(alias = "reversed")] pub fn is_reversed(&self) -> bool { unsafe { from_glib(ffi::adw_swipe_tracker_get_reversed(self.to_glib_none().0)) } } #[doc(alias = "adw_swipe_tracker_get_swipeable")] #[doc(alias = "get_swipeable")] pub fn swipeable(&self) -> Swipeable { unsafe { from_glib_none(ffi::adw_swipe_tracker_get_swipeable(self.to_glib_none().0)) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_swipe_tracker_get_upper_overshoot")] #[doc(alias = "get_upper_overshoot")] #[doc(alias = "upper-overshoot")] pub fn is_upper_overshoot(&self) -> bool { unsafe { from_glib(ffi::adw_swipe_tracker_get_upper_overshoot( self.to_glib_none().0, )) } } #[doc(alias = "adw_swipe_tracker_set_allow_long_swipes")] #[doc(alias = "allow-long-swipes")] pub fn set_allow_long_swipes(&self, allow_long_swipes: bool) { unsafe { ffi::adw_swipe_tracker_set_allow_long_swipes( self.to_glib_none().0, allow_long_swipes.into_glib(), ); } } #[doc(alias = "adw_swipe_tracker_set_allow_mouse_drag")] #[doc(alias = "allow-mouse-drag")] pub fn set_allow_mouse_drag(&self, allow_mouse_drag: bool) { unsafe { ffi::adw_swipe_tracker_set_allow_mouse_drag( self.to_glib_none().0, allow_mouse_drag.into_glib(), ); } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "adw_swipe_tracker_set_allow_window_handle")] #[doc(alias = "allow-window-handle")] pub fn set_allow_window_handle(&self, allow_window_handle: bool) { unsafe { ffi::adw_swipe_tracker_set_allow_window_handle( self.to_glib_none().0, allow_window_handle.into_glib(), ); } } #[doc(alias = "adw_swipe_tracker_set_enabled")] #[doc(alias = "enabled")] pub fn set_enabled(&self, enabled: bool) { unsafe { ffi::adw_swipe_tracker_set_enabled(self.to_glib_none().0, enabled.into_glib()); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_swipe_tracker_set_lower_overshoot")] #[doc(alias = "lower-overshoot")] pub fn set_lower_overshoot(&self, overshoot: bool) { unsafe { ffi::adw_swipe_tracker_set_lower_overshoot( self.to_glib_none().0, overshoot.into_glib(), ); } } #[doc(alias = "adw_swipe_tracker_set_reversed")] #[doc(alias = "reversed")] pub fn set_reversed(&self, reversed: bool) { unsafe { ffi::adw_swipe_tracker_set_reversed(self.to_glib_none().0, reversed.into_glib()); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_swipe_tracker_set_upper_overshoot")] #[doc(alias = "upper-overshoot")] pub fn set_upper_overshoot(&self, overshoot: bool) { unsafe { ffi::adw_swipe_tracker_set_upper_overshoot( self.to_glib_none().0, overshoot.into_glib(), ); } } #[doc(alias = "adw_swipe_tracker_shift_position")] pub fn shift_position(&self, delta: f64) { unsafe { ffi::adw_swipe_tracker_shift_position(self.to_glib_none().0, delta); } } #[doc(alias = "begin-swipe")] pub fn connect_begin_swipe(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn begin_swipe_trampoline( this: *mut ffi::AdwSwipeTracker, 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 _, c"begin-swipe".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( begin_swipe_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "end-swipe")] pub fn connect_end_swipe(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn end_swipe_trampoline( this: *mut ffi::AdwSwipeTracker, velocity: std::ffi::c_double, to: std::ffi::c_double, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), velocity, to) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"end-swipe".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( end_swipe_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "prepare")] pub fn connect_prepare( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn prepare_trampoline< F: Fn(&SwipeTracker, NavigationDirection) + 'static, >( this: *mut ffi::AdwSwipeTracker, direction: ffi::AdwNavigationDirection, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), from_glib(direction)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"prepare".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( prepare_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "update-swipe")] pub fn connect_update_swipe(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn update_swipe_trampoline( this: *mut ffi::AdwSwipeTracker, progress: std::ffi::c_double, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), progress) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"update-swipe".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( update_swipe_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "allow-long-swipes")] pub fn connect_allow_long_swipes_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_allow_long_swipes_trampoline( this: *mut ffi::AdwSwipeTracker, _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 _, c"notify::allow-long-swipes".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_allow_long_swipes_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "allow-mouse-drag")] pub fn connect_allow_mouse_drag_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_allow_mouse_drag_trampoline( this: *mut ffi::AdwSwipeTracker, _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 _, c"notify::allow-mouse-drag".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_allow_mouse_drag_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "allow-window-handle")] pub fn connect_allow_window_handle_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_allow_window_handle_trampoline< F: Fn(&SwipeTracker) + 'static, >( this: *mut ffi::AdwSwipeTracker, _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 _, c"notify::allow-window-handle".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_allow_window_handle_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "enabled")] pub fn connect_enabled_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_enabled_trampoline( this: *mut ffi::AdwSwipeTracker, _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 _, c"notify::enabled".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_enabled_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "lower-overshoot")] pub fn connect_lower_overshoot_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_lower_overshoot_trampoline( this: *mut ffi::AdwSwipeTracker, _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 _, c"notify::lower-overshoot".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_lower_overshoot_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "reversed")] pub fn connect_reversed_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_reversed_trampoline( this: *mut ffi::AdwSwipeTracker, _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 _, c"notify::reversed".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_reversed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "upper-overshoot")] pub fn connect_upper_overshoot_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_upper_overshoot_trampoline( this: *mut ffi::AdwSwipeTracker, _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 _, c"notify::upper-overshoot".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_upper_overshoot_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for SwipeTracker { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`SwipeTracker`] 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 SwipeTrackerBuilder { builder: glib::object::ObjectBuilder<'static, SwipeTracker>, } impl SwipeTrackerBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn allow_long_swipes(self, allow_long_swipes: bool) -> Self { Self { builder: self .builder .property("allow-long-swipes", allow_long_swipes), } } pub fn allow_mouse_drag(self, allow_mouse_drag: bool) -> Self { Self { builder: self.builder.property("allow-mouse-drag", allow_mouse_drag), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn allow_window_handle(self, allow_window_handle: bool) -> Self { Self { builder: self .builder .property("allow-window-handle", allow_window_handle), } } pub fn enabled(self, enabled: bool) -> Self { Self { builder: self.builder.property("enabled", enabled), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn lower_overshoot(self, lower_overshoot: bool) -> Self { Self { builder: self.builder.property("lower-overshoot", lower_overshoot), } } pub fn reversed(self, reversed: bool) -> Self { Self { builder: self.builder.property("reversed", reversed), } } pub fn swipeable(self, swipeable: &impl IsA) -> Self { Self { builder: self .builder .property("swipeable", swipeable.clone().upcast()), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn upper_overshoot(self, upper_overshoot: bool) -> Self { Self { builder: self.builder.property("upper-overshoot", upper_overshoot), } } pub fn orientation(self, orientation: gtk::Orientation) -> Self { Self { builder: self.builder.property("orientation", orientation), } } // rustdoc-stripper-ignore-next /// Build the [`SwipeTracker`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> SwipeTracker { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/swipeable.rs000064400000000000000000000046311046102023000160170ustar 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, NavigationDirection}; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "AdwSwipeable")] pub struct Swipeable(Interface) @requires gtk::Widget, gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_swipeable_get_type(), } } impl Swipeable { pub const NONE: Option<&'static Swipeable> = None; } pub trait SwipeableExt: IsA + 'static { #[doc(alias = "adw_swipeable_get_cancel_progress")] #[doc(alias = "get_cancel_progress")] fn cancel_progress(&self) -> f64 { unsafe { ffi::adw_swipeable_get_cancel_progress(self.as_ref().to_glib_none().0) } } #[doc(alias = "adw_swipeable_get_distance")] #[doc(alias = "get_distance")] fn distance(&self) -> f64 { unsafe { ffi::adw_swipeable_get_distance(self.as_ref().to_glib_none().0) } } #[doc(alias = "adw_swipeable_get_progress")] #[doc(alias = "get_progress")] fn progress(&self) -> f64 { unsafe { ffi::adw_swipeable_get_progress(self.as_ref().to_glib_none().0) } } #[doc(alias = "adw_swipeable_get_snap_points")] #[doc(alias = "get_snap_points")] fn snap_points(&self) -> Vec { unsafe { let mut n_snap_points = std::mem::MaybeUninit::uninit(); let ret = FromGlibContainer::from_glib_full_num( ffi::adw_swipeable_get_snap_points( self.as_ref().to_glib_none().0, n_snap_points.as_mut_ptr(), ), n_snap_points.assume_init() as _, ); ret } } #[doc(alias = "adw_swipeable_get_swipe_area")] #[doc(alias = "get_swipe_area")] fn swipe_area( &self, navigation_direction: NavigationDirection, is_drag: bool, ) -> gdk::Rectangle { unsafe { let mut rect = gdk::Rectangle::uninitialized(); ffi::adw_swipeable_get_swipe_area( self.as_ref().to_glib_none().0, navigation_direction.into_glib(), is_drag.into_glib(), rect.to_glib_none_mut().0, ); rect } } } impl> SwipeableExt for O {} libadwaita-0.7.2/src/auto/switch_row.rs000064400000000000000000000272441046102023000162410ustar 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, ActionRow, PreferencesRow}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwSwitchRow")] pub struct SwitchRow(Object) @extends ActionRow, PreferencesRow, gtk::ListBoxRow, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Actionable; match fn { type_ => || ffi::adw_switch_row_get_type(), } } impl SwitchRow { #[doc(alias = "adw_switch_row_new")] pub fn new() -> SwitchRow { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_switch_row_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`SwitchRow`] objects. /// /// This method returns an instance of [`SwitchRowBuilder`](crate::builders::SwitchRowBuilder) which can be used to create [`SwitchRow`] objects. pub fn builder() -> SwitchRowBuilder { SwitchRowBuilder::new() } #[doc(alias = "adw_switch_row_get_active")] #[doc(alias = "get_active")] #[doc(alias = "active")] pub fn is_active(&self) -> bool { unsafe { from_glib(ffi::adw_switch_row_get_active(self.to_glib_none().0)) } } #[doc(alias = "adw_switch_row_set_active")] #[doc(alias = "active")] pub fn set_active(&self, is_active: bool) { unsafe { ffi::adw_switch_row_set_active(self.to_glib_none().0, is_active.into_glib()); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "active")] pub fn connect_active_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_active_trampoline( this: *mut ffi::AdwSwitchRow, _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 _, c"notify::active".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_active_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl Default for SwitchRow { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`SwitchRow`] 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 SwitchRowBuilder { builder: glib::object::ObjectBuilder<'static, SwitchRow>, } impl SwitchRowBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn active(self, active: bool) -> Self { Self { builder: self.builder.property("active", active), } } pub fn activatable_widget(self, activatable_widget: &impl IsA) -> Self { Self { builder: self .builder .property("activatable-widget", activatable_widget.clone().upcast()), } } #[cfg_attr(feature = "v1_3", deprecated = "Since 1.3")] pub fn icon_name(self, icon_name: impl Into) -> Self { Self { builder: self.builder.property("icon-name", icon_name.into()), } } pub fn subtitle(self, subtitle: impl Into) -> Self { Self { builder: self.builder.property("subtitle", subtitle.into()), } } pub fn subtitle_lines(self, subtitle_lines: i32) -> Self { Self { builder: self.builder.property("subtitle-lines", subtitle_lines), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn subtitle_selectable(self, subtitle_selectable: bool) -> Self { Self { builder: self .builder .property("subtitle-selectable", subtitle_selectable), } } pub fn title_lines(self, title_lines: i32) -> Self { Self { builder: self.builder.property("title-lines", title_lines), } } pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub fn title_selectable(self, title_selectable: bool) -> Self { Self { builder: self.builder.property("title-selectable", title_selectable), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn use_markup(self, use_markup: bool) -> Self { Self { builder: self.builder.property("use-markup", use_markup), } } pub fn use_underline(self, use_underline: bool) -> Self { Self { builder: self.builder.property("use-underline", use_underline), } } pub fn activatable(self, activatable: bool) -> Self { Self { builder: self.builder.property("activatable", activatable), } } pub fn child(self, child: &impl IsA) -> Self { Self { builder: self.builder.property("child", child.clone().upcast()), } } pub fn selectable(self, selectable: bool) -> Self { Self { builder: self.builder.property("selectable", selectable), } } 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 action_name(self, action_name: impl Into) -> Self { Self { builder: self.builder.property("action-name", action_name.into()), } } pub fn action_target(self, action_target: &glib::Variant) -> Self { Self { builder: self .builder .property("action-target", action_target.clone()), } } // rustdoc-stripper-ignore-next /// Build the [`SwitchRow`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> SwitchRow { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/tab_bar.rs000064400000000000000000000611631046102023000154410ustar 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, TabPage, TabView}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwTabBar")] pub struct TabBar(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_tab_bar_get_type(), } } impl TabBar { #[doc(alias = "adw_tab_bar_new")] pub fn new() -> TabBar { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::adw_tab_bar_new()) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`TabBar`] objects. /// /// This method returns an instance of [`TabBarBuilder`](crate::builders::TabBarBuilder) which can be used to create [`TabBar`] objects. pub fn builder() -> TabBarBuilder { TabBarBuilder::new() } #[doc(alias = "adw_tab_bar_get_autohide")] #[doc(alias = "get_autohide")] #[doc(alias = "autohide")] pub fn is_autohide(&self) -> bool { unsafe { from_glib(ffi::adw_tab_bar_get_autohide(self.to_glib_none().0)) } } #[doc(alias = "adw_tab_bar_get_end_action_widget")] #[doc(alias = "get_end_action_widget")] #[doc(alias = "end-action-widget")] pub fn end_action_widget(&self) -> Option { unsafe { from_glib_none(ffi::adw_tab_bar_get_end_action_widget( self.to_glib_none().0, )) } } #[doc(alias = "adw_tab_bar_get_expand_tabs")] #[doc(alias = "get_expand_tabs")] #[doc(alias = "expand-tabs")] pub fn expands_tabs(&self) -> bool { unsafe { from_glib(ffi::adw_tab_bar_get_expand_tabs(self.to_glib_none().0)) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_tab_bar_get_extra_drag_preferred_action")] #[doc(alias = "get_extra_drag_preferred_action")] #[doc(alias = "extra-drag-preferred-action")] pub fn extra_drag_preferred_action(&self) -> gdk::DragAction { unsafe { from_glib(ffi::adw_tab_bar_get_extra_drag_preferred_action( self.to_glib_none().0, )) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_tab_bar_get_extra_drag_preload")] #[doc(alias = "get_extra_drag_preload")] #[doc(alias = "extra-drag-preload")] pub fn is_extra_drag_preload(&self) -> bool { unsafe { from_glib(ffi::adw_tab_bar_get_extra_drag_preload( self.to_glib_none().0, )) } } #[doc(alias = "adw_tab_bar_get_inverted")] #[doc(alias = "get_inverted")] #[doc(alias = "inverted")] pub fn is_inverted(&self) -> bool { unsafe { from_glib(ffi::adw_tab_bar_get_inverted(self.to_glib_none().0)) } } #[doc(alias = "adw_tab_bar_get_is_overflowing")] #[doc(alias = "get_is_overflowing")] #[doc(alias = "is-overflowing")] pub fn is_overflowing(&self) -> bool { unsafe { from_glib(ffi::adw_tab_bar_get_is_overflowing(self.to_glib_none().0)) } } #[doc(alias = "adw_tab_bar_get_start_action_widget")] #[doc(alias = "get_start_action_widget")] #[doc(alias = "start-action-widget")] pub fn start_action_widget(&self) -> Option { unsafe { from_glib_none(ffi::adw_tab_bar_get_start_action_widget( self.to_glib_none().0, )) } } #[doc(alias = "adw_tab_bar_get_tabs_revealed")] #[doc(alias = "get_tabs_revealed")] #[doc(alias = "tabs-revealed")] pub fn is_tabs_revealed(&self) -> bool { unsafe { from_glib(ffi::adw_tab_bar_get_tabs_revealed(self.to_glib_none().0)) } } #[doc(alias = "adw_tab_bar_get_view")] #[doc(alias = "get_view")] pub fn view(&self) -> Option { unsafe { from_glib_none(ffi::adw_tab_bar_get_view(self.to_glib_none().0)) } } #[doc(alias = "adw_tab_bar_set_autohide")] #[doc(alias = "autohide")] pub fn set_autohide(&self, autohide: bool) { unsafe { ffi::adw_tab_bar_set_autohide(self.to_glib_none().0, autohide.into_glib()); } } #[doc(alias = "adw_tab_bar_set_end_action_widget")] #[doc(alias = "end-action-widget")] pub fn set_end_action_widget(&self, widget: Option<&impl IsA>) { unsafe { ffi::adw_tab_bar_set_end_action_widget( self.to_glib_none().0, widget.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_tab_bar_set_expand_tabs")] #[doc(alias = "expand-tabs")] pub fn set_expand_tabs(&self, expand_tabs: bool) { unsafe { ffi::adw_tab_bar_set_expand_tabs(self.to_glib_none().0, expand_tabs.into_glib()); } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_tab_bar_set_extra_drag_preload")] #[doc(alias = "extra-drag-preload")] pub fn set_extra_drag_preload(&self, preload: bool) { unsafe { ffi::adw_tab_bar_set_extra_drag_preload(self.to_glib_none().0, preload.into_glib()); } } #[doc(alias = "adw_tab_bar_set_inverted")] #[doc(alias = "inverted")] pub fn set_inverted(&self, inverted: bool) { unsafe { ffi::adw_tab_bar_set_inverted(self.to_glib_none().0, inverted.into_glib()); } } #[doc(alias = "adw_tab_bar_set_start_action_widget")] #[doc(alias = "start-action-widget")] pub fn set_start_action_widget(&self, widget: Option<&impl IsA>) { unsafe { ffi::adw_tab_bar_set_start_action_widget( self.to_glib_none().0, widget.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_tab_bar_set_view")] #[doc(alias = "view")] pub fn set_view(&self, view: Option<&TabView>) { unsafe { ffi::adw_tab_bar_set_view(self.to_glib_none().0, view.to_glib_none().0); } } #[doc(alias = "extra-drag-drop")] pub fn connect_extra_drag_drop bool + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn extra_drag_drop_trampoline< F: Fn(&TabBar, &TabPage, &glib::Value) -> bool + 'static, >( this: *mut ffi::AdwTabBar, page: *mut ffi::AdwTabPage, value: *mut glib::gobject_ffi::GValue, f: glib::ffi::gpointer, ) -> glib::ffi::gboolean { let f: &F = &*(f as *const F); f( &from_glib_borrow(this), &from_glib_borrow(page), &from_glib_borrow(value), ) .into_glib() } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"extra-drag-drop".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( extra_drag_drop_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "extra-drag-value")] pub fn connect_extra_drag_value< F: Fn(&Self, &TabPage, &glib::Value) -> gdk::DragAction + 'static, >( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn extra_drag_value_trampoline< F: Fn(&TabBar, &TabPage, &glib::Value) -> gdk::DragAction + 'static, >( this: *mut ffi::AdwTabBar, page: *mut ffi::AdwTabPage, value: *mut glib::gobject_ffi::GValue, f: glib::ffi::gpointer, ) -> gdk::ffi::GdkDragAction { let f: &F = &*(f as *const F); f( &from_glib_borrow(this), &from_glib_borrow(page), &from_glib_borrow(value), ) .into_glib() } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"extra-drag-value".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( extra_drag_value_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "autohide")] pub fn connect_autohide_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_autohide_trampoline( this: *mut ffi::AdwTabBar, _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 _, c"notify::autohide".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_autohide_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "end-action-widget")] pub fn connect_end_action_widget_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_end_action_widget_trampoline( this: *mut ffi::AdwTabBar, _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 _, c"notify::end-action-widget".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_end_action_widget_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "expand-tabs")] pub fn connect_expand_tabs_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_expand_tabs_trampoline( this: *mut ffi::AdwTabBar, _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 _, c"notify::expand-tabs".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_expand_tabs_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "extra-drag-preferred-action")] pub fn connect_extra_drag_preferred_action_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_extra_drag_preferred_action_trampoline< F: Fn(&TabBar) + 'static, >( this: *mut ffi::AdwTabBar, _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 _, c"notify::extra-drag-preferred-action".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_extra_drag_preferred_action_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "extra-drag-preload")] pub fn connect_extra_drag_preload_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_extra_drag_preload_trampoline( this: *mut ffi::AdwTabBar, _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 _, c"notify::extra-drag-preload".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_extra_drag_preload_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "inverted")] pub fn connect_inverted_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_inverted_trampoline( this: *mut ffi::AdwTabBar, _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 _, c"notify::inverted".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_inverted_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "is-overflowing")] pub fn connect_is_overflowing_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_is_overflowing_trampoline( this: *mut ffi::AdwTabBar, _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 _, c"notify::is-overflowing".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_is_overflowing_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "start-action-widget")] pub fn connect_start_action_widget_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_start_action_widget_trampoline( this: *mut ffi::AdwTabBar, _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 _, c"notify::start-action-widget".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_start_action_widget_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "tabs-revealed")] pub fn connect_tabs_revealed_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_tabs_revealed_trampoline( this: *mut ffi::AdwTabBar, _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 _, c"notify::tabs-revealed".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_tabs_revealed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "view")] pub fn connect_view_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_view_trampoline( this: *mut ffi::AdwTabBar, _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 _, c"notify::view".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_view_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for TabBar { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`TabBar`] 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 TabBarBuilder { builder: glib::object::ObjectBuilder<'static, TabBar>, } impl TabBarBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn autohide(self, autohide: bool) -> Self { Self { builder: self.builder.property("autohide", autohide), } } pub fn end_action_widget(self, end_action_widget: &impl IsA) -> Self { Self { builder: self .builder .property("end-action-widget", end_action_widget.clone().upcast()), } } pub fn expand_tabs(self, expand_tabs: bool) -> Self { Self { builder: self.builder.property("expand-tabs", expand_tabs), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn extra_drag_preload(self, extra_drag_preload: bool) -> Self { Self { builder: self .builder .property("extra-drag-preload", extra_drag_preload), } } pub fn inverted(self, inverted: bool) -> Self { Self { builder: self.builder.property("inverted", inverted), } } pub fn start_action_widget(self, start_action_widget: &impl IsA) -> Self { Self { builder: self .builder .property("start-action-widget", start_action_widget.clone().upcast()), } } pub fn view(self, view: &TabView) -> Self { Self { builder: self.builder.property("view", view.clone()), } } 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 [`TabBar`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> TabBar { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/tab_button.rs000064400000000000000000000257641046102023000162170ustar 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, TabView}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwTabButton")] pub struct TabButton(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Actionable; match fn { type_ => || ffi::adw_tab_button_get_type(), } } impl TabButton { #[doc(alias = "adw_tab_button_new")] pub fn new() -> TabButton { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_tab_button_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`TabButton`] objects. /// /// This method returns an instance of [`TabButtonBuilder`](crate::builders::TabButtonBuilder) which can be used to create [`TabButton`] objects. pub fn builder() -> TabButtonBuilder { TabButtonBuilder::new() } #[doc(alias = "adw_tab_button_get_view")] #[doc(alias = "get_view")] pub fn view(&self) -> Option { unsafe { from_glib_none(ffi::adw_tab_button_get_view(self.to_glib_none().0)) } } #[doc(alias = "adw_tab_button_set_view")] #[doc(alias = "view")] pub fn set_view(&self, view: Option<&TabView>) { unsafe { ffi::adw_tab_button_set_view(self.to_glib_none().0, view.to_glib_none().0); } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "activate")] pub fn connect_activate(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn activate_trampoline( this: *mut ffi::AdwTabButton, 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 _, c"activate".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( activate_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn emit_activate(&self) { self.emit_by_name::<()>("activate", &[]); } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "clicked")] pub fn connect_clicked(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn clicked_trampoline( this: *mut ffi::AdwTabButton, 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 _, c"clicked".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( clicked_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn emit_clicked(&self) { self.emit_by_name::<()>("clicked", &[]); } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "view")] pub fn connect_view_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_view_trampoline( this: *mut ffi::AdwTabButton, _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 _, c"notify::view".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_view_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] impl Default for TabButton { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`TabButton`] 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 TabButtonBuilder { builder: glib::object::ObjectBuilder<'static, TabButton>, } impl TabButtonBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn view(self, view: &TabView) -> Self { Self { builder: self.builder.property("view", view.clone()), } } 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 action_name(self, action_name: impl Into) -> Self { Self { builder: self.builder.property("action-name", action_name.into()), } } pub fn action_target(self, action_target: &glib::Variant) -> Self { Self { builder: self .builder .property("action-target", action_target.clone()), } } // rustdoc-stripper-ignore-next /// Build the [`TabButton`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> TabButton { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/tab_overview.rs000064400000000000000000000772431046102023000165510ustar 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, TabPage, TabView}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwTabOverview")] pub struct TabOverview(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_tab_overview_get_type(), } } impl TabOverview { #[doc(alias = "adw_tab_overview_new")] pub fn new() -> TabOverview { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_tab_overview_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`TabOverview`] objects. /// /// This method returns an instance of [`TabOverviewBuilder`](crate::builders::TabOverviewBuilder) which can be used to create [`TabOverview`] objects. pub fn builder() -> TabOverviewBuilder { TabOverviewBuilder::new() } #[doc(alias = "adw_tab_overview_get_child")] #[doc(alias = "get_child")] pub fn child(&self) -> Option { unsafe { from_glib_none(ffi::adw_tab_overview_get_child(self.to_glib_none().0)) } } #[doc(alias = "adw_tab_overview_get_enable_new_tab")] #[doc(alias = "get_enable_new_tab")] #[doc(alias = "enable-new-tab")] pub fn enables_new_tab(&self) -> bool { unsafe { from_glib(ffi::adw_tab_overview_get_enable_new_tab( self.to_glib_none().0, )) } } #[doc(alias = "adw_tab_overview_get_enable_search")] #[doc(alias = "get_enable_search")] #[doc(alias = "enable-search")] pub fn enables_search(&self) -> bool { unsafe { from_glib(ffi::adw_tab_overview_get_enable_search( self.to_glib_none().0, )) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_tab_overview_get_extra_drag_preferred_action")] #[doc(alias = "get_extra_drag_preferred_action")] #[doc(alias = "extra-drag-preferred-action")] pub fn extra_drag_preferred_action(&self) -> gdk::DragAction { unsafe { from_glib(ffi::adw_tab_overview_get_extra_drag_preferred_action( self.to_glib_none().0, )) } } #[doc(alias = "adw_tab_overview_get_extra_drag_preload")] #[doc(alias = "get_extra_drag_preload")] #[doc(alias = "extra-drag-preload")] pub fn is_extra_drag_preload(&self) -> bool { unsafe { from_glib(ffi::adw_tab_overview_get_extra_drag_preload( self.to_glib_none().0, )) } } #[doc(alias = "adw_tab_overview_get_inverted")] #[doc(alias = "get_inverted")] #[doc(alias = "inverted")] pub fn is_inverted(&self) -> bool { unsafe { from_glib(ffi::adw_tab_overview_get_inverted(self.to_glib_none().0)) } } #[doc(alias = "adw_tab_overview_get_open")] #[doc(alias = "get_open")] #[doc(alias = "open")] pub fn is_open(&self) -> bool { unsafe { from_glib(ffi::adw_tab_overview_get_open(self.to_glib_none().0)) } } #[doc(alias = "adw_tab_overview_get_search_active")] #[doc(alias = "get_search_active")] #[doc(alias = "search-active")] pub fn is_search_active(&self) -> bool { unsafe { from_glib(ffi::adw_tab_overview_get_search_active( self.to_glib_none().0, )) } } #[doc(alias = "adw_tab_overview_get_secondary_menu")] #[doc(alias = "get_secondary_menu")] #[doc(alias = "secondary-menu")] pub fn secondary_menu(&self) -> Option { unsafe { from_glib_none(ffi::adw_tab_overview_get_secondary_menu( self.to_glib_none().0, )) } } #[doc(alias = "adw_tab_overview_get_show_end_title_buttons")] #[doc(alias = "get_show_end_title_buttons")] #[doc(alias = "show-end-title-buttons")] pub fn shows_end_title_buttons(&self) -> bool { unsafe { from_glib(ffi::adw_tab_overview_get_show_end_title_buttons( self.to_glib_none().0, )) } } #[doc(alias = "adw_tab_overview_get_show_start_title_buttons")] #[doc(alias = "get_show_start_title_buttons")] #[doc(alias = "show-start-title-buttons")] pub fn shows_start_title_buttons(&self) -> bool { unsafe { from_glib(ffi::adw_tab_overview_get_show_start_title_buttons( self.to_glib_none().0, )) } } #[doc(alias = "adw_tab_overview_get_view")] #[doc(alias = "get_view")] pub fn view(&self) -> Option { unsafe { from_glib_none(ffi::adw_tab_overview_get_view(self.to_glib_none().0)) } } #[doc(alias = "adw_tab_overview_set_child")] #[doc(alias = "child")] pub fn set_child(&self, child: Option<&impl IsA>) { unsafe { ffi::adw_tab_overview_set_child( self.to_glib_none().0, child.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_tab_overview_set_enable_new_tab")] #[doc(alias = "enable-new-tab")] pub fn set_enable_new_tab(&self, enable_new_tab: bool) { unsafe { ffi::adw_tab_overview_set_enable_new_tab( self.to_glib_none().0, enable_new_tab.into_glib(), ); } } #[doc(alias = "adw_tab_overview_set_enable_search")] #[doc(alias = "enable-search")] pub fn set_enable_search(&self, enable_search: bool) { unsafe { ffi::adw_tab_overview_set_enable_search( self.to_glib_none().0, enable_search.into_glib(), ); } } #[doc(alias = "adw_tab_overview_set_extra_drag_preload")] #[doc(alias = "extra-drag-preload")] pub fn set_extra_drag_preload(&self, preload: bool) { unsafe { ffi::adw_tab_overview_set_extra_drag_preload( self.to_glib_none().0, preload.into_glib(), ); } } #[doc(alias = "adw_tab_overview_set_inverted")] #[doc(alias = "inverted")] pub fn set_inverted(&self, inverted: bool) { unsafe { ffi::adw_tab_overview_set_inverted(self.to_glib_none().0, inverted.into_glib()); } } #[doc(alias = "adw_tab_overview_set_open")] #[doc(alias = "open")] pub fn set_open(&self, open: bool) { unsafe { ffi::adw_tab_overview_set_open(self.to_glib_none().0, open.into_glib()); } } #[doc(alias = "adw_tab_overview_set_secondary_menu")] #[doc(alias = "secondary-menu")] pub fn set_secondary_menu(&self, secondary_menu: Option<&impl IsA>) { unsafe { ffi::adw_tab_overview_set_secondary_menu( self.to_glib_none().0, secondary_menu.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_tab_overview_set_show_end_title_buttons")] #[doc(alias = "show-end-title-buttons")] pub fn set_show_end_title_buttons(&self, show_end_title_buttons: bool) { unsafe { ffi::adw_tab_overview_set_show_end_title_buttons( self.to_glib_none().0, show_end_title_buttons.into_glib(), ); } } #[doc(alias = "adw_tab_overview_set_show_start_title_buttons")] #[doc(alias = "show-start-title-buttons")] pub fn set_show_start_title_buttons(&self, show_start_title_buttons: bool) { unsafe { ffi::adw_tab_overview_set_show_start_title_buttons( self.to_glib_none().0, show_start_title_buttons.into_glib(), ); } } #[doc(alias = "adw_tab_overview_set_view")] #[doc(alias = "view")] pub fn set_view(&self, view: Option<&TabView>) { unsafe { ffi::adw_tab_overview_set_view(self.to_glib_none().0, view.to_glib_none().0); } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "create-tab")] pub fn connect_create_tab TabPage + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn create_tab_trampoline TabPage + 'static>( this: *mut ffi::AdwTabOverview, f: glib::ffi::gpointer, ) -> *mut ffi::AdwTabPage { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) /*Not checked*/ .to_glib_none() .0 } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"create-tab".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( create_tab_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "extra-drag-drop")] pub fn connect_extra_drag_drop bool + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn extra_drag_drop_trampoline< F: Fn(&TabOverview, &TabPage, &glib::Value) -> bool + 'static, >( this: *mut ffi::AdwTabOverview, page: *mut ffi::AdwTabPage, value: *mut glib::gobject_ffi::GValue, f: glib::ffi::gpointer, ) -> glib::ffi::gboolean { let f: &F = &*(f as *const F); f( &from_glib_borrow(this), &from_glib_borrow(page), &from_glib_borrow(value), ) .into_glib() } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"extra-drag-drop".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( extra_drag_drop_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "extra-drag-value")] pub fn connect_extra_drag_value< F: Fn(&Self, &TabPage, &glib::Value) -> gdk::DragAction + 'static, >( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn extra_drag_value_trampoline< F: Fn(&TabOverview, &TabPage, &glib::Value) -> gdk::DragAction + 'static, >( this: *mut ffi::AdwTabOverview, page: *mut ffi::AdwTabPage, value: *mut glib::gobject_ffi::GValue, f: glib::ffi::gpointer, ) -> gdk::ffi::GdkDragAction { let f: &F = &*(f as *const F); f( &from_glib_borrow(this), &from_glib_borrow(page), &from_glib_borrow(value), ) .into_glib() } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"extra-drag-value".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( extra_drag_value_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "child")] pub fn connect_child_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_child_trampoline( this: *mut ffi::AdwTabOverview, _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 _, c"notify::child".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_child_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "enable-new-tab")] pub fn connect_enable_new_tab_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_enable_new_tab_trampoline( this: *mut ffi::AdwTabOverview, _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 _, c"notify::enable-new-tab".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_enable_new_tab_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "enable-search")] pub fn connect_enable_search_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_enable_search_trampoline( this: *mut ffi::AdwTabOverview, _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 _, c"notify::enable-search".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_enable_search_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "extra-drag-preferred-action")] pub fn connect_extra_drag_preferred_action_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_extra_drag_preferred_action_trampoline< F: Fn(&TabOverview) + 'static, >( this: *mut ffi::AdwTabOverview, _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 _, c"notify::extra-drag-preferred-action".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_extra_drag_preferred_action_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "extra-drag-preload")] pub fn connect_extra_drag_preload_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_extra_drag_preload_trampoline( this: *mut ffi::AdwTabOverview, _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 _, c"notify::extra-drag-preload".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_extra_drag_preload_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "inverted")] pub fn connect_inverted_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_inverted_trampoline( this: *mut ffi::AdwTabOverview, _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 _, c"notify::inverted".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_inverted_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "open")] pub fn connect_open_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_open_trampoline( this: *mut ffi::AdwTabOverview, _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 _, c"notify::open".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_open_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "search-active")] pub fn connect_search_active_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_search_active_trampoline( this: *mut ffi::AdwTabOverview, _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 _, c"notify::search-active".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_search_active_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "secondary-menu")] pub fn connect_secondary_menu_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_secondary_menu_trampoline( this: *mut ffi::AdwTabOverview, _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 _, c"notify::secondary-menu".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_secondary_menu_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "show-end-title-buttons")] pub fn connect_show_end_title_buttons_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_show_end_title_buttons_trampoline< F: Fn(&TabOverview) + 'static, >( this: *mut ffi::AdwTabOverview, _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 _, c"notify::show-end-title-buttons".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_show_end_title_buttons_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "show-start-title-buttons")] pub fn connect_show_start_title_buttons_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_show_start_title_buttons_trampoline< F: Fn(&TabOverview) + 'static, >( this: *mut ffi::AdwTabOverview, _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 _, c"notify::show-start-title-buttons".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_show_start_title_buttons_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "view")] pub fn connect_view_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_view_trampoline( this: *mut ffi::AdwTabOverview, _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 _, c"notify::view".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_view_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] impl Default for TabOverview { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`TabOverview`] 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 TabOverviewBuilder { builder: glib::object::ObjectBuilder<'static, TabOverview>, } impl TabOverviewBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn child(self, child: &impl IsA) -> Self { Self { builder: self.builder.property("child", child.clone().upcast()), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn enable_new_tab(self, enable_new_tab: bool) -> Self { Self { builder: self.builder.property("enable-new-tab", enable_new_tab), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn enable_search(self, enable_search: bool) -> Self { Self { builder: self.builder.property("enable-search", enable_search), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn extra_drag_preload(self, extra_drag_preload: bool) -> Self { Self { builder: self .builder .property("extra-drag-preload", extra_drag_preload), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn inverted(self, inverted: bool) -> Self { Self { builder: self.builder.property("inverted", inverted), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn open(self, open: bool) -> Self { Self { builder: self.builder.property("open", open), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn secondary_menu(self, secondary_menu: &impl IsA) -> Self { Self { builder: self .builder .property("secondary-menu", secondary_menu.clone().upcast()), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn show_end_title_buttons(self, show_end_title_buttons: bool) -> Self { Self { builder: self .builder .property("show-end-title-buttons", show_end_title_buttons), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn show_start_title_buttons(self, show_start_title_buttons: bool) -> Self { Self { builder: self .builder .property("show-start-title-buttons", show_start_title_buttons), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn view(self, view: &TabView) -> Self { Self { builder: self.builder.property("view", view.clone()), } } 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 [`TabOverview`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> TabOverview { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/tab_page.rs000064400000000000000000000525621046102023000156140ustar 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 = "AdwTabPage")] pub struct TabPage(Object) @implements gtk::Accessible; match fn { type_ => || ffi::adw_tab_page_get_type(), } } impl TabPage { #[doc(alias = "adw_tab_page_get_child")] #[doc(alias = "get_child")] pub fn child(&self) -> gtk::Widget { unsafe { from_glib_none(ffi::adw_tab_page_get_child(self.to_glib_none().0)) } } #[doc(alias = "adw_tab_page_get_icon")] #[doc(alias = "get_icon")] pub fn icon(&self) -> Option { unsafe { from_glib_none(ffi::adw_tab_page_get_icon(self.to_glib_none().0)) } } #[doc(alias = "adw_tab_page_get_indicator_activatable")] #[doc(alias = "get_indicator_activatable")] #[doc(alias = "indicator-activatable")] pub fn is_indicator_activatable(&self) -> bool { unsafe { from_glib(ffi::adw_tab_page_get_indicator_activatable( self.to_glib_none().0, )) } } #[doc(alias = "adw_tab_page_get_indicator_icon")] #[doc(alias = "get_indicator_icon")] #[doc(alias = "indicator-icon")] pub fn indicator_icon(&self) -> Option { unsafe { from_glib_none(ffi::adw_tab_page_get_indicator_icon(self.to_glib_none().0)) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "adw_tab_page_get_indicator_tooltip")] #[doc(alias = "get_indicator_tooltip")] #[doc(alias = "indicator-tooltip")] pub fn indicator_tooltip(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_tab_page_get_indicator_tooltip( self.to_glib_none().0, )) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_tab_page_get_keyword")] #[doc(alias = "get_keyword")] pub fn keyword(&self) -> Option { unsafe { from_glib_none(ffi::adw_tab_page_get_keyword(self.to_glib_none().0)) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_tab_page_get_live_thumbnail")] #[doc(alias = "get_live_thumbnail")] #[doc(alias = "live-thumbnail")] pub fn is_live_thumbnail(&self) -> bool { unsafe { from_glib(ffi::adw_tab_page_get_live_thumbnail(self.to_glib_none().0)) } } #[doc(alias = "adw_tab_page_get_loading")] #[doc(alias = "get_loading")] #[doc(alias = "loading")] pub fn is_loading(&self) -> bool { unsafe { from_glib(ffi::adw_tab_page_get_loading(self.to_glib_none().0)) } } #[doc(alias = "adw_tab_page_get_needs_attention")] #[doc(alias = "get_needs_attention")] #[doc(alias = "needs-attention")] pub fn needs_attention(&self) -> bool { unsafe { from_glib(ffi::adw_tab_page_get_needs_attention(self.to_glib_none().0)) } } #[doc(alias = "adw_tab_page_get_parent")] #[doc(alias = "get_parent")] #[must_use] pub fn parent(&self) -> Option { unsafe { from_glib_none(ffi::adw_tab_page_get_parent(self.to_glib_none().0)) } } #[doc(alias = "adw_tab_page_get_pinned")] #[doc(alias = "get_pinned")] #[doc(alias = "pinned")] pub fn is_pinned(&self) -> bool { unsafe { from_glib(ffi::adw_tab_page_get_pinned(self.to_glib_none().0)) } } #[doc(alias = "adw_tab_page_get_selected")] #[doc(alias = "get_selected")] #[doc(alias = "selected")] pub fn is_selected(&self) -> bool { unsafe { from_glib(ffi::adw_tab_page_get_selected(self.to_glib_none().0)) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_tab_page_get_thumbnail_xalign")] #[doc(alias = "get_thumbnail_xalign")] #[doc(alias = "thumbnail-xalign")] pub fn thumbnail_xalign(&self) -> f32 { unsafe { ffi::adw_tab_page_get_thumbnail_xalign(self.to_glib_none().0) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_tab_page_get_thumbnail_yalign")] #[doc(alias = "get_thumbnail_yalign")] #[doc(alias = "thumbnail-yalign")] pub fn thumbnail_yalign(&self) -> f32 { unsafe { ffi::adw_tab_page_get_thumbnail_yalign(self.to_glib_none().0) } } #[doc(alias = "adw_tab_page_get_title")] #[doc(alias = "get_title")] pub fn title(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_tab_page_get_title(self.to_glib_none().0)) } } #[doc(alias = "adw_tab_page_get_tooltip")] #[doc(alias = "get_tooltip")] pub fn tooltip(&self) -> Option { unsafe { from_glib_none(ffi::adw_tab_page_get_tooltip(self.to_glib_none().0)) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_tab_page_invalidate_thumbnail")] pub fn invalidate_thumbnail(&self) { unsafe { ffi::adw_tab_page_invalidate_thumbnail(self.to_glib_none().0); } } #[doc(alias = "adw_tab_page_set_icon")] #[doc(alias = "icon")] pub fn set_icon(&self, icon: Option<&impl IsA>) { unsafe { ffi::adw_tab_page_set_icon( self.to_glib_none().0, icon.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_tab_page_set_indicator_activatable")] #[doc(alias = "indicator-activatable")] pub fn set_indicator_activatable(&self, activatable: bool) { unsafe { ffi::adw_tab_page_set_indicator_activatable( self.to_glib_none().0, activatable.into_glib(), ); } } #[doc(alias = "adw_tab_page_set_indicator_icon")] #[doc(alias = "indicator-icon")] pub fn set_indicator_icon(&self, indicator_icon: Option<&impl IsA>) { unsafe { ffi::adw_tab_page_set_indicator_icon( self.to_glib_none().0, indicator_icon.map(|p| p.as_ref()).to_glib_none().0, ); } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "adw_tab_page_set_indicator_tooltip")] #[doc(alias = "indicator-tooltip")] pub fn set_indicator_tooltip(&self, tooltip: &str) { unsafe { ffi::adw_tab_page_set_indicator_tooltip( self.to_glib_none().0, tooltip.to_glib_none().0, ); } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_tab_page_set_keyword")] #[doc(alias = "keyword")] pub fn set_keyword(&self, keyword: &str) { unsafe { ffi::adw_tab_page_set_keyword(self.to_glib_none().0, keyword.to_glib_none().0); } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_tab_page_set_live_thumbnail")] #[doc(alias = "live-thumbnail")] pub fn set_live_thumbnail(&self, live_thumbnail: bool) { unsafe { ffi::adw_tab_page_set_live_thumbnail(self.to_glib_none().0, live_thumbnail.into_glib()); } } #[doc(alias = "adw_tab_page_set_loading")] #[doc(alias = "loading")] pub fn set_loading(&self, loading: bool) { unsafe { ffi::adw_tab_page_set_loading(self.to_glib_none().0, loading.into_glib()); } } #[doc(alias = "adw_tab_page_set_needs_attention")] #[doc(alias = "needs-attention")] pub fn set_needs_attention(&self, needs_attention: bool) { unsafe { ffi::adw_tab_page_set_needs_attention( self.to_glib_none().0, needs_attention.into_glib(), ); } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_tab_page_set_thumbnail_xalign")] #[doc(alias = "thumbnail-xalign")] pub fn set_thumbnail_xalign(&self, xalign: f32) { unsafe { ffi::adw_tab_page_set_thumbnail_xalign(self.to_glib_none().0, xalign); } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_tab_page_set_thumbnail_yalign")] #[doc(alias = "thumbnail-yalign")] pub fn set_thumbnail_yalign(&self, yalign: f32) { unsafe { ffi::adw_tab_page_set_thumbnail_yalign(self.to_glib_none().0, yalign); } } #[doc(alias = "adw_tab_page_set_title")] #[doc(alias = "title")] pub fn set_title(&self, title: &str) { unsafe { ffi::adw_tab_page_set_title(self.to_glib_none().0, title.to_glib_none().0); } } #[doc(alias = "adw_tab_page_set_tooltip")] #[doc(alias = "tooltip")] pub fn set_tooltip(&self, tooltip: &str) { unsafe { ffi::adw_tab_page_set_tooltip(self.to_glib_none().0, tooltip.to_glib_none().0); } } #[doc(alias = "icon")] pub fn connect_icon_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_icon_trampoline( this: *mut ffi::AdwTabPage, _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 _, c"notify::icon".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_icon_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "indicator-activatable")] pub fn connect_indicator_activatable_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_indicator_activatable_trampoline( this: *mut ffi::AdwTabPage, _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 _, c"notify::indicator-activatable".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_indicator_activatable_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "indicator-icon")] pub fn connect_indicator_icon_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_indicator_icon_trampoline( this: *mut ffi::AdwTabPage, _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 _, c"notify::indicator-icon".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_indicator_icon_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "indicator-tooltip")] pub fn connect_indicator_tooltip_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_indicator_tooltip_trampoline( this: *mut ffi::AdwTabPage, _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 _, c"notify::indicator-tooltip".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_indicator_tooltip_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "keyword")] pub fn connect_keyword_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_keyword_trampoline( this: *mut ffi::AdwTabPage, _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 _, c"notify::keyword".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_keyword_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "live-thumbnail")] pub fn connect_live_thumbnail_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_live_thumbnail_trampoline( this: *mut ffi::AdwTabPage, _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 _, c"notify::live-thumbnail".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_live_thumbnail_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "loading")] pub fn connect_loading_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_loading_trampoline( this: *mut ffi::AdwTabPage, _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 _, c"notify::loading".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_loading_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "needs-attention")] pub fn connect_needs_attention_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_needs_attention_trampoline( this: *mut ffi::AdwTabPage, _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 _, c"notify::needs-attention".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_needs_attention_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "pinned")] pub fn connect_pinned_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_pinned_trampoline( this: *mut ffi::AdwTabPage, _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 _, c"notify::pinned".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_pinned_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "selected")] pub fn connect_selected_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_selected_trampoline( this: *mut ffi::AdwTabPage, _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 _, c"notify::selected".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_selected_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "thumbnail-xalign")] pub fn connect_thumbnail_xalign_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_thumbnail_xalign_trampoline( this: *mut ffi::AdwTabPage, _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 _, c"notify::thumbnail-xalign".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_thumbnail_xalign_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "thumbnail-yalign")] pub fn connect_thumbnail_yalign_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_thumbnail_yalign_trampoline( this: *mut ffi::AdwTabPage, _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 _, c"notify::thumbnail-yalign".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_thumbnail_yalign_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "title")] pub fn connect_title_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_trampoline( this: *mut ffi::AdwTabPage, _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 _, c"notify::title".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "tooltip")] pub fn connect_tooltip_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_tooltip_trampoline( this: *mut ffi::AdwTabPage, _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 _, c"notify::tooltip".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_tooltip_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } libadwaita-0.7.2/src/auto/tab_view.rs000064400000000000000000001007251046102023000156450ustar 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 #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] use crate::TabViewShortcuts; use crate::{ffi, TabPage}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwTabView")] pub struct TabView(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_tab_view_get_type(), } } impl TabView { #[doc(alias = "adw_tab_view_new")] pub fn new() -> TabView { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::adw_tab_view_new()) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`TabView`] objects. /// /// This method returns an instance of [`TabViewBuilder`](crate::builders::TabViewBuilder) which can be used to create [`TabView`] objects. pub fn builder() -> TabViewBuilder { TabViewBuilder::new() } #[doc(alias = "adw_tab_view_add_page")] pub fn add_page(&self, child: &impl IsA, parent: Option<&TabPage>) -> TabPage { unsafe { from_glib_none(ffi::adw_tab_view_add_page( self.to_glib_none().0, child.as_ref().to_glib_none().0, parent.to_glib_none().0, )) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "adw_tab_view_add_shortcuts")] pub fn add_shortcuts(&self, shortcuts: TabViewShortcuts) { unsafe { ffi::adw_tab_view_add_shortcuts(self.to_glib_none().0, shortcuts.into_glib()); } } #[doc(alias = "adw_tab_view_append")] pub fn append(&self, child: &impl IsA) -> TabPage { unsafe { from_glib_none(ffi::adw_tab_view_append( self.to_glib_none().0, child.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_tab_view_append_pinned")] pub fn append_pinned(&self, child: &impl IsA) -> TabPage { unsafe { from_glib_none(ffi::adw_tab_view_append_pinned( self.to_glib_none().0, child.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_tab_view_close_other_pages")] pub fn close_other_pages(&self, page: &TabPage) { unsafe { ffi::adw_tab_view_close_other_pages(self.to_glib_none().0, page.to_glib_none().0); } } #[doc(alias = "adw_tab_view_close_page")] pub fn close_page(&self, page: &TabPage) { unsafe { ffi::adw_tab_view_close_page(self.to_glib_none().0, page.to_glib_none().0); } } #[doc(alias = "adw_tab_view_close_page_finish")] pub fn close_page_finish(&self, page: &TabPage, confirm: bool) { unsafe { ffi::adw_tab_view_close_page_finish( self.to_glib_none().0, page.to_glib_none().0, confirm.into_glib(), ); } } #[doc(alias = "adw_tab_view_close_pages_after")] pub fn close_pages_after(&self, page: &TabPage) { unsafe { ffi::adw_tab_view_close_pages_after(self.to_glib_none().0, page.to_glib_none().0); } } #[doc(alias = "adw_tab_view_close_pages_before")] pub fn close_pages_before(&self, page: &TabPage) { unsafe { ffi::adw_tab_view_close_pages_before(self.to_glib_none().0, page.to_glib_none().0); } } #[doc(alias = "adw_tab_view_get_default_icon")] #[doc(alias = "get_default_icon")] #[doc(alias = "default-icon")] pub fn default_icon(&self) -> gio::Icon { unsafe { from_glib_none(ffi::adw_tab_view_get_default_icon(self.to_glib_none().0)) } } #[doc(alias = "adw_tab_view_get_is_transferring_page")] #[doc(alias = "get_is_transferring_page")] #[doc(alias = "is-transferring-page")] pub fn is_transferring_page(&self) -> bool { unsafe { from_glib(ffi::adw_tab_view_get_is_transferring_page( self.to_glib_none().0, )) } } #[doc(alias = "adw_tab_view_get_menu_model")] #[doc(alias = "get_menu_model")] #[doc(alias = "menu-model")] pub fn menu_model(&self) -> Option { unsafe { from_glib_none(ffi::adw_tab_view_get_menu_model(self.to_glib_none().0)) } } #[doc(alias = "adw_tab_view_get_n_pages")] #[doc(alias = "get_n_pages")] #[doc(alias = "n-pages")] pub fn n_pages(&self) -> i32 { unsafe { ffi::adw_tab_view_get_n_pages(self.to_glib_none().0) } } #[doc(alias = "adw_tab_view_get_n_pinned_pages")] #[doc(alias = "get_n_pinned_pages")] #[doc(alias = "n-pinned-pages")] pub fn n_pinned_pages(&self) -> i32 { unsafe { ffi::adw_tab_view_get_n_pinned_pages(self.to_glib_none().0) } } #[doc(alias = "adw_tab_view_get_page")] #[doc(alias = "get_page")] pub fn page(&self, child: &impl IsA) -> TabPage { unsafe { from_glib_none(ffi::adw_tab_view_get_page( self.to_glib_none().0, child.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_tab_view_get_page_position")] #[doc(alias = "get_page_position")] pub fn page_position(&self, page: &TabPage) -> i32 { unsafe { ffi::adw_tab_view_get_page_position(self.to_glib_none().0, page.to_glib_none().0) } } #[doc(alias = "adw_tab_view_get_pages")] #[doc(alias = "get_pages")] pub fn pages(&self) -> gtk::SelectionModel { unsafe { from_glib_full(ffi::adw_tab_view_get_pages(self.to_glib_none().0)) } } #[doc(alias = "adw_tab_view_get_selected_page")] #[doc(alias = "get_selected_page")] #[doc(alias = "selected-page")] pub fn selected_page(&self) -> Option { unsafe { from_glib_none(ffi::adw_tab_view_get_selected_page(self.to_glib_none().0)) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "adw_tab_view_get_shortcuts")] #[doc(alias = "get_shortcuts")] pub fn shortcuts(&self) -> TabViewShortcuts { unsafe { from_glib(ffi::adw_tab_view_get_shortcuts(self.to_glib_none().0)) } } #[doc(alias = "adw_tab_view_insert")] pub fn insert(&self, child: &impl IsA, position: i32) -> TabPage { unsafe { from_glib_none(ffi::adw_tab_view_insert( self.to_glib_none().0, child.as_ref().to_glib_none().0, position, )) } } #[doc(alias = "adw_tab_view_insert_pinned")] pub fn insert_pinned(&self, child: &impl IsA, position: i32) -> TabPage { unsafe { from_glib_none(ffi::adw_tab_view_insert_pinned( self.to_glib_none().0, child.as_ref().to_glib_none().0, position, )) } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_tab_view_invalidate_thumbnails")] pub fn invalidate_thumbnails(&self) { unsafe { ffi::adw_tab_view_invalidate_thumbnails(self.to_glib_none().0); } } #[doc(alias = "adw_tab_view_prepend")] pub fn prepend(&self, child: &impl IsA) -> TabPage { unsafe { from_glib_none(ffi::adw_tab_view_prepend( self.to_glib_none().0, child.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_tab_view_prepend_pinned")] pub fn prepend_pinned(&self, child: &impl IsA) -> TabPage { unsafe { from_glib_none(ffi::adw_tab_view_prepend_pinned( self.to_glib_none().0, child.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "adw_tab_view_remove_shortcuts")] pub fn remove_shortcuts(&self, shortcuts: TabViewShortcuts) { unsafe { ffi::adw_tab_view_remove_shortcuts(self.to_glib_none().0, shortcuts.into_glib()); } } #[doc(alias = "adw_tab_view_reorder_backward")] pub fn reorder_backward(&self, page: &TabPage) -> bool { unsafe { from_glib(ffi::adw_tab_view_reorder_backward( self.to_glib_none().0, page.to_glib_none().0, )) } } #[doc(alias = "adw_tab_view_reorder_first")] pub fn reorder_first(&self, page: &TabPage) -> bool { unsafe { from_glib(ffi::adw_tab_view_reorder_first( self.to_glib_none().0, page.to_glib_none().0, )) } } #[doc(alias = "adw_tab_view_reorder_forward")] pub fn reorder_forward(&self, page: &TabPage) -> bool { unsafe { from_glib(ffi::adw_tab_view_reorder_forward( self.to_glib_none().0, page.to_glib_none().0, )) } } #[doc(alias = "adw_tab_view_reorder_last")] pub fn reorder_last(&self, page: &TabPage) -> bool { unsafe { from_glib(ffi::adw_tab_view_reorder_last( self.to_glib_none().0, page.to_glib_none().0, )) } } #[doc(alias = "adw_tab_view_reorder_page")] pub fn reorder_page(&self, page: &TabPage, position: i32) -> bool { unsafe { from_glib(ffi::adw_tab_view_reorder_page( self.to_glib_none().0, page.to_glib_none().0, position, )) } } #[doc(alias = "adw_tab_view_select_next_page")] pub fn select_next_page(&self) -> bool { unsafe { from_glib(ffi::adw_tab_view_select_next_page(self.to_glib_none().0)) } } #[doc(alias = "adw_tab_view_select_previous_page")] pub fn select_previous_page(&self) -> bool { unsafe { from_glib(ffi::adw_tab_view_select_previous_page( self.to_glib_none().0, )) } } #[doc(alias = "adw_tab_view_set_default_icon")] #[doc(alias = "default-icon")] pub fn set_default_icon(&self, default_icon: &impl IsA) { unsafe { ffi::adw_tab_view_set_default_icon( self.to_glib_none().0, default_icon.as_ref().to_glib_none().0, ); } } #[doc(alias = "adw_tab_view_set_menu_model")] #[doc(alias = "menu-model")] pub fn set_menu_model(&self, menu_model: Option<&impl IsA>) { unsafe { ffi::adw_tab_view_set_menu_model( self.to_glib_none().0, menu_model.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_tab_view_set_page_pinned")] pub fn set_page_pinned(&self, page: &TabPage, pinned: bool) { unsafe { ffi::adw_tab_view_set_page_pinned( self.to_glib_none().0, page.to_glib_none().0, pinned.into_glib(), ); } } #[doc(alias = "adw_tab_view_set_selected_page")] #[doc(alias = "selected-page")] pub fn set_selected_page(&self, selected_page: &TabPage) { unsafe { ffi::adw_tab_view_set_selected_page( self.to_glib_none().0, selected_page.to_glib_none().0, ); } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "adw_tab_view_set_shortcuts")] #[doc(alias = "shortcuts")] pub fn set_shortcuts(&self, shortcuts: TabViewShortcuts) { unsafe { ffi::adw_tab_view_set_shortcuts(self.to_glib_none().0, shortcuts.into_glib()); } } #[doc(alias = "adw_tab_view_transfer_page")] pub fn transfer_page(&self, page: &TabPage, other_view: &TabView, position: i32) { unsafe { ffi::adw_tab_view_transfer_page( self.to_glib_none().0, page.to_glib_none().0, other_view.to_glib_none().0, position, ); } } #[doc(alias = "close-page")] pub fn connect_close_page glib::Propagation + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn close_page_trampoline< F: Fn(&TabView, &TabPage) -> glib::Propagation + 'static, >( this: *mut ffi::AdwTabView, page: *mut ffi::AdwTabPage, f: glib::ffi::gpointer, ) -> glib::ffi::gboolean { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(page)).into_glib() } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"close-page".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( close_page_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "create-window")] pub fn connect_create_window Option + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn create_window_trampoline< F: Fn(&TabView) -> Option + 'static, >( this: *mut ffi::AdwTabView, f: glib::ffi::gpointer, ) -> *mut ffi::AdwTabView { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) /*Not checked*/ .to_glib_none() .0 } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"create-window".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( create_window_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "indicator-activated")] pub fn connect_indicator_activated( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn indicator_activated_trampoline( this: *mut ffi::AdwTabView, page: *mut ffi::AdwTabPage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(page)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"indicator-activated".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( indicator_activated_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "page-attached")] pub fn connect_page_attached( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn page_attached_trampoline( this: *mut ffi::AdwTabView, page: *mut ffi::AdwTabPage, position: std::ffi::c_int, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(page), position) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"page-attached".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( page_attached_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "page-detached")] pub fn connect_page_detached( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn page_detached_trampoline( this: *mut ffi::AdwTabView, page: *mut ffi::AdwTabPage, position: std::ffi::c_int, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(page), position) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"page-detached".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( page_detached_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "page-reordered")] pub fn connect_page_reordered( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn page_reordered_trampoline( this: *mut ffi::AdwTabView, page: *mut ffi::AdwTabPage, position: std::ffi::c_int, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(page), position) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"page-reordered".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( page_reordered_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "setup-menu")] pub fn connect_setup_menu) + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn setup_menu_trampoline) + 'static>( this: *mut ffi::AdwTabView, page: *mut ffi::AdwTabPage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( &from_glib_borrow(this), Option::::from_glib_borrow(page).as_ref().as_ref(), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"setup-menu".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( setup_menu_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "default-icon")] pub fn connect_default_icon_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_default_icon_trampoline( this: *mut ffi::AdwTabView, _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 _, c"notify::default-icon".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_default_icon_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "is-transferring-page")] pub fn connect_is_transferring_page_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_is_transferring_page_trampoline( this: *mut ffi::AdwTabView, _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 _, c"notify::is-transferring-page".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_is_transferring_page_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "menu-model")] pub fn connect_menu_model_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_menu_model_trampoline( this: *mut ffi::AdwTabView, _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 _, c"notify::menu-model".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_menu_model_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "n-pages")] pub fn connect_n_pages_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_n_pages_trampoline( this: *mut ffi::AdwTabView, _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 _, c"notify::n-pages".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 = "n-pinned-pages")] pub fn connect_n_pinned_pages_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_n_pinned_pages_trampoline( this: *mut ffi::AdwTabView, _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 _, c"notify::n-pinned-pages".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_n_pinned_pages_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "pages")] pub fn connect_pages_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_pages_trampoline( this: *mut ffi::AdwTabView, _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 _, c"notify::pages".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_pages_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "selected-page")] pub fn connect_selected_page_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_selected_page_trampoline( this: *mut ffi::AdwTabView, _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 _, c"notify::selected-page".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_selected_page_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "shortcuts")] pub fn connect_shortcuts_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_shortcuts_trampoline( this: *mut ffi::AdwTabView, _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 _, c"notify::shortcuts".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_shortcuts_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for TabView { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`TabView`] 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 TabViewBuilder { builder: glib::object::ObjectBuilder<'static, TabView>, } impl TabViewBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn default_icon(self, default_icon: &impl IsA) -> Self { Self { builder: self .builder .property("default-icon", default_icon.clone().upcast()), } } pub fn menu_model(self, menu_model: &impl IsA) -> Self { Self { builder: self .builder .property("menu-model", menu_model.clone().upcast()), } } pub fn selected_page(self, selected_page: &TabPage) -> Self { Self { builder: self .builder .property("selected-page", selected_page.clone()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn shortcuts(self, shortcuts: TabViewShortcuts) -> Self { Self { builder: self.builder.property("shortcuts", shortcuts), } } 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 [`TabView`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> TabView { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/timed_animation.rs000064400000000000000000000331441046102023000172060ustar 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, Animation, AnimationTarget, Easing}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwTimedAnimation")] pub struct TimedAnimation(Object) @extends Animation; match fn { type_ => || ffi::adw_timed_animation_get_type(), } } impl TimedAnimation { #[doc(alias = "adw_timed_animation_new")] pub fn new( widget: &impl IsA, from: f64, to: f64, duration: u32, target: impl IsA, ) -> TimedAnimation { skip_assert_initialized!(); unsafe { Animation::from_glib_none(ffi::adw_timed_animation_new( widget.as_ref().to_glib_none().0, from, to, duration, target.upcast().into_glib_ptr(), )) .unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`TimedAnimation`] objects. /// /// This method returns an instance of [`TimedAnimationBuilder`](crate::builders::TimedAnimationBuilder) which can be used to create [`TimedAnimation`] objects. pub fn builder() -> TimedAnimationBuilder { TimedAnimationBuilder::new() } #[doc(alias = "adw_timed_animation_get_alternate")] #[doc(alias = "get_alternate")] #[doc(alias = "alternate")] pub fn is_alternate(&self) -> bool { unsafe { from_glib(ffi::adw_timed_animation_get_alternate( self.to_glib_none().0, )) } } #[doc(alias = "adw_timed_animation_get_duration")] #[doc(alias = "get_duration")] pub fn duration(&self) -> u32 { unsafe { ffi::adw_timed_animation_get_duration(self.to_glib_none().0) } } #[doc(alias = "adw_timed_animation_get_easing")] #[doc(alias = "get_easing")] pub fn easing(&self) -> Easing { unsafe { from_glib(ffi::adw_timed_animation_get_easing(self.to_glib_none().0)) } } #[doc(alias = "adw_timed_animation_get_repeat_count")] #[doc(alias = "get_repeat_count")] #[doc(alias = "repeat-count")] pub fn repeat_count(&self) -> u32 { unsafe { ffi::adw_timed_animation_get_repeat_count(self.to_glib_none().0) } } #[doc(alias = "adw_timed_animation_get_reverse")] #[doc(alias = "get_reverse")] #[doc(alias = "reverse")] pub fn is_reverse(&self) -> bool { unsafe { from_glib(ffi::adw_timed_animation_get_reverse(self.to_glib_none().0)) } } #[doc(alias = "adw_timed_animation_get_value_from")] #[doc(alias = "get_value_from")] #[doc(alias = "value-from")] pub fn value_from(&self) -> f64 { unsafe { ffi::adw_timed_animation_get_value_from(self.to_glib_none().0) } } #[doc(alias = "adw_timed_animation_get_value_to")] #[doc(alias = "get_value_to")] #[doc(alias = "value-to")] pub fn value_to(&self) -> f64 { unsafe { ffi::adw_timed_animation_get_value_to(self.to_glib_none().0) } } #[doc(alias = "adw_timed_animation_set_alternate")] #[doc(alias = "alternate")] pub fn set_alternate(&self, alternate: bool) { unsafe { ffi::adw_timed_animation_set_alternate(self.to_glib_none().0, alternate.into_glib()); } } #[doc(alias = "adw_timed_animation_set_duration")] #[doc(alias = "duration")] pub fn set_duration(&self, duration: u32) { unsafe { ffi::adw_timed_animation_set_duration(self.to_glib_none().0, duration); } } #[doc(alias = "adw_timed_animation_set_easing")] #[doc(alias = "easing")] pub fn set_easing(&self, easing: Easing) { unsafe { ffi::adw_timed_animation_set_easing(self.to_glib_none().0, easing.into_glib()); } } #[doc(alias = "adw_timed_animation_set_repeat_count")] #[doc(alias = "repeat-count")] pub fn set_repeat_count(&self, repeat_count: u32) { unsafe { ffi::adw_timed_animation_set_repeat_count(self.to_glib_none().0, repeat_count); } } #[doc(alias = "adw_timed_animation_set_reverse")] #[doc(alias = "reverse")] pub fn set_reverse(&self, reverse: bool) { unsafe { ffi::adw_timed_animation_set_reverse(self.to_glib_none().0, reverse.into_glib()); } } #[doc(alias = "adw_timed_animation_set_value_from")] #[doc(alias = "value-from")] pub fn set_value_from(&self, value: f64) { unsafe { ffi::adw_timed_animation_set_value_from(self.to_glib_none().0, value); } } #[doc(alias = "adw_timed_animation_set_value_to")] #[doc(alias = "value-to")] pub fn set_value_to(&self, value: f64) { unsafe { ffi::adw_timed_animation_set_value_to(self.to_glib_none().0, value); } } #[doc(alias = "alternate")] pub fn connect_alternate_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_alternate_trampoline( this: *mut ffi::AdwTimedAnimation, _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 _, c"notify::alternate".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_alternate_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "duration")] pub fn connect_duration_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_duration_trampoline( this: *mut ffi::AdwTimedAnimation, _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 _, c"notify::duration".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_duration_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "easing")] pub fn connect_easing_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_easing_trampoline( this: *mut ffi::AdwTimedAnimation, _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 _, c"notify::easing".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_easing_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "repeat-count")] pub fn connect_repeat_count_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_repeat_count_trampoline( this: *mut ffi::AdwTimedAnimation, _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 _, c"notify::repeat-count".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_repeat_count_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "reverse")] pub fn connect_reverse_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_reverse_trampoline( this: *mut ffi::AdwTimedAnimation, _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 _, c"notify::reverse".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_reverse_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "value-from")] pub fn connect_value_from_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_value_from_trampoline( this: *mut ffi::AdwTimedAnimation, _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 _, c"notify::value-from".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_value_from_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "value-to")] pub fn connect_value_to_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_value_to_trampoline( this: *mut ffi::AdwTimedAnimation, _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 _, c"notify::value-to".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_value_to_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for TimedAnimation { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`TimedAnimation`] 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 TimedAnimationBuilder { builder: glib::object::ObjectBuilder<'static, TimedAnimation>, } impl TimedAnimationBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn alternate(self, alternate: bool) -> Self { Self { builder: self.builder.property("alternate", alternate), } } pub fn duration(self, duration: u32) -> Self { Self { builder: self.builder.property("duration", duration), } } pub fn easing(self, easing: Easing) -> Self { Self { builder: self.builder.property("easing", easing), } } pub fn repeat_count(self, repeat_count: u32) -> Self { Self { builder: self.builder.property("repeat-count", repeat_count), } } pub fn reverse(self, reverse: bool) -> Self { Self { builder: self.builder.property("reverse", reverse), } } pub fn value_from(self, value_from: f64) -> Self { Self { builder: self.builder.property("value-from", value_from), } } pub fn value_to(self, value_to: f64) -> Self { Self { builder: self.builder.property("value-to", value_to), } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] pub fn follow_enable_animations_setting(self, follow_enable_animations_setting: bool) -> Self { Self { builder: self.builder.property( "follow-enable-animations-setting", follow_enable_animations_setting, ), } } pub fn target(self, target: &impl IsA) -> Self { Self { builder: self.builder.property("target", target.clone().upcast()), } } pub fn widget(self, widget: &impl IsA) -> Self { Self { builder: self.builder.property("widget", widget.clone().upcast()), } } // rustdoc-stripper-ignore-next /// Build the [`TimedAnimation`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> TimedAnimation { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/toast.rs000064400000000000000000000416171046102023000152030ustar 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, ToastPriority}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwToast")] pub struct Toast(Object); match fn { type_ => || ffi::adw_toast_get_type(), } } impl Toast { #[doc(alias = "adw_toast_new")] pub fn new(title: &str) -> Toast { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::adw_toast_new(title.to_glib_none().0)) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Toast`] objects. /// /// This method returns an instance of [`ToastBuilder`](crate::builders::ToastBuilder) which can be used to create [`Toast`] objects. pub fn builder() -> ToastBuilder { ToastBuilder::new() } #[doc(alias = "adw_toast_dismiss")] pub fn dismiss(&self) { unsafe { ffi::adw_toast_dismiss(self.to_glib_none().0); } } #[doc(alias = "adw_toast_get_action_name")] #[doc(alias = "get_action_name")] #[doc(alias = "action-name")] pub fn action_name(&self) -> Option { unsafe { from_glib_none(ffi::adw_toast_get_action_name(self.to_glib_none().0)) } } #[doc(alias = "adw_toast_get_action_target_value")] #[doc(alias = "get_action_target_value")] #[doc(alias = "action-target")] pub fn action_target_value(&self) -> Option { unsafe { from_glib_none(ffi::adw_toast_get_action_target_value( self.to_glib_none().0, )) } } #[doc(alias = "adw_toast_get_button_label")] #[doc(alias = "get_button_label")] #[doc(alias = "button-label")] pub fn button_label(&self) -> Option { unsafe { from_glib_none(ffi::adw_toast_get_button_label(self.to_glib_none().0)) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "adw_toast_get_custom_title")] #[doc(alias = "get_custom_title")] #[doc(alias = "custom-title")] pub fn custom_title(&self) -> Option { unsafe { from_glib_none(ffi::adw_toast_get_custom_title(self.to_glib_none().0)) } } #[doc(alias = "adw_toast_get_priority")] #[doc(alias = "get_priority")] pub fn priority(&self) -> ToastPriority { unsafe { from_glib(ffi::adw_toast_get_priority(self.to_glib_none().0)) } } #[doc(alias = "adw_toast_get_timeout")] #[doc(alias = "get_timeout")] pub fn timeout(&self) -> u32 { unsafe { ffi::adw_toast_get_timeout(self.to_glib_none().0) } } #[doc(alias = "adw_toast_get_title")] #[doc(alias = "get_title")] pub fn title(&self) -> Option { unsafe { from_glib_none(ffi::adw_toast_get_title(self.to_glib_none().0)) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_toast_get_use_markup")] #[doc(alias = "get_use_markup")] #[doc(alias = "use-markup")] pub fn uses_markup(&self) -> bool { unsafe { from_glib(ffi::adw_toast_get_use_markup(self.to_glib_none().0)) } } #[doc(alias = "adw_toast_set_action_name")] #[doc(alias = "action-name")] pub fn set_action_name(&self, action_name: Option<&str>) { unsafe { ffi::adw_toast_set_action_name(self.to_glib_none().0, action_name.to_glib_none().0); } } #[doc(alias = "adw_toast_set_action_target_value")] #[doc(alias = "action-target")] pub fn set_action_target_value(&self, action_target: Option<&glib::Variant>) { unsafe { ffi::adw_toast_set_action_target_value( self.to_glib_none().0, action_target.to_glib_none().0, ); } } #[doc(alias = "adw_toast_set_button_label")] #[doc(alias = "button-label")] pub fn set_button_label(&self, button_label: Option<&str>) { unsafe { ffi::adw_toast_set_button_label(self.to_glib_none().0, button_label.to_glib_none().0); } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "adw_toast_set_custom_title")] #[doc(alias = "custom-title")] pub fn set_custom_title(&self, widget: Option<&impl IsA>) { unsafe { ffi::adw_toast_set_custom_title( self.to_glib_none().0, widget.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_toast_set_detailed_action_name")] pub fn set_detailed_action_name(&self, detailed_action_name: Option<&str>) { unsafe { ffi::adw_toast_set_detailed_action_name( self.to_glib_none().0, detailed_action_name.to_glib_none().0, ); } } #[doc(alias = "adw_toast_set_priority")] #[doc(alias = "priority")] pub fn set_priority(&self, priority: ToastPriority) { unsafe { ffi::adw_toast_set_priority(self.to_glib_none().0, priority.into_glib()); } } #[doc(alias = "adw_toast_set_timeout")] #[doc(alias = "timeout")] pub fn set_timeout(&self, timeout: u32) { unsafe { ffi::adw_toast_set_timeout(self.to_glib_none().0, timeout); } } #[doc(alias = "adw_toast_set_title")] #[doc(alias = "title")] pub fn set_title(&self, title: &str) { unsafe { ffi::adw_toast_set_title(self.to_glib_none().0, title.to_glib_none().0); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_toast_set_use_markup")] #[doc(alias = "use-markup")] pub fn set_use_markup(&self, use_markup: bool) { unsafe { ffi::adw_toast_set_use_markup(self.to_glib_none().0, use_markup.into_glib()); } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "button-clicked")] pub fn connect_button_clicked(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn button_clicked_trampoline( this: *mut ffi::AdwToast, 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 _, c"button-clicked".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( button_clicked_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "dismissed")] pub fn connect_dismissed(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn dismissed_trampoline( this: *mut ffi::AdwToast, 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 _, c"dismissed".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( dismissed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "action-name")] pub fn connect_action_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_action_name_trampoline( this: *mut ffi::AdwToast, _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 _, c"notify::action-name".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_action_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "action-target")] pub fn connect_action_target_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_action_target_trampoline( this: *mut ffi::AdwToast, _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 _, c"notify::action-target".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_action_target_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "button-label")] pub fn connect_button_label_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_button_label_trampoline( this: *mut ffi::AdwToast, _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 _, c"notify::button-label".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_button_label_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "custom-title")] pub fn connect_custom_title_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_custom_title_trampoline( this: *mut ffi::AdwToast, _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 _, c"notify::custom-title".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_custom_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "priority")] pub fn connect_priority_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_priority_trampoline( this: *mut ffi::AdwToast, _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 _, c"notify::priority".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_priority_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "timeout")] pub fn connect_timeout_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_timeout_trampoline( this: *mut ffi::AdwToast, _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 _, c"notify::timeout".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_timeout_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "title")] pub fn connect_title_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_trampoline( this: *mut ffi::AdwToast, _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 _, c"notify::title".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "use-markup")] pub fn connect_use_markup_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_use_markup_trampoline( this: *mut ffi::AdwToast, _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 _, c"notify::use-markup".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_use_markup_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for Toast { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Toast`] 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 ToastBuilder { builder: glib::object::ObjectBuilder<'static, Toast>, } impl ToastBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn action_name(self, action_name: impl Into) -> Self { Self { builder: self.builder.property("action-name", action_name.into()), } } pub fn action_target(self, action_target: &glib::Variant) -> Self { Self { builder: self .builder .property("action-target", action_target.clone()), } } pub fn button_label(self, button_label: impl Into) -> Self { Self { builder: self.builder.property("button-label", button_label.into()), } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub fn custom_title(self, custom_title: &impl IsA) -> Self { Self { builder: self .builder .property("custom-title", custom_title.clone().upcast()), } } pub fn priority(self, priority: ToastPriority) -> Self { Self { builder: self.builder.property("priority", priority), } } pub fn timeout(self, timeout: u32) -> Self { Self { builder: self.builder.property("timeout", timeout), } } pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn use_markup(self, use_markup: bool) -> Self { Self { builder: self.builder.property("use-markup", use_markup), } } // rustdoc-stripper-ignore-next /// Build the [`Toast`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Toast { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/toast_overlay.rs000064400000000000000000000054311046102023000167360ustar 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, Toast}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwToastOverlay")] pub struct ToastOverlay(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_toast_overlay_get_type(), } } impl ToastOverlay { #[doc(alias = "adw_toast_overlay_new")] pub fn new() -> ToastOverlay { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_toast_overlay_new()).unsafe_cast() } } #[doc(alias = "adw_toast_overlay_add_toast")] pub fn add_toast(&self, toast: Toast) { unsafe { ffi::adw_toast_overlay_add_toast(self.to_glib_none().0, toast.into_glib_ptr()); } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_toast_overlay_dismiss_all")] pub fn dismiss_all(&self) { unsafe { ffi::adw_toast_overlay_dismiss_all(self.to_glib_none().0); } } #[doc(alias = "adw_toast_overlay_get_child")] #[doc(alias = "get_child")] pub fn child(&self) -> Option { unsafe { from_glib_none(ffi::adw_toast_overlay_get_child(self.to_glib_none().0)) } } #[doc(alias = "adw_toast_overlay_set_child")] #[doc(alias = "child")] pub fn set_child(&self, child: Option<&impl IsA>) { unsafe { ffi::adw_toast_overlay_set_child( self.to_glib_none().0, child.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "child")] pub fn connect_child_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_child_trampoline( this: *mut ffi::AdwToastOverlay, _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 _, c"notify::child".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_child_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for ToastOverlay { fn default() -> Self { Self::new() } } libadwaita-0.7.2/src/auto/toggle.rs000064400000000000000000000331471046102023000153310ustar 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 = "AdwToggle")] pub struct Toggle(Object); match fn { type_ => || ffi::adw_toggle_get_type(), } } impl Toggle { #[doc(alias = "adw_toggle_new")] pub fn new() -> Toggle { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::adw_toggle_new()) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Toggle`] objects. /// /// This method returns an instance of [`ToggleBuilder`](crate::builders::ToggleBuilder) which can be used to create [`Toggle`] objects. pub fn builder() -> ToggleBuilder { ToggleBuilder::new() } #[doc(alias = "adw_toggle_get_child")] #[doc(alias = "get_child")] pub fn child(&self) -> Option { unsafe { from_glib_none(ffi::adw_toggle_get_child(self.to_glib_none().0)) } } #[doc(alias = "adw_toggle_get_enabled")] #[doc(alias = "get_enabled")] #[doc(alias = "enabled")] pub fn is_enabled(&self) -> bool { unsafe { from_glib(ffi::adw_toggle_get_enabled(self.to_glib_none().0)) } } #[doc(alias = "adw_toggle_get_icon_name")] #[doc(alias = "get_icon_name")] #[doc(alias = "icon-name")] pub fn icon_name(&self) -> Option { unsafe { from_glib_none(ffi::adw_toggle_get_icon_name(self.to_glib_none().0)) } } #[doc(alias = "adw_toggle_get_index")] #[doc(alias = "get_index")] pub fn index(&self) -> u32 { unsafe { ffi::adw_toggle_get_index(self.to_glib_none().0) } } #[doc(alias = "adw_toggle_get_label")] #[doc(alias = "get_label")] pub fn label(&self) -> Option { unsafe { from_glib_none(ffi::adw_toggle_get_label(self.to_glib_none().0)) } } #[doc(alias = "adw_toggle_get_name")] #[doc(alias = "get_name")] pub fn name(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_toggle_get_name(self.to_glib_none().0)) } } #[doc(alias = "adw_toggle_get_tooltip")] #[doc(alias = "get_tooltip")] pub fn tooltip(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_toggle_get_tooltip(self.to_glib_none().0)) } } #[doc(alias = "adw_toggle_get_use_underline")] #[doc(alias = "get_use_underline")] #[doc(alias = "use-underline")] pub fn uses_underline(&self) -> bool { unsafe { from_glib(ffi::adw_toggle_get_use_underline(self.to_glib_none().0)) } } #[doc(alias = "adw_toggle_set_child")] #[doc(alias = "child")] pub fn set_child(&self, child: Option<&impl IsA>) { unsafe { ffi::adw_toggle_set_child( self.to_glib_none().0, child.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_toggle_set_enabled")] #[doc(alias = "enabled")] pub fn set_enabled(&self, enabled: bool) { unsafe { ffi::adw_toggle_set_enabled(self.to_glib_none().0, enabled.into_glib()); } } #[doc(alias = "adw_toggle_set_icon_name")] #[doc(alias = "icon-name")] pub fn set_icon_name(&self, icon_name: Option<&str>) { unsafe { ffi::adw_toggle_set_icon_name(self.to_glib_none().0, icon_name.to_glib_none().0); } } #[doc(alias = "adw_toggle_set_label")] #[doc(alias = "label")] pub fn set_label(&self, label: Option<&str>) { unsafe { ffi::adw_toggle_set_label(self.to_glib_none().0, label.to_glib_none().0); } } #[doc(alias = "adw_toggle_set_name")] #[doc(alias = "name")] pub fn set_name(&self, name: Option<&str>) { unsafe { ffi::adw_toggle_set_name(self.to_glib_none().0, name.to_glib_none().0); } } #[doc(alias = "adw_toggle_set_tooltip")] #[doc(alias = "tooltip")] pub fn set_tooltip(&self, tooltip: &str) { unsafe { ffi::adw_toggle_set_tooltip(self.to_glib_none().0, tooltip.to_glib_none().0); } } #[doc(alias = "adw_toggle_set_use_underline")] #[doc(alias = "use-underline")] pub fn set_use_underline(&self, use_underline: bool) { unsafe { ffi::adw_toggle_set_use_underline(self.to_glib_none().0, use_underline.into_glib()); } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "child")] pub fn connect_child_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_child_trampoline( this: *mut ffi::AdwToggle, _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 _, c"notify::child".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_child_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "enabled")] pub fn connect_enabled_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_enabled_trampoline( this: *mut ffi::AdwToggle, _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 _, c"notify::enabled".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_enabled_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[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::AdwToggle, _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 _, c"notify::icon-name".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_icon_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "label")] pub fn connect_label_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_label_trampoline( this: *mut ffi::AdwToggle, _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 _, c"notify::label".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_label_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "name")] pub fn connect_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_name_trampoline( this: *mut ffi::AdwToggle, _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 _, c"notify::name".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "tooltip")] pub fn connect_tooltip_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_tooltip_trampoline( this: *mut ffi::AdwToggle, _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 _, c"notify::tooltip".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_tooltip_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "use-underline")] pub fn connect_use_underline_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_use_underline_trampoline( this: *mut ffi::AdwToggle, _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 _, c"notify::use-underline".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_use_underline_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl Default for Toggle { fn default() -> Self { Self::new() } } impl std::fmt::Display for Toggle { #[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 [`Toggle`] 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 ToggleBuilder { builder: glib::object::ObjectBuilder<'static, Toggle>, } impl ToggleBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn child(self, child: &impl IsA) -> Self { Self { builder: self.builder.property("child", child.clone().upcast()), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn enabled(self, enabled: bool) -> Self { Self { builder: self.builder.property("enabled", enabled), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn icon_name(self, icon_name: impl Into) -> Self { Self { builder: self.builder.property("icon-name", icon_name.into()), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn label(self, label: impl Into) -> Self { Self { builder: self.builder.property("label", label.into()), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn name(self, name: impl Into) -> Self { Self { builder: self.builder.property("name", name.into()), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn tooltip(self, tooltip: impl Into) -> Self { Self { builder: self.builder.property("tooltip", tooltip.into()), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn use_underline(self, use_underline: bool) -> Self { Self { builder: self.builder.property("use-underline", use_underline), } } // rustdoc-stripper-ignore-next /// Build the [`Toggle`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Toggle { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/toggle_group.rs000064400000000000000000000426761046102023000165540ustar 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, Toggle}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwToggleGroup")] pub struct ToggleGroup(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable; match fn { type_ => || ffi::adw_toggle_group_get_type(), } } impl ToggleGroup { #[doc(alias = "adw_toggle_group_new")] pub fn new() -> ToggleGroup { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_toggle_group_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`ToggleGroup`] objects. /// /// This method returns an instance of [`ToggleGroupBuilder`](crate::builders::ToggleGroupBuilder) which can be used to create [`ToggleGroup`] objects. pub fn builder() -> ToggleGroupBuilder { ToggleGroupBuilder::new() } #[doc(alias = "adw_toggle_group_add")] pub fn add(&self, toggle: Toggle) { unsafe { ffi::adw_toggle_group_add(self.to_glib_none().0, toggle.into_glib_ptr()); } } #[doc(alias = "adw_toggle_group_get_active")] #[doc(alias = "get_active")] pub fn active(&self) -> u32 { unsafe { ffi::adw_toggle_group_get_active(self.to_glib_none().0) } } #[doc(alias = "adw_toggle_group_get_active_name")] #[doc(alias = "get_active_name")] #[doc(alias = "active-name")] pub fn active_name(&self) -> Option { unsafe { from_glib_none(ffi::adw_toggle_group_get_active_name(self.to_glib_none().0)) } } #[doc(alias = "adw_toggle_group_get_can_shrink")] #[doc(alias = "get_can_shrink")] #[doc(alias = "can-shrink")] pub fn can_shrink(&self) -> bool { unsafe { from_glib(ffi::adw_toggle_group_get_can_shrink(self.to_glib_none().0)) } } #[doc(alias = "adw_toggle_group_get_homogeneous")] #[doc(alias = "get_homogeneous")] #[doc(alias = "homogeneous")] pub fn is_homogeneous(&self) -> bool { unsafe { from_glib(ffi::adw_toggle_group_get_homogeneous(self.to_glib_none().0)) } } #[doc(alias = "adw_toggle_group_get_n_toggles")] #[doc(alias = "get_n_toggles")] #[doc(alias = "n-toggles")] pub fn n_toggles(&self) -> u32 { unsafe { ffi::adw_toggle_group_get_n_toggles(self.to_glib_none().0) } } #[doc(alias = "adw_toggle_group_get_toggle")] #[doc(alias = "get_toggle")] pub fn toggle(&self, index: u32) -> Option { unsafe { from_glib_none(ffi::adw_toggle_group_get_toggle( self.to_glib_none().0, index, )) } } #[doc(alias = "adw_toggle_group_get_toggle_by_name")] #[doc(alias = "get_toggle_by_name")] pub fn toggle_by_name(&self, name: &str) -> Option { unsafe { from_glib_none(ffi::adw_toggle_group_get_toggle_by_name( self.to_glib_none().0, name.to_glib_none().0, )) } } #[doc(alias = "adw_toggle_group_get_toggles")] #[doc(alias = "get_toggles")] pub fn toggles(&self) -> gtk::SelectionModel { unsafe { from_glib_full(ffi::adw_toggle_group_get_toggles(self.to_glib_none().0)) } } #[doc(alias = "adw_toggle_group_remove")] pub fn remove(&self, toggle: &Toggle) { unsafe { ffi::adw_toggle_group_remove(self.to_glib_none().0, toggle.to_glib_none().0); } } #[doc(alias = "adw_toggle_group_remove_all")] pub fn remove_all(&self) { unsafe { ffi::adw_toggle_group_remove_all(self.to_glib_none().0); } } #[doc(alias = "adw_toggle_group_set_active")] #[doc(alias = "active")] pub fn set_active(&self, active: u32) { unsafe { ffi::adw_toggle_group_set_active(self.to_glib_none().0, active); } } #[doc(alias = "adw_toggle_group_set_active_name")] #[doc(alias = "active-name")] pub fn set_active_name(&self, name: Option<&str>) { unsafe { ffi::adw_toggle_group_set_active_name(self.to_glib_none().0, name.to_glib_none().0); } } #[doc(alias = "adw_toggle_group_set_can_shrink")] #[doc(alias = "can-shrink")] pub fn set_can_shrink(&self, can_shrink: bool) { unsafe { ffi::adw_toggle_group_set_can_shrink(self.to_glib_none().0, can_shrink.into_glib()); } } #[doc(alias = "adw_toggle_group_set_homogeneous")] #[doc(alias = "homogeneous")] pub fn set_homogeneous(&self, homogeneous: bool) { unsafe { ffi::adw_toggle_group_set_homogeneous(self.to_glib_none().0, homogeneous.into_glib()); } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "active")] pub fn connect_active_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_active_trampoline( this: *mut ffi::AdwToggleGroup, _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 _, c"notify::active".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_active_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "active-name")] pub fn connect_active_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_active_name_trampoline( this: *mut ffi::AdwToggleGroup, _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 _, c"notify::active-name".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_active_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "can-shrink")] pub fn connect_can_shrink_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_can_shrink_trampoline( this: *mut ffi::AdwToggleGroup, _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 _, c"notify::can-shrink".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_can_shrink_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "homogeneous")] pub fn connect_homogeneous_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_homogeneous_trampoline( this: *mut ffi::AdwToggleGroup, _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 _, c"notify::homogeneous".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_homogeneous_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "n-toggles")] pub fn connect_n_toggles_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_n_toggles_trampoline( this: *mut ffi::AdwToggleGroup, _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 _, c"notify::n-toggles".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_n_toggles_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "toggles")] pub fn connect_toggles_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_toggles_trampoline( this: *mut ffi::AdwToggleGroup, _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 _, c"notify::toggles".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_toggles_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl Default for ToggleGroup { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`ToggleGroup`] 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 ToggleGroupBuilder { builder: glib::object::ObjectBuilder<'static, ToggleGroup>, } impl ToggleGroupBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn active(self, active: u32) -> Self { Self { builder: self.builder.property("active", active), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn active_name(self, active_name: impl Into) -> Self { Self { builder: self.builder.property("active-name", active_name.into()), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn can_shrink(self, can_shrink: bool) -> Self { Self { builder: self.builder.property("can-shrink", can_shrink), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn homogeneous(self, homogeneous: bool) -> Self { Self { builder: self.builder.property("homogeneous", homogeneous), } } 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 orientation(self, orientation: gtk::Orientation) -> Self { Self { builder: self.builder.property("orientation", orientation), } } // rustdoc-stripper-ignore-next /// Build the [`ToggleGroup`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> ToggleGroup { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/toolbar_view.rs000064400000000000000000000574171046102023000165520ustar 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, ToolbarStyle}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwToolbarView")] pub struct ToolbarView(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_toolbar_view_get_type(), } } impl ToolbarView { #[doc(alias = "adw_toolbar_view_new")] pub fn new() -> ToolbarView { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_toolbar_view_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`ToolbarView`] objects. /// /// This method returns an instance of [`ToolbarViewBuilder`](crate::builders::ToolbarViewBuilder) which can be used to create [`ToolbarView`] objects. pub fn builder() -> ToolbarViewBuilder { ToolbarViewBuilder::new() } #[doc(alias = "adw_toolbar_view_add_bottom_bar")] pub fn add_bottom_bar(&self, widget: &impl IsA) { unsafe { ffi::adw_toolbar_view_add_bottom_bar( self.to_glib_none().0, widget.as_ref().to_glib_none().0, ); } } #[doc(alias = "adw_toolbar_view_add_top_bar")] pub fn add_top_bar(&self, widget: &impl IsA) { unsafe { ffi::adw_toolbar_view_add_top_bar( self.to_glib_none().0, widget.as_ref().to_glib_none().0, ); } } #[doc(alias = "adw_toolbar_view_get_bottom_bar_height")] #[doc(alias = "get_bottom_bar_height")] #[doc(alias = "bottom-bar-height")] pub fn bottom_bar_height(&self) -> i32 { unsafe { ffi::adw_toolbar_view_get_bottom_bar_height(self.to_glib_none().0) } } #[doc(alias = "adw_toolbar_view_get_bottom_bar_style")] #[doc(alias = "get_bottom_bar_style")] #[doc(alias = "bottom-bar-style")] pub fn bottom_bar_style(&self) -> ToolbarStyle { unsafe { from_glib(ffi::adw_toolbar_view_get_bottom_bar_style( self.to_glib_none().0, )) } } #[doc(alias = "adw_toolbar_view_get_content")] #[doc(alias = "get_content")] pub fn content(&self) -> Option { unsafe { from_glib_none(ffi::adw_toolbar_view_get_content(self.to_glib_none().0)) } } #[doc(alias = "adw_toolbar_view_get_extend_content_to_bottom_edge")] #[doc(alias = "get_extend_content_to_bottom_edge")] #[doc(alias = "extend-content-to-bottom-edge")] pub fn is_extend_content_to_bottom_edge(&self) -> bool { unsafe { from_glib(ffi::adw_toolbar_view_get_extend_content_to_bottom_edge( self.to_glib_none().0, )) } } #[doc(alias = "adw_toolbar_view_get_extend_content_to_top_edge")] #[doc(alias = "get_extend_content_to_top_edge")] #[doc(alias = "extend-content-to-top-edge")] pub fn is_extend_content_to_top_edge(&self) -> bool { unsafe { from_glib(ffi::adw_toolbar_view_get_extend_content_to_top_edge( self.to_glib_none().0, )) } } #[doc(alias = "adw_toolbar_view_get_reveal_bottom_bars")] #[doc(alias = "get_reveal_bottom_bars")] #[doc(alias = "reveal-bottom-bars")] pub fn reveals_bottom_bars(&self) -> bool { unsafe { from_glib(ffi::adw_toolbar_view_get_reveal_bottom_bars( self.to_glib_none().0, )) } } #[doc(alias = "adw_toolbar_view_get_reveal_top_bars")] #[doc(alias = "get_reveal_top_bars")] #[doc(alias = "reveal-top-bars")] pub fn reveals_top_bars(&self) -> bool { unsafe { from_glib(ffi::adw_toolbar_view_get_reveal_top_bars( self.to_glib_none().0, )) } } #[doc(alias = "adw_toolbar_view_get_top_bar_height")] #[doc(alias = "get_top_bar_height")] #[doc(alias = "top-bar-height")] pub fn top_bar_height(&self) -> i32 { unsafe { ffi::adw_toolbar_view_get_top_bar_height(self.to_glib_none().0) } } #[doc(alias = "adw_toolbar_view_get_top_bar_style")] #[doc(alias = "get_top_bar_style")] #[doc(alias = "top-bar-style")] pub fn top_bar_style(&self) -> ToolbarStyle { unsafe { from_glib(ffi::adw_toolbar_view_get_top_bar_style( self.to_glib_none().0, )) } } #[doc(alias = "adw_toolbar_view_remove")] pub fn remove(&self, widget: &impl IsA) { unsafe { ffi::adw_toolbar_view_remove(self.to_glib_none().0, widget.as_ref().to_glib_none().0); } } #[doc(alias = "adw_toolbar_view_set_bottom_bar_style")] #[doc(alias = "bottom-bar-style")] pub fn set_bottom_bar_style(&self, style: ToolbarStyle) { unsafe { ffi::adw_toolbar_view_set_bottom_bar_style(self.to_glib_none().0, style.into_glib()); } } #[doc(alias = "adw_toolbar_view_set_content")] #[doc(alias = "content")] pub fn set_content(&self, content: Option<&impl IsA>) { unsafe { ffi::adw_toolbar_view_set_content( self.to_glib_none().0, content.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_toolbar_view_set_extend_content_to_bottom_edge")] #[doc(alias = "extend-content-to-bottom-edge")] pub fn set_extend_content_to_bottom_edge(&self, extend: bool) { unsafe { ffi::adw_toolbar_view_set_extend_content_to_bottom_edge( self.to_glib_none().0, extend.into_glib(), ); } } #[doc(alias = "adw_toolbar_view_set_extend_content_to_top_edge")] #[doc(alias = "extend-content-to-top-edge")] pub fn set_extend_content_to_top_edge(&self, extend: bool) { unsafe { ffi::adw_toolbar_view_set_extend_content_to_top_edge( self.to_glib_none().0, extend.into_glib(), ); } } #[doc(alias = "adw_toolbar_view_set_reveal_bottom_bars")] #[doc(alias = "reveal-bottom-bars")] pub fn set_reveal_bottom_bars(&self, reveal: bool) { unsafe { ffi::adw_toolbar_view_set_reveal_bottom_bars(self.to_glib_none().0, reveal.into_glib()); } } #[doc(alias = "adw_toolbar_view_set_reveal_top_bars")] #[doc(alias = "reveal-top-bars")] pub fn set_reveal_top_bars(&self, reveal: bool) { unsafe { ffi::adw_toolbar_view_set_reveal_top_bars(self.to_glib_none().0, reveal.into_glib()); } } #[doc(alias = "adw_toolbar_view_set_top_bar_style")] #[doc(alias = "top-bar-style")] pub fn set_top_bar_style(&self, style: ToolbarStyle) { unsafe { ffi::adw_toolbar_view_set_top_bar_style(self.to_glib_none().0, style.into_glib()); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "bottom-bar-height")] pub fn connect_bottom_bar_height_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_bottom_bar_height_trampoline( this: *mut ffi::AdwToolbarView, _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 _, c"notify::bottom-bar-height".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_bottom_bar_height_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "bottom-bar-style")] pub fn connect_bottom_bar_style_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_bottom_bar_style_trampoline( this: *mut ffi::AdwToolbarView, _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 _, c"notify::bottom-bar-style".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_bottom_bar_style_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "content")] pub fn connect_content_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_content_trampoline( this: *mut ffi::AdwToolbarView, _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 _, c"notify::content".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_content_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "extend-content-to-bottom-edge")] pub fn connect_extend_content_to_bottom_edge_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_extend_content_to_bottom_edge_trampoline< F: Fn(&ToolbarView) + 'static, >( this: *mut ffi::AdwToolbarView, _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 _, c"notify::extend-content-to-bottom-edge".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_extend_content_to_bottom_edge_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "extend-content-to-top-edge")] pub fn connect_extend_content_to_top_edge_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_extend_content_to_top_edge_trampoline< F: Fn(&ToolbarView) + 'static, >( this: *mut ffi::AdwToolbarView, _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 _, c"notify::extend-content-to-top-edge".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_extend_content_to_top_edge_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "reveal-bottom-bars")] pub fn connect_reveal_bottom_bars_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_reveal_bottom_bars_trampoline( this: *mut ffi::AdwToolbarView, _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 _, c"notify::reveal-bottom-bars".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_reveal_bottom_bars_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "reveal-top-bars")] pub fn connect_reveal_top_bars_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_reveal_top_bars_trampoline( this: *mut ffi::AdwToolbarView, _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 _, c"notify::reveal-top-bars".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_reveal_top_bars_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "top-bar-height")] pub fn connect_top_bar_height_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_top_bar_height_trampoline( this: *mut ffi::AdwToolbarView, _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 _, c"notify::top-bar-height".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_top_bar_height_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "top-bar-style")] pub fn connect_top_bar_style_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_top_bar_style_trampoline( this: *mut ffi::AdwToolbarView, _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 _, c"notify::top-bar-style".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_top_bar_style_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] impl Default for ToolbarView { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`ToolbarView`] 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 ToolbarViewBuilder { builder: glib::object::ObjectBuilder<'static, ToolbarView>, } impl ToolbarViewBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn bottom_bar_style(self, bottom_bar_style: ToolbarStyle) -> Self { Self { builder: self.builder.property("bottom-bar-style", bottom_bar_style), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn content(self, content: &impl IsA) -> Self { Self { builder: self.builder.property("content", content.clone().upcast()), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn extend_content_to_bottom_edge(self, extend_content_to_bottom_edge: bool) -> Self { Self { builder: self.builder.property( "extend-content-to-bottom-edge", extend_content_to_bottom_edge, ), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn extend_content_to_top_edge(self, extend_content_to_top_edge: bool) -> Self { Self { builder: self .builder .property("extend-content-to-top-edge", extend_content_to_top_edge), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn reveal_bottom_bars(self, reveal_bottom_bars: bool) -> Self { Self { builder: self .builder .property("reveal-bottom-bars", reveal_bottom_bars), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn reveal_top_bars(self, reveal_top_bars: bool) -> Self { Self { builder: self.builder.property("reveal-top-bars", reveal_top_bars), } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub fn top_bar_style(self, top_bar_style: ToolbarStyle) -> Self { Self { builder: self.builder.property("top-bar-style", top_bar_style), } } 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 [`ToolbarView`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> ToolbarView { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/versions.txt000064400000000000000000000002161046102023000161020ustar 00000000000000Generated by gir (https://github.com/gtk-rs/gir @ 61370e8fc46f) from from gir-files (https://github.com/gtk-rs/gir-files.git @ 98d70b9d6535) libadwaita-0.7.2/src/auto/view_stack.rs000064400000000000000000000555431046102023000162130ustar 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, ViewStackPage}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwViewStack")] pub struct ViewStack(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_view_stack_get_type(), } } impl ViewStack { #[doc(alias = "adw_view_stack_new")] pub fn new() -> ViewStack { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_view_stack_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`ViewStack`] objects. /// /// This method returns an instance of [`ViewStackBuilder`](crate::builders::ViewStackBuilder) which can be used to create [`ViewStack`] objects. pub fn builder() -> ViewStackBuilder { ViewStackBuilder::new() } #[doc(alias = "adw_view_stack_add")] pub fn add(&self, child: &impl IsA) -> ViewStackPage { unsafe { from_glib_none(ffi::adw_view_stack_add( self.to_glib_none().0, child.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_view_stack_add_named")] pub fn add_named(&self, child: &impl IsA, name: Option<&str>) -> ViewStackPage { unsafe { from_glib_none(ffi::adw_view_stack_add_named( self.to_glib_none().0, child.as_ref().to_glib_none().0, name.to_glib_none().0, )) } } #[doc(alias = "adw_view_stack_add_titled")] pub fn add_titled( &self, child: &impl IsA, name: Option<&str>, title: &str, ) -> ViewStackPage { unsafe { from_glib_none(ffi::adw_view_stack_add_titled( self.to_glib_none().0, child.as_ref().to_glib_none().0, name.to_glib_none().0, title.to_glib_none().0, )) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "adw_view_stack_add_titled_with_icon")] pub fn add_titled_with_icon( &self, child: &impl IsA, name: Option<&str>, title: &str, icon_name: &str, ) -> ViewStackPage { unsafe { from_glib_none(ffi::adw_view_stack_add_titled_with_icon( self.to_glib_none().0, child.as_ref().to_glib_none().0, name.to_glib_none().0, title.to_glib_none().0, icon_name.to_glib_none().0, )) } } #[doc(alias = "adw_view_stack_get_child_by_name")] #[doc(alias = "get_child_by_name")] pub fn child_by_name(&self, name: &str) -> Option { unsafe { from_glib_none(ffi::adw_view_stack_get_child_by_name( self.to_glib_none().0, name.to_glib_none().0, )) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_view_stack_get_enable_transitions")] #[doc(alias = "get_enable_transitions")] #[doc(alias = "enable-transitions")] pub fn enables_transitions(&self) -> bool { unsafe { from_glib(ffi::adw_view_stack_get_enable_transitions( self.to_glib_none().0, )) } } #[doc(alias = "adw_view_stack_get_hhomogeneous")] #[doc(alias = "get_hhomogeneous")] #[doc(alias = "hhomogeneous")] pub fn is_hhomogeneous(&self) -> bool { unsafe { from_glib(ffi::adw_view_stack_get_hhomogeneous(self.to_glib_none().0)) } } #[doc(alias = "adw_view_stack_get_page")] #[doc(alias = "get_page")] pub fn page(&self, child: &impl IsA) -> ViewStackPage { unsafe { from_glib_none(ffi::adw_view_stack_get_page( self.to_glib_none().0, child.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_view_stack_get_pages")] #[doc(alias = "get_pages")] pub fn pages(&self) -> gtk::SelectionModel { unsafe { from_glib_full(ffi::adw_view_stack_get_pages(self.to_glib_none().0)) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_view_stack_get_transition_duration")] #[doc(alias = "get_transition_duration")] #[doc(alias = "transition-duration")] pub fn transition_duration(&self) -> u32 { unsafe { ffi::adw_view_stack_get_transition_duration(self.to_glib_none().0) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_view_stack_get_transition_running")] #[doc(alias = "get_transition_running")] #[doc(alias = "transition-running")] pub fn is_transition_running(&self) -> bool { unsafe { from_glib(ffi::adw_view_stack_get_transition_running( self.to_glib_none().0, )) } } #[doc(alias = "adw_view_stack_get_vhomogeneous")] #[doc(alias = "get_vhomogeneous")] #[doc(alias = "vhomogeneous")] pub fn is_vhomogeneous(&self) -> bool { unsafe { from_glib(ffi::adw_view_stack_get_vhomogeneous(self.to_glib_none().0)) } } #[doc(alias = "adw_view_stack_get_visible_child")] #[doc(alias = "get_visible_child")] #[doc(alias = "visible-child")] pub fn visible_child(&self) -> Option { unsafe { from_glib_none(ffi::adw_view_stack_get_visible_child(self.to_glib_none().0)) } } #[doc(alias = "adw_view_stack_get_visible_child_name")] #[doc(alias = "get_visible_child_name")] #[doc(alias = "visible-child-name")] pub fn visible_child_name(&self) -> Option { unsafe { from_glib_none(ffi::adw_view_stack_get_visible_child_name( self.to_glib_none().0, )) } } #[doc(alias = "adw_view_stack_remove")] pub fn remove(&self, child: &impl IsA) { unsafe { ffi::adw_view_stack_remove(self.to_glib_none().0, child.as_ref().to_glib_none().0); } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_view_stack_set_enable_transitions")] #[doc(alias = "enable-transitions")] pub fn set_enable_transitions(&self, enable_transitions: bool) { unsafe { ffi::adw_view_stack_set_enable_transitions( self.to_glib_none().0, enable_transitions.into_glib(), ); } } #[doc(alias = "adw_view_stack_set_hhomogeneous")] #[doc(alias = "hhomogeneous")] pub fn set_hhomogeneous(&self, hhomogeneous: bool) { unsafe { ffi::adw_view_stack_set_hhomogeneous(self.to_glib_none().0, hhomogeneous.into_glib()); } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_view_stack_set_transition_duration")] #[doc(alias = "transition-duration")] pub fn set_transition_duration(&self, duration: u32) { unsafe { ffi::adw_view_stack_set_transition_duration(self.to_glib_none().0, duration); } } #[doc(alias = "adw_view_stack_set_vhomogeneous")] #[doc(alias = "vhomogeneous")] pub fn set_vhomogeneous(&self, vhomogeneous: bool) { unsafe { ffi::adw_view_stack_set_vhomogeneous(self.to_glib_none().0, vhomogeneous.into_glib()); } } #[doc(alias = "adw_view_stack_set_visible_child")] #[doc(alias = "visible-child")] pub fn set_visible_child(&self, child: &impl IsA) { unsafe { ffi::adw_view_stack_set_visible_child( self.to_glib_none().0, child.as_ref().to_glib_none().0, ); } } #[doc(alias = "adw_view_stack_set_visible_child_name")] #[doc(alias = "visible-child-name")] pub fn set_visible_child_name(&self, name: &str) { unsafe { ffi::adw_view_stack_set_visible_child_name( self.to_glib_none().0, name.to_glib_none().0, ); } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "enable-transitions")] pub fn connect_enable_transitions_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_enable_transitions_trampoline( this: *mut ffi::AdwViewStack, _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 _, c"notify::enable-transitions".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_enable_transitions_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "hhomogeneous")] pub fn connect_hhomogeneous_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_hhomogeneous_trampoline( this: *mut ffi::AdwViewStack, _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 _, c"notify::hhomogeneous".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_hhomogeneous_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "pages")] pub fn connect_pages_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_pages_trampoline( this: *mut ffi::AdwViewStack, _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 _, c"notify::pages".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_pages_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "transition-duration")] pub fn connect_transition_duration_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_transition_duration_trampoline( this: *mut ffi::AdwViewStack, _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 _, c"notify::transition-duration".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_transition_duration_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "transition-running")] pub fn connect_transition_running_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_transition_running_trampoline( this: *mut ffi::AdwViewStack, _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 _, c"notify::transition-running".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_transition_running_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "vhomogeneous")] pub fn connect_vhomogeneous_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_vhomogeneous_trampoline( this: *mut ffi::AdwViewStack, _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 _, c"notify::vhomogeneous".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_vhomogeneous_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "visible-child")] pub fn connect_visible_child_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_visible_child_trampoline( this: *mut ffi::AdwViewStack, _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 _, c"notify::visible-child".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_visible_child_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "visible-child-name")] pub fn connect_visible_child_name_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_visible_child_name_trampoline( this: *mut ffi::AdwViewStack, _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 _, c"notify::visible-child-name".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_visible_child_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for ViewStack { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`ViewStack`] 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 ViewStackBuilder { builder: glib::object::ObjectBuilder<'static, ViewStack>, } impl ViewStackBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn enable_transitions(self, enable_transitions: bool) -> Self { Self { builder: self .builder .property("enable-transitions", enable_transitions), } } pub fn hhomogeneous(self, hhomogeneous: bool) -> Self { Self { builder: self.builder.property("hhomogeneous", hhomogeneous), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn transition_duration(self, transition_duration: u32) -> Self { Self { builder: self .builder .property("transition-duration", transition_duration), } } pub fn vhomogeneous(self, vhomogeneous: bool) -> Self { Self { builder: self.builder.property("vhomogeneous", vhomogeneous), } } pub fn visible_child(self, visible_child: &impl IsA) -> Self { Self { builder: self .builder .property("visible-child", visible_child.clone().upcast()), } } pub fn visible_child_name(self, visible_child_name: impl Into) -> Self { Self { builder: self .builder .property("visible-child-name", visible_child_name.into()), } } 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 [`ViewStack`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> ViewStack { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/view_stack_page.rs000064400000000000000000000252641046102023000172040ustar 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 = "AdwViewStackPage")] pub struct ViewStackPage(Object) @implements gtk::Accessible; match fn { type_ => || ffi::adw_view_stack_page_get_type(), } } impl ViewStackPage { #[doc(alias = "adw_view_stack_page_get_badge_number")] #[doc(alias = "get_badge_number")] #[doc(alias = "badge-number")] pub fn badge_number(&self) -> u32 { unsafe { ffi::adw_view_stack_page_get_badge_number(self.to_glib_none().0) } } #[doc(alias = "adw_view_stack_page_get_child")] #[doc(alias = "get_child")] pub fn child(&self) -> gtk::Widget { unsafe { from_glib_none(ffi::adw_view_stack_page_get_child(self.to_glib_none().0)) } } #[doc(alias = "adw_view_stack_page_get_icon_name")] #[doc(alias = "get_icon_name")] #[doc(alias = "icon-name")] pub fn icon_name(&self) -> Option { unsafe { from_glib_none(ffi::adw_view_stack_page_get_icon_name( self.to_glib_none().0, )) } } #[doc(alias = "adw_view_stack_page_get_name")] #[doc(alias = "get_name")] pub fn name(&self) -> Option { unsafe { from_glib_none(ffi::adw_view_stack_page_get_name(self.to_glib_none().0)) } } #[doc(alias = "adw_view_stack_page_get_needs_attention")] #[doc(alias = "get_needs_attention")] #[doc(alias = "needs-attention")] pub fn needs_attention(&self) -> bool { unsafe { from_glib(ffi::adw_view_stack_page_get_needs_attention( self.to_glib_none().0, )) } } #[doc(alias = "adw_view_stack_page_get_title")] #[doc(alias = "get_title")] pub fn title(&self) -> Option { unsafe { from_glib_none(ffi::adw_view_stack_page_get_title(self.to_glib_none().0)) } } #[doc(alias = "adw_view_stack_page_get_use_underline")] #[doc(alias = "get_use_underline")] #[doc(alias = "use-underline")] pub fn uses_underline(&self) -> bool { unsafe { from_glib(ffi::adw_view_stack_page_get_use_underline( self.to_glib_none().0, )) } } #[doc(alias = "adw_view_stack_page_get_visible")] #[doc(alias = "get_visible")] #[doc(alias = "visible")] pub fn is_visible(&self) -> bool { unsafe { from_glib(ffi::adw_view_stack_page_get_visible(self.to_glib_none().0)) } } #[doc(alias = "adw_view_stack_page_set_badge_number")] #[doc(alias = "badge-number")] pub fn set_badge_number(&self, badge_number: u32) { unsafe { ffi::adw_view_stack_page_set_badge_number(self.to_glib_none().0, badge_number); } } #[doc(alias = "adw_view_stack_page_set_icon_name")] #[doc(alias = "icon-name")] pub fn set_icon_name(&self, icon_name: Option<&str>) { unsafe { ffi::adw_view_stack_page_set_icon_name( self.to_glib_none().0, icon_name.to_glib_none().0, ); } } #[doc(alias = "adw_view_stack_page_set_name")] #[doc(alias = "name")] pub fn set_name(&self, name: Option<&str>) { unsafe { ffi::adw_view_stack_page_set_name(self.to_glib_none().0, name.to_glib_none().0); } } #[doc(alias = "adw_view_stack_page_set_needs_attention")] #[doc(alias = "needs-attention")] pub fn set_needs_attention(&self, needs_attention: bool) { unsafe { ffi::adw_view_stack_page_set_needs_attention( self.to_glib_none().0, needs_attention.into_glib(), ); } } #[doc(alias = "adw_view_stack_page_set_title")] #[doc(alias = "title")] pub fn set_title(&self, title: Option<&str>) { unsafe { ffi::adw_view_stack_page_set_title(self.to_glib_none().0, title.to_glib_none().0); } } #[doc(alias = "adw_view_stack_page_set_use_underline")] #[doc(alias = "use-underline")] pub fn set_use_underline(&self, use_underline: bool) { unsafe { ffi::adw_view_stack_page_set_use_underline( self.to_glib_none().0, use_underline.into_glib(), ); } } #[doc(alias = "adw_view_stack_page_set_visible")] #[doc(alias = "visible")] pub fn set_visible(&self, visible: bool) { unsafe { ffi::adw_view_stack_page_set_visible(self.to_glib_none().0, visible.into_glib()); } } #[doc(alias = "badge-number")] pub fn connect_badge_number_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_badge_number_trampoline( this: *mut ffi::AdwViewStackPage, _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 _, c"notify::badge-number".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_badge_number_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::AdwViewStackPage, _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 _, c"notify::icon-name".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 = "name")] pub fn connect_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_name_trampoline( this: *mut ffi::AdwViewStackPage, _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 _, c"notify::name".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "needs-attention")] pub fn connect_needs_attention_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_needs_attention_trampoline( this: *mut ffi::AdwViewStackPage, _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 _, c"notify::needs-attention".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_needs_attention_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "title")] pub fn connect_title_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_trampoline( this: *mut ffi::AdwViewStackPage, _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 _, c"notify::title".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "use-underline")] pub fn connect_use_underline_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_use_underline_trampoline( this: *mut ffi::AdwViewStackPage, _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 _, c"notify::use-underline".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_use_underline_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "visible")] pub fn connect_visible_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_visible_trampoline( this: *mut ffi::AdwViewStackPage, _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 _, c"notify::visible".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_visible_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } libadwaita-0.7.2/src/auto/view_stack_pages.rs000064400000000000000000000043431046102023000173620ustar 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, ViewStackPage}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwViewStackPages")] pub struct ViewStackPages(Object) @implements gio::ListModel, gtk::SelectionModel; match fn { type_ => || ffi::adw_view_stack_pages_get_type(), } } impl ViewStackPages { #[doc(alias = "adw_view_stack_pages_get_selected_page")] #[doc(alias = "get_selected_page")] #[doc(alias = "selected-page")] pub fn selected_page(&self) -> Option { unsafe { from_glib_none(ffi::adw_view_stack_pages_get_selected_page( self.to_glib_none().0, )) } } #[doc(alias = "adw_view_stack_pages_set_selected_page")] #[doc(alias = "selected-page")] pub fn set_selected_page(&self, page: &ViewStackPage) { unsafe { ffi::adw_view_stack_pages_set_selected_page( self.to_glib_none().0, page.to_glib_none().0, ); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "selected-page")] pub fn connect_selected_page_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_selected_page_trampoline( this: *mut ffi::AdwViewStackPages, _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 _, c"notify::selected-page".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_selected_page_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } libadwaita-0.7.2/src/auto/view_switcher.rs000064400000000000000000000236601046102023000167310ustar 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, ViewStack, ViewSwitcherPolicy}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwViewSwitcher")] pub struct ViewSwitcher(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_view_switcher_get_type(), } } impl ViewSwitcher { #[doc(alias = "adw_view_switcher_new")] pub fn new() -> ViewSwitcher { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_view_switcher_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`ViewSwitcher`] objects. /// /// This method returns an instance of [`ViewSwitcherBuilder`](crate::builders::ViewSwitcherBuilder) which can be used to create [`ViewSwitcher`] objects. pub fn builder() -> ViewSwitcherBuilder { ViewSwitcherBuilder::new() } #[doc(alias = "adw_view_switcher_get_policy")] #[doc(alias = "get_policy")] pub fn policy(&self) -> ViewSwitcherPolicy { unsafe { from_glib(ffi::adw_view_switcher_get_policy(self.to_glib_none().0)) } } #[doc(alias = "adw_view_switcher_get_stack")] #[doc(alias = "get_stack")] pub fn stack(&self) -> Option { unsafe { from_glib_none(ffi::adw_view_switcher_get_stack(self.to_glib_none().0)) } } #[doc(alias = "adw_view_switcher_set_policy")] #[doc(alias = "policy")] pub fn set_policy(&self, policy: ViewSwitcherPolicy) { unsafe { ffi::adw_view_switcher_set_policy(self.to_glib_none().0, policy.into_glib()); } } #[doc(alias = "adw_view_switcher_set_stack")] #[doc(alias = "stack")] pub fn set_stack(&self, stack: Option<&ViewStack>) { unsafe { ffi::adw_view_switcher_set_stack(self.to_glib_none().0, stack.to_glib_none().0); } } #[doc(alias = "policy")] pub fn connect_policy_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_policy_trampoline( this: *mut ffi::AdwViewSwitcher, _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 _, c"notify::policy".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_policy_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "stack")] pub fn connect_stack_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_stack_trampoline( this: *mut ffi::AdwViewSwitcher, _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 _, c"notify::stack".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_stack_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for ViewSwitcher { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`ViewSwitcher`] 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 ViewSwitcherBuilder { builder: glib::object::ObjectBuilder<'static, ViewSwitcher>, } impl ViewSwitcherBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn policy(self, policy: ViewSwitcherPolicy) -> Self { Self { builder: self.builder.property("policy", policy), } } pub fn stack(self, stack: &ViewStack) -> Self { Self { builder: self.builder.property("stack", stack.clone()), } } 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 [`ViewSwitcher`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> ViewSwitcher { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/view_switcher_bar.rs000064400000000000000000000240011046102023000175430ustar 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, ViewStack}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwViewSwitcherBar")] pub struct ViewSwitcherBar(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_view_switcher_bar_get_type(), } } impl ViewSwitcherBar { #[doc(alias = "adw_view_switcher_bar_new")] pub fn new() -> ViewSwitcherBar { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_view_switcher_bar_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`ViewSwitcherBar`] objects. /// /// This method returns an instance of [`ViewSwitcherBarBuilder`](crate::builders::ViewSwitcherBarBuilder) which can be used to create [`ViewSwitcherBar`] objects. pub fn builder() -> ViewSwitcherBarBuilder { ViewSwitcherBarBuilder::new() } #[doc(alias = "adw_view_switcher_bar_get_reveal")] #[doc(alias = "get_reveal")] #[doc(alias = "reveal")] pub fn reveals(&self) -> bool { unsafe { from_glib(ffi::adw_view_switcher_bar_get_reveal(self.to_glib_none().0)) } } #[doc(alias = "adw_view_switcher_bar_get_stack")] #[doc(alias = "get_stack")] pub fn stack(&self) -> Option { unsafe { from_glib_none(ffi::adw_view_switcher_bar_get_stack(self.to_glib_none().0)) } } #[doc(alias = "adw_view_switcher_bar_set_reveal")] #[doc(alias = "reveal")] pub fn set_reveal(&self, reveal: bool) { unsafe { ffi::adw_view_switcher_bar_set_reveal(self.to_glib_none().0, reveal.into_glib()); } } #[doc(alias = "adw_view_switcher_bar_set_stack")] #[doc(alias = "stack")] pub fn set_stack(&self, stack: Option<&ViewStack>) { unsafe { ffi::adw_view_switcher_bar_set_stack(self.to_glib_none().0, stack.to_glib_none().0); } } #[doc(alias = "reveal")] pub fn connect_reveal_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_reveal_trampoline( this: *mut ffi::AdwViewSwitcherBar, _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 _, c"notify::reveal".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_reveal_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "stack")] pub fn connect_stack_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_stack_trampoline( this: *mut ffi::AdwViewSwitcherBar, _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 _, c"notify::stack".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_stack_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for ViewSwitcherBar { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`ViewSwitcherBar`] 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 ViewSwitcherBarBuilder { builder: glib::object::ObjectBuilder<'static, ViewSwitcherBar>, } impl ViewSwitcherBarBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn reveal(self, reveal: bool) -> Self { Self { builder: self.builder.property("reveal", reveal), } } pub fn stack(self, stack: &ViewStack) -> Self { Self { builder: self.builder.property("stack", stack.clone()), } } 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 [`ViewSwitcherBar`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> ViewSwitcherBar { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/view_switcher_title.rs000064400000000000000000000405161046102023000201310ustar 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 #![allow(deprecated)] use crate::{ffi, ViewStack}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwViewSwitcherTitle")] pub struct ViewSwitcherTitle(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_view_switcher_title_get_type(), } } impl ViewSwitcherTitle { #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_view_switcher_title_new")] pub fn new() -> ViewSwitcherTitle { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_view_switcher_title_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`ViewSwitcherTitle`] objects. /// /// This method returns an instance of [`ViewSwitcherTitleBuilder`](crate::builders::ViewSwitcherTitleBuilder) which can be used to create [`ViewSwitcherTitle`] objects. pub fn builder() -> ViewSwitcherTitleBuilder { ViewSwitcherTitleBuilder::new() } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_view_switcher_title_get_stack")] #[doc(alias = "get_stack")] pub fn stack(&self) -> Option { unsafe { from_glib_none(ffi::adw_view_switcher_title_get_stack( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_view_switcher_title_get_subtitle")] #[doc(alias = "get_subtitle")] pub fn subtitle(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_view_switcher_title_get_subtitle( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_view_switcher_title_get_title")] #[doc(alias = "get_title")] pub fn title(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_view_switcher_title_get_title( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_view_switcher_title_get_title_visible")] #[doc(alias = "get_title_visible")] #[doc(alias = "title-visible")] pub fn is_title_visible(&self) -> bool { unsafe { from_glib(ffi::adw_view_switcher_title_get_title_visible( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_view_switcher_title_get_view_switcher_enabled")] #[doc(alias = "get_view_switcher_enabled")] #[doc(alias = "view-switcher-enabled")] pub fn is_view_switcher_enabled(&self) -> bool { unsafe { from_glib(ffi::adw_view_switcher_title_get_view_switcher_enabled( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_view_switcher_title_set_stack")] #[doc(alias = "stack")] pub fn set_stack(&self, stack: Option<&ViewStack>) { unsafe { ffi::adw_view_switcher_title_set_stack(self.to_glib_none().0, stack.to_glib_none().0); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_view_switcher_title_set_subtitle")] #[doc(alias = "subtitle")] pub fn set_subtitle(&self, subtitle: &str) { unsafe { ffi::adw_view_switcher_title_set_subtitle( self.to_glib_none().0, subtitle.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_view_switcher_title_set_title")] #[doc(alias = "title")] pub fn set_title(&self, title: &str) { unsafe { ffi::adw_view_switcher_title_set_title(self.to_glib_none().0, title.to_glib_none().0); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[allow(deprecated)] #[doc(alias = "adw_view_switcher_title_set_view_switcher_enabled")] #[doc(alias = "view-switcher-enabled")] pub fn set_view_switcher_enabled(&self, enabled: bool) { unsafe { ffi::adw_view_switcher_title_set_view_switcher_enabled( self.to_glib_none().0, enabled.into_glib(), ); } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "stack")] pub fn connect_stack_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_stack_trampoline( this: *mut ffi::AdwViewSwitcherTitle, _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 _, c"notify::stack".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_stack_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "subtitle")] pub fn connect_subtitle_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_subtitle_trampoline( this: *mut ffi::AdwViewSwitcherTitle, _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 _, c"notify::subtitle".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_subtitle_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "title")] pub fn connect_title_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_trampoline( this: *mut ffi::AdwViewSwitcherTitle, _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 _, c"notify::title".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "title-visible")] pub fn connect_title_visible_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_visible_trampoline< F: Fn(&ViewSwitcherTitle) + 'static, >( this: *mut ffi::AdwViewSwitcherTitle, _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 _, c"notify::title-visible".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_title_visible_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] #[doc(alias = "view-switcher-enabled")] pub fn connect_view_switcher_enabled_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_view_switcher_enabled_trampoline< F: Fn(&ViewSwitcherTitle) + 'static, >( this: *mut ffi::AdwViewSwitcherTitle, _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 _, c"notify::view-switcher-enabled".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_view_switcher_enabled_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for ViewSwitcherTitle { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`ViewSwitcherTitle`] 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 ViewSwitcherTitleBuilder { builder: glib::object::ObjectBuilder<'static, ViewSwitcherTitle>, } impl ViewSwitcherTitleBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn stack(self, stack: &ViewStack) -> Self { Self { builder: self.builder.property("stack", stack.clone()), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn subtitle(self, subtitle: impl Into) -> Self { Self { builder: self.builder.property("subtitle", subtitle.into()), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")] pub fn view_switcher_enabled(self, view_switcher_enabled: bool) -> Self { Self { builder: self .builder .property("view-switcher-enabled", view_switcher_enabled), } } 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 [`ViewSwitcherTitle`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> ViewSwitcherTitle { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/window.rs000064400000000000000000000471351046102023000153610ustar 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; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] use crate::Breakpoint; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] use crate::Dialog; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwWindow")] pub struct Window(Object) @extends gtk::Window, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Native, gtk::Root, gtk::ShortcutManager; match fn { type_ => || ffi::adw_window_get_type(), } } impl Window { pub const NONE: Option<&'static Window> = None; #[doc(alias = "adw_window_new")] pub fn new() -> Window { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_window_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Window`] objects. /// /// This method returns an instance of [`WindowBuilder`](crate::builders::WindowBuilder) which can be used to create [`Window`] objects. pub fn builder() -> WindowBuilder { WindowBuilder::new() } } impl Default for Window { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Window`] 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 WindowBuilder { builder: glib::object::ObjectBuilder<'static, Window>, } impl WindowBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn adaptive_preview(self, adaptive_preview: bool) -> Self { Self { builder: self.builder.property("adaptive-preview", adaptive_preview), } } pub fn content(self, content: &impl IsA) -> Self { Self { builder: self.builder.property("content", content.clone().upcast()), } } pub fn application(self, application: &impl IsA) -> Self { Self { builder: self .builder .property("application", application.clone().upcast()), } } pub fn decorated(self, decorated: bool) -> Self { Self { builder: self.builder.property("decorated", decorated), } } pub fn default_height(self, default_height: i32) -> Self { Self { builder: self.builder.property("default-height", default_height), } } pub fn default_widget(self, default_widget: &impl IsA) -> Self { Self { builder: self .builder .property("default-widget", default_widget.clone().upcast()), } } pub fn default_width(self, default_width: i32) -> Self { Self { builder: self.builder.property("default-width", default_width), } } pub fn deletable(self, deletable: bool) -> Self { Self { builder: self.builder.property("deletable", deletable), } } pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self { Self { builder: self .builder .property("destroy-with-parent", destroy_with_parent), } } pub fn display(self, display: &gdk::Display) -> Self { Self { builder: self.builder.property("display", display.clone()), } } pub fn focus_visible(self, focus_visible: bool) -> Self { Self { builder: self.builder.property("focus-visible", focus_visible), } } pub fn focus_widget(self, focus_widget: &impl IsA) -> Self { Self { builder: self .builder .property("focus-widget", focus_widget.clone().upcast()), } } pub fn fullscreened(self, fullscreened: bool) -> Self { Self { builder: self.builder.property("fullscreened", fullscreened), } } #[cfg(feature = "gtk_v4_2")] #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_2")))] pub fn handle_menubar_accel(self, handle_menubar_accel: bool) -> Self { Self { builder: self .builder .property("handle-menubar-accel", handle_menubar_accel), } } pub fn hide_on_close(self, hide_on_close: bool) -> Self { Self { builder: self.builder.property("hide-on-close", hide_on_close), } } pub fn icon_name(self, icon_name: impl Into) -> Self { Self { builder: self.builder.property("icon-name", icon_name.into()), } } pub fn maximized(self, maximized: bool) -> Self { Self { builder: self.builder.property("maximized", maximized), } } pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self { Self { builder: self .builder .property("mnemonics-visible", mnemonics_visible), } } pub fn modal(self, modal: bool) -> Self { Self { builder: self.builder.property("modal", modal), } } pub fn resizable(self, resizable: bool) -> Self { Self { builder: self.builder.property("resizable", resizable), } } pub fn startup_id(self, startup_id: impl Into) -> Self { Self { builder: self.builder.property("startup-id", startup_id.into()), } } pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } #[cfg(feature = "gtk_v4_6")] #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_6")))] pub fn titlebar(self, titlebar: &impl IsA) -> Self { Self { builder: self.builder.property("titlebar", titlebar.clone().upcast()), } } pub fn transient_for(self, transient_for: &impl IsA) -> Self { Self { builder: self .builder .property("transient-for", transient_for.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 [`Window`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Window { assert_initialized_main_thread!(); self.builder.build() } } pub trait AdwWindowExt: IsA + 'static { #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_window_add_breakpoint")] fn add_breakpoint(&self, breakpoint: Breakpoint) { unsafe { ffi::adw_window_add_breakpoint( self.as_ref().to_glib_none().0, breakpoint.into_glib_ptr(), ); } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_window_get_adaptive_preview")] #[doc(alias = "get_adaptive_preview")] #[doc(alias = "adaptive-preview")] fn is_adaptive_preview(&self) -> bool { unsafe { from_glib(ffi::adw_window_get_adaptive_preview( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_window_get_content")] #[doc(alias = "get_content")] fn content(&self) -> Option { unsafe { from_glib_none(ffi::adw_window_get_content(self.as_ref().to_glib_none().0)) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_window_get_current_breakpoint")] #[doc(alias = "get_current_breakpoint")] #[doc(alias = "current-breakpoint")] fn current_breakpoint(&self) -> Option { unsafe { from_glib_none(ffi::adw_window_get_current_breakpoint( self.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "adw_window_get_dialogs")] #[doc(alias = "get_dialogs")] fn dialogs(&self) -> gio::ListModel { unsafe { from_glib_full(ffi::adw_window_get_dialogs(self.as_ref().to_glib_none().0)) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "adw_window_get_visible_dialog")] #[doc(alias = "get_visible_dialog")] #[doc(alias = "visible-dialog")] fn visible_dialog(&self) -> Option { unsafe { from_glib_none(ffi::adw_window_get_visible_dialog( self.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adw_window_set_adaptive_preview")] #[doc(alias = "adaptive-preview")] fn set_adaptive_preview(&self, adaptive_preview: bool) { unsafe { ffi::adw_window_set_adaptive_preview( self.as_ref().to_glib_none().0, adaptive_preview.into_glib(), ); } } #[doc(alias = "adw_window_set_content")] #[doc(alias = "content")] fn set_content(&self, content: Option<&impl IsA>) { unsafe { ffi::adw_window_set_content( self.as_ref().to_glib_none().0, content.map(|p| p.as_ref()).to_glib_none().0, ); } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "adaptive-preview")] fn connect_adaptive_preview_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_adaptive_preview_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwWindow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Window::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::adaptive-preview".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_adaptive_preview_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "content")] fn connect_content_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_content_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwWindow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Window::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::content".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_content_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "current-breakpoint")] fn connect_current_breakpoint_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_current_breakpoint_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwWindow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Window::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::current-breakpoint".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_current_breakpoint_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "dialogs")] fn connect_dialogs_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_dialogs_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::AdwWindow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Window::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::dialogs".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_dialogs_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "visible-dialog")] fn connect_visible_dialog_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_visible_dialog_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::AdwWindow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Window::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::visible-dialog".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_visible_dialog_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> AdwWindowExt for O {} libadwaita-0.7.2/src/auto/window_title.rs000064400000000000000000000241061046102023000165530ustar 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 = "AdwWindowTitle")] pub struct WindowTitle(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::adw_window_title_get_type(), } } impl WindowTitle { #[doc(alias = "adw_window_title_new")] pub fn new(title: &str, subtitle: &str) -> WindowTitle { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_window_title_new( title.to_glib_none().0, subtitle.to_glib_none().0, )) .unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`WindowTitle`] objects. /// /// This method returns an instance of [`WindowTitleBuilder`](crate::builders::WindowTitleBuilder) which can be used to create [`WindowTitle`] objects. pub fn builder() -> WindowTitleBuilder { WindowTitleBuilder::new() } #[doc(alias = "adw_window_title_get_subtitle")] #[doc(alias = "get_subtitle")] pub fn subtitle(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_window_title_get_subtitle(self.to_glib_none().0)) } } #[doc(alias = "adw_window_title_get_title")] #[doc(alias = "get_title")] pub fn title(&self) -> glib::GString { unsafe { from_glib_none(ffi::adw_window_title_get_title(self.to_glib_none().0)) } } #[doc(alias = "adw_window_title_set_subtitle")] #[doc(alias = "subtitle")] pub fn set_subtitle(&self, subtitle: &str) { unsafe { ffi::adw_window_title_set_subtitle(self.to_glib_none().0, subtitle.to_glib_none().0); } } #[doc(alias = "adw_window_title_set_title")] #[doc(alias = "title")] pub fn set_title(&self, title: &str) { unsafe { ffi::adw_window_title_set_title(self.to_glib_none().0, title.to_glib_none().0); } } #[doc(alias = "subtitle")] pub fn connect_subtitle_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_subtitle_trampoline( this: *mut ffi::AdwWindowTitle, _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 _, c"notify::subtitle".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_subtitle_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "title")] pub fn connect_title_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_trampoline( this: *mut ffi::AdwWindowTitle, _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 _, c"notify::title".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for WindowTitle { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`WindowTitle`] 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 WindowTitleBuilder { builder: glib::object::ObjectBuilder<'static, WindowTitle>, } impl WindowTitleBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn subtitle(self, subtitle: impl Into) -> Self { Self { builder: self.builder.property("subtitle", subtitle.into()), } } pub fn title(self, title: impl Into) -> Self { Self { builder: self.builder.property("title", title.into()), } } 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 [`WindowTitle`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> WindowTitle { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/wrap_box.rs000064400000000000000000000774201046102023000156730ustar 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, JustifyMode, LengthUnit, PackDirection, WrapPolicy}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwWrapBox")] pub struct WrapBox(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable; match fn { type_ => || ffi::adw_wrap_box_get_type(), } } impl WrapBox { #[doc(alias = "adw_wrap_box_new")] pub fn new() -> WrapBox { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::adw_wrap_box_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`WrapBox`] objects. /// /// This method returns an instance of [`WrapBoxBuilder`](crate::builders::WrapBoxBuilder) which can be used to create [`WrapBox`] objects. pub fn builder() -> WrapBoxBuilder { WrapBoxBuilder::new() } #[doc(alias = "adw_wrap_box_append")] pub fn append(&self, child: &impl IsA) { unsafe { ffi::adw_wrap_box_append(self.to_glib_none().0, child.as_ref().to_glib_none().0); } } #[doc(alias = "adw_wrap_box_get_align")] #[doc(alias = "get_align")] pub fn align(&self) -> f32 { unsafe { ffi::adw_wrap_box_get_align(self.to_glib_none().0) } } #[doc(alias = "adw_wrap_box_get_child_spacing")] #[doc(alias = "get_child_spacing")] #[doc(alias = "child-spacing")] pub fn child_spacing(&self) -> i32 { unsafe { ffi::adw_wrap_box_get_child_spacing(self.to_glib_none().0) } } #[doc(alias = "adw_wrap_box_get_child_spacing_unit")] #[doc(alias = "get_child_spacing_unit")] #[doc(alias = "child-spacing-unit")] pub fn child_spacing_unit(&self) -> LengthUnit { unsafe { from_glib(ffi::adw_wrap_box_get_child_spacing_unit( self.to_glib_none().0, )) } } #[doc(alias = "adw_wrap_box_get_justify")] #[doc(alias = "get_justify")] pub fn justify(&self) -> JustifyMode { unsafe { from_glib(ffi::adw_wrap_box_get_justify(self.to_glib_none().0)) } } #[doc(alias = "adw_wrap_box_get_justify_last_line")] #[doc(alias = "get_justify_last_line")] #[doc(alias = "justify-last-line")] pub fn is_justify_last_line(&self) -> bool { unsafe { from_glib(ffi::adw_wrap_box_get_justify_last_line( self.to_glib_none().0, )) } } #[doc(alias = "adw_wrap_box_get_line_homogeneous")] #[doc(alias = "get_line_homogeneous")] #[doc(alias = "line-homogeneous")] pub fn is_line_homogeneous(&self) -> bool { unsafe { from_glib(ffi::adw_wrap_box_get_line_homogeneous( self.to_glib_none().0, )) } } #[doc(alias = "adw_wrap_box_get_line_spacing")] #[doc(alias = "get_line_spacing")] #[doc(alias = "line-spacing")] pub fn line_spacing(&self) -> i32 { unsafe { ffi::adw_wrap_box_get_line_spacing(self.to_glib_none().0) } } #[doc(alias = "adw_wrap_box_get_line_spacing_unit")] #[doc(alias = "get_line_spacing_unit")] #[doc(alias = "line-spacing-unit")] pub fn line_spacing_unit(&self) -> LengthUnit { unsafe { from_glib(ffi::adw_wrap_box_get_line_spacing_unit( self.to_glib_none().0, )) } } #[doc(alias = "adw_wrap_box_get_natural_line_length")] #[doc(alias = "get_natural_line_length")] #[doc(alias = "natural-line-length")] pub fn natural_line_length(&self) -> i32 { unsafe { ffi::adw_wrap_box_get_natural_line_length(self.to_glib_none().0) } } #[doc(alias = "adw_wrap_box_get_natural_line_length_unit")] #[doc(alias = "get_natural_line_length_unit")] #[doc(alias = "natural-line-length-unit")] pub fn natural_line_length_unit(&self) -> LengthUnit { unsafe { from_glib(ffi::adw_wrap_box_get_natural_line_length_unit( self.to_glib_none().0, )) } } #[doc(alias = "adw_wrap_box_get_pack_direction")] #[doc(alias = "get_pack_direction")] #[doc(alias = "pack-direction")] pub fn pack_direction(&self) -> PackDirection { unsafe { from_glib(ffi::adw_wrap_box_get_pack_direction(self.to_glib_none().0)) } } #[doc(alias = "adw_wrap_box_get_wrap_policy")] #[doc(alias = "get_wrap_policy")] #[doc(alias = "wrap-policy")] pub fn wrap_policy(&self) -> WrapPolicy { unsafe { from_glib(ffi::adw_wrap_box_get_wrap_policy(self.to_glib_none().0)) } } #[doc(alias = "adw_wrap_box_get_wrap_reverse")] #[doc(alias = "get_wrap_reverse")] #[doc(alias = "wrap-reverse")] pub fn wraps_reverse(&self) -> bool { unsafe { from_glib(ffi::adw_wrap_box_get_wrap_reverse(self.to_glib_none().0)) } } #[doc(alias = "adw_wrap_box_insert_child_after")] pub fn insert_child_after( &self, child: &impl IsA, sibling: Option<&impl IsA>, ) { unsafe { ffi::adw_wrap_box_insert_child_after( self.to_glib_none().0, child.as_ref().to_glib_none().0, sibling.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_wrap_box_prepend")] pub fn prepend(&self, child: &impl IsA) { unsafe { ffi::adw_wrap_box_prepend(self.to_glib_none().0, child.as_ref().to_glib_none().0); } } #[doc(alias = "adw_wrap_box_remove")] pub fn remove(&self, child: &impl IsA) { unsafe { ffi::adw_wrap_box_remove(self.to_glib_none().0, child.as_ref().to_glib_none().0); } } #[doc(alias = "adw_wrap_box_reorder_child_after")] pub fn reorder_child_after( &self, child: &impl IsA, sibling: Option<&impl IsA>, ) { unsafe { ffi::adw_wrap_box_reorder_child_after( self.to_glib_none().0, child.as_ref().to_glib_none().0, sibling.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "adw_wrap_box_set_align")] #[doc(alias = "align")] pub fn set_align(&self, align: f32) { unsafe { ffi::adw_wrap_box_set_align(self.to_glib_none().0, align); } } #[doc(alias = "adw_wrap_box_set_child_spacing")] #[doc(alias = "child-spacing")] pub fn set_child_spacing(&self, child_spacing: i32) { unsafe { ffi::adw_wrap_box_set_child_spacing(self.to_glib_none().0, child_spacing); } } #[doc(alias = "adw_wrap_box_set_child_spacing_unit")] #[doc(alias = "child-spacing-unit")] pub fn set_child_spacing_unit(&self, unit: LengthUnit) { unsafe { ffi::adw_wrap_box_set_child_spacing_unit(self.to_glib_none().0, unit.into_glib()); } } #[doc(alias = "adw_wrap_box_set_justify")] #[doc(alias = "justify")] pub fn set_justify(&self, justify: JustifyMode) { unsafe { ffi::adw_wrap_box_set_justify(self.to_glib_none().0, justify.into_glib()); } } #[doc(alias = "adw_wrap_box_set_justify_last_line")] #[doc(alias = "justify-last-line")] pub fn set_justify_last_line(&self, justify_last_line: bool) { unsafe { ffi::adw_wrap_box_set_justify_last_line( self.to_glib_none().0, justify_last_line.into_glib(), ); } } #[doc(alias = "adw_wrap_box_set_line_homogeneous")] #[doc(alias = "line-homogeneous")] pub fn set_line_homogeneous(&self, homogeneous: bool) { unsafe { ffi::adw_wrap_box_set_line_homogeneous(self.to_glib_none().0, homogeneous.into_glib()); } } #[doc(alias = "adw_wrap_box_set_line_spacing")] #[doc(alias = "line-spacing")] pub fn set_line_spacing(&self, line_spacing: i32) { unsafe { ffi::adw_wrap_box_set_line_spacing(self.to_glib_none().0, line_spacing); } } #[doc(alias = "adw_wrap_box_set_line_spacing_unit")] #[doc(alias = "line-spacing-unit")] pub fn set_line_spacing_unit(&self, unit: LengthUnit) { unsafe { ffi::adw_wrap_box_set_line_spacing_unit(self.to_glib_none().0, unit.into_glib()); } } #[doc(alias = "adw_wrap_box_set_natural_line_length")] #[doc(alias = "natural-line-length")] pub fn set_natural_line_length(&self, natural_line_length: i32) { unsafe { ffi::adw_wrap_box_set_natural_line_length(self.to_glib_none().0, natural_line_length); } } #[doc(alias = "adw_wrap_box_set_natural_line_length_unit")] #[doc(alias = "natural-line-length-unit")] pub fn set_natural_line_length_unit(&self, unit: LengthUnit) { unsafe { ffi::adw_wrap_box_set_natural_line_length_unit(self.to_glib_none().0, unit.into_glib()); } } #[doc(alias = "adw_wrap_box_set_pack_direction")] #[doc(alias = "pack-direction")] pub fn set_pack_direction(&self, pack_direction: PackDirection) { unsafe { ffi::adw_wrap_box_set_pack_direction(self.to_glib_none().0, pack_direction.into_glib()); } } #[doc(alias = "adw_wrap_box_set_wrap_policy")] #[doc(alias = "wrap-policy")] pub fn set_wrap_policy(&self, wrap_policy: WrapPolicy) { unsafe { ffi::adw_wrap_box_set_wrap_policy(self.to_glib_none().0, wrap_policy.into_glib()); } } #[doc(alias = "adw_wrap_box_set_wrap_reverse")] #[doc(alias = "wrap-reverse")] pub fn set_wrap_reverse(&self, wrap_reverse: bool) { unsafe { ffi::adw_wrap_box_set_wrap_reverse(self.to_glib_none().0, wrap_reverse.into_glib()); } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "align")] pub fn connect_align_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_align_trampoline( this: *mut ffi::AdwWrapBox, _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 _, c"notify::align".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_align_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "child-spacing")] pub fn connect_child_spacing_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_child_spacing_trampoline( this: *mut ffi::AdwWrapBox, _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 _, c"notify::child-spacing".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_child_spacing_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "child-spacing-unit")] pub fn connect_child_spacing_unit_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_child_spacing_unit_trampoline( this: *mut ffi::AdwWrapBox, _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 _, c"notify::child-spacing-unit".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_child_spacing_unit_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "justify")] pub fn connect_justify_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_justify_trampoline( this: *mut ffi::AdwWrapBox, _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 _, c"notify::justify".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_justify_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "justify-last-line")] pub fn connect_justify_last_line_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_justify_last_line_trampoline( this: *mut ffi::AdwWrapBox, _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 _, c"notify::justify-last-line".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_justify_last_line_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "line-homogeneous")] pub fn connect_line_homogeneous_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_line_homogeneous_trampoline( this: *mut ffi::AdwWrapBox, _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 _, c"notify::line-homogeneous".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_line_homogeneous_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "line-spacing")] pub fn connect_line_spacing_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_line_spacing_trampoline( this: *mut ffi::AdwWrapBox, _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 _, c"notify::line-spacing".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_line_spacing_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "line-spacing-unit")] pub fn connect_line_spacing_unit_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_line_spacing_unit_trampoline( this: *mut ffi::AdwWrapBox, _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 _, c"notify::line-spacing-unit".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_line_spacing_unit_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "natural-line-length")] pub fn connect_natural_line_length_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_natural_line_length_trampoline( this: *mut ffi::AdwWrapBox, _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 _, c"notify::natural-line-length".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_natural_line_length_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "natural-line-length-unit")] pub fn connect_natural_line_length_unit_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_natural_line_length_unit_trampoline< F: Fn(&WrapBox) + 'static, >( this: *mut ffi::AdwWrapBox, _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 _, c"notify::natural-line-length-unit".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_natural_line_length_unit_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "pack-direction")] pub fn connect_pack_direction_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_pack_direction_trampoline( this: *mut ffi::AdwWrapBox, _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 _, c"notify::pack-direction".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_pack_direction_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "wrap-policy")] pub fn connect_wrap_policy_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_wrap_policy_trampoline( this: *mut ffi::AdwWrapBox, _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 _, c"notify::wrap-policy".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_wrap_policy_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "wrap-reverse")] pub fn connect_wrap_reverse_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_wrap_reverse_trampoline( this: *mut ffi::AdwWrapBox, _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 _, c"notify::wrap-reverse".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_wrap_reverse_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl Default for WrapBox { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`WrapBox`] 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 WrapBoxBuilder { builder: glib::object::ObjectBuilder<'static, WrapBox>, } impl WrapBoxBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn align(self, align: f32) -> Self { Self { builder: self.builder.property("align", align), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn child_spacing(self, child_spacing: i32) -> Self { Self { builder: self.builder.property("child-spacing", child_spacing), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn child_spacing_unit(self, child_spacing_unit: LengthUnit) -> Self { Self { builder: self .builder .property("child-spacing-unit", child_spacing_unit), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn justify(self, justify: JustifyMode) -> Self { Self { builder: self.builder.property("justify", justify), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn justify_last_line(self, justify_last_line: bool) -> Self { Self { builder: self .builder .property("justify-last-line", justify_last_line), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn line_homogeneous(self, line_homogeneous: bool) -> Self { Self { builder: self.builder.property("line-homogeneous", line_homogeneous), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn line_spacing(self, line_spacing: i32) -> Self { Self { builder: self.builder.property("line-spacing", line_spacing), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn line_spacing_unit(self, line_spacing_unit: LengthUnit) -> Self { Self { builder: self .builder .property("line-spacing-unit", line_spacing_unit), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn natural_line_length(self, natural_line_length: i32) -> Self { Self { builder: self .builder .property("natural-line-length", natural_line_length), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn natural_line_length_unit(self, natural_line_length_unit: LengthUnit) -> Self { Self { builder: self .builder .property("natural-line-length-unit", natural_line_length_unit), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn pack_direction(self, pack_direction: PackDirection) -> Self { Self { builder: self.builder.property("pack-direction", pack_direction), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn wrap_policy(self, wrap_policy: WrapPolicy) -> Self { Self { builder: self.builder.property("wrap-policy", wrap_policy), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn wrap_reverse(self, wrap_reverse: bool) -> Self { Self { builder: self.builder.property("wrap-reverse", wrap_reverse), } } 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 orientation(self, orientation: gtk::Orientation) -> Self { Self { builder: self.builder.property("orientation", orientation), } } // rustdoc-stripper-ignore-next /// Build the [`WrapBox`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> WrapBox { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/auto/wrap_layout.rs000064400000000000000000000634421046102023000164170ustar 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, JustifyMode, LengthUnit, PackDirection, WrapPolicy}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "AdwWrapLayout")] pub struct WrapLayout(Object) @extends gtk::LayoutManager, @implements gtk::Orientable; match fn { type_ => || ffi::adw_wrap_layout_get_type(), } } impl WrapLayout { #[doc(alias = "adw_wrap_layout_new")] pub fn new() -> WrapLayout { assert_initialized_main_thread!(); unsafe { gtk::LayoutManager::from_glib_full(ffi::adw_wrap_layout_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`WrapLayout`] objects. /// /// This method returns an instance of [`WrapLayoutBuilder`](crate::builders::WrapLayoutBuilder) which can be used to create [`WrapLayout`] objects. pub fn builder() -> WrapLayoutBuilder { WrapLayoutBuilder::new() } #[doc(alias = "adw_wrap_layout_get_align")] #[doc(alias = "get_align")] pub fn align(&self) -> f32 { unsafe { ffi::adw_wrap_layout_get_align(self.to_glib_none().0) } } #[doc(alias = "adw_wrap_layout_get_child_spacing")] #[doc(alias = "get_child_spacing")] #[doc(alias = "child-spacing")] pub fn child_spacing(&self) -> i32 { unsafe { ffi::adw_wrap_layout_get_child_spacing(self.to_glib_none().0) } } #[doc(alias = "adw_wrap_layout_get_child_spacing_unit")] #[doc(alias = "get_child_spacing_unit")] #[doc(alias = "child-spacing-unit")] pub fn child_spacing_unit(&self) -> LengthUnit { unsafe { from_glib(ffi::adw_wrap_layout_get_child_spacing_unit( self.to_glib_none().0, )) } } #[doc(alias = "adw_wrap_layout_get_justify")] #[doc(alias = "get_justify")] pub fn justify(&self) -> JustifyMode { unsafe { from_glib(ffi::adw_wrap_layout_get_justify(self.to_glib_none().0)) } } #[doc(alias = "adw_wrap_layout_get_justify_last_line")] #[doc(alias = "get_justify_last_line")] #[doc(alias = "justify-last-line")] pub fn is_justify_last_line(&self) -> bool { unsafe { from_glib(ffi::adw_wrap_layout_get_justify_last_line( self.to_glib_none().0, )) } } #[doc(alias = "adw_wrap_layout_get_line_homogeneous")] #[doc(alias = "get_line_homogeneous")] #[doc(alias = "line-homogeneous")] pub fn is_line_homogeneous(&self) -> bool { unsafe { from_glib(ffi::adw_wrap_layout_get_line_homogeneous( self.to_glib_none().0, )) } } #[doc(alias = "adw_wrap_layout_get_line_spacing")] #[doc(alias = "get_line_spacing")] #[doc(alias = "line-spacing")] pub fn line_spacing(&self) -> i32 { unsafe { ffi::adw_wrap_layout_get_line_spacing(self.to_glib_none().0) } } #[doc(alias = "adw_wrap_layout_get_line_spacing_unit")] #[doc(alias = "get_line_spacing_unit")] #[doc(alias = "line-spacing-unit")] pub fn line_spacing_unit(&self) -> LengthUnit { unsafe { from_glib(ffi::adw_wrap_layout_get_line_spacing_unit( self.to_glib_none().0, )) } } #[doc(alias = "adw_wrap_layout_get_natural_line_length")] #[doc(alias = "get_natural_line_length")] #[doc(alias = "natural-line-length")] pub fn natural_line_length(&self) -> i32 { unsafe { ffi::adw_wrap_layout_get_natural_line_length(self.to_glib_none().0) } } #[doc(alias = "adw_wrap_layout_get_natural_line_length_unit")] #[doc(alias = "get_natural_line_length_unit")] #[doc(alias = "natural-line-length-unit")] pub fn natural_line_length_unit(&self) -> LengthUnit { unsafe { from_glib(ffi::adw_wrap_layout_get_natural_line_length_unit( self.to_glib_none().0, )) } } #[doc(alias = "adw_wrap_layout_get_pack_direction")] #[doc(alias = "get_pack_direction")] #[doc(alias = "pack-direction")] pub fn pack_direction(&self) -> PackDirection { unsafe { from_glib(ffi::adw_wrap_layout_get_pack_direction( self.to_glib_none().0, )) } } #[doc(alias = "adw_wrap_layout_get_wrap_policy")] #[doc(alias = "get_wrap_policy")] #[doc(alias = "wrap-policy")] pub fn wrap_policy(&self) -> WrapPolicy { unsafe { from_glib(ffi::adw_wrap_layout_get_wrap_policy(self.to_glib_none().0)) } } #[doc(alias = "adw_wrap_layout_get_wrap_reverse")] #[doc(alias = "get_wrap_reverse")] #[doc(alias = "wrap-reverse")] pub fn wraps_reverse(&self) -> bool { unsafe { from_glib(ffi::adw_wrap_layout_get_wrap_reverse(self.to_glib_none().0)) } } #[doc(alias = "adw_wrap_layout_set_align")] #[doc(alias = "align")] pub fn set_align(&self, align: f32) { unsafe { ffi::adw_wrap_layout_set_align(self.to_glib_none().0, align); } } #[doc(alias = "adw_wrap_layout_set_child_spacing")] #[doc(alias = "child-spacing")] pub fn set_child_spacing(&self, child_spacing: i32) { unsafe { ffi::adw_wrap_layout_set_child_spacing(self.to_glib_none().0, child_spacing); } } #[doc(alias = "adw_wrap_layout_set_child_spacing_unit")] #[doc(alias = "child-spacing-unit")] pub fn set_child_spacing_unit(&self, unit: LengthUnit) { unsafe { ffi::adw_wrap_layout_set_child_spacing_unit(self.to_glib_none().0, unit.into_glib()); } } #[doc(alias = "adw_wrap_layout_set_justify")] #[doc(alias = "justify")] pub fn set_justify(&self, justify: JustifyMode) { unsafe { ffi::adw_wrap_layout_set_justify(self.to_glib_none().0, justify.into_glib()); } } #[doc(alias = "adw_wrap_layout_set_justify_last_line")] #[doc(alias = "justify-last-line")] pub fn set_justify_last_line(&self, justify_last_line: bool) { unsafe { ffi::adw_wrap_layout_set_justify_last_line( self.to_glib_none().0, justify_last_line.into_glib(), ); } } #[doc(alias = "adw_wrap_layout_set_line_homogeneous")] #[doc(alias = "line-homogeneous")] pub fn set_line_homogeneous(&self, homogeneous: bool) { unsafe { ffi::adw_wrap_layout_set_line_homogeneous( self.to_glib_none().0, homogeneous.into_glib(), ); } } #[doc(alias = "adw_wrap_layout_set_line_spacing")] #[doc(alias = "line-spacing")] pub fn set_line_spacing(&self, line_spacing: i32) { unsafe { ffi::adw_wrap_layout_set_line_spacing(self.to_glib_none().0, line_spacing); } } #[doc(alias = "adw_wrap_layout_set_line_spacing_unit")] #[doc(alias = "line-spacing-unit")] pub fn set_line_spacing_unit(&self, unit: LengthUnit) { unsafe { ffi::adw_wrap_layout_set_line_spacing_unit(self.to_glib_none().0, unit.into_glib()); } } #[doc(alias = "adw_wrap_layout_set_natural_line_length")] #[doc(alias = "natural-line-length")] pub fn set_natural_line_length(&self, natural_line_length: i32) { unsafe { ffi::adw_wrap_layout_set_natural_line_length( self.to_glib_none().0, natural_line_length, ); } } #[doc(alias = "adw_wrap_layout_set_natural_line_length_unit")] #[doc(alias = "natural-line-length-unit")] pub fn set_natural_line_length_unit(&self, unit: LengthUnit) { unsafe { ffi::adw_wrap_layout_set_natural_line_length_unit( self.to_glib_none().0, unit.into_glib(), ); } } #[doc(alias = "adw_wrap_layout_set_pack_direction")] #[doc(alias = "pack-direction")] pub fn set_pack_direction(&self, pack_direction: PackDirection) { unsafe { ffi::adw_wrap_layout_set_pack_direction( self.to_glib_none().0, pack_direction.into_glib(), ); } } #[doc(alias = "adw_wrap_layout_set_wrap_policy")] #[doc(alias = "wrap-policy")] pub fn set_wrap_policy(&self, wrap_policy: WrapPolicy) { unsafe { ffi::adw_wrap_layout_set_wrap_policy(self.to_glib_none().0, wrap_policy.into_glib()); } } #[doc(alias = "adw_wrap_layout_set_wrap_reverse")] #[doc(alias = "wrap-reverse")] pub fn set_wrap_reverse(&self, wrap_reverse: bool) { unsafe { ffi::adw_wrap_layout_set_wrap_reverse(self.to_glib_none().0, wrap_reverse.into_glib()); } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "align")] pub fn connect_align_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_align_trampoline( this: *mut ffi::AdwWrapLayout, _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 _, c"notify::align".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_align_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "child-spacing")] pub fn connect_child_spacing_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_child_spacing_trampoline( this: *mut ffi::AdwWrapLayout, _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 _, c"notify::child-spacing".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_child_spacing_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "child-spacing-unit")] pub fn connect_child_spacing_unit_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_child_spacing_unit_trampoline( this: *mut ffi::AdwWrapLayout, _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 _, c"notify::child-spacing-unit".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_child_spacing_unit_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "justify")] pub fn connect_justify_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_justify_trampoline( this: *mut ffi::AdwWrapLayout, _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 _, c"notify::justify".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_justify_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "justify-last-line")] pub fn connect_justify_last_line_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_justify_last_line_trampoline( this: *mut ffi::AdwWrapLayout, _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 _, c"notify::justify-last-line".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_justify_last_line_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "line-homogeneous")] pub fn connect_line_homogeneous_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_line_homogeneous_trampoline( this: *mut ffi::AdwWrapLayout, _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 _, c"notify::line-homogeneous".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_line_homogeneous_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "line-spacing")] pub fn connect_line_spacing_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_line_spacing_trampoline( this: *mut ffi::AdwWrapLayout, _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 _, c"notify::line-spacing".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_line_spacing_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "line-spacing-unit")] pub fn connect_line_spacing_unit_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_line_spacing_unit_trampoline( this: *mut ffi::AdwWrapLayout, _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 _, c"notify::line-spacing-unit".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_line_spacing_unit_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "natural-line-length")] pub fn connect_natural_line_length_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_natural_line_length_trampoline( this: *mut ffi::AdwWrapLayout, _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 _, c"notify::natural-line-length".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_natural_line_length_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "natural-line-length-unit")] pub fn connect_natural_line_length_unit_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_natural_line_length_unit_trampoline< F: Fn(&WrapLayout) + 'static, >( this: *mut ffi::AdwWrapLayout, _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 _, c"notify::natural-line-length-unit".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_natural_line_length_unit_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "pack-direction")] pub fn connect_pack_direction_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_pack_direction_trampoline( this: *mut ffi::AdwWrapLayout, _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 _, c"notify::pack-direction".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_pack_direction_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "wrap-policy")] pub fn connect_wrap_policy_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_wrap_policy_trampoline( this: *mut ffi::AdwWrapLayout, _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 _, c"notify::wrap-policy".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_wrap_policy_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] #[doc(alias = "wrap-reverse")] pub fn connect_wrap_reverse_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_wrap_reverse_trampoline( this: *mut ffi::AdwWrapLayout, _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 _, c"notify::wrap-reverse".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_wrap_reverse_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] impl Default for WrapLayout { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`WrapLayout`] 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 WrapLayoutBuilder { builder: glib::object::ObjectBuilder<'static, WrapLayout>, } impl WrapLayoutBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn align(self, align: f32) -> Self { Self { builder: self.builder.property("align", align), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn child_spacing(self, child_spacing: i32) -> Self { Self { builder: self.builder.property("child-spacing", child_spacing), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn child_spacing_unit(self, child_spacing_unit: LengthUnit) -> Self { Self { builder: self .builder .property("child-spacing-unit", child_spacing_unit), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn justify(self, justify: JustifyMode) -> Self { Self { builder: self.builder.property("justify", justify), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn justify_last_line(self, justify_last_line: bool) -> Self { Self { builder: self .builder .property("justify-last-line", justify_last_line), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn line_homogeneous(self, line_homogeneous: bool) -> Self { Self { builder: self.builder.property("line-homogeneous", line_homogeneous), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn line_spacing(self, line_spacing: i32) -> Self { Self { builder: self.builder.property("line-spacing", line_spacing), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn line_spacing_unit(self, line_spacing_unit: LengthUnit) -> Self { Self { builder: self .builder .property("line-spacing-unit", line_spacing_unit), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn natural_line_length(self, natural_line_length: i32) -> Self { Self { builder: self .builder .property("natural-line-length", natural_line_length), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn natural_line_length_unit(self, natural_line_length_unit: LengthUnit) -> Self { Self { builder: self .builder .property("natural-line-length-unit", natural_line_length_unit), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn pack_direction(self, pack_direction: PackDirection) -> Self { Self { builder: self.builder.property("pack-direction", pack_direction), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn wrap_policy(self, wrap_policy: WrapPolicy) -> Self { Self { builder: self.builder.property("wrap-policy", wrap_policy), } } #[cfg(feature = "v1_7")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))] pub fn wrap_reverse(self, wrap_reverse: bool) -> Self { Self { builder: self.builder.property("wrap-reverse", wrap_reverse), } } pub fn orientation(self, orientation: gtk::Orientation) -> Self { Self { builder: self.builder.property("orientation", orientation), } } // rustdoc-stripper-ignore-next /// Build the [`WrapLayout`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> WrapLayout { assert_initialized_main_thread!(); self.builder.build() } } libadwaita-0.7.2/src/breakpoint.rs000064400000000000000000000020561046102023000152310ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::{prelude::*, Breakpoint}; use glib::translate::*; impl Breakpoint { #[doc(alias = "adw_breakpoint_add_settersv")] #[doc(alias = "add_settersv")] pub fn add_setters(&self, additions: &[(&impl IsA, &str, impl ToValue)]) { let n_setters = additions.len() as _; let objects = additions .iter() .map(|(o, _n, _v)| (*o).clone().upcast::()) .collect::>(); let names = additions.iter().map(|(_o, n, _v)| *n).collect::>(); let values = additions .iter() .map(|(_o, _n, v)| v.to_value()) .collect::>(); unsafe { ffi::adw_breakpoint_add_settersv( self.to_glib_none().0, n_setters, objects.as_slice().to_glib_none().0, names.as_slice().to_glib_none().0, values.as_slice().to_glib_none().0, ); } } } libadwaita-0.7.2/src/builders.rs000064400000000000000000000001631046102023000147010ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. pub use crate::auto::builders::*; libadwaita-0.7.2/src/carousel.rs000064400000000000000000000006371046102023000147130ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::Carousel; use glib::translate::*; impl Carousel { #[doc(alias = "adw_carousel_get_nth_page")] #[doc(alias = "get_nth_page")] pub fn nth_page(&self, n: u32) -> gtk::Widget { assert!(n < self.n_pages()); unsafe { from_glib_none(ffi::adw_carousel_get_nth_page(self.to_glib_none().0, n)) } } } libadwaita-0.7.2/src/functions.rs000064400000000000000000000004061046102023000151000ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. #[doc(alias = "adw_init")] pub fn init() -> Result<(), glib::BoolError> { skip_assert_initialized!(); gtk::init()?; unsafe { ffi::adw_init(); } Ok(()) } libadwaita-0.7.2/src/lib.rs000064400000000000000000000106141046102023000136400ustar 00000000000000#![cfg_attr(docsrs, feature(doc_cfg))] #![allow(clippy::needless_doctest_main)] #![doc( html_logo_url = "https://gitlab.gnome.org/GNOME/libadwaita/-/raw/main/doc/libadwaita.svg", html_favicon_url = "https://gitlab.gnome.org/GNOME/libadwaita/-/raw/main/demo/data/org.gnome.Adwaita1.Demo-symbolic.svg" )] //! # Rust Adwaita bindings //! //! This library contains safe Rust bindings for [Adwaita](https://gitlab.gnome.org/GNOME/libadwaita), a library that offers //! building blocks for modern GNOME applications. //! //! See also //! //! - [GTK 4 Rust bindings documentation](mod@gtk) //! - [Libadwaita documentation](https://gnome.pages.gitlab.gnome.org/libadwaita/) //! - [gtk-rs project overview](https://gtk-rs.org/) //! - [Report bindings related issues](https://gitlab.gnome.org/World/Rust/libadwaita-rs) //! - [Report upstream libadwaita issues](https://gitlab.gnome.org/GNOME/libadwaita/) //! //! # Example //! //! Adwaita needs to be initialized before use. //! This can be done by either: //! - using [`adw::Application`](struct@Application) instead of [`gtk::Application`](struct@gtk::Application), or by //! - calling [`fn@init`] on [`startup`](fn@gio::prelude::ApplicationExt::connect_startup). //! //! The [`libadwaita`](mod@crate) crate is usually renamed to `adw`. You can //! do this globally in your `Cargo.toml` file: //! //! ```toml //! [dependencies.adw] //! package = "libadwaita" //! version = "0.x.y" //! ``` //! //! ```no_run //! # use libadwaita as adw; //! use adw::prelude::*; //! //! use adw::{ActionRow, Application, ApplicationWindow, HeaderBar}; //! use gtk::{Box, ListBox, Orientation, SelectionMode}; //! //! fn main() { //! let application = Application::builder() //! .application_id("com.example.FirstAdwaitaApp") //! .build(); //! //! application.connect_activate(|app| { //! // ActionRows are only available in Adwaita //! let row = ActionRow::builder() //! .activatable(true) //! .title("Click me") //! .build(); //! row.connect_activated(|_| { //! eprintln!("Clicked!"); //! }); //! //! let list = ListBox::builder() //! .margin_top(32) //! .margin_end(32) //! .margin_bottom(32) //! .margin_start(32) //! .selection_mode(SelectionMode::None) //! // makes the list look nicer //! .css_classes(vec![String::from("boxed-list")]) //! .build(); //! list.append(&row); //! //! // Combine the content in a box //! let content = Box::new(Orientation::Vertical, 0); //! // Adwaitas' ApplicationWindow does not include a HeaderBar //! content.append(&HeaderBar::new()); //! content.append(&list); //! //! let window = ApplicationWindow::builder() //! .application(app) //! .title("First App") //! .default_width(350) //! // add content to window //! .content(&content) //! .build(); //! window.present(); //! }); //! //! application.run(); //! } //! ``` // Re-export the -sys bindings pub use ffi; pub use gdk; pub use gio; pub use glib; pub use gtk; /// Asserts that this is the main thread and `gtk::init` has been called. macro_rules! assert_initialized_main_thread { () => { if !::gtk::is_initialized_main_thread() { if ::gtk::is_initialized() { panic!("libadwaita may only be used from the main thread."); } else { panic!("Gtk has to be initialized before using libadwaita."); } } }; } macro_rules! skip_assert_initialized { () => {}; } #[allow(unused_imports)] #[allow(clippy::let_and_return)] #[allow(clippy::type_complexity)] mod auto; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] mod alert_dialog; mod application; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] mod breakpoint; mod carousel; mod functions; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] mod message_dialog; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] mod spin_row; mod tab_bar; #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] mod tab_overview; mod tab_view; mod toast; pub use auto::functions::*; pub use auto::*; pub use functions::*; pub mod builders; pub mod prelude; pub mod subclass; libadwaita-0.7.2/src/message_dialog.rs000064400000000000000000000067161046102023000160450ustar 00000000000000use glib::object::IsA; use glib::translate::*; use crate::prelude::*; use crate::MessageDialog; #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] use std::boxed::Box as Box_; #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] use std::pin::Pin; mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait MessageDialogExtManual: sealed::Sealed + IsA + 'static { #[doc(alias = "adw_message_dialog_get_response_label")] #[doc(alias = "get_response_label")] fn response_label(&self, response: &str) -> glib::GString { assert!(self.as_ref().has_response(response)); unsafe { from_glib_none(ffi::adw_message_dialog_get_response_label( self.as_ref().to_glib_none().0, response.to_glib_none().0, )) } } #[doc(alias = "adw_message_dialog_add_responses")] fn add_responses(&self, ids_and_labels: &[(&str, &str)]) { ids_and_labels.iter().for_each(|(id, label)| { self.add_response(id, label); }); } #[doc(alias = "adw_message_dialog_choose")] #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] fn choose( self, 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 choose_trampoline( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer, ) { let result = from_glib_none(ffi::adw_message_dialog_choose_finish( _source_object as *mut _, res, )); let callback: Box_> = Box_::from_raw(user_data as *mut _); let callback: P = callback.into_inner(); callback(result); } let callback = choose_trampoline::

; unsafe { ffi::adw_message_dialog_choose( self.upcast().into_glib_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _, ); } } #[cfg(feature = "v1_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))] #[doc(alias = "adw_message_dialog_choose")] fn choose_future(self) -> Pin + 'static>> { Box_::pin(gio::GioFuture::new( &self, move |obj: &Self, cancellable, send| { obj.clone().choose(Some(cancellable), move |res| { send.resolve(res); }); }, )) } } impl> MessageDialogExtManual for O {} libadwaita-0.7.2/src/prelude.rs000064400000000000000000000005061046102023000145310ustar 00000000000000#[doc(hidden)] pub use gtk::prelude::*; pub use crate::auto::traits::*; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub use crate::alert_dialog::AlertDialogExtManual; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub use crate::message_dialog::MessageDialogExtManual; libadwaita-0.7.2/src/spin_row.rs000064400000000000000000000022221046102023000147260ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::SpinRow; use glib::{ signal::{connect_raw, SignalHandlerId}, translate::*, }; use gtk::{glib, prelude::*}; use libc::{c_double, c_int}; use std::{boxed::Box as Box_, mem::transmute}; impl SpinRow { pub fn connect_input(&self, f: F) -> SignalHandlerId where F: Fn(&Self) -> Option> + 'static, { unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"input\0".as_ptr() as *mut _, Some(transmute(input_trampoline:: as usize)), Box_::into_raw(f), ) } } } unsafe extern "C" fn input_trampoline Option> + 'static>( this: *mut ffi::AdwSpinRow, new_value: *mut c_double, f: &F, ) -> c_int { match f(SpinRow::from_glib_borrow(this).unsafe_cast_ref()) { Some(Ok(v)) => { *new_value = v; glib::ffi::GTRUE } Some(Err(_)) => gtk::ffi::GTK_INPUT_ERROR, None => glib::ffi::GFALSE, } } libadwaita-0.7.2/src/subclass/action_row.rs000064400000000000000000000022671046102023000170620ustar 00000000000000use glib::subclass::prelude::*; use glib::translate::*; use crate::subclass::prelude::PreferencesRowImpl; use crate::{prelude::*, ActionRow}; pub trait ActionRowImpl: PreferencesRowImpl + ObjectSubclass> { fn activate(&self) { ActionRowImplExt::parent_activate(self) } } pub trait ActionRowImplExt: ActionRowImpl { fn parent_activate(&self) { unsafe { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::AdwActionRowClass; if let Some(f) = (*parent_class).activate { f(self.obj().unsafe_cast_ref::().to_glib_none().0) } } } } impl ActionRowImplExt for T {} unsafe impl IsSubclassable for ActionRow { fn class_init(class: &mut glib::Class) { Self::parent_class_init::(class); let klass = class.as_mut(); klass.activate = Some(row_activate::); } } unsafe extern "C" fn row_activate(ptr: *mut ffi::AdwActionRow) { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); ActionRowImpl::activate(imp) } libadwaita-0.7.2/src/subclass/alert_dialog.rs000064400000000000000000000027051046102023000173410ustar 00000000000000use glib::subclass::prelude::*; use glib::translate::*; use super::dialog::AdwDialogImpl; use crate::{prelude::*, AlertDialog}; pub trait AdwAlertDialogImpl: AdwDialogImpl + ObjectSubclass> { fn response(&self, response: &str) { AdwAlertDialogImplExt::parent_response(self, response) } } pub trait AdwAlertDialogImplExt: AdwAlertDialogImpl { fn parent_response(&self, response: &str) { unsafe { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::AdwAlertDialogClass; if let Some(f) = (*parent_class).response { f( self.obj().unsafe_cast_ref::().to_glib_none().0, response.to_glib_none().0, ) } } } } impl AdwAlertDialogImplExt for T {} unsafe impl IsSubclassable for AlertDialog { fn class_init(class: &mut glib::Class) { Self::parent_class_init::(class); let klass = class.as_mut(); klass.response = Some(response::); } } unsafe extern "C" fn response( ptr: *mut ffi::AdwAlertDialog, response: *const libc::c_char, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); let response: Borrowed = from_glib_borrow(response); imp.response(response.as_ref()) } libadwaita-0.7.2/src/subclass/application.rs000064400000000000000000000003651046102023000172160ustar 00000000000000use crate::Application; use glib::prelude::*; use gtk::subclass::prelude::*; pub trait AdwApplicationImpl: GtkApplicationImpl + ObjectSubclass> {} unsafe impl IsSubclassable for Application {} libadwaita-0.7.2/src/subclass/application_window.rs000064400000000000000000000004321046102023000206000ustar 00000000000000use crate::ApplicationWindow; use glib::prelude::*; use gtk::subclass::prelude::*; pub trait AdwApplicationWindowImpl: ApplicationWindowImpl + ObjectSubclass> { } unsafe impl IsSubclassable for ApplicationWindow {} libadwaita-0.7.2/src/subclass/bin.rs000064400000000000000000000003471046102023000154630ustar 00000000000000use crate::Bin; use glib::prelude::*; use glib::subclass::prelude::*; use gtk::subclass::prelude::WidgetImpl; pub trait BinImpl: WidgetImpl + ObjectSubclass> {} unsafe impl IsSubclassable for Bin {} libadwaita-0.7.2/src/subclass/breakpoint_bin.rs000064400000000000000000000004311046102023000176730ustar 00000000000000use crate::BreakpointBin; use glib::prelude::*; use glib::subclass::prelude::*; use gtk::subclass::prelude::WidgetImpl; pub trait BreakpointBinImpl: WidgetImpl + ObjectSubclass> {} unsafe impl IsSubclassable for BreakpointBin {} libadwaita-0.7.2/src/subclass/combo_row.rs000064400000000000000000000004011046102023000166700ustar 00000000000000use super::action_row::ActionRowImpl; use crate::ComboRow; use glib::prelude::*; use glib::subclass::prelude::*; pub trait ComboRowImpl: ActionRowImpl + ObjectSubclass> {} unsafe impl IsSubclassable for ComboRow {} libadwaita-0.7.2/src/subclass/dialog.rs000064400000000000000000000034671046102023000161600ustar 00000000000000use glib::subclass::prelude::*; use glib::translate::*; use crate::{prelude::*, Dialog}; use gtk::subclass::prelude::WidgetImpl; pub trait AdwDialogImpl: WidgetImpl + ObjectSubclass> { fn close_attempt(&self) { AdwDialogImplExt::parent_close_attempt(self) } fn closed(&self) { AdwDialogImplExt::parent_closed(self) } } pub trait AdwDialogImplExt: AdwDialogImpl { fn parent_close_attempt(&self) { unsafe { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::AdwDialogClass; if let Some(f) = (*parent_class).close_attempt { f(self.obj().unsafe_cast_ref::

().to_glib_none().0) } } } fn parent_closed(&self) { unsafe { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::AdwDialogClass; if let Some(f) = (*parent_class).closed { f(self.obj().unsafe_cast_ref::().to_glib_none().0) } } } } impl AdwDialogImplExt for T {} unsafe impl IsSubclassable for Dialog { fn class_init(class: &mut glib::Class) { Self::parent_class_init::(class); let klass = class.as_mut(); klass.close_attempt = Some(close_attempt::); klass.closed = Some(closed::); } } unsafe extern "C" fn close_attempt(ptr: *mut ffi::AdwDialog) { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); AdwDialogImpl::close_attempt(imp) } unsafe extern "C" fn closed(ptr: *mut ffi::AdwDialog) { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); AdwDialogImpl::closed(imp) } libadwaita-0.7.2/src/subclass/entry_row.rs000064400000000000000000000004231046102023000167360ustar 00000000000000use glib::prelude::*; use glib::subclass::prelude::*; use crate::subclass::prelude::PreferencesRowImpl; use crate::EntryRow; pub trait EntryRowImpl: PreferencesRowImpl + ObjectSubclass> {} unsafe impl IsSubclassable for EntryRow {} libadwaita-0.7.2/src/subclass/expander_row.rs000064400000000000000000000004371046102023000174100ustar 00000000000000use super::preferences_row::PreferencesRowImpl; use crate::ExpanderRow; use glib::prelude::*; use glib::subclass::prelude::*; pub trait ExpanderRowImpl: PreferencesRowImpl + ObjectSubclass> {} unsafe impl IsSubclassable for ExpanderRow {} libadwaita-0.7.2/src/subclass/message_dialog.rs000064400000000000000000000030201046102023000176450ustar 00000000000000use crate::{prelude::*, MessageDialog}; use glib::translate::*; use gtk::subclass::prelude::*; pub trait MessageDialogImpl: gtk::subclass::prelude::WindowImpl + ObjectSubclass> { fn response(&self, response: &str) { self.parent_response(response) } } pub trait MessageDialogImplExt: MessageDialogImpl { fn parent_response(&self, response: &str) { unsafe { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::AdwMessageDialogClass; if let Some(f) = (*parent_class).response { f( self.obj() .unsafe_cast_ref::() .to_glib_none() .0, response.to_glib_none().0, ) } } } } impl MessageDialogImplExt for T {} unsafe impl IsSubclassable for MessageDialog { fn class_init(class: &mut glib::Class) { Self::parent_class_init::(class); let klass = class.as_mut(); klass.response = Some(message_dialog_response::); } } unsafe extern "C" fn message_dialog_response( ptr: *mut ffi::AdwMessageDialog, response: *const libc::c_char, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); let response: Borrowed = from_glib_borrow(response); imp.response(response.as_ref()) } libadwaita-0.7.2/src/subclass/mod.rs000064400000000000000000000054561046102023000155000ustar 00000000000000pub mod action_row; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub mod alert_dialog; pub mod application; pub mod application_window; pub mod bin; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub mod breakpoint_bin; pub mod combo_row; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub mod dialog; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub mod entry_row; pub mod expander_row; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] mod message_dialog; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub mod navigation_page; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub mod preferences_dialog; pub mod preferences_group; pub mod preferences_page; pub mod preferences_row; pub mod preferences_window; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub mod spin_row; pub mod swipeable; pub mod window; pub mod prelude { pub use super::action_row::{ActionRowImpl, ActionRowImplExt}; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub use super::alert_dialog::{AdwAlertDialogImpl, AdwAlertDialogImplExt}; pub use super::application::AdwApplicationImpl; pub use super::application_window::AdwApplicationWindowImpl; pub use super::bin::BinImpl; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use super::breakpoint_bin::BreakpointBinImpl; pub use super::combo_row::ComboRowImpl; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub use super::dialog::{AdwDialogImpl, AdwDialogImplExt}; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub use super::entry_row::EntryRowImpl; pub use super::expander_row::ExpanderRowImpl; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub use super::message_dialog::{MessageDialogImpl, MessageDialogImplExt}; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use super::navigation_page::{NavigationPageImpl, NavigationPageImplExt}; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub use super::preferences_dialog::PreferencesDialogImpl; pub use super::preferences_group::PreferencesGroupImpl; pub use super::preferences_page::PreferencesPageImpl; pub use super::preferences_row::PreferencesRowImpl; pub use super::preferences_window::PreferencesWindowImpl; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use super::spin_row::SpinRowImpl; pub use super::swipeable::SwipeableImpl; pub use super::window::AdwWindowImpl; pub use gtk::subclass::prelude::*; } libadwaita-0.7.2/src/subclass/navigation_page.rs000064400000000000000000000070511046102023000200450ustar 00000000000000use crate::{prelude::*, NavigationPage}; use glib::subclass::prelude::*; use glib::translate::*; use gtk::subclass::prelude::WidgetImpl; pub trait NavigationPageImpl: WidgetImpl + ObjectSubclass> { fn hidden(&self) { self.parent_hidden() } fn hiding(&self) { self.parent_hiding(); } fn showing(&self) { self.parent_showing(); } fn shown(&self) { self.parent_shown(); } } pub trait NavigationPageImplExt: NavigationPageImpl { fn parent_hidden(&self) { unsafe { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::AdwNavigationPageClass; if let Some(f) = (*parent_class).hidden { f(self .obj() .unsafe_cast_ref::() .to_glib_none() .0); } } } fn parent_hiding(&self) { unsafe { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::AdwNavigationPageClass; if let Some(f) = (*parent_class).hiding { f(self .obj() .unsafe_cast_ref::() .to_glib_none() .0); } } } fn parent_showing(&self) { unsafe { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::AdwNavigationPageClass; if let Some(f) = (*parent_class).showing { f(self .obj() .unsafe_cast_ref::() .to_glib_none() .0); } } } fn parent_shown(&self) { unsafe { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::AdwNavigationPageClass; if let Some(f) = (*parent_class).shown { f(self .obj() .unsafe_cast_ref::() .to_glib_none() .0); } } } } impl NavigationPageImplExt for T {} unsafe impl IsSubclassable for NavigationPage { fn class_init(class: &mut glib::Class) { Self::parent_class_init::(class); let klass = class.as_mut(); klass.hidden = Some(navigation_page_hidden::); klass.hiding = Some(navigation_page_hiding::); klass.showing = Some(navigation_page_showing::); klass.shown = Some(navigation_page_shown::); } } unsafe extern "C" fn navigation_page_hidden( ptr: *mut ffi::AdwNavigationPage, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); imp.hidden(); } unsafe extern "C" fn navigation_page_hiding( ptr: *mut ffi::AdwNavigationPage, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); imp.hiding(); } unsafe extern "C" fn navigation_page_showing( ptr: *mut ffi::AdwNavigationPage, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); imp.showing(); } unsafe extern "C" fn navigation_page_shown( ptr: *mut ffi::AdwNavigationPage, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); imp.shown(); } libadwaita-0.7.2/src/subclass/preferences_dialog.rs000064400000000000000000000004571046102023000205350ustar 00000000000000use super::dialog::AdwDialogImpl; use crate::PreferencesDialog; use glib::prelude::*; use glib::subclass::prelude::*; pub trait PreferencesDialogImpl: AdwDialogImpl + ObjectSubclass> { } unsafe impl IsSubclassable for PreferencesDialog {} libadwaita-0.7.2/src/subclass/preferences_group.rs000064400000000000000000000004471046102023000204310ustar 00000000000000use crate::PreferencesGroup; use glib::prelude::*; use glib::subclass::prelude::*; use gtk::subclass::widget::WidgetImpl; pub trait PreferencesGroupImpl: WidgetImpl + ObjectSubclass> {} unsafe impl IsSubclassable for PreferencesGroup {} libadwaita-0.7.2/src/subclass/preferences_page.rs000064400000000000000000000004421046102023000202040ustar 00000000000000use crate::PreferencesPage; use glib::prelude::*; use glib::subclass::prelude::*; use gtk::subclass::widget::WidgetImpl; pub trait PreferencesPageImpl: WidgetImpl + ObjectSubclass> {} unsafe impl IsSubclassable for PreferencesPage {} libadwaita-0.7.2/src/subclass/preferences_row.rs000064400000000000000000000004531046102023000201010ustar 00000000000000use crate::PreferencesRow; use glib::prelude::*; use glib::subclass::prelude::*; use gtk::subclass::list_box_row::ListBoxRowImpl; pub trait PreferencesRowImpl: ListBoxRowImpl + ObjectSubclass> {} unsafe impl IsSubclassable for PreferencesRow {} libadwaita-0.7.2/src/subclass/preferences_window.rs000064400000000000000000000004571046102023000206050ustar 00000000000000use super::window::AdwWindowImpl; use crate::PreferencesWindow; use glib::prelude::*; use glib::subclass::prelude::*; pub trait PreferencesWindowImpl: AdwWindowImpl + ObjectSubclass> { } unsafe impl IsSubclassable for PreferencesWindow {} libadwaita-0.7.2/src/subclass/spin_row.rs000064400000000000000000000004041046102023000165450ustar 00000000000000use glib::prelude::*; use glib::subclass::prelude::*; use crate::subclass::prelude::ActionRowImpl; use crate::SpinRow; pub trait SpinRowImpl: ActionRowImpl + ObjectSubclass> {} unsafe impl IsSubclassable for SpinRow {} libadwaita-0.7.2/src/subclass/swipeable.rs000064400000000000000000000133141046102023000166640ustar 00000000000000use crate::{prelude::*, NavigationDirection, Swipeable}; use glib::translate::*; use gtk::subclass::prelude::*; pub trait SwipeableImpl: WidgetImpl + ObjectSubclass> { fn cancel_progress(&self) -> f64 { self.parent_cancel_progress() } fn distance(&self) -> f64 { self.parent_distance() } fn progress(&self) -> f64 { self.parent_progress() } fn snap_points(&self) -> Vec { self.parent_snap_points() } fn swipe_area( &self, navigation_direction: NavigationDirection, is_drag: bool, ) -> gdk::Rectangle { self.parent_swipe_area(navigation_direction, is_drag) } } pub trait SwipeableImplExt: SwipeableImpl { fn parent_cancel_progress(&self) -> f64 { unsafe { let type_data = Self::type_data(); let parent_iface = type_data.as_ref().parent_interface::() as *const ffi::AdwSwipeableInterface; let func = (*parent_iface) .get_cancel_progress .expect("no parent \"get_cancel_progress\" implementation"); func(self.obj().unsafe_cast_ref::().to_glib_none().0) } } fn parent_distance(&self) -> f64 { unsafe { let type_data = Self::type_data(); let parent_iface = type_data.as_ref().parent_interface::() as *const ffi::AdwSwipeableInterface; let func = (*parent_iface) .get_distance .expect("no parent \"get_distance\" implementation"); func(self.obj().unsafe_cast_ref::().to_glib_none().0) } } fn parent_progress(&self) -> f64 { unsafe { let type_data = Self::type_data(); let parent_iface = type_data.as_ref().parent_interface::() as *const ffi::AdwSwipeableInterface; let func = (*parent_iface) .get_progress .expect("no parent \"get_progress\" implementation"); func(self.obj().unsafe_cast_ref::().to_glib_none().0) } } fn parent_snap_points(&self) -> Vec { unsafe { let type_data = Self::type_data(); let parent_iface = type_data.as_ref().parent_interface::() as *const ffi::AdwSwipeableInterface; let func = (*parent_iface) .get_snap_points .expect("no parent \"get_snap_points\" implementation"); let mut n_points = std::mem::MaybeUninit::uninit(); let points = func( self.obj().unsafe_cast_ref::().to_glib_none().0, n_points.as_mut_ptr(), ); let size = n_points.assume_init() as usize; Vec::from_raw_parts(points, size, size) } } fn parent_swipe_area( &self, navigation_direction: NavigationDirection, is_drag: bool, ) -> gdk::Rectangle { unsafe { let type_data = Self::type_data(); let parent_iface = type_data.as_ref().parent_interface::() as *const ffi::AdwSwipeableInterface; let func = (*parent_iface) .get_swipe_area .expect("no parent \"get_swipe_area\" implementation"); let mut rect = gdk::Rectangle::uninitialized(); func( self.obj().unsafe_cast_ref::().to_glib_none().0, navigation_direction.into_glib(), is_drag.into_glib(), rect.to_glib_none_mut().0, ); rect } } } impl SwipeableImplExt for T {} unsafe impl IsImplementable for Swipeable { fn interface_init(iface: &mut glib::Interface) { let iface = iface.as_mut(); iface.get_cancel_progress = Some(swipeable_get_cancel_progress::); iface.get_distance = Some(swipeable_get_distance::); iface.get_progress = Some(swipeable_get_progress::); iface.get_snap_points = Some(swipeable_get_snap_points::); iface.get_swipe_area = Some(swipeable_get_swipe_area::); } } unsafe extern "C" fn swipeable_get_cancel_progress( swipeable: *mut ffi::AdwSwipeable, ) -> f64 { let instance = &*(swipeable as *mut T::Instance); let imp = instance.imp(); imp.cancel_progress() } unsafe extern "C" fn swipeable_get_distance( swipeable: *mut ffi::AdwSwipeable, ) -> f64 { let instance = &*(swipeable as *mut T::Instance); let imp = instance.imp(); imp.distance() } unsafe extern "C" fn swipeable_get_progress( swipeable: *mut ffi::AdwSwipeable, ) -> f64 { let instance = &*(swipeable as *mut T::Instance); let imp = instance.imp(); imp.progress() } unsafe extern "C" fn swipeable_get_snap_points( swipeable: *mut ffi::AdwSwipeable, n_pointsptr: *mut libc::c_int, ) -> *mut f64 { let instance = &*(swipeable as *mut T::Instance); let imp = instance.imp(); let points = imp.snap_points(); n_pointsptr.write(points.len() as libc::c_int); ToGlibContainerFromSlice::to_glib_full_from_slice(points.as_slice()) } unsafe extern "C" fn swipeable_get_swipe_area( swipeable: *mut ffi::AdwSwipeable, navigation_direction: ffi::AdwNavigationDirection, is_drag: i32, area: *mut gdk::ffi::GdkRectangle, ) { let instance = &*(swipeable as *mut T::Instance); let imp = instance.imp(); let swipe_area = imp.swipe_area(from_glib(navigation_direction), from_glib(is_drag)); *area = *swipe_area.to_glib_full(); } libadwaita-0.7.2/src/subclass/window.rs000064400000000000000000000003231046102023000162140ustar 00000000000000use crate::Window; use glib::prelude::*; use gtk::subclass::prelude::*; pub trait AdwWindowImpl: WindowImpl + ObjectSubclass> {} unsafe impl IsSubclassable for Window {} libadwaita-0.7.2/src/tab_bar.rs000064400000000000000000000010311046102023000144550ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::TabBar; use glib::translate::*; impl TabBar { #[doc(alias = "adw_tab_bar_setup_extra_drop_target")] pub fn setup_extra_drop_target(&self, actions: gdk::DragAction, types: &[glib::Type]) { unsafe { ffi::adw_tab_bar_setup_extra_drop_target( self.to_glib_none().0, actions.into_glib(), types.to_glib_none().0, types.len(), ) } } } libadwaita-0.7.2/src/tab_overview.rs000064400000000000000000000010551046102023000155650ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::TabOverview; use glib::translate::*; impl TabOverview { #[doc(alias = "adw_tab_overview_setup_extra_drop_target")] pub fn setup_extra_drop_target(&self, actions: gdk::DragAction, types: &[glib::Type]) { unsafe { ffi::adw_tab_overview_setup_extra_drop_target( self.to_glib_none().0, actions.into_glib(), types.to_glib_none().0, types.len(), ) } } } libadwaita-0.7.2/src/tab_view.rs000064400000000000000000000007741046102023000147000ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::{TabPage, TabView}; use glib::translate::*; impl TabView { #[doc(alias = "adw_tab_view_get_nth_page")] #[doc(alias = "get_nth_page")] pub fn nth_page(&self, position: i32) -> TabPage { assert!(position < self.n_pages()); unsafe { from_glib_none(ffi::adw_tab_view_get_nth_page( self.to_glib_none().0, position, )) } } } libadwaita-0.7.2/src/toast.rs000064400000000000000000000010461046102023000142230ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::Toast; use glib::translate::*; use glib::variant::ToVariant; impl Toast { #[doc(alias = "adw_toast_set_action_target")] #[doc(alias = "adw_toast_set_action_target_value")] pub fn set_action_target(&self, target: Option<&impl ToVariant>) { unsafe { ffi::adw_toast_set_action_target_value( self.to_glib_none().0, target.map(|v| v.to_variant()).to_glib_none().0, ); } } }