libadwaita-0.6.0/.cargo_vcs_info.json0000644000000001500000000000100131340ustar { "git": { "sha1": "891046160dbf28e84cc241611558e68b55665f03" }, "path_in_vcs": "libadwaita" }libadwaita-0.6.0/Cargo.lock0000644000000460160000000000100111220ustar # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[package]] name = "anyhow" version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" [[package]] name = "autocfg" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "bitflags" version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "cairo-rs" version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc1c415b7088381c53c575420899c34c9e6312df5ac5defd05614210e9fd6e1b" dependencies = [ "bitflags", "cairo-sys-rs", "glib", "libc", "thiserror", ] [[package]] name = "cairo-sys-rs" version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75b6a5fefce2eadb8333e3c604ac964ba6573ec4f28bdd17f67032c4a2831831" dependencies = [ "glib-sys", "libc", "system-deps", ] [[package]] name = "cfg-expr" version = "0.15.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6100bc57b6209840798d95cb2775684849d332f7bd788db2a8c8caf7ef82a41a" dependencies = [ "smallvec", "target-lexicon", ] [[package]] name = "equivalent" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[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.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", ] [[package]] name = "futures-core" version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", "futures-util", ] [[package]] name = "futures-io" version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-macro" version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", "syn 2.0.48", ] [[package]] name = "futures-task" version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-core", "futures-macro", "futures-task", "pin-project-lite", "pin-utils", "slab", ] [[package]] name = "gdk-pixbuf" version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c311c47800051b87de1335e8792774d7cec551c91a0a3d109ab21d76b36f208f" dependencies = [ "gdk-pixbuf-sys", "gio", "glib", "libc", ] [[package]] name = "gdk-pixbuf-sys" version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dcbd04c1b2c4834cc008b4828bc917d062483b88d26effde6342e5622028f96" dependencies = [ "gio-sys", "glib-sys", "gobject-sys", "libc", "system-deps", ] [[package]] name = "gdk4" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6771942f85a2beaa220c64739395e4401b9fab4a52aba9b503fa1e6ed4d4d806" dependencies = [ "cairo-rs", "gdk-pixbuf", "gdk4-sys", "gio", "glib", "libc", "pango", ] [[package]] name = "gdk4-sys" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1eb95854fab65072023a7814434f003db571d6e45c287c0b0c540c1c78bdf6ae" 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.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3d1aaa2d926710a27f3b35822806b1513b393b71174dd2601c9d02fdab0cb82" dependencies = [ "futures-channel", "futures-core", "futures-io", "futures-util", "gio-sys", "glib", "libc", "pin-project-lite", "smallvec", "thiserror", ] [[package]] name = "gio-sys" version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bcf8e1d9219bb294636753d307b030c1e8a032062cba74f493c431a5c8b81ce4" dependencies = [ "glib-sys", "gobject-sys", "libc", "system-deps", "windows-sys", ] [[package]] name = "glib" version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "170ee82b9b44b3b5fd1cf4971d6cf0eadec38303bb84c7bcc4e6b95a18934e71" dependencies = [ "bitflags", "futures-channel", "futures-core", "futures-executor", "futures-task", "futures-util", "gio-sys", "glib-macros", "glib-sys", "gobject-sys", "libc", "memchr", "smallvec", "thiserror", ] [[package]] name = "glib-macros" version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ff52fff7e4d1bb8598ae744e9bb90c8c76271712483c3f0ce931bee9814de85" dependencies = [ "heck", "proc-macro-crate", "proc-macro2", "quote", "syn 2.0.48", ] [[package]] name = "glib-sys" version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "630f097773d7c7a0bb3258df4e8157b47dc98bbfa0e60ad9ab56174813feced4" dependencies = [ "libc", "system-deps", ] [[package]] name = "gobject-sys" version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c85e2b1080b9418dd0c58b498da3a5c826030343e0ef07bde6a955d28de54979" dependencies = [ "glib-sys", "libc", "system-deps", ] [[package]] name = "graphene-rs" version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147827e4f506f8073ac3ec5b28cc2255bdf3abc30f5b4e101a80506eebe11d2c" dependencies = [ "glib", "graphene-sys", "libc", ] [[package]] name = "graphene-sys" version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "236ed66cc9b18d8adf233716f75de803d0bf6fc806f60d14d948974a12e240d0" dependencies = [ "glib-sys", "libc", "pkg-config", "system-deps", ] [[package]] name = "gsk4" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e8ce8dee0fd87a11002214b1204ff18c9272fbd530408f0884a0f9b25dc31de" dependencies = [ "cairo-rs", "gdk4", "glib", "graphene-rs", "gsk4-sys", "libc", "pango", ] [[package]] name = "gsk4-sys" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2660a652da5b662d43924df19ba40d73f015ed427329ef51d2b1360a4e0dc0e4" dependencies = [ "cairo-sys-rs", "gdk4-sys", "glib-sys", "gobject-sys", "graphene-sys", "libc", "pango-sys", "system-deps", ] [[package]] name = "gtk4" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d26ffa3ec6316ccaa1df62d3e7f5bae1637c0acbb43f250fabef38319f73c64" 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.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8b86439e9896f6f3f47c3d8077c5c8205174078760afdabd9098a8e9e937d97" dependencies = [ "anyhow", "proc-macro-crate", "proc-macro-error", "proc-macro2", "quote", "syn 1.0.109", ] [[package]] name = "gtk4-sys" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2abc0a6d356d59a3806021829ce6ed3e70bba3509b41a535fedcb09fae13fbc0" 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.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" [[package]] name = "heck" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "indexmap" version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" dependencies = [ "equivalent", "hashbrown", ] [[package]] name = "libadwaita" version = "0.6.0" dependencies = [ "gdk-pixbuf", "gdk4", "gio", "glib", "gtk4", "libadwaita-sys", "libc", "pango", ] [[package]] name = "libadwaita-sys" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23a748e4e92be1265cd9e93d569c0b5dfc7814107985aa6743d670ab281ea1a8" dependencies = [ "gdk4-sys", "gio-sys", "glib-sys", "gobject-sys", "gtk4-sys", "libc", "pango-sys", "system-deps", ] [[package]] name = "libc" version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "memchr" version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "memoffset" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" dependencies = [ "autocfg", ] [[package]] name = "pango" version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78d7f779b957728c74fd1a060dfa6d89a0bea792ebc50cc2da80e4e87282d69e" dependencies = [ "gio", "glib", "libc", "pango-sys", ] [[package]] name = "pango-sys" version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f52ef6a881c19fbfe3b1484df5cad411acaaba29dbec843941c3110d19f340ea" dependencies = [ "glib-sys", "gobject-sys", "libc", "system-deps", ] [[package]] name = "pin-project-lite" version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[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.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "proc-macro-crate" version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ "toml_edit", ] [[package]] name = "proc-macro-error" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", "proc-macro2", "quote", "syn 1.0.109", "version_check", ] [[package]] name = "proc-macro-error-attr" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ "proc-macro2", "quote", "version_check", ] [[package]] name = "proc-macro2" version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] [[package]] name = "quote" version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] [[package]] name = "rustc_version" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ "semver", ] [[package]] name = "semver" version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" [[package]] name = "serde" version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", "syn 2.0.48", ] [[package]] name = "serde_spanned" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" 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.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "syn" version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "syn" version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "system-deps" version = "6.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a2d580ff6a20c55dfb86be5f9c238f67835d0e81cbdea8bf5680e0897320331" dependencies = [ "cfg-expr", "heck", "pkg-config", "toml", "version-compare", ] [[package]] name = "target-lexicon" version = "0.12.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" [[package]] name = "thiserror" version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", "syn 2.0.48", ] [[package]] name = "toml" version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6a4b9e8023eb94392d3dca65d717c53abc5dad49c07cb65bb8fcd87115fa325" dependencies = [ "serde", "serde_spanned", "toml_datetime", "toml_edit", ] [[package]] name = "toml_datetime" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" dependencies = [ "serde", ] [[package]] name = "toml_edit" version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ "indexmap", "serde", "serde_spanned", "toml_datetime", "winnow", ] [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "version-compare" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "windows-sys" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", "windows_i686_msvc", "windows_x86_64_gnu", "windows_x86_64_gnullvm", "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" [[package]] name = "windows_aarch64_msvc" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" [[package]] name = "windows_i686_gnu" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" [[package]] name = "windows_i686_msvc" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" [[package]] name = "windows_x86_64_gnu" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" [[package]] name = "windows_x86_64_gnullvm" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" [[package]] name = "windows_x86_64_msvc" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" version = "0.5.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7cad8365489051ae9f054164e459304af2e7e9bb407c958076c8bf4aef52da5" dependencies = [ "memchr", ] libadwaita-0.6.0/Cargo.toml0000644000000035340000000000100111430ustar # 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.6.0" authors = ["Bilal Elmoussaoui "] 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", ] [lib] name = "libadwaita" [dependencies.ffi] version = "0.6" package = "libadwaita-sys" [dependencies.gdk] version = "0.8" package = "gdk4" [dependencies.gdk-pixbuf] version = "0.19" [dependencies.gio] version = "0.19" [dependencies.glib] version = "0.19" [dependencies.gtk] version = "0.8" package = "gtk4" [dependencies.libc] version = "0.2" [dependencies.pango] version = "0.19" [features] gtk_v4_10 = ["gtk_v4_8"] gtk_v4_12 = ["gtk_v4_10"] gtk_v4_2 = [] gtk_v4_4 = ["gtk_v4_2"] gtk_v4_6 = ["gtk_v4_4"] gtk_v4_8 = ["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", ] libadwaita-0.6.0/Cargo.toml.orig000064400000000000000000000032351046102023000146220ustar 00000000000000[package] name = "libadwaita" version = "0.6.0" 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_4 = ["gtk_v4_2"] gtk_v4_6 = ["gtk_v4_4"] gtk_v4_8 = ["gtk_v4_6"] gtk_v4_10 = ["gtk_v4_8"] gtk_v4_12 = ["gtk_v4_10"] 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"] [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.19" version = "0.19" [dependencies.gio] git = "https://github.com/gtk-rs/gtk-rs-core" branch = "0.19" version = "0.19" [dependencies.gdk-pixbuf] git = "https://github.com/gtk-rs/gtk-rs-core" branch = "0.19" version = "0.19" [dependencies.pango] git = "https://github.com/gtk-rs/gtk-rs-core" branch = "0.19" version = "0.19" [dependencies.gdk] package = "gdk4" git = "https://github.com/gtk-rs/gtk4-rs" branch = "0.8" version = "0.8" [dependencies.gtk] package = "gtk4" git = "https://github.com/gtk-rs/gtk4-rs" branch = "0.8" version = "0.8" [dependencies.ffi] package = "libadwaita-sys" path = './sys' version = "0.6" libadwaita-0.6.0/Gir.toml000064400000000000000000000216101046102023000133460ustar 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.ActionRow", "Adw.AnimationState", "Adw.Avatar", "Adw.Banner", "Adw.Bin", "Adw.BreakpointBin", "Adw.BreakpointConditionLengthType", "Adw.BreakpointConditionRatioType", "Adw.ButtonContent", "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.Leaflet", "Adw.LeafletTransitionType", "Adw.LengthUnit", "Adw.NavigationDirection", "Adw.NavigationPage", "Adw.NavigationSplitView", "Adw.NavigationView", "Adw.OverlaySplitView", "Adw.PasswordEntryRow", "Adw.PreferencesDialog", "Adw.PreferencesGroup", "Adw.PreferencesPage", "Adw.PreferencesRow", "Adw.PreferencesWindow", "Adw.ResponseAppearance", "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.ToolbarStyle", "Adw.ToolbarView", "Adw.ViewStack", "Adw.ViewSwitcher", "Adw.ViewSwitcherBar", "Adw.ViewSwitcherPolicy", "Adw.ViewSwitcherTitle", "Adw.WindowTitle", ] manual = [ "GLib.Variant", "GObject.Object", "GObject.ParamSpec", "GObject.Value", "Gdk.Cursor", "Gdk.Display", "Gdk.DragAction", "Gdk.Paintable", "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.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 = "target_os = \"linux\"" [[object]] name = "Adw.AboutWindow" status = "generate" [[object.function]] name = "new_from_appdata" cfg_condition = "target_os = \"linux\"" [[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]] 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.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.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]] 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 version = "1.4" [[object]] name = "Adw.Window" status = "generate" trait_name = "AdwWindowExt" libadwaita-0.6.0/LICENCE000064400000000000000000000020001046102023000127050ustar 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.6.0/README.md000064400000000000000000000006111046102023000132050ustar 00000000000000# libadwaita-rs The Rust bindings of [libadwaita](https://gitlab.gnome.org/GNOME/libadwaita) Website: ## Documentation - libadwaita: - libadwaita-sys: libadwaita-0.6.0/examples/hello-world.rs000064400000000000000000000031371046102023000163500ustar 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.6.0/src/alert_dialog.rs000064400000000000000000000064211046102023000155160ustar 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.6.0/src/application.rs000064400000000000000000000027171046102023000153770ustar 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::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 initalize 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.6.0/src/auto/about_dialog.rs000064400000000000000000001374411046102023000165000ustar 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::{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; 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(target_os = "linux")] #[cfg_attr(docsrs, doc(cfg(target_os = "linux")))] #[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, ); } } #[doc(alias = "adw_about_dialog_get_application_icon")] #[doc(alias = "get_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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 libc::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 _, b"activate-link\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::application-icon\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::application-name\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::artists\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::comments\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::copyright\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::debug-info\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::debug-info-filename\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::designers\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::developer-name\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::developers\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::documenters\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::issue-url\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::license\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::license-type\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::release-notes\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::release-notes-version\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::support-url\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::translator-credits\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::version\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::website\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/about_window.rs000064400000000000000000001435071046102023000165500ustar 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::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 { #[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(target_os = "linux")] #[cfg_attr(docsrs, doc(cfg(target_os = "linux")))] #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[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() } #[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, ); } } #[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, ); } } #[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, ); } } #[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, ); } } #[doc(alias = "adw_about_window_get_application_icon")] #[doc(alias = "get_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, )) } } #[doc(alias = "adw_about_window_get_application_name")] #[doc(alias = "get_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, )) } } #[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, )) } } #[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)) } } #[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)) } } #[doc(alias = "adw_about_window_get_debug_info")] #[doc(alias = "get_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)) } } #[doc(alias = "adw_about_window_get_debug_info_filename")] #[doc(alias = "get_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, )) } } #[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, )) } } #[doc(alias = "adw_about_window_get_developer_name")] #[doc(alias = "get_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, )) } } #[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, )) } } #[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, )) } } #[doc(alias = "adw_about_window_get_issue_url")] #[doc(alias = "get_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)) } } #[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)) } } #[doc(alias = "adw_about_window_get_license_type")] #[doc(alias = "get_license_type")] pub fn license_type(&self) -> gtk::License { unsafe { from_glib(ffi::adw_about_window_get_license_type( self.to_glib_none().0, )) } } #[doc(alias = "adw_about_window_get_release_notes")] #[doc(alias = "get_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, )) } } #[doc(alias = "adw_about_window_get_release_notes_version")] #[doc(alias = "get_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, )) } } #[doc(alias = "adw_about_window_get_support_url")] #[doc(alias = "get_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)) } } #[doc(alias = "adw_about_window_get_translator_credits")] #[doc(alias = "get_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, )) } } #[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)) } } #[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)) } } #[doc(alias = "adw_about_window_set_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, ); } } #[doc(alias = "adw_about_window_set_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, ); } } #[doc(alias = "adw_about_window_set_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); } } #[doc(alias = "adw_about_window_set_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); } } #[doc(alias = "adw_about_window_set_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); } } #[doc(alias = "adw_about_window_set_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, ); } } #[doc(alias = "adw_about_window_set_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, ); } } #[doc(alias = "adw_about_window_set_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); } } #[doc(alias = "adw_about_window_set_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, ); } } #[doc(alias = "adw_about_window_set_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, ); } } #[doc(alias = "adw_about_window_set_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, ); } } #[doc(alias = "adw_about_window_set_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); } } #[doc(alias = "adw_about_window_set_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); } } #[doc(alias = "adw_about_window_set_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()); } } #[doc(alias = "adw_about_window_set_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, ); } } #[doc(alias = "adw_about_window_set_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, ); } } #[doc(alias = "adw_about_window_set_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, ); } } #[doc(alias = "adw_about_window_set_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, ); } } #[doc(alias = "adw_about_window_set_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); } } #[doc(alias = "adw_about_window_set_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(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 libc::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 _, b"activate-link\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( activate_link_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::application-icon\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_application_icon_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::application-name\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_application_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::artists\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_artists_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::comments\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_comments_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::copyright\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_copyright_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::debug-info\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_debug_info_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::debug-info-filename\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_debug_info_filename_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::designers\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_designers_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::developer-name\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_developer_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::developers\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_developers_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::documenters\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_documenters_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::issue-url\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_issue_url_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::license\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_license_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::license-type\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_license_type_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::release-notes\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_release_notes_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::release-notes-version\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_release_notes_version_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::support-url\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_support_url_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::translator-credits\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_translator_credits_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::version\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_version_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::website\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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")))] 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")))] 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")))] 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")))] 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")))] 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")))] 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")))] 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")))] 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")))] 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")))] 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")))] 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")))] 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")))] 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")))] 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")))] 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")))] 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")))] 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")))] 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")))] 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")))] pub fn website(self, website: impl Into) -> Self { Self { builder: self.builder.property("website", website.into()), } } 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/action_row.rs000064400000000000000000000525371046102023000162150ustar 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::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 { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait ActionRowExt: IsA + sealed::Sealed + '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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"activated\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::activatable-widget\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::icon-name\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::subtitle\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::subtitle-lines\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::subtitle-selectable\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::title-lines\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_title_lines_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> ActionRowExt for O {} libadwaita-0.6.0/src/auto/alert_dialog.rs000064400000000000000000000660361046102023000164760ustar 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::{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; 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_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 { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait AlertDialogExt: IsA + sealed::Sealed + '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")] 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")] 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")] 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")] 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")] 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_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")] 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")] 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")] 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")] 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")] 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")] 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")] 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(), ); } } #[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 libc::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::<_, 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 _, b"notify::body\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::body-use-markup\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::close-response\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::default-response\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::extra-child\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::heading\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::heading-use-markup\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_heading_use_markup_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> AlertDialogExt for O {} libadwaita-0.6.0/src/auto/animation.rs000064400000000000000000000202321046102023000160130ustar 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::{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; } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait AnimationExt: IsA + sealed::Sealed + '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")] 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")] 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")] 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 _, b"done\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::follow-enable-animations-setting\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::state\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::target\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::value\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_value_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> AnimationExt for O {} libadwaita-0.6.0/src/auto/animation_target.rs000064400000000000000000000007301046102023000173620ustar 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 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.6.0/src/auto/application.rs000064400000000000000000000113741046102023000163460ustar 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::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 action_group(self, action_group: &impl IsA) -> Self { Self { builder: self .builder .property("action-group", action_group.clone().upcast()), } } 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()), } } // 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 } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait AdwApplicationExt: IsA + sealed::Sealed + 'static { #[doc(alias = "adw_application_get_style_manager")] #[doc(alias = "get_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 _, b"notify::style-manager\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_style_manager_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> AdwApplicationExt for O {} libadwaita-0.6.0/src/auto/application_window.rs000064400000000000000000000450241046102023000177340ustar 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_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(), } } 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 { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait AdwApplicationWindowExt: IsA + sealed::Sealed + '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(), ); } } #[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")] 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")] fn visible_dialog(&self) -> Option

{ unsafe { from_glib_none(ffi::adw_application_window_get_visible_dialog( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_application_window_set_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, ); } } #[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 _, b"notify::content\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::current-breakpoint\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::dialogs\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::visible-dialog\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_visible_dialog_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> AdwApplicationWindowExt for O {} libadwaita-0.6.0/src/auto/avatar.rs000064400000000000000000000350341046102023000153200ustar 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 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"notify::custom-image\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::icon-name\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::show-initials\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::size\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::text\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/banner.rs000064400000000000000000000350201046102023000153020ustar 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 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")] pub fn button_label(&self) -> Option { unsafe { from_glib_none(ffi::adw_banner_get_button_label(self.to_glib_none().0)) } } #[doc(alias = "adw_banner_get_revealed")] #[doc(alias = "get_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")] 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")] 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); } } #[doc(alias = "adw_banner_set_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")] 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")] 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 _, b"button-clicked\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::button-label\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_button_label_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 _, b"notify::revealed\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::title\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::use-markup\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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_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 { self.builder.build() } } libadwaita-0.6.0/src/auto/bin.rs000064400000000000000000000207261046102023000146140ustar 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 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 { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait BinExt: IsA + sealed::Sealed + '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")] 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 _, b"notify::child\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_child_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> BinExt for O {} libadwaita-0.6.0/src/auto/breakpoint.rs000064400000000000000000000104661046102023000162020ustar 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::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: &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")] 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 _, b"apply\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"unapply\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::condition\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_condition_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } libadwaita-0.6.0/src/auto/breakpoint_bin.rs000064400000000000000000000262501046102023000170300ustar 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::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 { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait BreakpointBinExt: IsA + sealed::Sealed + '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")] 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")] 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 _, b"notify::child\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::current-breakpoint\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_current_breakpoint_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> BreakpointBinExt for O {} libadwaita-0.6.0/src/auto/breakpoint_condition.rs000064400000000000000000000063321046102023000202450ustar 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::{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.6.0/src/auto/button_content.rs000064400000000000000000000325251046102023000171110ustar 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 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"notify::can-shrink\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::icon-name\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::label\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::use-underline\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/callback_animation_target.rs000064400000000000000000000032071046102023000212000ustar 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::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: libc::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.6.0/src/auto/carousel.rs000064400000000000000000000546621046102023000156670ustar 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::{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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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: libc::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 _, b"page-changed\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::allow-long-swipes\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::allow-mouse-drag\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::allow-scroll-wheel\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::interactive\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::n-pages\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::position\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::reveal-duration\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::scroll-params\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::spacing\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/carousel_indicator_dots.rs000064400000000000000000000217071046102023000207460ustar 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::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")] 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 _, b"notify::carousel\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/carousel_indicator_lines.rs000064400000000000000000000220161046102023000211010ustar 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::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")] 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 _, b"notify::carousel\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/clamp.rs000064400000000000000000000323101046102023000151300ustar 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_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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"notify::child\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::maximum-size\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::tightening-threshold\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::unit\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/clamp_layout.rs000064400000000000000000000161151046102023000165320ustar 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_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")] 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")] 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")] 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")] 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")] 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 _, b"notify::maximum-size\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::tightening-threshold\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::unit\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/clamp_scrollable.rs000064400000000000000000000351221046102023000173360ustar 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_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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"notify::child\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::maximum-size\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::tightening-threshold\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::unit\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/combo_row.rs000064400000000000000000000563061046102023000160350ustar 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::{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()), } } 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()), } } 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 { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait ComboRowExt: IsA + sealed::Sealed + '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")] 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, )) } } #[doc(alias = "adw_combo_row_get_list_factory")] #[doc(alias = "get_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)) } } #[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")] 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")] 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")] 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")] 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")] 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, ); } } #[doc(alias = "adw_combo_row_set_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")] 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, ); } } #[doc(alias = "adw_combo_row_set_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")] 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 _, b"notify::enable-search\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::expression\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::factory\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_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 _, b"notify::list-factory\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::model\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_model_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 _, b"notify::selected\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::selected-item\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::use-subtitle\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_use_subtitle_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> ComboRowExt for O {} libadwaita-0.6.0/src/auto/dialog.rs000064400000000000000000000670711046102023000153070ustar 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::{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; 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 { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait AdwDialogExt: IsA

+ sealed::Sealed + '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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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: &impl IsA) { unsafe { ffi::adw_dialog_present( self.as_ref().to_glib_none().0, parent.as_ref().to_glib_none().0, ); } } #[doc(alias = "adw_dialog_set_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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 = "focus-widget")] fn focus_widget(&self) -> Option { ObjectExt::property(self.as_ref(), "focus-widget") } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "focus-widget")] fn set_focus_widget>(&self, focus_widget: Option<&P>) { ObjectExt::set_property(self.as_ref(), "focus-widget", focus_widget) } #[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 _, b"close-attempt\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"closed\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::can-close\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::child\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::content-height\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::content-width\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::current-breakpoint\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::default-widget\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::focus-widget\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::follows-content-size\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::presentation-mode\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::title\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> AdwDialogExt for O {} libadwaita-0.6.0/src/auto/entry_row.rs000064400000000000000000000627051046102023000160770ustar 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::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_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 { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait EntryRowExt: IsA + sealed::Sealed + '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")] 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")] 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")] 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")] fn input_purpose(&self) -> gtk::InputPurpose { unsafe { from_glib(ffi::adw_entry_row_get_input_purpose( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_entry_row_get_show_apply_button")] #[doc(alias = "get_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")] 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")] 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")] 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")] 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")] 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")] 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(), ); } } #[doc(alias = "adw_entry_row_set_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 _, b"apply\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"entry-activated\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::activates-default\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::attributes\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::enable-emoji-completion\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::input-hints\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::input-purpose\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_input_purpose_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 _, b"notify::show-apply-button\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::text-length\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_text_length_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> EntryRowExt for O {} libadwaita-0.6.0/src/auto/enum_list_item.rs000064400000000000000000000073651046102023000170650ustar 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 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 _, b"notify::name\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::nick\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::value\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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.6.0/src/auto/enum_list_model.rs000064400000000000000000000022531046102023000172160ustar 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 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")] 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.6.0/src/auto/enums.rs000064400000000000000000001665161046102023000152030ustar 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 glib::{prelude::*, translate::*}; #[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_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, #[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, 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, 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_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_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) } } libadwaita-0.6.0/src/auto/expander_row.rs000064400000000000000000000563661046102023000165520ustar 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::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 { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait ExpanderRowExt: IsA + sealed::Sealed + '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")] 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")] 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")] 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")] 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")] fn is_subtitle_lines(&self) -> bool { unsafe { from_glib(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")] fn is_title_lines(&self) -> bool { unsafe { from_glib(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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"notify::enable-expansion\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::expanded\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::icon-name\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::show-enable-switch\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::subtitle\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::subtitle-lines\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::title-lines\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_title_lines_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> ExpanderRowExt for O {} libadwaita-0.6.0/src/auto/flags.rs000064400000000000000000000116061046102023000151350ustar 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 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.6.0/src/auto/flap.rs000064400000000000000000001041451046102023000147640ustar 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::{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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"notify::content\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::flap\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::flap-position\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::fold-duration\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::fold-policy\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::fold-threshold-policy\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::folded\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::locked\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::modal\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::reveal-flap\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::reveal-params\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::reveal-progress\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::separator\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::swipe-to-close\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::swipe-to-open\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::transition-type\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/functions.rs000064400000000000000000000026021046102023000160450ustar 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 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) } } libadwaita-0.6.0/src/auto/header_bar.rs000064400000000000000000000477651046102023000161340ustar 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::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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"notify::centering-policy\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::decoration-layout\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::show-back-button\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::show-end-title-buttons\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::show-start-title-buttons\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::show-title\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::title-widget\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/leaflet.rs000064400000000000000000001040261046102023000154540ustar 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::{ 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"notify::can-navigate-back\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::can-navigate-forward\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::can-unfold\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::child-transition-params\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::child-transition-running\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::fold-threshold-policy\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::folded\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::homogeneous\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::mode-transition-duration\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::pages\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::transition-type\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::visible-child\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::visible-child-name\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/leaflet_page.rs000064400000000000000000000075131046102023000164530ustar 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 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")] 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")] 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")] 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 _, b"notify::name\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::navigatable\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_navigatable_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } libadwaita-0.6.0/src/auto/message_dialog.rs000064400000000000000000000730311046102023000170040ustar 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::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; #[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")))] 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")))] 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")))] 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")))] 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")))] 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")))] 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")))] 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 { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait MessageDialogExt: IsA + sealed::Sealed + 'static { #[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, ); } } #[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, )) } } #[doc(alias = "adw_message_dialog_get_body_use_markup")] #[doc(alias = "get_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, )) } } #[doc(alias = "adw_message_dialog_get_close_response")] #[doc(alias = "get_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, )) } } #[doc(alias = "adw_message_dialog_get_default_response")] #[doc(alias = "get_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, )) } } #[doc(alias = "adw_message_dialog_get_extra_child")] #[doc(alias = "get_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, )) } } #[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, )) } } #[doc(alias = "adw_message_dialog_get_heading_use_markup")] #[doc(alias = "get_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, )) } } #[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, )) } } #[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, )) } } #[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(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[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, ); } } #[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, ); } } #[doc(alias = "adw_message_dialog_set_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); } } #[doc(alias = "adw_message_dialog_set_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(), ); } } #[doc(alias = "adw_message_dialog_set_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, ); } } #[doc(alias = "adw_message_dialog_set_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, ); } } #[doc(alias = "adw_message_dialog_set_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, ); } } #[doc(alias = "adw_message_dialog_set_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, ); } } #[doc(alias = "adw_message_dialog_set_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(), ); } } #[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(), ); } } #[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(), ); } } #[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(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 libc::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::<_, unsafe extern "C" fn()>( response_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::body\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_body_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::body-use-markup\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_body_use_markup_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::close-response\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_close_response_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::default-response\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_default_response_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::extra-child\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_extra_child_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::heading\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_heading_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::heading-use-markup\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_heading_use_markup_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> MessageDialogExt for O {} libadwaita-0.6.0/src/auto/mod.rs000064400000000000000000000400651046102023000146210ustar 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")))] mod about_window; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] 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_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; 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_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")))] mod message_dialog; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub use self::message_dialog::MessageDialog; #[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; mod preferences_window; 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; 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_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_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; pub use self::enums::AnimationState; #[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; #[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_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; 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")))] 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; 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")))] 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_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use super::breakpoint_bin::BreakpointBinBuilder; pub use super::button_content::ButtonContentBuilder; 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_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")))] pub use super::message_dialog::MessageDialogBuilder; #[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; pub use super::preferences_window::PreferencesWindowBuilder; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] pub use super::spin_row::SpinRowBuilder; 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_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; } libadwaita-0.6.0/src/auto/navigation_page.rs000064400000000000000000000447451046102023000172060ustar 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 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 { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait NavigationPageExt: IsA + sealed::Sealed + 'static { #[doc(alias = "adw_navigation_page_get_can_pop")] #[doc(alias = "get_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")] 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")] 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")] 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")] 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 _, b"hidden\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"hiding\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"showing\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"shown\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::can-pop\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::child\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::tag\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::title\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> NavigationPageExt for O {} libadwaita-0.6.0/src/auto/navigation_split_view.rs000064400000000000000000000536171046102023000204550ustar 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::{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")] 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")] 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")] 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")] 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, )) } } #[doc(alias = "adw_navigation_split_view_get_sidebar_width_fraction")] #[doc(alias = "get_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")] 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")] 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")] 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")] 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")] 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")] 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")] 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, ); } } #[doc(alias = "adw_navigation_split_view_set_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")] 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 _, b"notify::collapsed\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::content\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::max-sidebar-width\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::min-sidebar-width\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::show-content\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::sidebar\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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-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 _, b"notify::sidebar-width-fraction\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::sidebar-width-unit\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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_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 { self.builder.build() } } libadwaita-0.6.0/src/auto/navigation_view.rs000064400000000000000000000500701046102023000172300ustar 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::{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")] pub fn is_animate_transitions(&self) -> bool { unsafe { from_glib(ffi::adw_navigation_view_get_animate_transitions( self.to_glib_none().0, )) } } #[doc(alias = "adw_navigation_view_get_navigation_stack")] #[doc(alias = "get_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")] 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, )) } } #[doc(alias = "adw_navigation_view_get_visible_page")] #[doc(alias = "get_visible_page")] pub fn visible_page(&self) -> Option { unsafe { from_glib_none(ffi::adw_navigation_view_get_visible_page( 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")] 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(), ); } } #[doc(alias = "adw_navigation_view_set_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_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 _, b"get-next-page\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"popped\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"pushed\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"replaced\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::animate-transitions\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_animate_transitions_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 _, b"notify::navigation-stack\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::pop-on-escape\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_pop_on_escape_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 _, b"notify::visible-page\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_visible_page_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_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), } } 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/overlay_split_view.rs000064400000000000000000000722151046102023000177720ustar 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::{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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"notify::collapsed\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::content\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::enable-hide-gesture\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::enable-show-gesture\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::max-sidebar-width\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::min-sidebar-width\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::pin-sidebar\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::show-sidebar\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::sidebar\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::sidebar-position\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::sidebar-width-fraction\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::sidebar-width-unit\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/password_entry_row.rs000064400000000000000000000266371046102023000200250ustar 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::{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_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 { self.builder.build() } } libadwaita-0.6.0/src/auto/preferences_dialog.rs000064400000000000000000000424101046102023000176560ustar 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::{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; 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 { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait PreferencesDialogExt: IsA + sealed::Sealed + '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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"notify::search-enabled\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::visible-page\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::visible-page-name\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_visible_page_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> PreferencesDialogExt for O {} libadwaita-0.6.0/src/auto/preferences_group.rs000064400000000000000000000326431046102023000175620ustar 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 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()), } } 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 { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait PreferencesGroupExt: IsA + sealed::Sealed + '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")] fn header_suffix(&self) -> Option { unsafe { from_glib_none(ffi::adw_preferences_group_get_header_suffix( 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")] 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")] 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, ); } } #[doc(alias = "adw_preferences_group_set_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 _, b"notify::description\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::header-suffix\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_header_suffix_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 _, b"notify::title\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> PreferencesGroupExt for O {} libadwaita-0.6.0/src/auto/preferences_page.rs000064400000000000000000000374571046102023000173520ustar 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::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_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()), } } 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 { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait PreferencesPageExt: IsA + sealed::Sealed + '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_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, )) } } #[doc(alias = "adw_preferences_page_get_icon_name")] #[doc(alias = "get_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")] 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_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "adw_preferences_page_set_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, ); } } #[doc(alias = "adw_preferences_page_set_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")] 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")] 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")] 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_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 _, b"notify::description\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_description_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 _, b"notify::icon-name\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::title\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::use-underline\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_use_underline_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> PreferencesPageExt for O {} libadwaita-0.6.0/src/auto/preferences_row.rs000064400000000000000000000370421046102023000172330ustar 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 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 { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait PreferencesRowExt: IsA + sealed::Sealed + '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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"notify::title\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::title-selectable\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::use-markup\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::use-underline\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_use_underline_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> PreferencesRowExt for O {} libadwaita-0.6.0/src/auto/preferences_window.rs000064400000000000000000000533601046102023000177340ustar 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::{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; #[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), } } pub fn search_enabled(self, search_enabled: bool) -> Self { Self { builder: self.builder.property("search-enabled", search_enabled), } } pub fn visible_page(self, visible_page: &impl IsA) -> Self { Self { builder: self .builder .property("visible-page", visible_page.clone().upcast()), } } pub fn visible_page_name(self, visible_page_name: impl Into) -> Self { Self { builder: self .builder .property("visible-page-name", visible_page_name.into()), } } 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 { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait PreferencesWindowExt: IsA + sealed::Sealed + 'static { #[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, ); } } #[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")] fn can_navigate_back(&self) -> bool { unsafe { from_glib(ffi::adw_preferences_window_get_can_navigate_back( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_preferences_window_get_search_enabled")] #[doc(alias = "get_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, )) } } #[doc(alias = "adw_preferences_window_get_visible_page")] #[doc(alias = "get_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, )) } } #[doc(alias = "adw_preferences_window_get_visible_page_name")] #[doc(alias = "get_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(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[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(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[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, ); } } #[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")] 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(), ); } } #[doc(alias = "adw_preferences_window_set_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(), ); } } #[doc(alias = "adw_preferences_window_set_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, ); } } #[doc(alias = "adw_preferences_window_set_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 _, b"notify::can-navigate-back\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_can_navigate_back_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::search-enabled\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_search_enabled_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::visible-page\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_visible_page_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[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 _, b"notify::visible-page-name\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_visible_page_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> PreferencesWindowExt for O {} libadwaita-0.6.0/src/auto/property_animation_target.rs000064400000000000000000000041631046102023000213320ustar 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::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.6.0/src/auto/spin_row.rs000064400000000000000000000652411046102023000157050ustar 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::{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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"output\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"wrapped\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::adjustment\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::climb-rate\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::digits\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::numeric\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::snap-to-ticks\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::update-policy\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::value\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::wrap\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/split_button.rs000064400000000000000000000574531046102023000166010ustar 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 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"activate\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"clicked\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::can-shrink\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::child\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::direction\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::dropdown-tooltip\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::icon-name\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::label\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::menu-model\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::popover\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::use-underline\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/spring_animation.rs000064400000000000000000000355511046102023000174070ustar 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::{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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"notify::clamp\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::epsilon\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::estimated-duration\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::initial-velocity\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::spring-params\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::value-from\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::value-to\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::velocity\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/spring_params.rs000064400000000000000000000035561046102023000167130ustar 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 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.6.0/src/auto/squeezer.rs000064400000000000000000000647251046102023000157160ustar 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::{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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"notify::allow-none\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::homogeneous\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::interpolate-size\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::pages\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::switch-threshold-policy\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::transition-duration\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::transition-running\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::transition-type\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::visible-child\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::xalign\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::yalign\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/squeezer_page.rs000064400000000000000000000044761046102023000167070ustar 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 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")] 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")] 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 _, b"notify::enabled\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_enabled_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } libadwaita-0.6.0/src/auto/status_page.rs000064400000000000000000000347221046102023000163640ustar 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 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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"notify::child\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::description\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::icon-name\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::paintable\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::title\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/style_manager.rs000064400000000000000000000145131046102023000166730ustar 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::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 { #[doc(alias = "adw_style_manager_get_color_scheme")] #[doc(alias = "get_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")] 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)) } } #[doc(alias = "adw_style_manager_get_high_contrast")] #[doc(alias = "get_high_contrast")] pub fn is_high_contrast(&self) -> bool { unsafe { from_glib(ffi::adw_style_manager_get_high_contrast( self.to_glib_none().0, )) } } #[doc(alias = "adw_style_manager_get_system_supports_color_schemes")] #[doc(alias = "get_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")] 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, )) } } #[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 _, b"notify::color-scheme\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::dark\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_dark_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 _, b"notify::high-contrast\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_high_contrast_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 _, b"notify::system-supports-color-schemes\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_system_supports_color_schemes_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } libadwaita-0.6.0/src/auto/swipe_tracker.rs000064400000000000000000000450201046102023000167000ustar 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::{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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"begin-swipe\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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: libc::c_double, to: libc::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 _, b"end-swipe\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"prepare\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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: libc::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 _, b"update-swipe\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::allow-long-swipes\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::allow-mouse-drag\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::allow-window-handle\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::enabled\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::lower-overshoot\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::reversed\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::upper-overshoot\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/swipeable.rs000064400000000000000000000050051046102023000160100ustar 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::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; } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait SwipeableExt: IsA + sealed::Sealed + '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.6.0/src/auto/switch_row.rs000064400000000000000000000270641046102023000162360ustar 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::{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")] 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")] 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 _, b"notify::active\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/tab_bar.rs000064400000000000000000000576571046102023000154530ustar 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::{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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"extra-drag-drop\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"extra-drag-value\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::autohide\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::end-action-widget\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::expand-tabs\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::extra-drag-preferred-action\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::extra-drag-preload\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::inverted\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::is-overflowing\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::start-action-widget\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::tabs-revealed\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::view\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/tab_button.rs000064400000000000000000000256251046102023000162100ustar 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::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")] 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 _, b"activate\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"clicked\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::view\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/tab_overview.rs000064400000000000000000000754621046102023000165470ustar 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::{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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"create-tab\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"extra-drag-drop\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"extra-drag-value\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::child\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::enable-new-tab\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::enable-search\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::extra-drag-preferred-action\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::extra-drag-preload\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::inverted\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::open\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::search-active\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::secondary-menu\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::show-end-title-buttons\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::show-start-title-buttons\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::view\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/tab_page.rs000064400000000000000000000507771046102023000156170ustar 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 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"notify::icon\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::indicator-activatable\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::indicator-icon\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::indicator-tooltip\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::keyword\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::live-thumbnail\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::loading\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::needs-attention\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::pinned\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::selected\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::thumbnail-xalign\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::thumbnail-yalign\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::title\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::tooltip\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_tooltip_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } libadwaita-0.6.0/src/auto/tab_view.rs000064400000000000000000000776561046102023000156620ustar 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::TabPage; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] use crate::TabViewShortcuts; 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 bool + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn close_page_trampoline bool + '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 _, b"close-page\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"create-window\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"indicator-activated\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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: libc::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 _, b"page-attached\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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: libc::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 _, b"page-detached\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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: libc::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 _, b"page-reordered\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"setup-menu\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::default-icon\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::is-transferring-page\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::menu-model\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::n-pages\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::n-pinned-pages\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::pages\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::selected-page\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::shortcuts\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/timed_animation.rs000064400000000000000000000322141046102023000172000ustar 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::{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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"notify::alternate\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::duration\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::easing\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::repeat-count\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::reverse\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::value-from\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::value-to\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/toast.rs000064400000000000000000000405561046102023000152010ustar 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::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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"button-clicked\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"dismissed\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::action-name\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::action-target\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::button-label\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::custom-title\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::priority\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::timeout\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::title\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::use-markup\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/toast_overlay.rs000064400000000000000000000047421046102023000167370ustar 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::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()); } } #[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")] 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 _, b"notify::child\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_child_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for ToastOverlay { fn default() -> Self { Self::new() } } libadwaita-0.6.0/src/auto/toolbar_view.rs000064400000000000000000000560761046102023000165470ustar 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::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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"notify::bottom-bar-height\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::bottom-bar-style\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::content\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::extend-content-to-bottom-edge\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::extend-content-to-top-edge\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::reveal-bottom-bars\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::reveal-top-bars\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::top-bar-height\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::top-bar-style\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/versions.txt000064400000000000000000000002161046102023000160770ustar 00000000000000Generated by gir (https://github.com/gtk-rs/gir @ 0e476ab5c1de) from from gir-files (https://github.com/gtk-rs/gir-files.git @ cfc0305f903b) libadwaita-0.6.0/src/auto/view_stack.rs000064400000000000000000000416761046102023000162120ustar 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::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, )) } } #[doc(alias = "adw_view_stack_get_hhomogeneous")] #[doc(alias = "get_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)) } } #[doc(alias = "adw_view_stack_get_vhomogeneous")] #[doc(alias = "get_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")] 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")] 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); } } #[doc(alias = "adw_view_stack_set_hhomogeneous")] pub fn set_hhomogeneous(&self, hhomogeneous: bool) { unsafe { ffi::adw_view_stack_set_hhomogeneous(self.to_glib_none().0, hhomogeneous.into_glib()); } } #[doc(alias = "adw_view_stack_set_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")] 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")] 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, ); } } #[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 _, b"notify::hhomogeneous\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::pages\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_pages_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 _, b"notify::vhomogeneous\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::visible-child\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::visible-child-name\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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(), } } pub fn hhomogeneous(self, hhomogeneous: bool) -> Self { Self { builder: self.builder.property("hhomogeneous", hhomogeneous), } } 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/view_stack_page.rs000064400000000000000000000243551046102023000172010ustar 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 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"notify::badge-number\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::icon-name\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::name\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::needs-attention\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::title\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::use-underline\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::visible\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_visible_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } libadwaita-0.6.0/src/auto/view_stack_pages.rs000064400000000000000000000042161046102023000173560ustar 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::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")] 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")] 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 _, b"notify::selected-page\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_selected_page_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } libadwaita-0.6.0/src/auto/view_switcher.rs000064400000000000000000000234731046102023000167300ustar 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::{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")] 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")] 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 _, b"notify::policy\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::stack\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/view_switcher_bar.rs000064400000000000000000000235551046102023000175550ustar 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::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")] 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")] 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")] 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 _, b"notify::reveal\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::stack\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/view_switcher_title.rs000064400000000000000000000400531046102023000201220ustar 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::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")] 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")] 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")] 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")] 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")] 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")] 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 _, b"notify::stack\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::subtitle\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::title\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::title-visible\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::view-switcher-enabled\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/auto/window.rs000064400000000000000000000426501046102023000153530ustar 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_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(), } } 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 { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait AdwWindowExt: IsA + sealed::Sealed + '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(), ); } } #[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")] 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")] fn visible_dialog(&self) -> Option { unsafe { from_glib_none(ffi::adw_window_get_visible_dialog( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "adw_window_set_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, ); } } #[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 _, b"notify::content\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::current-breakpoint\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::dialogs\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::visible-dialog\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_visible_dialog_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> AdwWindowExt for O {} libadwaita-0.6.0/src/auto/window_title.rs000064400000000000000000000237041046102023000165530ustar 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 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")] 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")] 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 _, b"notify::subtitle\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 _, b"notify::title\0".as_ptr() as *const _, Some(std::mem::transmute::<_, 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 { self.builder.build() } } libadwaita-0.6.0/src/breakpoint.rs000064400000000000000000000020561046102023000152260ustar 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.6.0/src/builders.rs000064400000000000000000000001631046102023000146760ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. pub use crate::auto::builders::*; libadwaita-0.6.0/src/carousel.rs000064400000000000000000000006371046102023000147100ustar 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.6.0/src/functions.rs000064400000000000000000000004061046102023000150750ustar 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.6.0/src/lib.rs000064400000000000000000000106141046102023000136350ustar 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.6.0/src/message_dialog.rs000064400000000000000000000067161046102023000160420ustar 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.6.0/src/prelude.rs000064400000000000000000000005061046102023000145260ustar 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.6.0/src/spin_row.rs000064400000000000000000000022221046102023000147230ustar 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.6.0/src/subclass/action_row.rs000064400000000000000000000024001046102023000170440ustar 00000000000000use glib::subclass::prelude::*; use glib::translate::*; use crate::subclass::prelude::PreferencesRowImpl; use crate::{prelude::*, ActionRow}; pub trait ActionRowImpl: PreferencesRowImpl { fn activate(&self) { ActionRowImplExt::parent_activate(self) } } mod sealed { pub trait Sealed {} impl Sealed for T {} } pub trait ActionRowImplExt: sealed::Sealed + ObjectSubclass { 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.6.0/src/subclass/alert_dialog.rs000064400000000000000000000030131046102023000173270ustar 00000000000000use glib::subclass::prelude::*; use glib::translate::*; use super::dialog::AdwDialogImpl; use crate::{prelude::*, AlertDialog}; pub trait AdwAlertDialogImpl: AdwDialogImpl { fn response(&self, response: &str) { AdwAlertDialogImplExt::parent_response(self, response) } } mod sealed { pub trait Sealed {} impl Sealed for T {} } pub trait AdwAlertDialogImplExt: sealed::Sealed + ObjectSubclass { 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.6.0/src/subclass/application.rs000064400000000000000000000002661046102023000172130ustar 00000000000000use crate::Application; use gtk::subclass::prelude::*; pub trait AdwApplicationImpl: GtkApplicationImpl {} unsafe impl IsSubclassable for Application {} libadwaita-0.6.0/src/subclass/application_window.rs000064400000000000000000000003201046102023000205710ustar 00000000000000use crate::ApplicationWindow; use gtk::subclass::prelude::*; pub trait AdwApplicationWindowImpl: ApplicationWindowImpl {} unsafe impl IsSubclassable for ApplicationWindow {} libadwaita-0.6.0/src/subclass/bin.rs000064400000000000000000000002601046102023000154520ustar 00000000000000use crate::Bin; use glib::subclass::prelude::*; use gtk::subclass::prelude::WidgetImpl; pub trait BinImpl: WidgetImpl {} unsafe impl IsSubclassable for Bin {} libadwaita-0.6.0/src/subclass/breakpoint_bin.rs000064400000000000000000000003301046102023000176660ustar 00000000000000use crate::BreakpointBin; use glib::subclass::prelude::*; use gtk::subclass::prelude::WidgetImpl; pub trait BreakpointBinImpl: WidgetImpl {} unsafe impl IsSubclassable for BreakpointBin {} libadwaita-0.6.0/src/subclass/combo_row.rs000064400000000000000000000003051046102023000166700ustar 00000000000000use super::action_row::ActionRowImpl; use crate::ComboRow; use glib::subclass::prelude::*; pub trait ComboRowImpl: ActionRowImpl {} unsafe impl IsSubclassable for ComboRow {} libadwaita-0.6.0/src/subclass/dialog.rs000064400000000000000000000036021046102023000161440ustar 00000000000000use glib::subclass::prelude::*; use glib::translate::*; use crate::{prelude::*, Dialog}; use gtk::subclass::prelude::WidgetImpl; pub trait AdwDialogImpl: WidgetImpl { fn close_attempt(&self) { AdwDialogImplExt::parent_close_attempt(self) } fn closed(&self) { AdwDialogImplExt::parent_closed(self) } } mod sealed { pub trait Sealed {} impl Sealed for T {} } pub trait AdwDialogImplExt: sealed::Sealed + ObjectSubclass { 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.6.0/src/subclass/entry_row.rs000064400000000000000000000003271046102023000167360ustar 00000000000000use glib::subclass::prelude::*; use crate::subclass::prelude::PreferencesRowImpl; use crate::EntryRow; pub trait EntryRowImpl: PreferencesRowImpl {} unsafe impl IsSubclassable for EntryRow {} libadwaita-0.6.0/src/subclass/expander_row.rs000064400000000000000000000003401046102023000173760ustar 00000000000000use super::preferences_row::PreferencesRowImpl; use crate::ExpanderRow; use glib::subclass::prelude::*; pub trait ExpanderRowImpl: PreferencesRowImpl {} unsafe impl IsSubclassable for ExpanderRow {} libadwaita-0.6.0/src/subclass/message_dialog.rs000064400000000000000000000031201046102023000176430ustar 00000000000000use crate::{prelude::*, MessageDialog}; use glib::translate::*; use gtk::subclass::prelude::*; pub trait MessageDialogImpl: gtk::subclass::prelude::WindowImpl { fn response(&self, response: &str) { self.parent_response(response) } } mod sealed { pub trait Sealed {} impl Sealed for T {} } pub trait MessageDialogImplExt: sealed::Sealed + ObjectSubclass { 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.6.0/src/subclass/mod.rs000064400000000000000000000053241046102023000154670ustar 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; #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub use super::alert_dialog::AdwAlertDialogImpl; 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; #[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; #[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.6.0/src/subclass/navigation_page.rs000064400000000000000000000071541046102023000200460ustar 00000000000000use crate::{prelude::*, NavigationPage}; use glib::subclass::prelude::*; use glib::translate::*; use gtk::subclass::prelude::WidgetImpl; pub trait NavigationPageImpl: WidgetImpl { fn hidden(&self) { self.parent_hidden() } fn hiding(&self) { self.parent_hiding(); } fn showing(&self) { self.parent_showing(); } fn shown(&self) { self.parent_shown(); } } mod sealed { pub trait Sealed {} impl Sealed for T {} } pub trait NavigationPageImplExt: sealed::Sealed + ObjectSubclass { 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.6.0/src/subclass/preferences_dialog.rs000064400000000000000000000003451046102023000205260ustar 00000000000000use super::dialog::AdwDialogImpl; use crate::PreferencesDialog; use glib::subclass::prelude::*; pub trait PreferencesDialogImpl: AdwDialogImpl {} unsafe impl IsSubclassable for PreferencesDialog {} libadwaita-0.6.0/src/subclass/preferences_group.rs000064400000000000000000000003431046102023000204210ustar 00000000000000use crate::PreferencesGroup; use glib::subclass::prelude::*; use gtk::subclass::widget::WidgetImpl; pub trait PreferencesGroupImpl: WidgetImpl {} unsafe impl IsSubclassable for PreferencesGroup {} libadwaita-0.6.0/src/subclass/preferences_page.rs000064400000000000000000000003371046102023000202040ustar 00000000000000use crate::PreferencesPage; use glib::subclass::prelude::*; use gtk::subclass::widget::WidgetImpl; pub trait PreferencesPageImpl: WidgetImpl {} unsafe impl IsSubclassable for PreferencesPage {} libadwaita-0.6.0/src/subclass/preferences_row.rs000064400000000000000000000003511046102023000200730ustar 00000000000000use crate::PreferencesRow; use glib::subclass::prelude::*; use gtk::subclass::list_box_row::ListBoxRowImpl; pub trait PreferencesRowImpl: ListBoxRowImpl {} unsafe impl IsSubclassable for PreferencesRow {} libadwaita-0.6.0/src/subclass/preferences_window.rs000064400000000000000000000003451046102023000205760ustar 00000000000000use super::window::AdwWindowImpl; use crate::PreferencesWindow; use glib::subclass::prelude::*; pub trait PreferencesWindowImpl: AdwWindowImpl {} unsafe impl IsSubclassable for PreferencesWindow {} libadwaita-0.6.0/src/subclass/spin_row.rs000064400000000000000000000003111046102023000165370ustar 00000000000000use glib::subclass::prelude::*; use crate::subclass::prelude::ActionRowImpl; use crate::SpinRow; pub trait SpinRowImpl: ActionRowImpl {} unsafe impl IsSubclassable for SpinRow {} libadwaita-0.6.0/src/subclass/swipeable.rs000064400000000000000000000134251046102023000166640ustar 00000000000000use crate::{prelude::*, NavigationDirection, Swipeable}; use glib::translate::*; use gtk::subclass::prelude::*; pub trait SwipeableImpl: WidgetImpl { 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) } } mod sealed { pub trait Sealed {} impl Sealed for T {} } pub trait SwipeableImplExt: sealed::Sealed + ObjectSubclass { 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.6.0/src/subclass/window.rs000064400000000000000000000002311046102023000162070ustar 00000000000000use crate::Window; use gtk::subclass::prelude::*; pub trait AdwWindowImpl: WindowImpl {} unsafe impl IsSubclassable for Window {} libadwaita-0.6.0/src/tab_bar.rs000064400000000000000000000010311046102023000144520ustar 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.6.0/src/tab_overview.rs000064400000000000000000000010551046102023000155620ustar 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.6.0/src/tab_view.rs000064400000000000000000000007741046102023000146750ustar 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.6.0/src/toast.rs000064400000000000000000000010461046102023000142200ustar 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, ); } } }