libshumate-0.7.0/.cargo_vcs_info.json0000644000000001500000000000100131710ustar { "git": { "sha1": "c79a7738e14f11f206c4e74e833f20d74198ee78" }, "path_in_vcs": "libshumate" }libshumate-0.7.0/Cargo.lock0000644000000451730000000000100111620ustar # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 4 [[package]] name = "autocfg" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "bitflags" version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" [[package]] name = "cairo-rs" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6466a563dea2e99f59f6ffbb749fd0bdf75764f5e6e93976b5e7bd73c4c9efb" dependencies = [ "bitflags", "cairo-sys-rs", "glib", "libc", ] [[package]] name = "cairo-sys-rs" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cab7e9f13c802625aad1ad2b4ae3989f4ce9339ff388f335a6f109f9338705e2" dependencies = [ "glib-sys", "libc", "system-deps", ] [[package]] name = "cfg-expr" version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d0390889d58f934f01cd49736275b4c2da15bcfc328c78ff2349907e6cabf22" dependencies = [ "smallvec", "target-lexicon", ] [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "field-offset" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e1c54951450cbd39f3dbcf1005ac413b49487dabf18a720ad2383eccfeffb92" dependencies = [ "memoffset", "rustc_version", ] [[package]] name = "futures-channel" version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050" dependencies = [ "futures-core", ] [[package]] name = "futures-core" version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf" [[package]] name = "futures-executor" version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ff63c23854bee61b6e9cd331d523909f238fc7636290b96826e9cfa5faa00ab" dependencies = [ "futures-core", "futures-task", "futures-util", ] [[package]] name = "futures-io" version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68" [[package]] name = "futures-macro" version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17" dependencies = [ "proc-macro2", "quote", "syn 1.0.100", ] [[package]] name = "futures-task" version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1" [[package]] name = "futures-util" version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90" dependencies = [ "futures-core", "futures-macro", "futures-task", "pin-project-lite", "pin-utils", "slab", ] [[package]] name = "gdk-pixbuf" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "688dc7eaf551dbac1f5b11d000d089c3db29feb25562455f47c1a2080cc60bda" dependencies = [ "gdk-pixbuf-sys", "gio", "glib", "libc", ] [[package]] name = "gdk-pixbuf-sys" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5af1823d3d1cb72616873ba0a593bd440eb92da700fdfb047505a21ee3ec3e10" dependencies = [ "gio-sys", "glib-sys", "gobject-sys", "libc", "system-deps", ] [[package]] name = "gdk4" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a67b064d2f35e649232455c7724f56f977555d2608c43300eabc530eaa4e359" dependencies = [ "cairo-rs", "gdk-pixbuf", "gdk4-sys", "gio", "glib", "libc", "pango", ] [[package]] name = "gdk4-sys" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2edbda0d879eb85317bdb49a3da591ed70a804a10776e358ef416be38c6db2c5" 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.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "273d64c833fbbf7cd86c4cdced893c5d3f2f5d6aeb30fd0c30d172456ce8be2e" dependencies = [ "futures-channel", "futures-core", "futures-io", "futures-util", "gio-sys", "glib", "libc", "pin-project-lite", "smallvec", ] [[package]] name = "gio-sys" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c8130f5810a839d74afc3a929c34a700bf194972bb034f2ecfe639682dd13cc" dependencies = [ "glib-sys", "gobject-sys", "libc", "system-deps", "windows-sys", ] [[package]] name = "glib" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "690e8bcf8a819b5911d6ae79879226191d01253a4f602748072603defd5b9553" dependencies = [ "bitflags", "futures-channel", "futures-core", "futures-executor", "futures-task", "futures-util", "gio-sys", "glib-macros", "glib-sys", "gobject-sys", "libc", "memchr", "smallvec", ] [[package]] name = "glib-macros" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e772291ebea14c28eb11bb75741f62f4a4894f25e60ce80100797b6b010ef0f9" dependencies = [ "heck", "proc-macro-crate", "proc-macro2", "quote", "syn 2.0.104", ] [[package]] name = "glib-sys" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b2be4c74454fb4a6bd3328320737d0fa3d6939e2d570f5d846da00cb222f6a0" dependencies = [ "libc", "system-deps", ] [[package]] name = "gobject-sys" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab318a786f9abd49d388013b9161fa0ef8218ea6118ee7111c95e62186f7d31f" dependencies = [ "glib-sys", "libc", "system-deps", ] [[package]] name = "graphene-rs" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0487f78e8a772ec89020458fbabadd1332bc1e3236ca1c63ef1d61afd4e5f2cc" dependencies = [ "glib", "graphene-sys", "libc", ] [[package]] name = "graphene-sys" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "270cefb6b270fcb2ef9708c3a35c0e25c2e831dac28d75c4f87e5ad3540c9543" dependencies = [ "glib-sys", "libc", "pkg-config", "system-deps", ] [[package]] name = "gsk4" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5dbe33ceed6fc20def67c03d36e532f5a4a569ae437ae015a7146094f31e10c" dependencies = [ "cairo-rs", "gdk4", "glib", "graphene-rs", "gsk4-sys", "libc", "pango", ] [[package]] name = "gsk4-sys" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d76011d55dd19fde16ffdedee08877ae6ec942818cfa7bc08a91259bc0b9fc9" dependencies = [ "cairo-sys-rs", "gdk4-sys", "glib-sys", "gobject-sys", "graphene-sys", "libc", "pango-sys", "system-deps", ] [[package]] name = "gtk4" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "938d68ad43080ad5ee710c30d467c1bc022ee5947856f593855691d726305b3e" 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.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0912d2068695633002b92c5966edc108b2e4f54b58c509d1eeddd4cbceb7315c" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", "syn 2.0.104", ] [[package]] name = "gtk4-sys" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a923bdcf00e46723801162de24432cbce38a6810e0178a2d0b6dd4ecc26a1c74" dependencies = [ "cairo-sys-rs", "gdk-pixbuf-sys", "gdk4-sys", "gio-sys", "glib-sys", "gobject-sys", "graphene-sys", "gsk4-sys", "libc", "pango-sys", "system-deps", ] [[package]] name = "hashbrown" version = "0.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" [[package]] name = "heck" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "indexmap" version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" dependencies = [ "equivalent", "hashbrown", ] [[package]] name = "libc" version = "0.2.133" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0f80d65747a3e43d1596c7c5492d95d5edddaabd45a7fcdb02b95f644164966" [[package]] name = "libshumate" version = "0.7.0" dependencies = [ "gdk-pixbuf", "gdk4", "gio", "glib", "gtk4", "libc", "libshumate-sys", ] [[package]] name = "libshumate-sys" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d397f1c0e73ff929acd042fa47babd3ce0ef6d9a8579bec03ca6bfd45d3696" dependencies = [ "gdk-pixbuf-sys", "gdk4-sys", "gio-sys", "glib-sys", "gobject-sys", "gtk4-sys", "libc", "system-deps", ] [[package]] name = "memchr" version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "memoffset" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" dependencies = [ "autocfg", ] [[package]] name = "pango" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d4803f086c4f49163c31ac14db162112a22401c116435080e4be8678c507d61" dependencies = [ "gio", "glib", "libc", "pango-sys", ] [[package]] name = "pango-sys" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66872b3cfd328ad6d1a4f89ebd5357119bd4c592a4ddbb8f6bc2386f8ce7b898" dependencies = [ "glib-sys", "gobject-sys", "libc", "system-deps", ] [[package]] name = "pest" version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb779fcf4bb850fbbb0edc96ff6cf34fd90c4b1a112ce042653280d9a7364048" dependencies = [ "thiserror", "ucd-trie", ] [[package]] name = "pin-project-lite" version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" [[package]] name = "pin-utils" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "proc-macro-crate" version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" dependencies = [ "toml_edit", ] [[package]] name = "proc-macro2" version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] [[package]] name = "quote" version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] [[package]] name = "rustc_version" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" dependencies = [ "semver", ] [[package]] name = "semver" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" dependencies = [ "semver-parser", ] [[package]] name = "semver-parser" version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" dependencies = [ "pest", ] [[package]] name = "serde" version = "1.0.145" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b" [[package]] name = "serde_spanned" version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" dependencies = [ "serde", ] [[package]] name = "slab" version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" dependencies = [ "autocfg", ] [[package]] name = "smallvec" version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "syn" version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52205623b1b0f064a4e71182c3b18ae902267282930c6d5462c91b859668426e" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "syn" version = "2.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "system-deps" version = "7.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4be53aa0cba896d2dc615bd42bbc130acdcffa239e0a2d965ea5b3b2a86ffdb" dependencies = [ "cfg-expr", "heck", "pkg-config", "toml", "version-compare", ] [[package]] name = "target-lexicon" version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a" [[package]] name = "thiserror" version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a99cb8c4b9a8ef0e7907cd3b617cc8dc04d571c4e73c8ae403d80ac160bb122" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a891860d3c8d66fec8e73ddb3765f90082374dbaaa833407b904a94f1a7eb43" dependencies = [ "proc-macro2", "quote", "syn 1.0.100", ] [[package]] name = "toml" version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" dependencies = [ "serde", "serde_spanned", "toml_datetime", "toml_edit", ] [[package]] name = "toml_datetime" version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" dependencies = [ "serde", ] [[package]] name = "toml_edit" version = "0.22.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" dependencies = [ "indexmap", "serde", "serde_spanned", "toml_datetime", "winnow", ] [[package]] name = "ucd-trie" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" [[package]] name = "unicode-ident" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd" [[package]] name = "version-compare" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" [[package]] name = "windows-sys" version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", "windows_i686_gnullvm", "windows_i686_msvc", "windows_x86_64_gnu", "windows_x86_64_gnullvm", "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" [[package]] name = "windows_aarch64_msvc" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" [[package]] name = "windows_i686_gnu" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" [[package]] name = "windows_i686_gnullvm" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" [[package]] name = "windows_i686_msvc" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" [[package]] name = "windows_x86_64_gnu" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" [[package]] name = "windows_x86_64_gnullvm" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" [[package]] name = "windows_x86_64_msvc" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" [[package]] name = "winnow" version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3edebf492c8125044983378ecb5766203ad3b4c2f7a922bd7dd207f6d443e95" dependencies = [ "memchr", ] libshumate-0.7.0/Cargo.toml0000644000000034770000000000100112060ustar # 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 = "libshumate" version = "0.7.0" authors = ["Corentin Noël "] build = false autolib = false autobins = false autoexamples = false autotests = false autobenches = false description = "Rust bindings for libshumate" homepage = "https://world.pages.gitlab.gnome.org/Rust/libshumate-rs/" documentation = "https://world.pages.gitlab.gnome.org/Rust/libshumate-rs/stable/latest/docs/libshumate" readme = "README.md" keywords = [ "gtk4-rs", "gnome", "Map", "GUI", ] categories = [ "api-bindings", "gui", ] license = "MIT" repository = "https://gitlab.gnome.org/World/Rust/libshumate-rs" [package.metadata.docs.rs] all-features = true rustc-args = [ "--cfg", "docsrs", ] rustdoc-args = [ "--cfg", "docsrs", "--generate-link-to-definition", ] [features] gtk_v4_18 = ["gtk/v4_18"] v1_1 = ["ffi/v1_1"] v1_2 = [ "v1_1", "ffi/v1_2", ] v1_4 = [ "v1_2", "ffi/v1_4", ] v1_5 = [ "v1_4", "ffi/v1_5", ] [lib] name = "libshumate" path = "src/lib.rs" [dependencies.ffi] version = "0.7" package = "libshumate-sys" [dependencies.gdk] version = "0.10" package = "gdk4" [dependencies.gdk-pixbuf] version = "0.21" [dependencies.gio] version = "0.21" [dependencies.glib] version = "0.21" [dependencies.gtk] version = "0.10" package = "gtk4" [dependencies.libc] version = "0.2" libshumate-0.7.0/Cargo.toml.orig000064400000000000000000000027151046102023000146610ustar 00000000000000[package] name = "libshumate" version = "0.7.0" authors = ["Corentin Noël "] edition = "2021" readme = "../README.md" homepage = "https://world.pages.gitlab.gnome.org/Rust/libshumate-rs/" description = "Rust bindings for libshumate" license = "MIT" repository = "https://gitlab.gnome.org/World/Rust/libshumate-rs" documentation = "https://world.pages.gitlab.gnome.org/Rust/libshumate-rs/stable/latest/docs/libshumate" categories = ["api-bindings", "gui"] keywords = ["gtk4-rs", "gnome", "Map", "GUI"] [lib] name = "libshumate" [features] gtk_v4_18 = ["gtk/v4_18"] v1_1 = ["ffi/v1_1"] v1_2 = ["v1_1", "ffi/v1_2"] v1_4 = ["v1_2", "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", "--generate-link-to-definition"] [dependencies] libc = '0.2' [dependencies.glib] git = "https://github.com/gtk-rs/gtk-rs-core" branch = "0.21" version = "0.21" [dependencies.gio] git = "https://github.com/gtk-rs/gtk-rs-core" branch = "0.21" version = "0.21" [dependencies.gdk] package = "gdk4" git = "https://github.com/gtk-rs/gtk4-rs" branch = "0.10" version = "0.10" [dependencies.gdk-pixbuf] git = "https://github.com/gtk-rs/gtk-rs-core" branch = "0.21" version = "0.21" [dependencies.gtk] package = "gtk4" git = "https://github.com/gtk-rs/gtk4-rs" branch = "0.10" version = "0.10" [dependencies.ffi] package = "libshumate-sys" path = './sys' version = "0.7" libshumate-0.7.0/Gir.toml000064400000000000000000000056241046102023000134120ustar 00000000000000[external_libraries] Gio = {min_version = "2.66"} [options] girs_directories = ["../gir-files", "../"] library = "Shumate" version = "1.0" min_cfg_version = "1" target_path = "." 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 use_gi_docgen = true external_libraries = [ "GLib", "GObject", "Gdk", "Gtk", ] generate = [ "Shumate.*", "Shumate.Compass", "Shumate.Coordinate", "Shumate.DataSource", "Shumate.DataSourceRequest", "Shumate.FileCache", "Shumate.GeometryType", "Shumate.Layer", "Shumate.License", "Shumate.Map", "Shumate.MapLayer", "Shumate.MapSource", "Shumate.MapSourceRegistry", "Shumate.Marker", "Shumate.MarkerLayer", "Shumate.PathLayer", "Shumate.Point", "Shumate.RasterRenderer", "Shumate.Scale", "Shumate.StyleError", "Shumate.Location", "Shumate.MapProjection", "Shumate.State", "Shumate.Unit", "Shumate.FileCacheError", "Shumate.Tile", "Shumate.TileDownloaderError", "Shumate.VectorReader", "Shumate.VectorRenderer", "Shumate.VectorSpriteSheet", "Shumate.Viewport", ] manual = [ "GLib.Bytes", "GLib.DateTime", "GLib.Error", "GLib.Variant", "GObject.Object", "GObject.Value", "Gdk.Cursor", "Gdk.Display", "Gdk.DragAction", "Gdk.Paintable", "Gdk.RGBA", "Gdk.Rectangle", "Gdk.Texture", "GdkPixbuf.Pixbuf", "Gio.Initable", "Gio.Cancellable", "Gio.Icon", "Gio.ListModel", "Gtk.Accessible", "Gtk.AccessibleRole", "Gtk.Actionable", "Gtk.Align", "Gtk.Buildable", "Gtk.ConstraintTarget", "Gtk.LayoutManager", "Gtk.Orientable", "Gtk.Orientation", "Gtk.Overflow", "Gtk.SelectionMode", "Gtk.SymbolicPaintable", "Gtk.Widget" ] [[object]] name = "Shumate.VectorSprite" status = "generate" [[object.function]] name = "new_full" [[object.function.parameter]] name = "source_rect" const = true [[object]] name = "Shumate.VectorReaderIter" status = "generate" generate_builder = false [[object.property]] name = "reader" generate = [] [[object]] name = "Shumate.TileDownloader" status = "generate" generate_builder = false [[object]] name = "Shumate.SimpleMap" status = "generate" [[object.function]] name = "insert_overlay_layer_above" # TODO Remove after https://gitlab.gnome.org/GNOME/libshumate/-/merge_requests/261 version = "1.5" [[object.function]] name = "insert_overlay_layer_behind" # TODO Remove after https://gitlab.gnome.org/GNOME/libshumate/-/merge_requests/261 version = "1.5" [[object]] name = "Shumate.SymbolEvent" status = "generate" [[object.function]] name = "get_keys" ignore = true # todo for later libshumate-0.7.0/README.md000064400000000000000000000006111046102023000132420ustar 00000000000000# libshumate-rs The Rust bindings of [libshumate](https://gitlab.gnome.org/GNOME/libshumate) Website: ## Documentation - libshumate: - libshumate-sys: libshumate-0.7.0/src/auto/compass.rs000064400000000000000000000213051046102023000155400ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::{ffi, Viewport}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "ShumateCompass")] pub struct Compass(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::shumate_compass_get_type(), } } impl Compass { #[doc(alias = "shumate_compass_new")] pub fn new(viewport: Option<&Viewport>) -> Compass { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::shumate_compass_new(viewport.to_glib_none().0)) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Compass`] objects. /// /// This method returns an instance of [`CompassBuilder`](crate::builders::CompassBuilder) which can be used to create [`Compass`] objects. pub fn builder() -> CompassBuilder { CompassBuilder::new() } #[doc(alias = "shumate_compass_get_viewport")] #[doc(alias = "get_viewport")] pub fn viewport(&self) -> Option { unsafe { from_glib_none(ffi::shumate_compass_get_viewport(self.to_glib_none().0)) } } #[doc(alias = "shumate_compass_set_viewport")] #[doc(alias = "viewport")] pub fn set_viewport(&self, viewport: Option<&Viewport>) { unsafe { ffi::shumate_compass_set_viewport(self.to_glib_none().0, viewport.to_glib_none().0); } } #[doc(alias = "viewport")] pub fn connect_viewport_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_viewport_trampoline( this: *mut ffi::ShumateCompass, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::viewport".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_viewport_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for Compass { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Compass`] 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 CompassBuilder { builder: glib::object::ObjectBuilder<'static, Compass>, } impl CompassBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn viewport(self, viewport: &Viewport) -> Self { Self { builder: self.builder.property("viewport", viewport.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()), } } #[cfg(feature = "gtk_v4_18")] #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))] pub fn limit_events(self, limit_events: bool) -> Self { Self { builder: self.builder.property("limit-events", limit_events), } } 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 [`Compass`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Compass { assert_initialized_main_thread!(); self.builder.build() } } libshumate-0.7.0/src/auto/constants.rs000064400000000000000000000034621046102023000161130ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::ffi; use glib::GStr; #[doc(alias = "SHUMATE_MAP_SOURCE_MFF_RELIEF")] pub static MAP_SOURCE_MFF_RELIEF: &GStr = unsafe { GStr::from_utf8_with_nul_unchecked(ffi::SHUMATE_MAP_SOURCE_MFF_RELIEF) }; #[doc(alias = "SHUMATE_MAP_SOURCE_OSM_CYCLE_MAP")] pub static MAP_SOURCE_OSM_CYCLE_MAP: &GStr = unsafe { GStr::from_utf8_with_nul_unchecked(ffi::SHUMATE_MAP_SOURCE_OSM_CYCLE_MAP) }; #[doc(alias = "SHUMATE_MAP_SOURCE_OSM_MAPNIK")] pub static MAP_SOURCE_OSM_MAPNIK: &GStr = unsafe { GStr::from_utf8_with_nul_unchecked(ffi::SHUMATE_MAP_SOURCE_OSM_MAPNIK) }; #[doc(alias = "SHUMATE_MAP_SOURCE_OSM_TRANSPORT_MAP")] pub static MAP_SOURCE_OSM_TRANSPORT_MAP: &GStr = unsafe { GStr::from_utf8_with_nul_unchecked(ffi::SHUMATE_MAP_SOURCE_OSM_TRANSPORT_MAP) }; #[doc(alias = "SHUMATE_MAP_SOURCE_OWM_CLOUDS")] pub static MAP_SOURCE_OWM_CLOUDS: &GStr = unsafe { GStr::from_utf8_with_nul_unchecked(ffi::SHUMATE_MAP_SOURCE_OWM_CLOUDS) }; #[doc(alias = "SHUMATE_MAP_SOURCE_OWM_PRECIPITATION")] pub static MAP_SOURCE_OWM_PRECIPITATION: &GStr = unsafe { GStr::from_utf8_with_nul_unchecked(ffi::SHUMATE_MAP_SOURCE_OWM_PRECIPITATION) }; #[doc(alias = "SHUMATE_MAP_SOURCE_OWM_PRESSURE")] pub static MAP_SOURCE_OWM_PRESSURE: &GStr = unsafe { GStr::from_utf8_with_nul_unchecked(ffi::SHUMATE_MAP_SOURCE_OWM_PRESSURE) }; #[doc(alias = "SHUMATE_MAP_SOURCE_OWM_TEMPERATURE")] pub static MAP_SOURCE_OWM_TEMPERATURE: &GStr = unsafe { GStr::from_utf8_with_nul_unchecked(ffi::SHUMATE_MAP_SOURCE_OWM_TEMPERATURE) }; #[doc(alias = "SHUMATE_MAP_SOURCE_OWM_WIND")] pub static MAP_SOURCE_OWM_WIND: &GStr = unsafe { GStr::from_utf8_with_nul_unchecked(ffi::SHUMATE_MAP_SOURCE_OWM_WIND) }; libshumate-0.7.0/src/auto/coordinate.rs000064400000000000000000000047411046102023000162270ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::{ffi, Location}; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "ShumateCoordinate")] pub struct Coordinate(Object) @implements Location; match fn { type_ => || ffi::shumate_coordinate_get_type(), } } impl Coordinate { pub const NONE: Option<&'static Coordinate> = None; #[doc(alias = "shumate_coordinate_new")] pub fn new() -> Coordinate { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::shumate_coordinate_new()) } } #[doc(alias = "shumate_coordinate_new_full")] pub fn new_full(latitude: f64, longitude: f64) -> Coordinate { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::shumate_coordinate_new_full(latitude, longitude)) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Coordinate`] objects. /// /// This method returns an instance of [`CoordinateBuilder`](crate::builders::CoordinateBuilder) which can be used to create [`Coordinate`] objects. pub fn builder() -> CoordinateBuilder { CoordinateBuilder::new() } } impl Default for Coordinate { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Coordinate`] 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 CoordinateBuilder { builder: glib::object::ObjectBuilder<'static, Coordinate>, } impl CoordinateBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn latitude(self, latitude: f64) -> Self { Self { builder: self.builder.property("latitude", latitude), } } pub fn longitude(self, longitude: f64) -> Self { Self { builder: self.builder.property("longitude", longitude), } } // rustdoc-stripper-ignore-next /// Build the [`Coordinate`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Coordinate { assert_initialized_main_thread!(); self.builder.build() } } libshumate-0.7.0/src/auto/data_source.rs000064400000000000000000000215321046102023000163660ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::ffi; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] use crate::DataSourceRequest; use glib::{ object::ObjectType as _, prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::{boxed::Box as Box_, pin::Pin}; glib::wrapper! { #[doc(alias = "ShumateDataSource")] pub struct DataSource(Object); match fn { type_ => || ffi::shumate_data_source_get_type(), } } impl DataSource { pub const NONE: Option<&'static DataSource> = None; } pub trait DataSourceExt: IsA + 'static { #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "shumate_data_source_get_max_zoom_level")] #[doc(alias = "get_max_zoom_level")] #[doc(alias = "max-zoom-level")] fn max_zoom_level(&self) -> u32 { unsafe { ffi::shumate_data_source_get_max_zoom_level(self.as_ref().to_glib_none().0) } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "shumate_data_source_get_min_zoom_level")] #[doc(alias = "get_min_zoom_level")] #[doc(alias = "min-zoom-level")] fn min_zoom_level(&self) -> u32 { unsafe { ffi::shumate_data_source_get_min_zoom_level(self.as_ref().to_glib_none().0) } } #[doc(alias = "shumate_data_source_get_tile_data_async")] #[doc(alias = "get_tile_data_async")] fn tile_data_async, glib::Error>) + 'static>( &self, x: i32, y: i32, zoom_level: i32, 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 tile_data_async_trampoline< P: FnOnce(Result, glib::Error>) + 'static, >( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer, ) { let mut error = std::ptr::null_mut(); let ret = ffi::shumate_data_source_get_tile_data_finish( _source_object as *mut _, res, &mut error, ); let result = if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }; let callback: Box_> = Box_::from_raw(user_data as *mut _); let callback: P = callback.into_inner(); callback(result); } let callback = tile_data_async_trampoline::

; unsafe { ffi::shumate_data_source_get_tile_data_async( self.as_ref().to_glib_none().0, x, y, zoom_level, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _, ); } } fn tile_data_future( &self, x: i32, y: i32, zoom_level: i32, ) -> Pin< Box_, glib::Error>> + 'static>, > { Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { obj.tile_data_async(x, y, zoom_level, Some(cancellable), move |res| { send.resolve(res); }); })) } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "shumate_data_source_set_max_zoom_level")] #[doc(alias = "max-zoom-level")] fn set_max_zoom_level(&self, zoom_level: u32) { unsafe { ffi::shumate_data_source_set_max_zoom_level(self.as_ref().to_glib_none().0, zoom_level); } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "shumate_data_source_set_min_zoom_level")] #[doc(alias = "min-zoom-level")] fn set_min_zoom_level(&self, zoom_level: u32) { unsafe { ffi::shumate_data_source_set_min_zoom_level(self.as_ref().to_glib_none().0, zoom_level); } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "shumate_data_source_start_request")] fn start_request( &self, x: i32, y: i32, zoom_level: i32, cancellable: Option<&impl IsA>, ) -> Option { unsafe { from_glib_full(ffi::shumate_data_source_start_request( self.as_ref().to_glib_none().0, x, y, zoom_level, cancellable.map(|p| p.as_ref()).to_glib_none().0, )) } } #[cfg_attr(feature = "v1_1", deprecated = "Since 1.1")] #[doc(alias = "received-data")] fn connect_received_data( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn received_data_trampoline< P: IsA, F: Fn(&P, i32, i32, i32, &glib::Bytes) + 'static, >( this: *mut ffi::ShumateDataSource, x: std::ffi::c_int, y: std::ffi::c_int, zoom_level: std::ffi::c_int, bytes: *mut glib::ffi::GBytes, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( DataSource::from_glib_borrow(this).unsafe_cast_ref(), x, y, zoom_level, &from_glib_borrow(bytes), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"received-data".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( received_data_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "max-zoom-level")] fn connect_max_zoom_level_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_max_zoom_level_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::ShumateDataSource, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(DataSource::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::max-zoom-level".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_max_zoom_level_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "min-zoom-level")] fn connect_min_zoom_level_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_min_zoom_level_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::ShumateDataSource, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(DataSource::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::min-zoom-level".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_min_zoom_level_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> DataSourceExt for O {} libshumate-0.7.0/src/auto/data_source_request.rs000064400000000000000000000207021046102023000201340ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::ffi; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "ShumateDataSourceRequest")] pub struct DataSourceRequest(Object); match fn { type_ => || ffi::shumate_data_source_request_get_type(), } } impl DataSourceRequest { pub const NONE: Option<&'static DataSourceRequest> = None; #[doc(alias = "shumate_data_source_request_new")] pub fn new(x: i32, y: i32, zoom_level: i32) -> DataSourceRequest { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::shumate_data_source_request_new(x, y, zoom_level)) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`DataSourceRequest`] objects. /// /// This method returns an instance of [`DataSourceRequestBuilder`](crate::builders::DataSourceRequestBuilder) which can be used to create [`DataSourceRequest`] objects. pub fn builder() -> DataSourceRequestBuilder { DataSourceRequestBuilder::new() } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] impl Default for DataSourceRequest { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`DataSourceRequest`] 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 DataSourceRequestBuilder { builder: glib::object::ObjectBuilder<'static, DataSourceRequest>, } impl DataSourceRequestBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub fn x(self, x: i32) -> Self { Self { builder: self.builder.property("x", x), } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub fn y(self, y: i32) -> Self { Self { builder: self.builder.property("y", y), } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub fn zoom_level(self, zoom_level: i32) -> Self { Self { builder: self.builder.property("zoom-level", zoom_level), } } // rustdoc-stripper-ignore-next /// Build the [`DataSourceRequest`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> DataSourceRequest { assert_initialized_main_thread!(); self.builder.build() } } pub trait DataSourceRequestExt: IsA + 'static { #[doc(alias = "shumate_data_source_request_complete")] fn complete(&self) { unsafe { ffi::shumate_data_source_request_complete(self.as_ref().to_glib_none().0); } } #[doc(alias = "shumate_data_source_request_emit_data")] fn emit_data(&self, data: &glib::Bytes, complete: bool) { unsafe { ffi::shumate_data_source_request_emit_data( self.as_ref().to_glib_none().0, data.to_glib_none().0, complete.into_glib(), ); } } #[doc(alias = "shumate_data_source_request_emit_error")] fn emit_error(&self, error: &glib::Error) { unsafe { ffi::shumate_data_source_request_emit_error( self.as_ref().to_glib_none().0, error.to_glib_none().0, ); } } #[doc(alias = "shumate_data_source_request_get_data")] #[doc(alias = "get_data")] fn data(&self) -> Option { unsafe { from_glib_none(ffi::shumate_data_source_request_get_data( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "shumate_data_source_request_get_error")] #[doc(alias = "get_error")] fn error(&self) -> Option { unsafe { from_glib_none(ffi::shumate_data_source_request_get_error( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "shumate_data_source_request_get_x")] #[doc(alias = "get_x")] fn x(&self) -> i32 { unsafe { ffi::shumate_data_source_request_get_x(self.as_ref().to_glib_none().0) } } #[doc(alias = "shumate_data_source_request_get_y")] #[doc(alias = "get_y")] fn y(&self) -> i32 { unsafe { ffi::shumate_data_source_request_get_y(self.as_ref().to_glib_none().0) } } #[doc(alias = "shumate_data_source_request_get_zoom_level")] #[doc(alias = "get_zoom_level")] #[doc(alias = "zoom-level")] fn zoom_level(&self) -> i32 { unsafe { ffi::shumate_data_source_request_get_zoom_level(self.as_ref().to_glib_none().0) } } #[doc(alias = "shumate_data_source_request_is_completed")] #[doc(alias = "completed")] fn is_completed(&self) -> bool { unsafe { from_glib(ffi::shumate_data_source_request_is_completed( self.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "completed")] fn connect_completed_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_completed_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::ShumateDataSourceRequest, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(DataSourceRequest::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::completed".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_completed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "data")] fn connect_data_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_data_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::ShumateDataSourceRequest, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(DataSourceRequest::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::data".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_data_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "error")] fn connect_error_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_error_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::ShumateDataSourceRequest, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(DataSourceRequest::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::error".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_error_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> DataSourceRequestExt for O {} libshumate-0.7.0/src/auto/enums.rs000064400000000000000000000552251046102023000152320ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::ffi; use glib::{prelude::*, translate::*}; #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "ShumateFileCacheError")] pub enum FileCacheError { #[doc(alias = "SHUMATE_FILE_CACHE_ERROR_FAILED")] Failed, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for FileCacheError { type GlibType = ffi::ShumateFileCacheError; #[inline] fn into_glib(self) -> ffi::ShumateFileCacheError { match self { Self::Failed => ffi::SHUMATE_FILE_CACHE_ERROR_FAILED, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for FileCacheError { #[inline] unsafe fn from_glib(value: ffi::ShumateFileCacheError) -> Self { skip_assert_initialized!(); match value { ffi::SHUMATE_FILE_CACHE_ERROR_FAILED => Self::Failed, value => Self::__Unknown(value), } } } impl glib::error::ErrorDomain for FileCacheError { #[inline] fn domain() -> glib::Quark { skip_assert_initialized!(); unsafe { from_glib(ffi::shumate_file_cache_error_quark()) } } #[inline] fn code(self) -> i32 { self.into_glib() } #[inline] #[allow(clippy::match_single_binding)] fn from(code: i32) -> Option { skip_assert_initialized!(); match unsafe { from_glib(code) } { Self::__Unknown(_) => Some(Self::Failed), value => Some(value), } } } impl StaticType for FileCacheError { #[inline] #[doc(alias = "shumate_file_cache_error_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::shumate_file_cache_error_get_type()) } } } impl glib::HasParamSpec for FileCacheError { 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 FileCacheError { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for FileCacheError { 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 FileCacheError { #[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: FileCacheError) -> 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 = "ShumateGeometryType")] pub enum GeometryType { #[doc(alias = "SHUMATE_GEOMETRY_TYPE_UNKNOWN")] Unknown, #[doc(alias = "SHUMATE_GEOMETRY_TYPE_POINT")] Point, #[doc(alias = "SHUMATE_GEOMETRY_TYPE_MULTIPOINT")] Multipoint, #[doc(alias = "SHUMATE_GEOMETRY_TYPE_LINESTRING")] Linestring, #[doc(alias = "SHUMATE_GEOMETRY_TYPE_MULTILINESTRING")] Multilinestring, #[doc(alias = "SHUMATE_GEOMETRY_TYPE_POLYGON")] Polygon, #[doc(alias = "SHUMATE_GEOMETRY_TYPE_MULTIPOLYGON")] Multipolygon, #[doc(hidden)] __Unknown(i32), } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(hidden)] impl IntoGlib for GeometryType { type GlibType = ffi::ShumateGeometryType; #[inline] fn into_glib(self) -> ffi::ShumateGeometryType { match self { Self::Unknown => ffi::SHUMATE_GEOMETRY_TYPE_UNKNOWN, Self::Point => ffi::SHUMATE_GEOMETRY_TYPE_POINT, Self::Multipoint => ffi::SHUMATE_GEOMETRY_TYPE_MULTIPOINT, Self::Linestring => ffi::SHUMATE_GEOMETRY_TYPE_LINESTRING, Self::Multilinestring => ffi::SHUMATE_GEOMETRY_TYPE_MULTILINESTRING, Self::Polygon => ffi::SHUMATE_GEOMETRY_TYPE_POLYGON, Self::Multipolygon => ffi::SHUMATE_GEOMETRY_TYPE_MULTIPOLYGON, Self::__Unknown(value) => value, } } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(hidden)] impl FromGlib for GeometryType { #[inline] unsafe fn from_glib(value: ffi::ShumateGeometryType) -> Self { skip_assert_initialized!(); match value { ffi::SHUMATE_GEOMETRY_TYPE_UNKNOWN => Self::Unknown, ffi::SHUMATE_GEOMETRY_TYPE_POINT => Self::Point, ffi::SHUMATE_GEOMETRY_TYPE_MULTIPOINT => Self::Multipoint, ffi::SHUMATE_GEOMETRY_TYPE_LINESTRING => Self::Linestring, ffi::SHUMATE_GEOMETRY_TYPE_MULTILINESTRING => Self::Multilinestring, ffi::SHUMATE_GEOMETRY_TYPE_POLYGON => Self::Polygon, ffi::SHUMATE_GEOMETRY_TYPE_MULTIPOLYGON => Self::Multipolygon, value => Self::__Unknown(value), } } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] impl StaticType for GeometryType { #[inline] #[doc(alias = "shumate_geometry_type_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::shumate_geometry_type_get_type()) } } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] impl glib::HasParamSpec for GeometryType { 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 GeometryType { type Type = Self; } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] unsafe impl<'a> glib::value::FromValue<'a> for GeometryType { 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 GeometryType { #[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: GeometryType) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "ShumateMapProjection")] pub enum MapProjection { #[doc(alias = "SHUMATE_MAP_PROJECTION_MERCATOR")] Mercator, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for MapProjection { type GlibType = ffi::ShumateMapProjection; #[inline] fn into_glib(self) -> ffi::ShumateMapProjection { match self { Self::Mercator => ffi::SHUMATE_MAP_PROJECTION_MERCATOR, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for MapProjection { #[inline] unsafe fn from_glib(value: ffi::ShumateMapProjection) -> Self { skip_assert_initialized!(); match value { ffi::SHUMATE_MAP_PROJECTION_MERCATOR => Self::Mercator, value => Self::__Unknown(value), } } } impl StaticType for MapProjection { #[inline] #[doc(alias = "shumate_map_projection_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::shumate_map_projection_get_type()) } } } impl glib::HasParamSpec for MapProjection { 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 MapProjection { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for MapProjection { 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 MapProjection { #[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: MapProjection) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "ShumateState")] pub enum State { #[doc(alias = "SHUMATE_STATE_NONE")] None, #[doc(alias = "SHUMATE_STATE_LOADING")] Loading, #[doc(alias = "SHUMATE_STATE_LOADED")] Loaded, #[doc(alias = "SHUMATE_STATE_DONE")] Done, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for State { type GlibType = ffi::ShumateState; #[inline] fn into_glib(self) -> ffi::ShumateState { match self { Self::None => ffi::SHUMATE_STATE_NONE, Self::Loading => ffi::SHUMATE_STATE_LOADING, Self::Loaded => ffi::SHUMATE_STATE_LOADED, Self::Done => ffi::SHUMATE_STATE_DONE, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for State { #[inline] unsafe fn from_glib(value: ffi::ShumateState) -> Self { skip_assert_initialized!(); match value { ffi::SHUMATE_STATE_NONE => Self::None, ffi::SHUMATE_STATE_LOADING => Self::Loading, ffi::SHUMATE_STATE_LOADED => Self::Loaded, ffi::SHUMATE_STATE_DONE => Self::Done, value => Self::__Unknown(value), } } } impl StaticType for State { #[inline] #[doc(alias = "shumate_state_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::shumate_state_get_type()) } } } impl glib::HasParamSpec for State { 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 State { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for State { 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 State { #[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: State) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "ShumateStyleError")] pub enum StyleError { #[doc(alias = "SHUMATE_STYLE_ERROR_FAILED")] Failed, #[doc(alias = "SHUMATE_STYLE_ERROR_MALFORMED_STYLE")] MalformedStyle, #[doc(alias = "SHUMATE_STYLE_ERROR_UNSUPPORTED_LAYER")] UnsupportedLayer, #[doc(alias = "SHUMATE_STYLE_ERROR_INVALID_EXPRESSION")] InvalidExpression, #[doc(alias = "SHUMATE_STYLE_ERROR_SUPPORT_OMITTED")] SupportOmitted, #[doc(alias = "SHUMATE_STYLE_ERROR_UNSUPPORTED")] Unsupported, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for StyleError { type GlibType = ffi::ShumateStyleError; #[inline] fn into_glib(self) -> ffi::ShumateStyleError { match self { Self::Failed => ffi::SHUMATE_STYLE_ERROR_FAILED, Self::MalformedStyle => ffi::SHUMATE_STYLE_ERROR_MALFORMED_STYLE, Self::UnsupportedLayer => ffi::SHUMATE_STYLE_ERROR_UNSUPPORTED_LAYER, Self::InvalidExpression => ffi::SHUMATE_STYLE_ERROR_INVALID_EXPRESSION, Self::SupportOmitted => ffi::SHUMATE_STYLE_ERROR_SUPPORT_OMITTED, Self::Unsupported => ffi::SHUMATE_STYLE_ERROR_UNSUPPORTED, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for StyleError { #[inline] unsafe fn from_glib(value: ffi::ShumateStyleError) -> Self { skip_assert_initialized!(); match value { ffi::SHUMATE_STYLE_ERROR_FAILED => Self::Failed, ffi::SHUMATE_STYLE_ERROR_MALFORMED_STYLE => Self::MalformedStyle, ffi::SHUMATE_STYLE_ERROR_UNSUPPORTED_LAYER => Self::UnsupportedLayer, ffi::SHUMATE_STYLE_ERROR_INVALID_EXPRESSION => Self::InvalidExpression, ffi::SHUMATE_STYLE_ERROR_SUPPORT_OMITTED => Self::SupportOmitted, ffi::SHUMATE_STYLE_ERROR_UNSUPPORTED => Self::Unsupported, value => Self::__Unknown(value), } } } impl glib::error::ErrorDomain for StyleError { #[inline] fn domain() -> glib::Quark { skip_assert_initialized!(); unsafe { from_glib(ffi::shumate_style_error_quark()) } } #[inline] fn code(self) -> i32 { self.into_glib() } #[inline] #[allow(clippy::match_single_binding)] fn from(code: i32) -> Option { skip_assert_initialized!(); match unsafe { from_glib(code) } { Self::__Unknown(_) => Some(Self::Failed), value => Some(value), } } } impl StaticType for StyleError { #[inline] #[doc(alias = "shumate_style_error_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::shumate_style_error_get_type()) } } } impl glib::HasParamSpec for StyleError { 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 StyleError { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for StyleError { 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 StyleError { #[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: StyleError) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "ShumateTileDownloaderError")] pub enum TileDownloaderError { #[doc(alias = "SHUMATE_TILE_DOWNLOADER_ERROR_FAILED")] Failed, #[doc(alias = "SHUMATE_TILE_DOWNLOADER_ERROR_BAD_RESPONSE")] BadResponse, #[doc(alias = "SHUMATE_TILE_DOWNLOADER_ERROR_COULD_NOT_CONNECT")] CouldNotConnect, #[doc(alias = "SHUMATE_TILE_DOWNLOADER_ERROR_MALFORMED_URL")] MalformedUrl, #[doc(alias = "SHUMATE_TILE_DOWNLOADER_ERROR_OFFLINE")] Offline, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for TileDownloaderError { type GlibType = ffi::ShumateTileDownloaderError; #[inline] fn into_glib(self) -> ffi::ShumateTileDownloaderError { match self { Self::Failed => ffi::SHUMATE_TILE_DOWNLOADER_ERROR_FAILED, Self::BadResponse => ffi::SHUMATE_TILE_DOWNLOADER_ERROR_BAD_RESPONSE, Self::CouldNotConnect => ffi::SHUMATE_TILE_DOWNLOADER_ERROR_COULD_NOT_CONNECT, Self::MalformedUrl => ffi::SHUMATE_TILE_DOWNLOADER_ERROR_MALFORMED_URL, Self::Offline => ffi::SHUMATE_TILE_DOWNLOADER_ERROR_OFFLINE, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for TileDownloaderError { #[inline] unsafe fn from_glib(value: ffi::ShumateTileDownloaderError) -> Self { skip_assert_initialized!(); match value { ffi::SHUMATE_TILE_DOWNLOADER_ERROR_FAILED => Self::Failed, ffi::SHUMATE_TILE_DOWNLOADER_ERROR_BAD_RESPONSE => Self::BadResponse, ffi::SHUMATE_TILE_DOWNLOADER_ERROR_COULD_NOT_CONNECT => Self::CouldNotConnect, ffi::SHUMATE_TILE_DOWNLOADER_ERROR_MALFORMED_URL => Self::MalformedUrl, ffi::SHUMATE_TILE_DOWNLOADER_ERROR_OFFLINE => Self::Offline, value => Self::__Unknown(value), } } } impl glib::error::ErrorDomain for TileDownloaderError { #[inline] fn domain() -> glib::Quark { skip_assert_initialized!(); unsafe { from_glib(ffi::shumate_tile_downloader_error_quark()) } } #[inline] fn code(self) -> i32 { self.into_glib() } #[inline] #[allow(clippy::match_single_binding)] fn from(code: i32) -> Option { skip_assert_initialized!(); match unsafe { from_glib(code) } { Self::__Unknown(_) => Some(Self::Failed), value => Some(value), } } } impl StaticType for TileDownloaderError { #[inline] #[doc(alias = "shumate_tile_downloader_error_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::shumate_tile_downloader_error_get_type()) } } } impl glib::HasParamSpec for TileDownloaderError { 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 TileDownloaderError { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for TileDownloaderError { 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 TileDownloaderError { #[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: TileDownloaderError) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "ShumateUnit")] pub enum Unit { #[doc(alias = "SHUMATE_UNIT_BOTH")] Both, #[doc(alias = "SHUMATE_UNIT_METRIC")] Metric, #[doc(alias = "SHUMATE_UNIT_IMPERIAL")] Imperial, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for Unit { type GlibType = ffi::ShumateUnit; #[inline] fn into_glib(self) -> ffi::ShumateUnit { match self { Self::Both => ffi::SHUMATE_UNIT_BOTH, Self::Metric => ffi::SHUMATE_UNIT_METRIC, Self::Imperial => ffi::SHUMATE_UNIT_IMPERIAL, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for Unit { #[inline] unsafe fn from_glib(value: ffi::ShumateUnit) -> Self { skip_assert_initialized!(); match value { ffi::SHUMATE_UNIT_BOTH => Self::Both, ffi::SHUMATE_UNIT_METRIC => Self::Metric, ffi::SHUMATE_UNIT_IMPERIAL => Self::Imperial, value => Self::__Unknown(value), } } } impl StaticType for Unit { #[inline] #[doc(alias = "shumate_unit_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::shumate_unit_get_type()) } } } impl glib::HasParamSpec for Unit { 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 Unit { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for Unit { 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 Unit { #[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: Unit) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } libshumate-0.7.0/src/auto/file_cache.rs000064400000000000000000000323061046102023000161400ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::ffi; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::{boxed::Box as Box_, pin::Pin}; glib::wrapper! { #[doc(alias = "ShumateFileCache")] pub struct FileCache(Object); match fn { type_ => || ffi::shumate_file_cache_get_type(), } } impl FileCache { #[doc(alias = "shumate_file_cache_new_full")] pub fn new_full(size_limit: u32, cache_key: &str, cache_dir: Option<&str>) -> FileCache { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::shumate_file_cache_new_full( size_limit, cache_key.to_glib_none().0, cache_dir.to_glib_none().0, )) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`FileCache`] objects. /// /// This method returns an instance of [`FileCacheBuilder`](crate::builders::FileCacheBuilder) which can be used to create [`FileCache`] objects. pub fn builder() -> FileCacheBuilder { FileCacheBuilder::new() } #[doc(alias = "shumate_file_cache_get_cache_dir")] #[doc(alias = "get_cache_dir")] #[doc(alias = "cache-dir")] pub fn cache_dir(&self) -> Option { unsafe { from_glib_none(ffi::shumate_file_cache_get_cache_dir(self.to_glib_none().0)) } } #[doc(alias = "shumate_file_cache_get_cache_key")] #[doc(alias = "get_cache_key")] #[doc(alias = "cache-key")] pub fn cache_key(&self) -> Option { unsafe { from_glib_none(ffi::shumate_file_cache_get_cache_key(self.to_glib_none().0)) } } #[doc(alias = "shumate_file_cache_get_size_limit")] #[doc(alias = "get_size_limit")] #[doc(alias = "size-limit")] pub fn size_limit(&self) -> u32 { unsafe { ffi::shumate_file_cache_get_size_limit(self.to_glib_none().0) } } #[doc(alias = "shumate_file_cache_get_tile_async")] #[doc(alias = "get_tile_async")] pub fn tile_async< P: FnOnce( Result<(glib::Bytes, Option, Option), glib::Error>, ) + 'static, >( &self, x: i32, y: i32, zoom_level: i32, 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 tile_async_trampoline< P: FnOnce( Result< (glib::Bytes, Option, Option), glib::Error, >, ) + 'static, >( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer, ) { let mut error = std::ptr::null_mut(); let mut etag = std::ptr::null_mut(); let mut modtime = std::ptr::null_mut(); let ret = ffi::shumate_file_cache_get_tile_finish( _source_object as *mut _, &mut etag, &mut modtime, res, &mut error, ); let result = if error.is_null() { Ok(( from_glib_full(ret), from_glib_full(etag), from_glib_full(modtime), )) } else { Err(from_glib_full(error)) }; let callback: Box_> = Box_::from_raw(user_data as *mut _); let callback: P = callback.into_inner(); callback(result); } let callback = tile_async_trampoline::

; unsafe { ffi::shumate_file_cache_get_tile_async( self.to_glib_none().0, x, y, zoom_level, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _, ); } } pub fn tile_future( &self, x: i32, y: i32, zoom_level: i32, ) -> Pin< Box_< dyn std::future::Future< Output = Result< (glib::Bytes, Option, Option), glib::Error, >, > + 'static, >, > { Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { obj.tile_async(x, y, zoom_level, Some(cancellable), move |res| { send.resolve(res); }); })) } #[doc(alias = "shumate_file_cache_mark_up_to_date")] pub fn mark_up_to_date(&self, x: i32, y: i32, zoom_level: i32) { unsafe { ffi::shumate_file_cache_mark_up_to_date(self.to_glib_none().0, x, y, zoom_level); } } #[doc(alias = "shumate_file_cache_purge_cache_async")] pub fn purge_cache_async) + 'static>( &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 purge_cache_async_trampoline< P: FnOnce(Result<(), glib::Error>) + 'static, >( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer, ) { let mut error = std::ptr::null_mut(); ffi::shumate_file_cache_purge_cache_finish(_source_object as *mut _, res, &mut error); let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }; let callback: Box_> = Box_::from_raw(user_data as *mut _); let callback: P = callback.into_inner(); callback(result); } let callback = purge_cache_async_trampoline::

; unsafe { ffi::shumate_file_cache_purge_cache_async( self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _, ); } } pub fn purge_cache_future( &self, ) -> Pin> + 'static>> { Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { obj.purge_cache_async(Some(cancellable), move |res| { send.resolve(res); }); })) } #[doc(alias = "shumate_file_cache_set_size_limit")] #[doc(alias = "size-limit")] pub fn set_size_limit(&self, size_limit: u32) { unsafe { ffi::shumate_file_cache_set_size_limit(self.to_glib_none().0, size_limit); } } #[doc(alias = "shumate_file_cache_store_tile_async")] pub fn store_tile_async) + 'static>( &self, x: i32, y: i32, zoom_level: i32, bytes: &glib::Bytes, etag: Option<&str>, 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 store_tile_async_trampoline< P: FnOnce(Result<(), glib::Error>) + 'static, >( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer, ) { let mut error = std::ptr::null_mut(); ffi::shumate_file_cache_store_tile_finish(_source_object as *mut _, res, &mut error); let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }; let callback: Box_> = Box_::from_raw(user_data as *mut _); let callback: P = callback.into_inner(); callback(result); } let callback = store_tile_async_trampoline::

; unsafe { ffi::shumate_file_cache_store_tile_async( self.to_glib_none().0, x, y, zoom_level, bytes.to_glib_none().0, etag.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _, ); } } pub fn store_tile_future( &self, x: i32, y: i32, zoom_level: i32, bytes: &glib::Bytes, etag: Option<&str>, ) -> Pin> + 'static>> { let bytes = bytes.clone(); let etag = etag.map(ToOwned::to_owned); Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { obj.store_tile_async( x, y, zoom_level, &bytes, etag.as_ref().map(::std::borrow::Borrow::borrow), Some(cancellable), move |res| { send.resolve(res); }, ); })) } #[doc(alias = "size-limit")] pub fn connect_size_limit_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_size_limit_trampoline( this: *mut ffi::ShumateFileCache, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::size-limit".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_size_limit_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`FileCache`] 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 FileCacheBuilder { builder: glib::object::ObjectBuilder<'static, FileCache>, } impl FileCacheBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn cache_dir(self, cache_dir: impl Into) -> Self { Self { builder: self.builder.property("cache-dir", cache_dir.into()), } } pub fn cache_key(self, cache_key: impl Into) -> Self { Self { builder: self.builder.property("cache-key", cache_key.into()), } } pub fn size_limit(self, size_limit: u32) -> Self { Self { builder: self.builder.property("size-limit", size_limit), } } // rustdoc-stripper-ignore-next /// Build the [`FileCache`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> FileCache { assert_initialized_main_thread!(); self.builder.build() } } libshumate-0.7.0/src/auto/functions.rs000064400000000000000000000012001046102023000160730ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::ffi; use glib::translate::*; #[doc(alias = "shumate_get_user_agent")] #[doc(alias = "get_user_agent")] pub fn user_agent() -> Option { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::shumate_get_user_agent()) } } #[doc(alias = "shumate_set_user_agent")] pub fn set_user_agent(new_user_agent: Option<&str>) { assert_initialized_main_thread!(); unsafe { ffi::shumate_set_user_agent(new_user_agent.to_glib_none().0); } } libshumate-0.7.0/src/auto/layer.rs000064400000000000000000000016571046102023000152170ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::{ffi, Viewport}; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "ShumateLayer")] pub struct Layer(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::shumate_layer_get_type(), } } impl Layer { pub const NONE: Option<&'static Layer> = None; } pub trait LayerExt: IsA + 'static { #[doc(alias = "shumate_layer_get_viewport")] #[doc(alias = "get_viewport")] fn viewport(&self) -> Option { unsafe { from_glib_none(ffi::shumate_layer_get_viewport( self.as_ref().to_glib_none().0, )) } } } impl> LayerExt for O {} libshumate-0.7.0/src/auto/license.rs000064400000000000000000000260111046102023000155140ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::{ffi, MapSource}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "ShumateLicense")] pub struct License(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::shumate_license_get_type(), } } impl License { #[doc(alias = "shumate_license_new")] pub fn new() -> License { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::shumate_license_new()) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`License`] objects. /// /// This method returns an instance of [`LicenseBuilder`](crate::builders::LicenseBuilder) which can be used to create [`License`] objects. pub fn builder() -> LicenseBuilder { LicenseBuilder::new() } #[doc(alias = "shumate_license_append_map_source")] pub fn append_map_source(&self, map_source: &impl IsA) { unsafe { ffi::shumate_license_append_map_source( self.to_glib_none().0, map_source.as_ref().to_glib_none().0, ); } } #[doc(alias = "shumate_license_get_extra_text")] #[doc(alias = "get_extra_text")] #[doc(alias = "extra-text")] pub fn extra_text(&self) -> Option { unsafe { from_glib_none(ffi::shumate_license_get_extra_text(self.to_glib_none().0)) } } #[doc(alias = "shumate_license_get_xalign")] #[doc(alias = "get_xalign")] pub fn xalign(&self) -> f32 { unsafe { ffi::shumate_license_get_xalign(self.to_glib_none().0) } } #[doc(alias = "shumate_license_prepend_map_source")] pub fn prepend_map_source(&self, map_source: &impl IsA) { unsafe { ffi::shumate_license_prepend_map_source( self.to_glib_none().0, map_source.as_ref().to_glib_none().0, ); } } #[doc(alias = "shumate_license_remove_map_source")] pub fn remove_map_source(&self, map_source: &impl IsA) { unsafe { ffi::shumate_license_remove_map_source( self.to_glib_none().0, map_source.as_ref().to_glib_none().0, ); } } #[doc(alias = "shumate_license_set_extra_text")] #[doc(alias = "extra-text")] pub fn set_extra_text(&self, text: &str) { unsafe { ffi::shumate_license_set_extra_text(self.to_glib_none().0, text.to_glib_none().0); } } #[doc(alias = "shumate_license_set_xalign")] #[doc(alias = "xalign")] pub fn set_xalign(&self, xalign: f32) { unsafe { ffi::shumate_license_set_xalign(self.to_glib_none().0, xalign); } } #[doc(alias = "extra-text")] pub fn connect_extra_text_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_extra_text_trampoline( this: *mut ffi::ShumateLicense, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::extra-text".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_extra_text_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "xalign")] pub fn connect_xalign_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_xalign_trampoline( this: *mut ffi::ShumateLicense, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::xalign".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_xalign_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for License { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`License`] 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 LicenseBuilder { builder: glib::object::ObjectBuilder<'static, License>, } impl LicenseBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn extra_text(self, extra_text: impl Into) -> Self { Self { builder: self.builder.property("extra-text", extra_text.into()), } } pub fn xalign(self, xalign: f32) -> Self { Self { builder: self.builder.property("xalign", xalign), } } 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()), } } #[cfg(feature = "gtk_v4_18")] #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))] pub fn limit_events(self, limit_events: bool) -> Self { Self { builder: self.builder.property("limit-events", limit_events), } } 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 [`License`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> License { assert_initialized_main_thread!(); self.builder.build() } } libshumate-0.7.0/src/auto/location.rs000064400000000000000000000072741046102023000157140ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::ffi; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "ShumateLocation")] pub struct Location(Interface); match fn { type_ => || ffi::shumate_location_get_type(), } } impl Location { pub const NONE: Option<&'static Location> = None; } pub trait LocationExt: IsA + 'static { #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "shumate_location_distance")] fn distance(&self, other: &impl IsA) -> f64 { unsafe { ffi::shumate_location_distance( self.as_ref().to_glib_none().0, other.as_ref().to_glib_none().0, ) } } #[doc(alias = "shumate_location_get_latitude")] #[doc(alias = "get_latitude")] fn latitude(&self) -> f64 { unsafe { ffi::shumate_location_get_latitude(self.as_ref().to_glib_none().0) } } #[doc(alias = "shumate_location_get_longitude")] #[doc(alias = "get_longitude")] fn longitude(&self) -> f64 { unsafe { ffi::shumate_location_get_longitude(self.as_ref().to_glib_none().0) } } #[doc(alias = "shumate_location_set_location")] fn set_location(&self, latitude: f64, longitude: f64) { unsafe { ffi::shumate_location_set_location(self.as_ref().to_glib_none().0, latitude, longitude); } } fn set_latitude(&self, latitude: f64) { ObjectExt::set_property(self.as_ref(), "latitude", latitude) } fn set_longitude(&self, longitude: f64) { ObjectExt::set_property(self.as_ref(), "longitude", longitude) } #[doc(alias = "latitude")] fn connect_latitude_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_latitude_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::ShumateLocation, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Location::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::latitude".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_latitude_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "longitude")] fn connect_longitude_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_longitude_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::ShumateLocation, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Location::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::longitude".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_longitude_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> LocationExt for O {} libshumate-0.7.0/src/auto/map.rs000064400000000000000000000447661046102023000146700ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::{ffi, Layer, MapSource, State, Viewport}; use glib::{ object::ObjectType as _, prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "ShumateMap")] pub struct Map(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::shumate_map_get_type(), } } impl Map { #[doc(alias = "shumate_map_new")] pub fn new() -> Map { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::shumate_map_new()) } } #[doc(alias = "shumate_map_new_simple")] pub fn new_simple() -> Map { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::shumate_map_new_simple()) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Map`] objects. /// /// This method returns an instance of [`MapBuilder`](crate::builders::MapBuilder) which can be used to create [`Map`] objects. pub fn builder() -> MapBuilder { MapBuilder::new() } #[doc(alias = "shumate_map_add_layer")] pub fn add_layer(&self, layer: &impl IsA) { unsafe { ffi::shumate_map_add_layer(self.to_glib_none().0, layer.as_ref().to_glib_none().0); } } #[doc(alias = "shumate_map_center_on")] pub fn center_on(&self, latitude: f64, longitude: f64) { unsafe { ffi::shumate_map_center_on(self.to_glib_none().0, latitude, longitude); } } #[doc(alias = "shumate_map_get_animate_zoom")] #[doc(alias = "get_animate_zoom")] #[doc(alias = "animate-zoom")] pub fn is_animate_zoom(&self) -> bool { unsafe { from_glib(ffi::shumate_map_get_animate_zoom(self.to_glib_none().0)) } } #[doc(alias = "shumate_map_get_go_to_duration")] #[doc(alias = "get_go_to_duration")] #[doc(alias = "go-to-duration")] pub fn go_to_duration(&self) -> u32 { unsafe { ffi::shumate_map_get_go_to_duration(self.to_glib_none().0) } } #[doc(alias = "shumate_map_get_state")] #[doc(alias = "get_state")] pub fn state(&self) -> State { unsafe { from_glib(ffi::shumate_map_get_state(self.to_glib_none().0)) } } #[doc(alias = "shumate_map_get_viewport")] #[doc(alias = "get_viewport")] pub fn viewport(&self) -> Option { unsafe { from_glib_none(ffi::shumate_map_get_viewport(self.to_glib_none().0)) } } #[doc(alias = "shumate_map_get_zoom_on_double_click")] #[doc(alias = "get_zoom_on_double_click")] #[doc(alias = "zoom-on-double-click")] pub fn is_zoom_on_double_click(&self) -> bool { unsafe { from_glib(ffi::shumate_map_get_zoom_on_double_click( self.to_glib_none().0, )) } } #[doc(alias = "shumate_map_go_to")] pub fn go_to(&self, latitude: f64, longitude: f64) { unsafe { ffi::shumate_map_go_to(self.to_glib_none().0, latitude, longitude); } } #[doc(alias = "shumate_map_go_to_full")] pub fn go_to_full(&self, latitude: f64, longitude: f64, zoom_level: f64) { unsafe { ffi::shumate_map_go_to_full(self.to_glib_none().0, latitude, longitude, zoom_level); } } #[doc(alias = "shumate_map_go_to_full_with_duration")] pub fn go_to_full_with_duration( &self, latitude: f64, longitude: f64, zoom_level: f64, duration_ms: u32, ) { unsafe { ffi::shumate_map_go_to_full_with_duration( self.to_glib_none().0, latitude, longitude, zoom_level, duration_ms, ); } } #[doc(alias = "shumate_map_insert_layer_above")] pub fn insert_layer_above( &self, layer: &impl IsA, next_sibling: Option<&impl IsA>, ) { unsafe { ffi::shumate_map_insert_layer_above( self.to_glib_none().0, layer.as_ref().to_glib_none().0, next_sibling.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "shumate_map_insert_layer_behind")] pub fn insert_layer_behind( &self, layer: &impl IsA, next_sibling: Option<&impl IsA>, ) { unsafe { ffi::shumate_map_insert_layer_behind( self.to_glib_none().0, layer.as_ref().to_glib_none().0, next_sibling.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "shumate_map_remove_layer")] pub fn remove_layer(&self, layer: &impl IsA) { unsafe { ffi::shumate_map_remove_layer(self.to_glib_none().0, layer.as_ref().to_glib_none().0); } } #[doc(alias = "shumate_map_set_animate_zoom")] #[doc(alias = "animate-zoom")] pub fn set_animate_zoom(&self, value: bool) { unsafe { ffi::shumate_map_set_animate_zoom(self.to_glib_none().0, value.into_glib()); } } #[doc(alias = "shumate_map_set_go_to_duration")] #[doc(alias = "go-to-duration")] pub fn set_go_to_duration(&self, duration: u32) { unsafe { ffi::shumate_map_set_go_to_duration(self.to_glib_none().0, duration); } } #[doc(alias = "shumate_map_set_map_source")] pub fn set_map_source(&self, map_source: &impl IsA) { unsafe { ffi::shumate_map_set_map_source( self.to_glib_none().0, map_source.as_ref().to_glib_none().0, ); } } #[doc(alias = "shumate_map_set_zoom_on_double_click")] #[doc(alias = "zoom-on-double-click")] pub fn set_zoom_on_double_click(&self, value: bool) { unsafe { ffi::shumate_map_set_zoom_on_double_click(self.to_glib_none().0, value.into_glib()); } } #[doc(alias = "shumate_map_stop_go_to")] pub fn stop_go_to(&self) { unsafe { ffi::shumate_map_stop_go_to(self.to_glib_none().0); } } #[doc(alias = "shumate_map_zoom_in")] pub fn zoom_in(&self) { unsafe { ffi::shumate_map_zoom_in(self.to_glib_none().0); } } #[doc(alias = "shumate_map_zoom_out")] pub fn zoom_out(&self) { unsafe { ffi::shumate_map_zoom_out(self.to_glib_none().0); } } #[doc(alias = "animation-completed")] pub fn connect_animation_completed( &self, detail: Option<&str>, f: F, ) -> SignalHandlerId { unsafe extern "C" fn animation_completed_trampoline( this: *mut ffi::ShumateMap, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); let detailed_signal_name = detail.map(|name| format!("animation-completed::{name}\0")); let signal_name: &[u8] = detailed_signal_name .as_ref() .map_or(c"animation-completed".to_bytes(), |n| n.as_bytes()); connect_raw( self.as_ptr() as *mut _, signal_name.as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( animation_completed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "animate-zoom")] pub fn connect_animate_zoom_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_animate_zoom_trampoline( this: *mut ffi::ShumateMap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::animate-zoom".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_animate_zoom_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "go-to-duration")] pub fn connect_go_to_duration_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_go_to_duration_trampoline( this: *mut ffi::ShumateMap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::go-to-duration".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_go_to_duration_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "state")] pub fn connect_state_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_state_trampoline( this: *mut ffi::ShumateMap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::state".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_state_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "viewport")] pub fn connect_viewport_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_viewport_trampoline( this: *mut ffi::ShumateMap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::viewport".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_viewport_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "zoom-on-double-click")] pub fn connect_zoom_on_double_click_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_zoom_on_double_click_trampoline( this: *mut ffi::ShumateMap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::zoom-on-double-click".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_zoom_on_double_click_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for Map { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Map`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html #[must_use = "The builder must be built to be used"] pub struct MapBuilder { builder: glib::object::ObjectBuilder<'static, Map>, } impl MapBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn animate_zoom(self, animate_zoom: bool) -> Self { Self { builder: self.builder.property("animate-zoom", animate_zoom), } } pub fn go_to_duration(self, go_to_duration: u32) -> Self { Self { builder: self.builder.property("go-to-duration", go_to_duration), } } pub fn zoom_on_double_click(self, zoom_on_double_click: bool) -> Self { Self { builder: self .builder .property("zoom-on-double-click", zoom_on_double_click), } } 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()), } } #[cfg(feature = "gtk_v4_18")] #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))] pub fn limit_events(self, limit_events: bool) -> Self { Self { builder: self.builder.property("limit-events", limit_events), } } 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 [`Map`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Map { assert_initialized_main_thread!(); self.builder.build() } } libshumate-0.7.0/src/auto/map_layer.rs000064400000000000000000000264511046102023000160530ustar 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_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] use crate::SymbolEvent; #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] use crate::Tile; use crate::{ffi, Layer, MapSource, Viewport}; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] use glib::{ object::ObjectType as _, signal::{connect_raw, SignalHandlerId}, }; use glib::{prelude::*, translate::*}; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "ShumateMapLayer")] pub struct MapLayer(Object) @extends Layer, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::shumate_map_layer_get_type(), } } impl MapLayer { #[doc(alias = "shumate_map_layer_new")] pub fn new(map_source: &impl IsA, viewport: &Viewport) -> MapLayer { skip_assert_initialized!(); unsafe { from_glib_none(ffi::shumate_map_layer_new( map_source.as_ref().to_glib_none().0, viewport.to_glib_none().0, )) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`MapLayer`] objects. /// /// This method returns an instance of [`MapLayerBuilder`](crate::builders::MapLayerBuilder) which can be used to create [`MapLayer`] objects. pub fn builder() -> MapLayerBuilder { MapLayerBuilder::new() } #[doc(alias = "map-source")] pub fn map_source(&self) -> Option { ObjectExt::property(self, "map-source") } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "map-loaded")] pub fn connect_map_loaded(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn map_loaded_trampoline( this: *mut ffi::ShumateMapLayer, errors: glib::ffi::gboolean, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), from_glib(errors)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"map-loaded".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( map_loaded_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "symbol-clicked")] pub fn connect_symbol_clicked( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn symbol_clicked_trampoline( this: *mut ffi::ShumateMapLayer, event: *mut ffi::ShumateSymbolEvent, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(event)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"symbol-clicked".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( symbol_clicked_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "tile-error")] pub fn connect_tile_error( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn tile_error_trampoline< F: Fn(&MapLayer, &Tile, &glib::Error) + 'static, >( this: *mut ffi::ShumateMapLayer, tile: *mut ffi::ShumateTile, error: *mut glib::ffi::GError, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( &from_glib_borrow(this), &from_glib_borrow(tile), &from_glib_borrow(error), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"tile-error".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( tile_error_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for MapLayer { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`MapLayer`] 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 MapLayerBuilder { builder: glib::object::ObjectBuilder<'static, MapLayer>, } impl MapLayerBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn map_source(self, map_source: &impl IsA) -> Self { Self { builder: self .builder .property("map-source", map_source.clone().upcast()), } } pub fn viewport(self, viewport: &Viewport) -> Self { Self { builder: self.builder.property("viewport", viewport.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()), } } #[cfg(feature = "gtk_v4_18")] #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))] pub fn limit_events(self, limit_events: bool) -> Self { Self { builder: self.builder.property("limit-events", limit_events), } } 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 [`MapLayer`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> MapLayer { assert_initialized_main_thread!(); self.builder.build() } } libshumate-0.7.0/src/auto/map_source.rs000064400000000000000000000421521046102023000162330ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::{ffi, MapProjection, Tile}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::{boxed::Box as Box_, pin::Pin}; glib::wrapper! { #[doc(alias = "ShumateMapSource")] pub struct MapSource(Object); match fn { type_ => || ffi::shumate_map_source_get_type(), } } impl MapSource { pub const NONE: Option<&'static MapSource> = None; } pub trait MapSourceExt: IsA + 'static { #[doc(alias = "shumate_map_source_fill_tile_async")] fn fill_tile_async) + 'static>( &self, tile: &Tile, 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 fill_tile_async_trampoline< P: FnOnce(Result<(), glib::Error>) + 'static, >( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer, ) { let mut error = std::ptr::null_mut(); ffi::shumate_map_source_fill_tile_finish(_source_object as *mut _, res, &mut error); let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }; let callback: Box_> = Box_::from_raw(user_data as *mut _); let callback: P = callback.into_inner(); callback(result); } let callback = fill_tile_async_trampoline::

; unsafe { ffi::shumate_map_source_fill_tile_async( self.as_ref().to_glib_none().0, tile.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _, ); } } fn fill_tile_future( &self, tile: &Tile, ) -> Pin> + 'static>> { let tile = tile.clone(); Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { obj.fill_tile_async(&tile, Some(cancellable), move |res| { send.resolve(res); }); })) } #[doc(alias = "shumate_map_source_get_column_count")] #[doc(alias = "get_column_count")] fn column_count(&self, zoom_level: u32) -> u32 { unsafe { ffi::shumate_map_source_get_column_count(self.as_ref().to_glib_none().0, zoom_level) } } #[doc(alias = "shumate_map_source_get_id")] #[doc(alias = "get_id")] fn id(&self) -> Option { unsafe { from_glib_none(ffi::shumate_map_source_get_id( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "shumate_map_source_get_latitude")] #[doc(alias = "get_latitude")] fn latitude(&self, zoom_level: f64, y: f64) -> f64 { unsafe { ffi::shumate_map_source_get_latitude(self.as_ref().to_glib_none().0, zoom_level, y) } } #[doc(alias = "shumate_map_source_get_license")] #[doc(alias = "get_license")] fn license(&self) -> Option { unsafe { from_glib_none(ffi::shumate_map_source_get_license( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "shumate_map_source_get_license_uri")] #[doc(alias = "get_license_uri")] #[doc(alias = "license-uri")] fn license_uri(&self) -> Option { unsafe { from_glib_none(ffi::shumate_map_source_get_license_uri( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "shumate_map_source_get_longitude")] #[doc(alias = "get_longitude")] fn longitude(&self, zoom_level: f64, x: f64) -> f64 { unsafe { ffi::shumate_map_source_get_longitude(self.as_ref().to_glib_none().0, zoom_level, x) } } #[doc(alias = "shumate_map_source_get_max_zoom_level")] #[doc(alias = "get_max_zoom_level")] #[doc(alias = "max-zoom-level")] fn max_zoom_level(&self) -> u32 { unsafe { ffi::shumate_map_source_get_max_zoom_level(self.as_ref().to_glib_none().0) } } #[doc(alias = "shumate_map_source_get_meters_per_pixel")] #[doc(alias = "get_meters_per_pixel")] fn meters_per_pixel(&self, zoom_level: f64, latitude: f64, longitude: f64) -> f64 { unsafe { ffi::shumate_map_source_get_meters_per_pixel( self.as_ref().to_glib_none().0, zoom_level, latitude, longitude, ) } } #[doc(alias = "shumate_map_source_get_min_zoom_level")] #[doc(alias = "get_min_zoom_level")] #[doc(alias = "min-zoom-level")] fn min_zoom_level(&self) -> u32 { unsafe { ffi::shumate_map_source_get_min_zoom_level(self.as_ref().to_glib_none().0) } } #[doc(alias = "shumate_map_source_get_name")] #[doc(alias = "get_name")] fn name(&self) -> Option { unsafe { from_glib_none(ffi::shumate_map_source_get_name( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "shumate_map_source_get_projection")] #[doc(alias = "get_projection")] fn projection(&self) -> MapProjection { unsafe { from_glib(ffi::shumate_map_source_get_projection( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "shumate_map_source_get_row_count")] #[doc(alias = "get_row_count")] fn row_count(&self, zoom_level: u32) -> u32 { unsafe { ffi::shumate_map_source_get_row_count(self.as_ref().to_glib_none().0, zoom_level) } } #[doc(alias = "shumate_map_source_get_tile_size")] #[doc(alias = "get_tile_size")] #[doc(alias = "tile-size")] fn tile_size(&self) -> u32 { unsafe { ffi::shumate_map_source_get_tile_size(self.as_ref().to_glib_none().0) } } #[doc(alias = "shumate_map_source_get_tile_size_at_zoom")] #[doc(alias = "get_tile_size_at_zoom")] fn tile_size_at_zoom(&self, zoom_level: f64) -> f64 { unsafe { ffi::shumate_map_source_get_tile_size_at_zoom( self.as_ref().to_glib_none().0, zoom_level, ) } } #[doc(alias = "shumate_map_source_get_x")] #[doc(alias = "get_x")] fn x(&self, zoom_level: f64, longitude: f64) -> f64 { unsafe { ffi::shumate_map_source_get_x(self.as_ref().to_glib_none().0, zoom_level, longitude) } } #[doc(alias = "shumate_map_source_get_y")] #[doc(alias = "get_y")] fn y(&self, zoom_level: f64, latitude: f64) -> f64 { unsafe { ffi::shumate_map_source_get_y(self.as_ref().to_glib_none().0, zoom_level, latitude) } } #[doc(alias = "shumate_map_source_set_id")] #[doc(alias = "id")] fn set_id(&self, id: &str) { unsafe { ffi::shumate_map_source_set_id(self.as_ref().to_glib_none().0, id.to_glib_none().0); } } #[doc(alias = "shumate_map_source_set_license")] #[doc(alias = "license")] fn set_license(&self, license: &str) { unsafe { ffi::shumate_map_source_set_license( self.as_ref().to_glib_none().0, license.to_glib_none().0, ); } } #[doc(alias = "shumate_map_source_set_license_uri")] #[doc(alias = "license-uri")] fn set_license_uri(&self, license_uri: &str) { unsafe { ffi::shumate_map_source_set_license_uri( self.as_ref().to_glib_none().0, license_uri.to_glib_none().0, ); } } #[doc(alias = "shumate_map_source_set_max_zoom_level")] #[doc(alias = "max-zoom-level")] fn set_max_zoom_level(&self, zoom_level: u32) { unsafe { ffi::shumate_map_source_set_max_zoom_level(self.as_ref().to_glib_none().0, zoom_level); } } #[doc(alias = "shumate_map_source_set_min_zoom_level")] #[doc(alias = "min-zoom-level")] fn set_min_zoom_level(&self, zoom_level: u32) { unsafe { ffi::shumate_map_source_set_min_zoom_level(self.as_ref().to_glib_none().0, zoom_level); } } #[doc(alias = "shumate_map_source_set_name")] #[doc(alias = "name")] fn set_name(&self, name: &str) { unsafe { ffi::shumate_map_source_set_name(self.as_ref().to_glib_none().0, name.to_glib_none().0); } } #[doc(alias = "shumate_map_source_set_projection")] #[doc(alias = "projection")] fn set_projection(&self, projection: MapProjection) { unsafe { ffi::shumate_map_source_set_projection( self.as_ref().to_glib_none().0, projection.into_glib(), ); } } #[doc(alias = "shumate_map_source_set_tile_size")] #[doc(alias = "tile-size")] fn set_tile_size(&self, tile_size: u32) { unsafe { ffi::shumate_map_source_set_tile_size(self.as_ref().to_glib_none().0, tile_size); } } #[doc(alias = "id")] fn connect_id_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_id_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::ShumateMapSource, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(MapSource::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::id".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_id_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "license")] fn connect_license_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_license_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::ShumateMapSource, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(MapSource::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::license".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_license_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "license-uri")] fn connect_license_uri_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_license_uri_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::ShumateMapSource, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(MapSource::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::license-uri".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_license_uri_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "max-zoom-level")] fn connect_max_zoom_level_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_max_zoom_level_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::ShumateMapSource, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(MapSource::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::max-zoom-level".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_max_zoom_level_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "min-zoom-level")] fn connect_min_zoom_level_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_min_zoom_level_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::ShumateMapSource, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(MapSource::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::min-zoom-level".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_min_zoom_level_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "name")] fn connect_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_name_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::ShumateMapSource, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(MapSource::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::name".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "projection")] fn connect_projection_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_projection_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::ShumateMapSource, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(MapSource::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::projection".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_projection_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "tile-size")] fn connect_tile_size_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_tile_size_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::ShumateMapSource, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(MapSource::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::tile-size".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_tile_size_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> MapSourceExt for O {} libshumate-0.7.0/src/auto/map_source_registry.rs000064400000000000000000000043001046102023000201540ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::{ffi, MapSource}; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "ShumateMapSourceRegistry")] pub struct MapSourceRegistry(Object) @implements gio::ListModel; match fn { type_ => || ffi::shumate_map_source_registry_get_type(), } } impl MapSourceRegistry { #[doc(alias = "shumate_map_source_registry_new")] pub fn new() -> MapSourceRegistry { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::shumate_map_source_registry_new()) } } #[doc(alias = "shumate_map_source_registry_new_with_defaults")] #[doc(alias = "new_with_defaults")] pub fn with_defaults() -> MapSourceRegistry { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::shumate_map_source_registry_new_with_defaults()) } } #[doc(alias = "shumate_map_source_registry_add")] pub fn add(&self, map_source: impl IsA) { unsafe { ffi::shumate_map_source_registry_add( self.to_glib_none().0, map_source.upcast().into_glib_ptr(), ); } } #[doc(alias = "shumate_map_source_registry_get_by_id")] #[doc(alias = "get_by_id")] pub fn by_id(&self, id: &str) -> Option { unsafe { from_glib_none(ffi::shumate_map_source_registry_get_by_id( self.to_glib_none().0, id.to_glib_none().0, )) } } #[doc(alias = "shumate_map_source_registry_populate_defaults")] pub fn populate_defaults(&self) { unsafe { ffi::shumate_map_source_registry_populate_defaults(self.to_glib_none().0); } } #[doc(alias = "shumate_map_source_registry_remove")] pub fn remove(&self, id: &str) { unsafe { ffi::shumate_map_source_registry_remove(self.to_glib_none().0, id.to_glib_none().0); } } } impl Default for MapSourceRegistry { fn default() -> Self { Self::new() } } libshumate-0.7.0/src/auto/marker.rs000064400000000000000000000305161046102023000153600ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::{ffi, Location}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "ShumateMarker")] pub struct Marker(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, Location; match fn { type_ => || ffi::shumate_marker_get_type(), } } impl Marker { pub const NONE: Option<&'static Marker> = None; #[doc(alias = "shumate_marker_new")] pub fn new() -> Marker { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::shumate_marker_new()) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Marker`] objects. /// /// This method returns an instance of [`MarkerBuilder`](crate::builders::MarkerBuilder) which can be used to create [`Marker`] objects. pub fn builder() -> MarkerBuilder { MarkerBuilder::new() } } impl Default for Marker { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Marker`] 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 MarkerBuilder { builder: glib::object::ObjectBuilder<'static, Marker>, } impl MarkerBuilder { 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 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()), } } #[cfg(feature = "gtk_v4_18")] #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))] pub fn limit_events(self, limit_events: bool) -> Self { Self { builder: self.builder.property("limit-events", limit_events), } } 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 latitude(self, latitude: f64) -> Self { Self { builder: self.builder.property("latitude", latitude), } } pub fn longitude(self, longitude: f64) -> Self { Self { builder: self.builder.property("longitude", longitude), } } // rustdoc-stripper-ignore-next /// Build the [`Marker`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Marker { assert_initialized_main_thread!(); self.builder.build() } } pub trait MarkerExt: IsA + 'static { #[doc(alias = "shumate_marker_animate_in")] fn animate_in(&self) { unsafe { ffi::shumate_marker_animate_in(self.as_ref().to_glib_none().0); } } #[doc(alias = "shumate_marker_animate_in_with_delay")] fn animate_in_with_delay(&self, delay: u32) { unsafe { ffi::shumate_marker_animate_in_with_delay(self.as_ref().to_glib_none().0, delay); } } #[doc(alias = "shumate_marker_animate_out")] fn animate_out(&self) { unsafe { ffi::shumate_marker_animate_out(self.as_ref().to_glib_none().0); } } #[doc(alias = "shumate_marker_animate_out_with_delay")] fn animate_out_with_delay(&self, delay: u32) { unsafe { ffi::shumate_marker_animate_out_with_delay(self.as_ref().to_glib_none().0, delay); } } #[doc(alias = "shumate_marker_get_child")] #[doc(alias = "get_child")] fn child(&self) -> Option { unsafe { from_glib_none(ffi::shumate_marker_get_child( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "shumate_marker_get_draggable")] #[doc(alias = "get_draggable")] fn is_draggable(&self) -> bool { unsafe { from_glib(ffi::shumate_marker_get_draggable( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "shumate_marker_get_selectable")] #[doc(alias = "get_selectable")] #[doc(alias = "selectable")] fn is_selectable(&self) -> bool { unsafe { from_glib(ffi::shumate_marker_get_selectable( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "shumate_marker_is_selected")] fn is_selected(&self) -> bool { unsafe { from_glib(ffi::shumate_marker_is_selected( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "shumate_marker_set_child")] #[doc(alias = "child")] fn set_child(&self, child: Option<&impl IsA>) { unsafe { ffi::shumate_marker_set_child( self.as_ref().to_glib_none().0, child.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "shumate_marker_set_draggable")] fn set_draggable(&self, value: bool) { unsafe { ffi::shumate_marker_set_draggable(self.as_ref().to_glib_none().0, value.into_glib()); } } #[doc(alias = "shumate_marker_set_selectable")] #[doc(alias = "selectable")] fn set_selectable(&self, value: bool) { unsafe { ffi::shumate_marker_set_selectable(self.as_ref().to_glib_none().0, value.into_glib()); } } #[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::ShumateMarker, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Marker::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::child".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_child_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "selectable")] fn connect_selectable_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_selectable_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::ShumateMarker, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Marker::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::selectable".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_selectable_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> MarkerExt for O {} libshumate-0.7.0/src/auto/marker_layer.rs000064400000000000000000000335301046102023000165530ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::{ffi, Layer, Marker, Viewport}; use glib::{ object::ObjectType as _, prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "ShumateMarkerLayer")] pub struct MarkerLayer(Object) @extends Layer, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::shumate_marker_layer_get_type(), } } impl MarkerLayer { #[doc(alias = "shumate_marker_layer_new")] pub fn new(viewport: &Viewport) -> MarkerLayer { skip_assert_initialized!(); unsafe { from_glib_none(ffi::shumate_marker_layer_new(viewport.to_glib_none().0)) } } #[doc(alias = "shumate_marker_layer_new_full")] pub fn new_full(viewport: &Viewport, mode: gtk::SelectionMode) -> MarkerLayer { skip_assert_initialized!(); unsafe { from_glib_none(ffi::shumate_marker_layer_new_full( viewport.to_glib_none().0, mode.into_glib(), )) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`MarkerLayer`] objects. /// /// This method returns an instance of [`MarkerLayerBuilder`](crate::builders::MarkerLayerBuilder) which can be used to create [`MarkerLayer`] objects. pub fn builder() -> MarkerLayerBuilder { MarkerLayerBuilder::new() } #[doc(alias = "shumate_marker_layer_add_marker")] pub fn add_marker(&self, marker: &impl IsA) { unsafe { ffi::shumate_marker_layer_add_marker( self.to_glib_none().0, marker.as_ref().to_glib_none().0, ); } } #[doc(alias = "shumate_marker_layer_get_markers")] #[doc(alias = "get_markers")] pub fn markers(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_container(ffi::shumate_marker_layer_get_markers( self.to_glib_none().0, )) } } #[doc(alias = "shumate_marker_layer_get_selected")] #[doc(alias = "get_selected")] pub fn selected(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_container(ffi::shumate_marker_layer_get_selected( self.to_glib_none().0, )) } } #[doc(alias = "shumate_marker_layer_get_selection_mode")] #[doc(alias = "get_selection_mode")] #[doc(alias = "selection-mode")] pub fn selection_mode(&self) -> gtk::SelectionMode { unsafe { from_glib(ffi::shumate_marker_layer_get_selection_mode( self.to_glib_none().0, )) } } #[doc(alias = "shumate_marker_layer_remove_all")] pub fn remove_all(&self) { unsafe { ffi::shumate_marker_layer_remove_all(self.to_glib_none().0); } } #[doc(alias = "shumate_marker_layer_remove_marker")] pub fn remove_marker(&self, marker: &impl IsA) { unsafe { ffi::shumate_marker_layer_remove_marker( self.to_glib_none().0, marker.as_ref().to_glib_none().0, ); } } #[doc(alias = "shumate_marker_layer_select_all_markers")] pub fn select_all_markers(&self) { unsafe { ffi::shumate_marker_layer_select_all_markers(self.to_glib_none().0); } } #[doc(alias = "shumate_marker_layer_select_marker")] pub fn select_marker(&self, marker: &impl IsA) -> bool { unsafe { from_glib(ffi::shumate_marker_layer_select_marker( self.to_glib_none().0, marker.as_ref().to_glib_none().0, )) } } #[doc(alias = "shumate_marker_layer_set_selection_mode")] #[doc(alias = "selection-mode")] pub fn set_selection_mode(&self, mode: gtk::SelectionMode) { unsafe { ffi::shumate_marker_layer_set_selection_mode(self.to_glib_none().0, mode.into_glib()); } } #[doc(alias = "shumate_marker_layer_unselect_all_markers")] pub fn unselect_all_markers(&self) { unsafe { ffi::shumate_marker_layer_unselect_all_markers(self.to_glib_none().0); } } #[doc(alias = "shumate_marker_layer_unselect_marker")] pub fn unselect_marker(&self, marker: &impl IsA) { unsafe { ffi::shumate_marker_layer_unselect_marker( self.to_glib_none().0, marker.as_ref().to_glib_none().0, ); } } #[doc(alias = "marker-selected")] pub fn connect_marker_selected( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn marker_selected_trampoline( this: *mut ffi::ShumateMarkerLayer, marker: *mut ffi::ShumateMarker, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(marker)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"marker-selected".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( marker_selected_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "marker-unselected")] pub fn connect_marker_unselected( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn marker_unselected_trampoline< F: Fn(&MarkerLayer, &Marker) + 'static, >( this: *mut ffi::ShumateMarkerLayer, marker: *mut ffi::ShumateMarker, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(marker)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"marker-unselected".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( marker_unselected_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "selection-mode")] pub fn connect_selection_mode_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_selection_mode_trampoline( this: *mut ffi::ShumateMarkerLayer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::selection-mode".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_selection_mode_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for MarkerLayer { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`MarkerLayer`] 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 MarkerLayerBuilder { builder: glib::object::ObjectBuilder<'static, MarkerLayer>, } impl MarkerLayerBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn selection_mode(self, selection_mode: gtk::SelectionMode) -> Self { Self { builder: self.builder.property("selection-mode", selection_mode), } } pub fn viewport(self, viewport: &Viewport) -> Self { Self { builder: self.builder.property("viewport", viewport.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()), } } #[cfg(feature = "gtk_v4_18")] #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))] pub fn limit_events(self, limit_events: bool) -> Self { Self { builder: self.builder.property("limit-events", limit_events), } } 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 [`MarkerLayer`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> MarkerLayer { assert_initialized_main_thread!(); self.builder.build() } } libshumate-0.7.0/src/auto/mod.rs000064400000000000000000000115721046102023000146570ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT mod compass; pub use self::compass::Compass; mod coordinate; pub use self::coordinate::Coordinate; mod data_source; pub use self::data_source::DataSource; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] mod data_source_request; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub use self::data_source_request::DataSourceRequest; mod file_cache; pub use self::file_cache::FileCache; mod layer; pub use self::layer::Layer; mod license; pub use self::license::License; mod location; pub use self::location::Location; mod map; pub use self::map::Map; mod map_layer; pub use self::map_layer::MapLayer; mod map_source; pub use self::map_source::MapSource; mod map_source_registry; pub use self::map_source_registry::MapSourceRegistry; mod marker; pub use self::marker::Marker; mod marker_layer; pub use self::marker_layer::MarkerLayer; mod path_layer; pub use self::path_layer::PathLayer; mod point; pub use self::point::Point; mod raster_renderer; pub use self::raster_renderer::RasterRenderer; mod scale; pub use self::scale::Scale; mod simple_map; pub use self::simple_map::SimpleMap; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] mod symbol_event; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub use self::symbol_event::SymbolEvent; mod tile; pub use self::tile::Tile; mod tile_downloader; pub use self::tile_downloader::TileDownloader; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] mod vector_reader; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub use self::vector_reader::VectorReader; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] mod vector_reader_iter; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub use self::vector_reader_iter::VectorReaderIter; mod vector_renderer; pub use self::vector_renderer::VectorRenderer; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] mod vector_sprite; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub use self::vector_sprite::VectorSprite; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] mod vector_sprite_sheet; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub use self::vector_sprite_sheet::VectorSpriteSheet; mod viewport; pub use self::viewport::Viewport; mod enums; pub use self::enums::FileCacheError; #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] pub use self::enums::GeometryType; pub use self::enums::MapProjection; pub use self::enums::State; pub use self::enums::StyleError; pub use self::enums::TileDownloaderError; pub use self::enums::Unit; pub(crate) mod functions; mod constants; pub use self::constants::MAP_SOURCE_MFF_RELIEF; pub use self::constants::MAP_SOURCE_OSM_CYCLE_MAP; pub use self::constants::MAP_SOURCE_OSM_MAPNIK; pub use self::constants::MAP_SOURCE_OSM_TRANSPORT_MAP; pub use self::constants::MAP_SOURCE_OWM_CLOUDS; pub use self::constants::MAP_SOURCE_OWM_PRECIPITATION; pub use self::constants::MAP_SOURCE_OWM_PRESSURE; pub use self::constants::MAP_SOURCE_OWM_TEMPERATURE; pub use self::constants::MAP_SOURCE_OWM_WIND; pub(crate) mod traits { pub use super::data_source::DataSourceExt; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub use super::data_source_request::DataSourceRequestExt; pub use super::layer::LayerExt; pub use super::location::LocationExt; pub use super::map_source::MapSourceExt; pub use super::marker::MarkerExt; } pub(crate) mod builders { pub use super::compass::CompassBuilder; pub use super::coordinate::CoordinateBuilder; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub use super::data_source_request::DataSourceRequestBuilder; pub use super::file_cache::FileCacheBuilder; pub use super::license::LicenseBuilder; pub use super::map::MapBuilder; pub use super::map_layer::MapLayerBuilder; pub use super::marker::MarkerBuilder; pub use super::marker_layer::MarkerLayerBuilder; pub use super::path_layer::PathLayerBuilder; pub use super::point::PointBuilder; pub use super::raster_renderer::RasterRendererBuilder; pub use super::scale::ScaleBuilder; pub use super::simple_map::SimpleMapBuilder; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub use super::symbol_event::SymbolEventBuilder; pub use super::tile::TileBuilder; pub use super::vector_renderer::VectorRendererBuilder; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub use super::vector_sprite::VectorSpriteBuilder; pub use super::viewport::ViewportBuilder; } libshumate-0.7.0/src/auto/path_layer.rs000064400000000000000000000532051046102023000162270ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::{ffi, Layer, Location, Viewport}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "ShumatePathLayer")] pub struct PathLayer(Object) @extends Layer, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::shumate_path_layer_get_type(), } } impl PathLayer { #[doc(alias = "shumate_path_layer_new")] pub fn new(viewport: &Viewport) -> PathLayer { skip_assert_initialized!(); unsafe { from_glib_none(ffi::shumate_path_layer_new(viewport.to_glib_none().0)) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`PathLayer`] objects. /// /// This method returns an instance of [`PathLayerBuilder`](crate::builders::PathLayerBuilder) which can be used to create [`PathLayer`] objects. pub fn builder() -> PathLayerBuilder { PathLayerBuilder::new() } #[doc(alias = "shumate_path_layer_add_node")] pub fn add_node(&self, location: &impl IsA) { unsafe { ffi::shumate_path_layer_add_node( self.to_glib_none().0, location.as_ref().to_glib_none().0, ); } } #[doc(alias = "shumate_path_layer_get_closed")] #[doc(alias = "get_closed")] #[doc(alias = "closed")] pub fn is_closed(&self) -> bool { unsafe { from_glib(ffi::shumate_path_layer_get_closed(self.to_glib_none().0)) } } //#[doc(alias = "shumate_path_layer_get_dash")] //#[doc(alias = "get_dash")] //pub fn dash(&self) -> /*Unimplemented*/Option { // unsafe { TODO: call ffi:shumate_path_layer_get_dash() } //} #[doc(alias = "shumate_path_layer_get_fill")] #[doc(alias = "get_fill")] #[doc(alias = "fill")] pub fn fills(&self) -> bool { unsafe { from_glib(ffi::shumate_path_layer_get_fill(self.to_glib_none().0)) } } #[doc(alias = "shumate_path_layer_get_fill_color")] #[doc(alias = "get_fill_color")] #[doc(alias = "fill-color")] pub fn fill_color(&self) -> Option { unsafe { from_glib_full(ffi::shumate_path_layer_get_fill_color( self.to_glib_none().0, )) } } #[doc(alias = "shumate_path_layer_get_nodes")] #[doc(alias = "get_nodes")] pub fn nodes(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_container(ffi::shumate_path_layer_get_nodes( self.to_glib_none().0, )) } } #[doc(alias = "shumate_path_layer_get_outline_color")] #[doc(alias = "get_outline_color")] #[doc(alias = "outline-color")] pub fn outline_color(&self) -> Option { unsafe { from_glib_full(ffi::shumate_path_layer_get_outline_color( self.to_glib_none().0, )) } } #[doc(alias = "shumate_path_layer_get_outline_width")] #[doc(alias = "get_outline_width")] #[doc(alias = "outline-width")] pub fn outline_width(&self) -> f64 { unsafe { ffi::shumate_path_layer_get_outline_width(self.to_glib_none().0) } } #[doc(alias = "shumate_path_layer_get_stroke")] #[doc(alias = "get_stroke")] #[doc(alias = "stroke")] pub fn is_stroke(&self) -> bool { unsafe { from_glib(ffi::shumate_path_layer_get_stroke(self.to_glib_none().0)) } } #[doc(alias = "shumate_path_layer_get_stroke_color")] #[doc(alias = "get_stroke_color")] #[doc(alias = "stroke-color")] pub fn stroke_color(&self) -> Option { unsafe { from_glib_full(ffi::shumate_path_layer_get_stroke_color( self.to_glib_none().0, )) } } #[doc(alias = "shumate_path_layer_get_stroke_width")] #[doc(alias = "get_stroke_width")] #[doc(alias = "stroke-width")] pub fn stroke_width(&self) -> f64 { unsafe { ffi::shumate_path_layer_get_stroke_width(self.to_glib_none().0) } } #[doc(alias = "shumate_path_layer_insert_node")] pub fn insert_node(&self, location: &impl IsA, position: u32) { unsafe { ffi::shumate_path_layer_insert_node( self.to_glib_none().0, location.as_ref().to_glib_none().0, position, ); } } #[doc(alias = "shumate_path_layer_remove_all")] pub fn remove_all(&self) { unsafe { ffi::shumate_path_layer_remove_all(self.to_glib_none().0); } } #[doc(alias = "shumate_path_layer_remove_node")] pub fn remove_node(&self, location: &impl IsA) { unsafe { ffi::shumate_path_layer_remove_node( self.to_glib_none().0, location.as_ref().to_glib_none().0, ); } } #[doc(alias = "shumate_path_layer_set_closed")] #[doc(alias = "closed")] pub fn set_closed(&self, value: bool) { unsafe { ffi::shumate_path_layer_set_closed(self.to_glib_none().0, value.into_glib()); } } //#[doc(alias = "shumate_path_layer_set_dash")] //pub fn set_dash(&self, dash_pattern: /*Unimplemented*/&List TypeId { ns_id: 0, id: 15 }) { // unsafe { TODO: call ffi:shumate_path_layer_set_dash() } //} #[doc(alias = "shumate_path_layer_set_fill")] #[doc(alias = "fill")] pub fn set_fill(&self, value: bool) { unsafe { ffi::shumate_path_layer_set_fill(self.to_glib_none().0, value.into_glib()); } } #[doc(alias = "shumate_path_layer_set_fill_color")] #[doc(alias = "fill-color")] pub fn set_fill_color(&self, color: Option<&gdk::RGBA>) { unsafe { ffi::shumate_path_layer_set_fill_color(self.to_glib_none().0, color.to_glib_none().0); } } #[doc(alias = "shumate_path_layer_set_outline_color")] #[doc(alias = "outline-color")] pub fn set_outline_color(&self, color: Option<&gdk::RGBA>) { unsafe { ffi::shumate_path_layer_set_outline_color( self.to_glib_none().0, color.to_glib_none().0, ); } } #[doc(alias = "shumate_path_layer_set_outline_width")] #[doc(alias = "outline-width")] pub fn set_outline_width(&self, value: f64) { unsafe { ffi::shumate_path_layer_set_outline_width(self.to_glib_none().0, value); } } #[doc(alias = "shumate_path_layer_set_stroke")] #[doc(alias = "stroke")] pub fn set_stroke(&self, value: bool) { unsafe { ffi::shumate_path_layer_set_stroke(self.to_glib_none().0, value.into_glib()); } } #[doc(alias = "shumate_path_layer_set_stroke_color")] #[doc(alias = "stroke-color")] pub fn set_stroke_color(&self, color: Option<&gdk::RGBA>) { unsafe { ffi::shumate_path_layer_set_stroke_color(self.to_glib_none().0, color.to_glib_none().0); } } #[doc(alias = "shumate_path_layer_set_stroke_width")] #[doc(alias = "stroke-width")] pub fn set_stroke_width(&self, value: f64) { unsafe { ffi::shumate_path_layer_set_stroke_width(self.to_glib_none().0, value); } } #[doc(alias = "closed")] pub fn connect_closed_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_closed_trampoline( this: *mut ffi::ShumatePathLayer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::closed".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_closed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "fill")] pub fn connect_fill_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_fill_trampoline( this: *mut ffi::ShumatePathLayer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::fill".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_fill_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "fill-color")] pub fn connect_fill_color_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_fill_color_trampoline( this: *mut ffi::ShumatePathLayer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::fill-color".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_fill_color_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "outline-color")] pub fn connect_outline_color_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_outline_color_trampoline( this: *mut ffi::ShumatePathLayer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::outline-color".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_outline_color_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "outline-width")] pub fn connect_outline_width_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_outline_width_trampoline( this: *mut ffi::ShumatePathLayer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::outline-width".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_outline_width_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "stroke")] pub fn connect_stroke_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_stroke_trampoline( this: *mut ffi::ShumatePathLayer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::stroke".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_stroke_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "stroke-color")] pub fn connect_stroke_color_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_stroke_color_trampoline( this: *mut ffi::ShumatePathLayer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::stroke-color".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_stroke_color_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "stroke-width")] pub fn connect_stroke_width_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_stroke_width_trampoline( this: *mut ffi::ShumatePathLayer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::stroke-width".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_stroke_width_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for PathLayer { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`PathLayer`] 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 PathLayerBuilder { builder: glib::object::ObjectBuilder<'static, PathLayer>, } impl PathLayerBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn closed(self, closed: bool) -> Self { Self { builder: self.builder.property("closed", closed), } } pub fn fill(self, fill: bool) -> Self { Self { builder: self.builder.property("fill", fill), } } pub fn fill_color(self, fill_color: &gdk::RGBA) -> Self { Self { builder: self.builder.property("fill-color", fill_color), } } pub fn outline_color(self, outline_color: &gdk::RGBA) -> Self { Self { builder: self.builder.property("outline-color", outline_color), } } pub fn outline_width(self, outline_width: f64) -> Self { Self { builder: self.builder.property("outline-width", outline_width), } } pub fn stroke(self, stroke: bool) -> Self { Self { builder: self.builder.property("stroke", stroke), } } pub fn stroke_color(self, stroke_color: &gdk::RGBA) -> Self { Self { builder: self.builder.property("stroke-color", stroke_color), } } pub fn stroke_width(self, stroke_width: f64) -> Self { Self { builder: self.builder.property("stroke-width", stroke_width), } } pub fn viewport(self, viewport: &Viewport) -> Self { Self { builder: self.builder.property("viewport", viewport.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()), } } #[cfg(feature = "gtk_v4_18")] #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))] pub fn limit_events(self, limit_events: bool) -> Self { Self { builder: self.builder.property("limit-events", limit_events), } } 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 [`PathLayer`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> PathLayer { assert_initialized_main_thread!(); self.builder.build() } } libshumate-0.7.0/src/auto/point.rs000064400000000000000000000172271046102023000152340ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::{ffi, Location, Marker}; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "ShumatePoint")] pub struct Point(Object) @extends Marker, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, Location; match fn { type_ => || ffi::shumate_point_get_type(), } } impl Point { #[doc(alias = "shumate_point_new")] pub fn new() -> Point { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::shumate_point_new()) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Point`] objects. /// /// This method returns an instance of [`PointBuilder`](crate::builders::PointBuilder) which can be used to create [`Point`] objects. pub fn builder() -> PointBuilder { PointBuilder::new() } } impl Default for Point { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Point`] 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 PointBuilder { builder: glib::object::ObjectBuilder<'static, Point>, } impl PointBuilder { 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 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()), } } #[cfg(feature = "gtk_v4_18")] #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))] pub fn limit_events(self, limit_events: bool) -> Self { Self { builder: self.builder.property("limit-events", limit_events), } } 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 latitude(self, latitude: f64) -> Self { Self { builder: self.builder.property("latitude", latitude), } } pub fn longitude(self, longitude: f64) -> Self { Self { builder: self.builder.property("longitude", longitude), } } // rustdoc-stripper-ignore-next /// Build the [`Point`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Point { assert_initialized_main_thread!(); self.builder.build() } } libshumate-0.7.0/src/auto/raster_renderer.rs000064400000000000000000000134331046102023000172640ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::{ffi, DataSource, MapProjection, MapSource}; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "ShumateRasterRenderer")] pub struct RasterRenderer(Object) @extends MapSource; match fn { type_ => || ffi::shumate_raster_renderer_get_type(), } } impl RasterRenderer { #[doc(alias = "shumate_raster_renderer_new")] pub fn new(data_source: &impl IsA) -> RasterRenderer { skip_assert_initialized!(); unsafe { from_glib_full(ffi::shumate_raster_renderer_new( data_source.as_ref().to_glib_none().0, )) } } #[doc(alias = "shumate_raster_renderer_new_from_url")] #[doc(alias = "new_from_url")] pub fn from_url(url_template: &str) -> RasterRenderer { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::shumate_raster_renderer_new_from_url( url_template.to_glib_none().0, )) } } #[doc(alias = "shumate_raster_renderer_new_full")] pub fn new_full( id: &str, name: &str, license: &str, license_uri: &str, min_zoom: u32, max_zoom: u32, tile_size: u32, projection: MapProjection, data_source: &impl IsA, ) -> RasterRenderer { skip_assert_initialized!(); unsafe { from_glib_full(ffi::shumate_raster_renderer_new_full( id.to_glib_none().0, name.to_glib_none().0, license.to_glib_none().0, license_uri.to_glib_none().0, min_zoom, max_zoom, tile_size, projection.into_glib(), data_source.as_ref().to_glib_none().0, )) } } #[doc(alias = "shumate_raster_renderer_new_full_from_url")] pub fn new_full_from_url( id: &str, name: &str, license: &str, license_uri: &str, min_zoom: u32, max_zoom: u32, tile_size: u32, projection: MapProjection, url_template: &str, ) -> RasterRenderer { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::shumate_raster_renderer_new_full_from_url( id.to_glib_none().0, name.to_glib_none().0, license.to_glib_none().0, license_uri.to_glib_none().0, min_zoom, max_zoom, tile_size, projection.into_glib(), url_template.to_glib_none().0, )) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`RasterRenderer`] objects. /// /// This method returns an instance of [`RasterRendererBuilder`](crate::builders::RasterRendererBuilder) which can be used to create [`RasterRenderer`] objects. pub fn builder() -> RasterRendererBuilder { RasterRendererBuilder::new() } #[doc(alias = "data-source")] pub fn data_source(&self) -> Option { ObjectExt::property(self, "data-source") } } impl Default for RasterRenderer { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`RasterRenderer`] 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 RasterRendererBuilder { builder: glib::object::ObjectBuilder<'static, RasterRenderer>, } impl RasterRendererBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn data_source(self, data_source: &impl IsA) -> Self { Self { builder: self .builder .property("data-source", data_source.clone().upcast()), } } pub fn id(self, id: impl Into) -> Self { Self { builder: self.builder.property("id", id.into()), } } pub fn license(self, license: impl Into) -> Self { Self { builder: self.builder.property("license", license.into()), } } pub fn license_uri(self, license_uri: impl Into) -> Self { Self { builder: self.builder.property("license-uri", license_uri.into()), } } pub fn max_zoom_level(self, max_zoom_level: u32) -> Self { Self { builder: self.builder.property("max-zoom-level", max_zoom_level), } } pub fn min_zoom_level(self, min_zoom_level: u32) -> Self { Self { builder: self.builder.property("min-zoom-level", min_zoom_level), } } pub fn name(self, name: impl Into) -> Self { Self { builder: self.builder.property("name", name.into()), } } pub fn projection(self, projection: MapProjection) -> Self { Self { builder: self.builder.property("projection", projection), } } pub fn tile_size(self, tile_size: u32) -> Self { Self { builder: self.builder.property("tile-size", tile_size), } } // rustdoc-stripper-ignore-next /// Build the [`RasterRenderer`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> RasterRenderer { assert_initialized_main_thread!(); self.builder.build() } } libshumate-0.7.0/src/auto/scale.rs000064400000000000000000000267121046102023000151710ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::{ffi, Unit, Viewport}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "ShumateScale")] pub struct Scale(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::shumate_scale_get_type(), } } impl Scale { #[doc(alias = "shumate_scale_new")] pub fn new(viewport: Option<&Viewport>) -> Scale { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::shumate_scale_new(viewport.to_glib_none().0)) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Scale`] objects. /// /// This method returns an instance of [`ScaleBuilder`](crate::builders::ScaleBuilder) which can be used to create [`Scale`] objects. pub fn builder() -> ScaleBuilder { ScaleBuilder::new() } #[doc(alias = "shumate_scale_get_max_width")] #[doc(alias = "get_max_width")] #[doc(alias = "max-width")] pub fn max_width(&self) -> u32 { unsafe { ffi::shumate_scale_get_max_width(self.to_glib_none().0) } } #[doc(alias = "shumate_scale_get_unit")] #[doc(alias = "get_unit")] pub fn unit(&self) -> Unit { unsafe { from_glib(ffi::shumate_scale_get_unit(self.to_glib_none().0)) } } #[doc(alias = "shumate_scale_get_viewport")] #[doc(alias = "get_viewport")] pub fn viewport(&self) -> Option { unsafe { from_glib_none(ffi::shumate_scale_get_viewport(self.to_glib_none().0)) } } #[doc(alias = "shumate_scale_set_max_width")] #[doc(alias = "max-width")] pub fn set_max_width(&self, value: u32) { unsafe { ffi::shumate_scale_set_max_width(self.to_glib_none().0, value); } } #[doc(alias = "shumate_scale_set_unit")] #[doc(alias = "unit")] pub fn set_unit(&self, unit: Unit) { unsafe { ffi::shumate_scale_set_unit(self.to_glib_none().0, unit.into_glib()); } } #[doc(alias = "shumate_scale_set_viewport")] #[doc(alias = "viewport")] pub fn set_viewport(&self, viewport: Option<&Viewport>) { unsafe { ffi::shumate_scale_set_viewport(self.to_glib_none().0, viewport.to_glib_none().0); } } #[doc(alias = "max-width")] pub fn connect_max_width_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_max_width_trampoline( this: *mut ffi::ShumateScale, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::max-width".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_max_width_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "unit")] pub fn connect_unit_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_unit_trampoline( this: *mut ffi::ShumateScale, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::unit".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_unit_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "viewport")] pub fn connect_viewport_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_viewport_trampoline( this: *mut ffi::ShumateScale, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::viewport".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_viewport_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for Scale { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Scale`] 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 ScaleBuilder { builder: glib::object::ObjectBuilder<'static, Scale>, } impl ScaleBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn max_width(self, max_width: u32) -> Self { Self { builder: self.builder.property("max-width", max_width), } } pub fn unit(self, unit: Unit) -> Self { Self { builder: self.builder.property("unit", unit), } } pub fn viewport(self, viewport: &Viewport) -> Self { Self { builder: self.builder.property("viewport", viewport.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()), } } #[cfg(feature = "gtk_v4_18")] #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))] pub fn limit_events(self, limit_events: bool) -> Self { Self { builder: self.builder.property("limit-events", limit_events), } } 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 [`Scale`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Scale { assert_initialized_main_thread!(); self.builder.build() } } libshumate-0.7.0/src/auto/simple_map.rs000064400000000000000000000505221046102023000162240ustar 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::MapLayer; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] use crate::SymbolEvent; use crate::{ffi, Compass, Layer, License, Map, MapSource, Scale, Viewport}; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] use glib::object::ObjectType as _; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "ShumateSimpleMap")] pub struct SimpleMap(Object) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; match fn { type_ => || ffi::shumate_simple_map_get_type(), } } impl SimpleMap { #[doc(alias = "shumate_simple_map_new")] pub fn new() -> SimpleMap { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::shumate_simple_map_new()) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`SimpleMap`] objects. /// /// This method returns an instance of [`SimpleMapBuilder`](crate::builders::SimpleMapBuilder) which can be used to create [`SimpleMap`] objects. pub fn builder() -> SimpleMapBuilder { SimpleMapBuilder::new() } #[doc(alias = "shumate_simple_map_add_overlay_layer")] pub fn add_overlay_layer(&self, layer: &impl IsA) { unsafe { ffi::shumate_simple_map_add_overlay_layer( self.to_glib_none().0, layer.as_ref().to_glib_none().0, ); } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "shumate_simple_map_get_base_map_layer")] #[doc(alias = "get_base_map_layer")] #[doc(alias = "base-map-layer")] pub fn base_map_layer(&self) -> Option { unsafe { from_glib_none(ffi::shumate_simple_map_get_base_map_layer( self.to_glib_none().0, )) } } #[doc(alias = "shumate_simple_map_get_compass")] #[doc(alias = "get_compass")] pub fn compass(&self) -> Option { unsafe { from_glib_none(ffi::shumate_simple_map_get_compass(self.to_glib_none().0)) } } #[doc(alias = "shumate_simple_map_get_license")] #[doc(alias = "get_license")] pub fn license(&self) -> Option { unsafe { from_glib_none(ffi::shumate_simple_map_get_license(self.to_glib_none().0)) } } #[doc(alias = "shumate_simple_map_get_map")] #[doc(alias = "get_map")] pub fn map(&self) -> Option { unsafe { from_glib_none(ffi::shumate_simple_map_get_map(self.to_glib_none().0)) } } #[doc(alias = "shumate_simple_map_get_map_source")] #[doc(alias = "get_map_source")] #[doc(alias = "map-source")] pub fn map_source(&self) -> Option { unsafe { from_glib_none(ffi::shumate_simple_map_get_map_source( self.to_glib_none().0, )) } } #[doc(alias = "shumate_simple_map_get_scale")] #[doc(alias = "get_scale")] pub fn scale(&self) -> Option { unsafe { from_glib_none(ffi::shumate_simple_map_get_scale(self.to_glib_none().0)) } } #[doc(alias = "shumate_simple_map_get_show_zoom_buttons")] #[doc(alias = "get_show_zoom_buttons")] #[doc(alias = "show-zoom-buttons")] pub fn shows_zoom_buttons(&self) -> bool { unsafe { from_glib(ffi::shumate_simple_map_get_show_zoom_buttons( self.to_glib_none().0, )) } } #[doc(alias = "shumate_simple_map_get_viewport")] #[doc(alias = "get_viewport")] pub fn viewport(&self) -> Option { unsafe { from_glib_none(ffi::shumate_simple_map_get_viewport(self.to_glib_none().0)) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "shumate_simple_map_insert_overlay_layer_above")] pub fn insert_overlay_layer_above(&self, layer: &impl IsA, sibling: &impl IsA) { unsafe { ffi::shumate_simple_map_insert_overlay_layer_above( self.to_glib_none().0, layer.as_ref().to_glib_none().0, sibling.as_ref().to_glib_none().0, ); } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "shumate_simple_map_insert_overlay_layer_behind")] pub fn insert_overlay_layer_behind(&self, layer: &impl IsA, sibling: &impl IsA) { unsafe { ffi::shumate_simple_map_insert_overlay_layer_behind( self.to_glib_none().0, layer.as_ref().to_glib_none().0, sibling.as_ref().to_glib_none().0, ); } } #[doc(alias = "shumate_simple_map_remove_overlay_layer")] pub fn remove_overlay_layer(&self, layer: &impl IsA) { unsafe { ffi::shumate_simple_map_remove_overlay_layer( self.to_glib_none().0, layer.as_ref().to_glib_none().0, ); } } #[doc(alias = "shumate_simple_map_set_map_source")] #[doc(alias = "map-source")] pub fn set_map_source(&self, map_source: Option<&impl IsA>) { unsafe { ffi::shumate_simple_map_set_map_source( self.to_glib_none().0, map_source.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "shumate_simple_map_set_show_zoom_buttons")] #[doc(alias = "show-zoom-buttons")] pub fn set_show_zoom_buttons(&self, show_zoom_buttons: bool) { unsafe { ffi::shumate_simple_map_set_show_zoom_buttons( self.to_glib_none().0, show_zoom_buttons.into_glib(), ); } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "symbol-clicked")] pub fn connect_symbol_clicked( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn symbol_clicked_trampoline< F: Fn(&SimpleMap, &SymbolEvent) + 'static, >( this: *mut ffi::ShumateSimpleMap, event: *mut ffi::ShumateSymbolEvent, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(event)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"symbol-clicked".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( symbol_clicked_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))] #[doc(alias = "base-map-layer")] pub fn connect_base_map_layer_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_base_map_layer_trampoline( this: *mut ffi::ShumateSimpleMap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::base-map-layer".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_base_map_layer_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "compass")] pub fn connect_compass_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_compass_trampoline( this: *mut ffi::ShumateSimpleMap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::compass".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_compass_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "license")] pub fn connect_license_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_license_trampoline( this: *mut ffi::ShumateSimpleMap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::license".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_license_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "map")] pub fn connect_map_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_map_trampoline( this: *mut ffi::ShumateSimpleMap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::map".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_map_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "map-source")] pub fn connect_map_source_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_map_source_trampoline( this: *mut ffi::ShumateSimpleMap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::map-source".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_map_source_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "scale")] pub fn connect_scale_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_scale_trampoline( this: *mut ffi::ShumateSimpleMap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::scale".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_scale_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "show-zoom-buttons")] pub fn connect_show_zoom_buttons_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_show_zoom_buttons_trampoline( this: *mut ffi::ShumateSimpleMap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::show-zoom-buttons".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_show_zoom_buttons_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "viewport")] pub fn connect_viewport_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_viewport_trampoline( this: *mut ffi::ShumateSimpleMap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::viewport".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_viewport_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for SimpleMap { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`SimpleMap`] 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 SimpleMapBuilder { builder: glib::object::ObjectBuilder<'static, SimpleMap>, } impl SimpleMapBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn map_source(self, map_source: &impl IsA) -> Self { Self { builder: self .builder .property("map-source", map_source.clone().upcast()), } } pub fn show_zoom_buttons(self, show_zoom_buttons: bool) -> Self { Self { builder: self .builder .property("show-zoom-buttons", show_zoom_buttons), } } 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()), } } #[cfg(feature = "gtk_v4_18")] #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))] pub fn limit_events(self, limit_events: bool) -> Self { Self { builder: self.builder.property("limit-events", limit_events), } } 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 [`SimpleMap`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> SimpleMap { assert_initialized_main_thread!(); self.builder.build() } } libshumate-0.7.0/src/auto/symbol_event.rs000064400000000000000000000175201046102023000166050ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::{ffi, Location}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "ShumateSymbolEvent")] pub struct SymbolEvent(Object) @implements Location; match fn { type_ => || ffi::shumate_symbol_event_get_type(), } } impl SymbolEvent { // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`SymbolEvent`] objects. /// /// This method returns an instance of [`SymbolEventBuilder`](crate::builders::SymbolEventBuilder) which can be used to create [`SymbolEvent`] objects. pub fn builder() -> SymbolEventBuilder { SymbolEventBuilder::new() } #[doc(alias = "shumate_symbol_event_get_feature_id")] #[doc(alias = "get_feature_id")] #[doc(alias = "feature-id")] pub fn feature_id(&self) -> Option { unsafe { from_glib_none(ffi::shumate_symbol_event_get_feature_id( self.to_glib_none().0, )) } } #[doc(alias = "shumate_symbol_event_get_layer")] #[doc(alias = "get_layer")] pub fn layer(&self) -> Option { unsafe { from_glib_none(ffi::shumate_symbol_event_get_layer(self.to_glib_none().0)) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "shumate_symbol_event_get_n_press")] #[doc(alias = "get_n_press")] #[doc(alias = "n-press")] pub fn n_press(&self) -> i32 { unsafe { ffi::shumate_symbol_event_get_n_press(self.to_glib_none().0) } } #[doc(alias = "shumate_symbol_event_get_source_layer")] #[doc(alias = "get_source_layer")] #[doc(alias = "source-layer")] pub fn source_layer(&self) -> Option { unsafe { from_glib_none(ffi::shumate_symbol_event_get_source_layer( self.to_glib_none().0, )) } } #[doc(alias = "shumate_symbol_event_get_tag")] #[doc(alias = "get_tag")] pub fn tag(&self, tag_name: &str) -> Option { unsafe { from_glib_none(ffi::shumate_symbol_event_get_tag( self.to_glib_none().0, tag_name.to_glib_none().0, )) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "n-press")] pub fn set_n_press(&self, n_press: u32) { ObjectExt::set_property(self, "n-press", n_press) } #[cfg(not(feature = "v1_1"))] #[cfg_attr(docsrs, doc(cfg(not(feature = "v1_1"))))] #[doc(alias = "source-layer")] pub fn source_layer(&self) -> Option { ObjectExt::property(self, "source-layer") } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "feature-id")] pub fn connect_feature_id_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_feature_id_trampoline( this: *mut ffi::ShumateSymbolEvent, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::feature-id".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_feature_id_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "layer")] pub fn connect_layer_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_layer_trampoline( this: *mut ffi::ShumateSymbolEvent, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::layer".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_layer_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] #[doc(alias = "n-press")] pub fn connect_n_press_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_n_press_trampoline( this: *mut ffi::ShumateSymbolEvent, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::n-press".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_n_press_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "source-layer")] pub fn connect_source_layer_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_source_layer_trampoline( this: *mut ffi::ShumateSymbolEvent, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::source-layer".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_source_layer_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`SymbolEvent`] 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 SymbolEventBuilder { builder: glib::object::ObjectBuilder<'static, SymbolEvent>, } impl SymbolEventBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_5")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))] pub fn n_press(self, n_press: u32) -> Self { Self { builder: self.builder.property("n-press", n_press), } } pub fn latitude(self, latitude: f64) -> Self { Self { builder: self.builder.property("latitude", latitude), } } pub fn longitude(self, longitude: f64) -> Self { Self { builder: self.builder.property("longitude", longitude), } } // rustdoc-stripper-ignore-next /// Build the [`SymbolEvent`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> SymbolEvent { assert_initialized_main_thread!(); self.builder.build() } } libshumate-0.7.0/src/auto/tile.rs000064400000000000000000000332061046102023000150330ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::{ffi, State}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "ShumateTile")] pub struct Tile(Object); match fn { type_ => || ffi::shumate_tile_get_type(), } } impl Tile { #[doc(alias = "shumate_tile_new")] pub fn new() -> Tile { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::shumate_tile_new()) } } #[doc(alias = "shumate_tile_new_full")] pub fn new_full(x: u32, y: u32, size: u32, zoom_level: u32) -> Tile { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::shumate_tile_new_full(x, y, size, zoom_level)) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Tile`] objects. /// /// This method returns an instance of [`TileBuilder`](crate::builders::TileBuilder) which can be used to create [`Tile`] objects. pub fn builder() -> TileBuilder { TileBuilder::new() } #[doc(alias = "shumate_tile_get_fade_in")] #[doc(alias = "get_fade_in")] #[doc(alias = "fade-in")] pub fn is_fade_in(&self) -> bool { unsafe { from_glib(ffi::shumate_tile_get_fade_in(self.to_glib_none().0)) } } #[doc(alias = "shumate_tile_get_paintable")] #[doc(alias = "get_paintable")] pub fn paintable(&self) -> Option { unsafe { from_glib_none(ffi::shumate_tile_get_paintable(self.to_glib_none().0)) } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "shumate_tile_get_scale_factor")] #[doc(alias = "get_scale_factor")] #[doc(alias = "scale-factor")] pub fn scale_factor(&self) -> f64 { unsafe { ffi::shumate_tile_get_scale_factor(self.to_glib_none().0) } } #[doc(alias = "shumate_tile_get_size")] #[doc(alias = "get_size")] pub fn size(&self) -> u32 { unsafe { ffi::shumate_tile_get_size(self.to_glib_none().0) } } #[doc(alias = "shumate_tile_get_state")] #[doc(alias = "get_state")] pub fn state(&self) -> State { unsafe { from_glib(ffi::shumate_tile_get_state(self.to_glib_none().0)) } } #[doc(alias = "shumate_tile_get_x")] #[doc(alias = "get_x")] pub fn x(&self) -> u32 { unsafe { ffi::shumate_tile_get_x(self.to_glib_none().0) } } #[doc(alias = "shumate_tile_get_y")] #[doc(alias = "get_y")] pub fn y(&self) -> u32 { unsafe { ffi::shumate_tile_get_y(self.to_glib_none().0) } } #[doc(alias = "shumate_tile_get_zoom_level")] #[doc(alias = "get_zoom_level")] #[doc(alias = "zoom-level")] pub fn zoom_level(&self) -> u32 { unsafe { ffi::shumate_tile_get_zoom_level(self.to_glib_none().0) } } #[doc(alias = "shumate_tile_set_fade_in")] #[doc(alias = "fade-in")] pub fn set_fade_in(&self, fade_in: bool) { unsafe { ffi::shumate_tile_set_fade_in(self.to_glib_none().0, fade_in.into_glib()); } } #[doc(alias = "shumate_tile_set_paintable")] #[doc(alias = "paintable")] pub fn set_paintable(&self, paintable: &impl IsA) { unsafe { ffi::shumate_tile_set_paintable( self.to_glib_none().0, paintable.as_ref().to_glib_none().0, ); } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "shumate_tile_set_scale_factor")] #[doc(alias = "scale-factor")] pub fn set_scale_factor(&self, scale_factor: f64) { unsafe { ffi::shumate_tile_set_scale_factor(self.to_glib_none().0, scale_factor); } } #[doc(alias = "shumate_tile_set_size")] #[doc(alias = "size")] pub fn set_size(&self, size: u32) { unsafe { ffi::shumate_tile_set_size(self.to_glib_none().0, size); } } #[doc(alias = "shumate_tile_set_state")] #[doc(alias = "state")] pub fn set_state(&self, state: State) { unsafe { ffi::shumate_tile_set_state(self.to_glib_none().0, state.into_glib()); } } #[doc(alias = "shumate_tile_set_x")] #[doc(alias = "x")] pub fn set_x(&self, x: u32) { unsafe { ffi::shumate_tile_set_x(self.to_glib_none().0, x); } } #[doc(alias = "shumate_tile_set_y")] #[doc(alias = "y")] pub fn set_y(&self, y: u32) { unsafe { ffi::shumate_tile_set_y(self.to_glib_none().0, y); } } #[doc(alias = "shumate_tile_set_zoom_level")] #[doc(alias = "zoom-level")] pub fn set_zoom_level(&self, zoom_level: u32) { unsafe { ffi::shumate_tile_set_zoom_level(self.to_glib_none().0, zoom_level); } } #[doc(alias = "fade-in")] pub fn connect_fade_in_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_fade_in_trampoline( this: *mut ffi::ShumateTile, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::fade-in".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_fade_in_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::ShumateTile, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::paintable".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_paintable_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "scale-factor")] pub fn connect_scale_factor_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_scale_factor_trampoline( this: *mut ffi::ShumateTile, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::scale-factor".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_scale_factor_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::ShumateTile, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::size".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_size_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "state")] pub fn connect_state_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_state_trampoline( this: *mut ffi::ShumateTile, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::state".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_state_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "x")] pub fn connect_x_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_x_trampoline( this: *mut ffi::ShumateTile, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::x".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_x_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "y")] pub fn connect_y_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_y_trampoline( this: *mut ffi::ShumateTile, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::y".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_y_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "zoom-level")] pub fn connect_zoom_level_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_zoom_level_trampoline( this: *mut ffi::ShumateTile, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::zoom-level".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_zoom_level_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for Tile { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Tile`] 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 TileBuilder { builder: glib::object::ObjectBuilder<'static, Tile>, } impl TileBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn fade_in(self, fade_in: bool) -> Self { Self { builder: self.builder.property("fade-in", fade_in), } } pub fn paintable(self, paintable: &impl IsA) -> Self { Self { builder: self .builder .property("paintable", paintable.clone().upcast()), } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub fn scale_factor(self, scale_factor: f64) -> Self { Self { builder: self.builder.property("scale-factor", scale_factor), } } pub fn size(self, size: u32) -> Self { Self { builder: self.builder.property("size", size), } } pub fn state(self, state: State) -> Self { Self { builder: self.builder.property("state", state), } } pub fn x(self, x: u32) -> Self { Self { builder: self.builder.property("x", x), } } pub fn y(self, y: u32) -> Self { Self { builder: self.builder.property("y", y), } } pub fn zoom_level(self, zoom_level: u32) -> Self { Self { builder: self.builder.property("zoom-level", zoom_level), } } // rustdoc-stripper-ignore-next /// Build the [`Tile`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Tile { assert_initialized_main_thread!(); self.builder.build() } } libshumate-0.7.0/src/auto/tile_downloader.rs000064400000000000000000000017041046102023000172470ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::{ffi, DataSource}; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "ShumateTileDownloader")] pub struct TileDownloader(Object) @extends DataSource; match fn { type_ => || ffi::shumate_tile_downloader_get_type(), } } impl TileDownloader { #[doc(alias = "shumate_tile_downloader_new")] pub fn new(url_template: &str) -> TileDownloader { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::shumate_tile_downloader_new( url_template.to_glib_none().0, )) } } #[doc(alias = "url-template")] pub fn url_template(&self) -> Option { ObjectExt::property(self, "url-template") } } libshumate-0.7.0/src/auto/vector_reader.rs000064400000000000000000000016271046102023000167240ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::{ffi, VectorReaderIter}; use glib::translate::*; glib::wrapper! { #[doc(alias = "ShumateVectorReader")] pub struct VectorReader(Object); match fn { type_ => || ffi::shumate_vector_reader_get_type(), } } impl VectorReader { #[doc(alias = "shumate_vector_reader_new")] pub fn new(bytes: &glib::Bytes) -> VectorReader { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::shumate_vector_reader_new(bytes.to_glib_none().0)) } } #[doc(alias = "shumate_vector_reader_iterate")] pub fn iterate(&self) -> Option { unsafe { from_glib_full(ffi::shumate_vector_reader_iterate(self.to_glib_none().0)) } } } libshumate-0.7.0/src/auto/vector_reader_iter.rs000064400000000000000000000124661046102023000177520ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::{ffi, GeometryType, VectorReader}; use glib::translate::*; glib::wrapper! { #[doc(alias = "ShumateVectorReaderIter")] pub struct VectorReaderIter(Object); match fn { type_ => || ffi::shumate_vector_reader_iter_get_type(), } } impl VectorReaderIter { #[doc(alias = "shumate_vector_reader_iter_feature_contains_point")] pub fn feature_contains_point(&self, x: f64, y: f64) -> bool { unsafe { from_glib(ffi::shumate_vector_reader_iter_feature_contains_point( self.to_glib_none().0, x, y, )) } } #[doc(alias = "shumate_vector_reader_iter_get_feature_geometry_type")] #[doc(alias = "get_feature_geometry_type")] pub fn feature_geometry_type(&self) -> GeometryType { unsafe { from_glib(ffi::shumate_vector_reader_iter_get_feature_geometry_type( self.to_glib_none().0, )) } } #[doc(alias = "shumate_vector_reader_iter_get_feature_id")] #[doc(alias = "get_feature_id")] pub fn feature_id(&self) -> u64 { unsafe { ffi::shumate_vector_reader_iter_get_feature_id(self.to_glib_none().0) } } #[doc(alias = "shumate_vector_reader_iter_get_feature_keys")] #[doc(alias = "get_feature_keys")] pub fn feature_keys(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_container( ffi::shumate_vector_reader_iter_get_feature_keys(self.to_glib_none().0), ) } } #[doc(alias = "shumate_vector_reader_iter_get_feature_point")] #[doc(alias = "get_feature_point")] pub fn feature_point(&self) -> Option<(f64, f64)> { unsafe { let mut x = std::mem::MaybeUninit::uninit(); let mut y = std::mem::MaybeUninit::uninit(); let ret = from_glib(ffi::shumate_vector_reader_iter_get_feature_point( self.to_glib_none().0, x.as_mut_ptr(), y.as_mut_ptr(), )); if ret { Some((x.assume_init(), y.assume_init())) } else { None } } } #[doc(alias = "shumate_vector_reader_iter_get_feature_tag")] #[doc(alias = "get_feature_tag")] pub fn feature_tag(&self, key: &str) -> Option { unsafe { let mut value = glib::Value::uninitialized(); let ret = from_glib(ffi::shumate_vector_reader_iter_get_feature_tag( self.to_glib_none().0, key.to_glib_none().0, value.to_glib_none_mut().0, )); if ret { Some(value) } else { None } } } #[doc(alias = "shumate_vector_reader_iter_get_layer_count")] #[doc(alias = "get_layer_count")] pub fn layer_count(&self) -> u32 { unsafe { ffi::shumate_vector_reader_iter_get_layer_count(self.to_glib_none().0) } } #[doc(alias = "shumate_vector_reader_iter_get_layer_extent")] #[doc(alias = "get_layer_extent")] pub fn layer_extent(&self) -> u32 { unsafe { ffi::shumate_vector_reader_iter_get_layer_extent(self.to_glib_none().0) } } #[doc(alias = "shumate_vector_reader_iter_get_layer_feature_count")] #[doc(alias = "get_layer_feature_count")] pub fn layer_feature_count(&self) -> u32 { unsafe { ffi::shumate_vector_reader_iter_get_layer_feature_count(self.to_glib_none().0) } } #[doc(alias = "shumate_vector_reader_iter_get_layer_name")] #[doc(alias = "get_layer_name")] pub fn layer_name(&self) -> Option { unsafe { from_glib_none(ffi::shumate_vector_reader_iter_get_layer_name( self.to_glib_none().0, )) } } #[doc(alias = "shumate_vector_reader_iter_get_reader")] #[doc(alias = "get_reader")] pub fn reader(&self) -> Option { unsafe { from_glib_none(ffi::shumate_vector_reader_iter_get_reader( self.to_glib_none().0, )) } } #[doc(alias = "shumate_vector_reader_iter_next_feature")] pub fn next_feature(&self) -> bool { unsafe { from_glib(ffi::shumate_vector_reader_iter_next_feature( self.to_glib_none().0, )) } } #[doc(alias = "shumate_vector_reader_iter_read_feature")] pub fn read_feature(&self, index: i32) { unsafe { ffi::shumate_vector_reader_iter_read_feature(self.to_glib_none().0, index); } } #[doc(alias = "shumate_vector_reader_iter_read_layer")] pub fn read_layer(&self, index: i32) { unsafe { ffi::shumate_vector_reader_iter_read_layer(self.to_glib_none().0, index); } } #[doc(alias = "shumate_vector_reader_iter_read_layer_by_name")] pub fn read_layer_by_name(&self, name: &str) -> bool { unsafe { from_glib(ffi::shumate_vector_reader_iter_read_layer_by_name( self.to_glib_none().0, name.to_glib_none().0, )) } } } libshumate-0.7.0/src/auto/vector_renderer.rs000064400000000000000000000200461046102023000172640ustar 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_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] use crate::DataSource; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] use crate::VectorSpriteSheet; use crate::{ffi, MapProjection, MapSource}; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] use glib::signal::{connect_raw, SignalHandlerId}; use glib::{prelude::*, translate::*}; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "ShumateVectorRenderer")] pub struct VectorRenderer(Object) @extends MapSource, @implements gio::Initable; match fn { type_ => || ffi::shumate_vector_renderer_get_type(), } } impl VectorRenderer { #[doc(alias = "shumate_vector_renderer_new")] pub fn new(id: &str, style_json: &str) -> Result { assert_initialized_main_thread!(); unsafe { let mut error = std::ptr::null_mut(); let ret = ffi::shumate_vector_renderer_new( id.to_glib_none().0, style_json.to_glib_none().0, &mut error, ); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`VectorRenderer`] objects. /// /// This method returns an instance of [`VectorRendererBuilder`](crate::builders::VectorRendererBuilder) which can be used to create [`VectorRenderer`] objects. pub fn builder() -> VectorRendererBuilder { VectorRendererBuilder::new() } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "shumate_vector_renderer_get_sprite_sheet")] #[doc(alias = "get_sprite_sheet")] #[doc(alias = "sprite-sheet")] pub fn sprite_sheet(&self) -> Option { unsafe { from_glib_none(ffi::shumate_vector_renderer_get_sprite_sheet( self.to_glib_none().0, )) } } #[cfg(feature = "v1_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))] #[doc(alias = "shumate_vector_renderer_set_data_source")] pub fn set_data_source(&self, name: &str, data_source: &impl IsA) { unsafe { ffi::shumate_vector_renderer_set_data_source( self.to_glib_none().0, name.to_glib_none().0, data_source.as_ref().to_glib_none().0, ); } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "shumate_vector_renderer_set_sprite_sheet")] #[doc(alias = "sprite-sheet")] pub fn set_sprite_sheet(&self, sprites: &VectorSpriteSheet) { unsafe { ffi::shumate_vector_renderer_set_sprite_sheet( self.to_glib_none().0, sprites.to_glib_none().0, ); } } #[cfg_attr(feature = "v1_1", deprecated = "Since 1.1")] #[allow(deprecated)] #[doc(alias = "shumate_vector_renderer_set_sprite_sheet_data")] pub fn set_sprite_sheet_data( &self, sprites_pixbuf: &gdk_pixbuf::Pixbuf, sprites_json: &str, ) -> Result<(), glib::Error> { unsafe { let mut error = std::ptr::null_mut(); let is_ok = ffi::shumate_vector_renderer_set_sprite_sheet_data( self.to_glib_none().0, sprites_pixbuf.to_glib_none().0, sprites_json.to_glib_none().0, &mut error, ); debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "style-json")] pub fn style_json(&self) -> Option { ObjectExt::property(self, "style-json") } #[doc(alias = "shumate_vector_renderer_is_supported")] pub fn is_supported() -> bool { assert_initialized_main_thread!(); unsafe { from_glib(ffi::shumate_vector_renderer_is_supported()) } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] #[doc(alias = "sprite-sheet")] pub fn connect_sprite_sheet_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_sprite_sheet_trampoline( this: *mut ffi::ShumateVectorRenderer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::sprite-sheet".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_sprite_sheet_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for VectorRenderer { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`VectorRenderer`] 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 VectorRendererBuilder { builder: glib::object::ObjectBuilder<'static, VectorRenderer>, } impl VectorRendererBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub fn sprite_sheet(self, sprite_sheet: &VectorSpriteSheet) -> Self { Self { builder: self.builder.property("sprite-sheet", sprite_sheet.clone()), } } pub fn style_json(self, style_json: impl Into) -> Self { Self { builder: self.builder.property("style-json", style_json.into()), } } pub fn id(self, id: impl Into) -> Self { Self { builder: self.builder.property("id", id.into()), } } pub fn license(self, license: impl Into) -> Self { Self { builder: self.builder.property("license", license.into()), } } pub fn license_uri(self, license_uri: impl Into) -> Self { Self { builder: self.builder.property("license-uri", license_uri.into()), } } pub fn max_zoom_level(self, max_zoom_level: u32) -> Self { Self { builder: self.builder.property("max-zoom-level", max_zoom_level), } } pub fn min_zoom_level(self, min_zoom_level: u32) -> Self { Self { builder: self.builder.property("min-zoom-level", min_zoom_level), } } pub fn name(self, name: impl Into) -> Self { Self { builder: self.builder.property("name", name.into()), } } pub fn projection(self, projection: MapProjection) -> Self { Self { builder: self.builder.property("projection", projection), } } pub fn tile_size(self, tile_size: u32) -> Self { Self { builder: self.builder.property("tile-size", tile_size), } } // rustdoc-stripper-ignore-next /// Build the [`VectorRenderer`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> VectorRenderer { assert_initialized_main_thread!(); self.builder.build() } } libshumate-0.7.0/src/auto/vector_sprite.rs000064400000000000000000000134061046102023000167660ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::ffi; use glib::{prelude::*, translate::*}; #[cfg(feature = "gtk_v4_6")] #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_6")))] glib::wrapper! { #[doc(alias = "ShumateVectorSprite")] pub struct VectorSprite(Object) @implements gdk::Paintable, gtk::SymbolicPaintable; match fn { type_ => || ffi::shumate_vector_sprite_get_type(), } } #[cfg(not(any(feature = "gtk_v4_6")))] glib::wrapper! { #[doc(alias = "ShumateVectorSprite")] pub struct VectorSprite(Object) @implements gdk::Paintable; match fn { type_ => || ffi::shumate_vector_sprite_get_type(), } } impl VectorSprite { #[doc(alias = "shumate_vector_sprite_new")] pub fn new(source_paintable: &impl IsA) -> VectorSprite { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::shumate_vector_sprite_new( source_paintable.as_ref().to_glib_none().0, )) } } #[doc(alias = "shumate_vector_sprite_new_full")] pub fn new_full( source_paintable: &impl IsA, width: i32, height: i32, scale_factor: f64, source_rect: Option<&gdk::Rectangle>, ) -> VectorSprite { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::shumate_vector_sprite_new_full( source_paintable.as_ref().to_glib_none().0, width, height, scale_factor, mut_override(source_rect.to_glib_none().0), )) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`VectorSprite`] objects. /// /// This method returns an instance of [`VectorSpriteBuilder`](crate::builders::VectorSpriteBuilder) which can be used to create [`VectorSprite`] objects. pub fn builder() -> VectorSpriteBuilder { VectorSpriteBuilder::new() } #[doc(alias = "shumate_vector_sprite_get_height")] #[doc(alias = "get_height")] pub fn height(&self) -> i32 { unsafe { ffi::shumate_vector_sprite_get_height(self.to_glib_none().0) } } #[doc(alias = "shumate_vector_sprite_get_scale_factor")] #[doc(alias = "get_scale_factor")] #[doc(alias = "scale-factor")] pub fn scale_factor(&self) -> f64 { unsafe { ffi::shumate_vector_sprite_get_scale_factor(self.to_glib_none().0) } } #[doc(alias = "shumate_vector_sprite_get_source_paintable")] #[doc(alias = "get_source_paintable")] #[doc(alias = "source-paintable")] pub fn source_paintable(&self) -> Option { unsafe { from_glib_none(ffi::shumate_vector_sprite_get_source_paintable( self.to_glib_none().0, )) } } #[doc(alias = "shumate_vector_sprite_get_source_rect")] #[doc(alias = "get_source_rect")] #[doc(alias = "source-rect")] pub fn source_rect(&self) -> Option { unsafe { from_glib_none(ffi::shumate_vector_sprite_get_source_rect( self.to_glib_none().0, )) } } #[doc(alias = "shumate_vector_sprite_get_width")] #[doc(alias = "get_width")] pub fn width(&self) -> i32 { unsafe { ffi::shumate_vector_sprite_get_width(self.to_glib_none().0) } } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] impl Default for VectorSprite { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`VectorSprite`] 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 VectorSpriteBuilder { builder: glib::object::ObjectBuilder<'static, VectorSprite>, } impl VectorSpriteBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub fn height(self, height: i32) -> Self { Self { builder: self.builder.property("height", height), } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub fn scale_factor(self, scale_factor: f64) -> Self { Self { builder: self.builder.property("scale-factor", scale_factor), } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub fn source_paintable(self, source_paintable: &impl IsA) -> Self { Self { builder: self .builder .property("source-paintable", source_paintable.clone().upcast()), } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub fn source_rect(self, source_rect: &gdk::Rectangle) -> Self { Self { builder: self.builder.property("source-rect", source_rect), } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub fn width(self, width: i32) -> Self { Self { builder: self.builder.property("width", width), } } // rustdoc-stripper-ignore-next /// Build the [`VectorSprite`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> VectorSprite { assert_initialized_main_thread!(); self.builder.build() } } libshumate-0.7.0/src/auto/vector_sprite_sheet.rs000064400000000000000000000107641046102023000201620ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::{ffi, VectorSprite}; use glib::{prelude::*, translate::*}; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "ShumateVectorSpriteSheet")] pub struct VectorSpriteSheet(Object); match fn { type_ => || ffi::shumate_vector_sprite_sheet_get_type(), } } impl VectorSpriteSheet { #[doc(alias = "shumate_vector_sprite_sheet_new")] pub fn new() -> VectorSpriteSheet { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::shumate_vector_sprite_sheet_new()) } } #[doc(alias = "shumate_vector_sprite_sheet_add_page")] pub fn add_page( &self, texture: &impl IsA, json: &str, default_scale: f64, ) -> Result<(), glib::Error> { unsafe { let mut error = std::ptr::null_mut(); let is_ok = ffi::shumate_vector_sprite_sheet_add_page( self.to_glib_none().0, texture.as_ref().to_glib_none().0, json.to_glib_none().0, default_scale, &mut error, ); debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "shumate_vector_sprite_sheet_add_sprite")] pub fn add_sprite(&self, name: &str, sprite: &VectorSprite) { unsafe { ffi::shumate_vector_sprite_sheet_add_sprite( self.to_glib_none().0, name.to_glib_none().0, sprite.to_glib_none().0, ); } } #[doc(alias = "shumate_vector_sprite_sheet_get_sprite")] #[doc(alias = "get_sprite")] pub fn sprite(&self, name: &str, scale: f64) -> Option { unsafe { from_glib_full(ffi::shumate_vector_sprite_sheet_get_sprite( self.to_glib_none().0, name.to_glib_none().0, scale, )) } } #[doc(alias = "shumate_vector_sprite_sheet_set_fallback")] pub fn set_fallback( &self, fallback: Option< Box_ Option + 'static>, >, ) { let fallback_data: Box_< Option Option + 'static>>, > = Box_::new(fallback); unsafe extern "C" fn fallback_func( sprite_sheet: *mut ffi::ShumateVectorSpriteSheet, name: *const std::ffi::c_char, scale: std::ffi::c_double, user_data: glib::ffi::gpointer, ) -> *mut ffi::ShumateVectorSprite { let sprite_sheet = from_glib_borrow(sprite_sheet); let name: Borrowed = from_glib_borrow(name); let callback = &*(user_data as *mut Option< Box_ Option + 'static>, >); if let Some(ref callback) = *callback { callback(&sprite_sheet, name.as_str(), scale) } else { panic!("cannot get closure...") } .to_glib_full() } let fallback = if fallback_data.is_some() { Some(fallback_func as _) } else { None }; unsafe extern "C" fn notify_func(data: glib::ffi::gpointer) { let _callback = Box_::from_raw( data as *mut Option< Box_ Option + 'static>, >, ); } let destroy_call3 = Some(notify_func as _); let super_callback0: Box_< Option Option + 'static>>, > = fallback_data; unsafe { ffi::shumate_vector_sprite_sheet_set_fallback( self.to_glib_none().0, fallback, Box_::into_raw(super_callback0) as *mut _, destroy_call3, ); } } } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] impl Default for VectorSpriteSheet { fn default() -> Self { Self::new() } } libshumate-0.7.0/src/auto/versions.txt000064400000000000000000000002161046102023000161340ustar 00000000000000Generated by gir (https://github.com/gtk-rs/gir @ b3d444a058cf) from from gir-files (https://github.com/gtk-rs/gir-files.git @ 5c1e490fe50a) libshumate-0.7.0/src/auto/viewport.rs000064400000000000000000000271651046102023000157640ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::{ffi, Location, MapSource}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "ShumateViewport")] pub struct Viewport(Object) @implements Location; match fn { type_ => || ffi::shumate_viewport_get_type(), } } impl Viewport { #[doc(alias = "shumate_viewport_new")] pub fn new() -> Viewport { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::shumate_viewport_new()) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Viewport`] objects. /// /// This method returns an instance of [`ViewportBuilder`](crate::builders::ViewportBuilder) which can be used to create [`Viewport`] objects. pub fn builder() -> ViewportBuilder { ViewportBuilder::new() } #[doc(alias = "shumate_viewport_get_max_zoom_level")] #[doc(alias = "get_max_zoom_level")] #[doc(alias = "max-zoom-level")] pub fn max_zoom_level(&self) -> u32 { unsafe { ffi::shumate_viewport_get_max_zoom_level(self.to_glib_none().0) } } #[doc(alias = "shumate_viewport_get_min_zoom_level")] #[doc(alias = "get_min_zoom_level")] #[doc(alias = "min-zoom-level")] pub fn min_zoom_level(&self) -> u32 { unsafe { ffi::shumate_viewport_get_min_zoom_level(self.to_glib_none().0) } } #[doc(alias = "shumate_viewport_get_reference_map_source")] #[doc(alias = "get_reference_map_source")] #[doc(alias = "reference-map-source")] pub fn reference_map_source(&self) -> Option { unsafe { from_glib_none(ffi::shumate_viewport_get_reference_map_source( self.to_glib_none().0, )) } } #[doc(alias = "shumate_viewport_get_rotation")] #[doc(alias = "get_rotation")] pub fn rotation(&self) -> f64 { unsafe { ffi::shumate_viewport_get_rotation(self.to_glib_none().0) } } #[doc(alias = "shumate_viewport_get_zoom_level")] #[doc(alias = "get_zoom_level")] #[doc(alias = "zoom-level")] pub fn zoom_level(&self) -> f64 { unsafe { ffi::shumate_viewport_get_zoom_level(self.to_glib_none().0) } } #[doc(alias = "shumate_viewport_location_to_widget_coords")] pub fn location_to_widget_coords( &self, widget: &impl IsA, latitude: f64, longitude: f64, ) -> (f64, f64) { unsafe { let mut x = std::mem::MaybeUninit::uninit(); let mut y = std::mem::MaybeUninit::uninit(); ffi::shumate_viewport_location_to_widget_coords( self.to_glib_none().0, widget.as_ref().to_glib_none().0, latitude, longitude, x.as_mut_ptr(), y.as_mut_ptr(), ); (x.assume_init(), y.assume_init()) } } #[doc(alias = "shumate_viewport_set_max_zoom_level")] #[doc(alias = "max-zoom-level")] pub fn set_max_zoom_level(&self, max_zoom_level: u32) { unsafe { ffi::shumate_viewport_set_max_zoom_level(self.to_glib_none().0, max_zoom_level); } } #[doc(alias = "shumate_viewport_set_min_zoom_level")] #[doc(alias = "min-zoom-level")] pub fn set_min_zoom_level(&self, min_zoom_level: u32) { unsafe { ffi::shumate_viewport_set_min_zoom_level(self.to_glib_none().0, min_zoom_level); } } #[doc(alias = "shumate_viewport_set_reference_map_source")] #[doc(alias = "reference-map-source")] pub fn set_reference_map_source(&self, map_source: Option<&impl IsA>) { unsafe { ffi::shumate_viewport_set_reference_map_source( self.to_glib_none().0, map_source.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "shumate_viewport_set_rotation")] #[doc(alias = "rotation")] pub fn set_rotation(&self, rotation: f64) { unsafe { ffi::shumate_viewport_set_rotation(self.to_glib_none().0, rotation); } } #[doc(alias = "shumate_viewport_set_zoom_level")] #[doc(alias = "zoom-level")] pub fn set_zoom_level(&self, zoom_level: f64) { unsafe { ffi::shumate_viewport_set_zoom_level(self.to_glib_none().0, zoom_level); } } #[doc(alias = "shumate_viewport_widget_coords_to_location")] pub fn widget_coords_to_location( &self, widget: &impl IsA, x: f64, y: f64, ) -> (f64, f64) { unsafe { let mut latitude = std::mem::MaybeUninit::uninit(); let mut longitude = std::mem::MaybeUninit::uninit(); ffi::shumate_viewport_widget_coords_to_location( self.to_glib_none().0, widget.as_ref().to_glib_none().0, x, y, latitude.as_mut_ptr(), longitude.as_mut_ptr(), ); (latitude.assume_init(), longitude.assume_init()) } } #[doc(alias = "max-zoom-level")] pub fn connect_max_zoom_level_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_max_zoom_level_trampoline( this: *mut ffi::ShumateViewport, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::max-zoom-level".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_max_zoom_level_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "min-zoom-level")] pub fn connect_min_zoom_level_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_min_zoom_level_trampoline( this: *mut ffi::ShumateViewport, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::min-zoom-level".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_min_zoom_level_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "reference-map-source")] pub fn connect_reference_map_source_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_reference_map_source_trampoline( this: *mut ffi::ShumateViewport, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::reference-map-source".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_reference_map_source_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "rotation")] pub fn connect_rotation_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_rotation_trampoline( this: *mut ffi::ShumateViewport, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::rotation".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_rotation_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "zoom-level")] pub fn connect_zoom_level_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_zoom_level_trampoline( this: *mut ffi::ShumateViewport, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::zoom-level".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_zoom_level_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for Viewport { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Viewport`] 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 ViewportBuilder { builder: glib::object::ObjectBuilder<'static, Viewport>, } impl ViewportBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn max_zoom_level(self, max_zoom_level: u32) -> Self { Self { builder: self.builder.property("max-zoom-level", max_zoom_level), } } pub fn min_zoom_level(self, min_zoom_level: u32) -> Self { Self { builder: self.builder.property("min-zoom-level", min_zoom_level), } } pub fn reference_map_source(self, reference_map_source: &impl IsA) -> Self { Self { builder: self.builder.property( "reference-map-source", reference_map_source.clone().upcast(), ), } } pub fn rotation(self, rotation: f64) -> Self { Self { builder: self.builder.property("rotation", rotation), } } pub fn zoom_level(self, zoom_level: f64) -> Self { Self { builder: self.builder.property("zoom-level", zoom_level), } } pub fn latitude(self, latitude: f64) -> Self { Self { builder: self.builder.property("latitude", latitude), } } pub fn longitude(self, longitude: f64) -> Self { Self { builder: self.builder.property("longitude", longitude), } } // rustdoc-stripper-ignore-next /// Build the [`Viewport`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Viewport { assert_initialized_main_thread!(); self.builder.build() } } libshumate-0.7.0/src/lib.rs000064400000000000000000000050471046102023000136760ustar 00000000000000#![allow(clippy::needless_doctest_main)] //! # Rust Shumate bindings //! //! This library contains safe Rust bindings for [Shumate](https://gitlab.gnome.org/GNOME/libshumate), a library that offers //! a GTK4 widget to display maps. //! //! See also //! //! - [GTK 4 Rust bindings documentation](mod@gtk) //! - [libshumate documentation](https://gnome.pages.gitlab.gnome.org/libshumate/) //! - [gtk-rs project overview](https://gtk-rs.org/) //! //! # Example //! //! The [`libshumate`](mod@crate) crate is usually renamed to `shumate`. You can //! do this globally in your `Cargo.toml` file: //! //! ```toml //! [dependencies.shumate] //! package = "libshumate" //! version = "0.x.y" //! ``` //! //! ```no_run //! # use libshumate as shumate; //! use shumate::prelude::*; //! //! use shumate::{Map}; //! use gtk::{Application, Box, ListBox, Orientation, ApplicationWindow}; //! //! fn main() { //! let application = Application::builder() //! .application_id("com.example.FirstShumateApp") //! .build(); //! //! application.connect_activate(|app| { //! let content = Map::new(); //! //! let window = ApplicationWindow::builder() //! .application(app) //! .default_width(350) //! // add content to window //! .child(&content) //! .build(); //! window.show(); //! }); //! //! application.run(); //! } //! ``` // Re-export the -sys bindings pub use ffi; #[doc(hidden)] pub use gtk; #[doc(alias = "SHUMATE_MAX_LATITUDE")] pub const MAX_LATITUDE: f64 = ffi::SHUMATE_MAX_LATITUDE; #[doc(alias = "SHUMATE_MAX_LONGITUDE")] pub const MAX_LONGITUDE: f64 = ffi::SHUMATE_MAX_LONGITUDE; #[doc(alias = "SHUMATE_MIN_LATITUDE")] pub const MIN_LATITUDE: f64 = ffi::SHUMATE_MIN_LATITUDE; #[doc(alias = "SHUMATE_MIN_LONGITUDE")] pub const MIN_LONGITUDE: f64 = ffi::SHUMATE_MIN_LONGITUDE; /// 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!("libshumate may only be used from the main thread."); } else { panic!("Gtk has to be initialized before using libshumate."); } } }; } macro_rules! skip_assert_initialized { () => {}; } #[allow(unused_imports)] #[allow(clippy::type_complexity)] #[allow(clippy::too_many_arguments)] mod auto; pub use auto::*; pub mod prelude; pub mod subclass; pub mod functions { pub use super::auto::functions::*; } libshumate-0.7.0/src/prelude.rs000064400000000000000000000001111046102023000145530ustar 00000000000000#[doc(hidden)] pub use gtk::prelude::*; pub use crate::auto::traits::*; libshumate-0.7.0/src/subclass/data_source.rs000064400000000000000000000164571046102023000172470ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. // rustdoc-stripper-ignore-next //! Traits intended for subclassing [`DataSource`](crate::DataSource). #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] use crate::DataSourceRequest; use crate::{prelude::*, DataSource}; use gio::Cancellable; use glib::subclass::prelude::*; use glib::translate::*; use std::{future::Future, pin::Pin}; pub trait DataSourceImpl: ObjectImpl { fn tile_data_future( &self, x: i32, y: i32, zoom_level: i32, ) -> Pin> + 'static>>; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] fn start_request( &self, x: i32, y: i32, zoom_level: i32, cancellable: Option, ) -> Option { self.parent_start_request(x, y, zoom_level, cancellable) } } mod sealed { pub trait Sealed {} impl Sealed for T {} } pub trait DataSourceImplExt: sealed::Sealed + ObjectSubclass { #[allow(clippy::type_complexity)] fn parent_tile_data_async< Q: IsA, C: FnOnce(Result) + Send + 'static, >( &self, x: i32, y: i32, zoom_level: i32, cancellable: Option<&Q>, callback: C, ) { unsafe { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::ShumateDataSourceClass; let f = (*parent_class) .get_tile_data_async .expect("no parent \"get_tile_data_async\" implementation"); let finish = (*parent_class) .get_tile_data_finish .expect("no parent \"get_tile_data_finish\" implementation"); let user_data: Box<(C, _)> = Box::new((callback, finish)); unsafe extern "C" fn parent_get_tile_data_async_trampoline< C: FnOnce(Result) + Send + 'static, >( source_object_ptr: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer, ) { let mut error = std::ptr::null_mut(); let cb: Box<( C, fn( *mut ffi::ShumateDataSource, *mut gio::ffi::GAsyncResult, *mut *mut glib::ffi::GError, ) -> *mut glib::ffi::GBytes, )> = Box::from_raw(user_data as *mut _); let bytes = cb.1(source_object_ptr as _, res, &mut error); let result = if error.is_null() { Ok(from_glib_full(bytes)) } else { Err(from_glib_full(error)) }; cb.0(result); } let cancellable = cancellable.map(|p| p.as_ref()); let callback = parent_get_tile_data_async_trampoline::; f( self.obj().unsafe_cast_ref::().to_glib_none().0, x, y, zoom_level, cancellable.to_glib_none().0, Some(callback), Box::into_raw(user_data) as *mut _, ); } } fn parent_tile_data_future( &self, x: i32, y: i32, zoom_level: i32, ) -> Pin> + 'static>> { Box::pin(gio::GioFuture::new( &self.ref_counted(), move |imp, cancellable, send| { imp.parent_tile_data_async(x, y, zoom_level, Some(cancellable), move |res| { send.resolve(res); }); }, )) } #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] fn parent_start_request( &self, x: i32, y: i32, zoom_level: i32, cancellable: Option, ) -> Option { unsafe { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::ShumateDataSourceClass; if let Some(f) = (*parent_class).start_request { from_glib_full(f( self.obj().unsafe_cast_ref::().to_glib_none().0, x, y, zoom_level, cancellable.to_glib_none().0, )) } else { None } } } } impl DataSourceImplExt for T {} unsafe impl IsSubclassable for DataSource { fn class_init(class: &mut glib::Class) { Self::parent_class_init::(class); let klass = class.as_mut(); klass.get_tile_data_async = Some(data_source_get_tile_data_async::); klass.get_tile_data_finish = Some(data_source_get_tile_data_finish); #[cfg(feature = "v1_1")] { klass.start_request = Some(data_source_start_request::); } } } unsafe extern "C" fn data_source_get_tile_data_async( ptr: *mut ffi::ShumateDataSource, x: i32, y: i32, zoom_level: i32, cancellable_ptr: *mut gio::ffi::GCancellable, callback: gio::ffi::GAsyncReadyCallback, user_data: glib::ffi::gpointer, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); let cancellable: Option = from_glib_none(cancellable_ptr); let closure = move |result: gio::LocalTask, source_object: Option<&DataSource>| { let result: *mut gio::ffi::GAsyncResult = result .unsafe_cast_ref::() .to_glib_none() .0; let source_object = source_object .map(|o| o.unsafe_cast_ref::()) .to_glib_none() .0; callback.unwrap()(source_object, result, user_data) }; let t = gio::LocalTask::new(None, cancellable.as_ref(), closure); glib::MainContext::default().spawn_local(async move { let res = imp.tile_data_future(x, y, zoom_level).await; t.return_result(res); }); } unsafe extern "C" fn data_source_get_tile_data_finish( _ptr: *mut ffi::ShumateDataSource, res_ptr: *mut gio::ffi::GAsyncResult, error_ptr: *mut *mut glib::ffi::GError, ) -> *mut glib::ffi::GBytes { let res: gio::AsyncResult = from_glib_none(res_ptr); let task = res.downcast::>().unwrap(); match task.propagate() { Ok(bytes) => bytes.to_glib_full(), Err(e) => { *error_ptr = e.into_glib_ptr(); std::ptr::null_mut() } } } #[cfg(feature = "v1_1")] unsafe extern "C" fn data_source_start_request( ptr: *mut ffi::ShumateDataSource, x: i32, y: i32, zoom_level: i32, cancellable_ptr: *mut gio::ffi::GCancellable, ) -> *mut ffi::ShumateDataSourceRequest { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); imp.start_request(x, y, zoom_level, from_glib_none(cancellable_ptr)) .to_glib_full() } libshumate-0.7.0/src/subclass/location.rs000064400000000000000000000065151046102023000165600ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. // rustdoc-stripper-ignore-next //! Traits intended for implementing the [`Location`](crate::Location) interface. use crate::{prelude::*, Location}; use glib::subclass::prelude::*; use glib::translate::*; pub trait LocationImpl: ObjectImpl { fn latitude(&self) -> f64 { self.parent_latitude() } fn longitude(&self) -> f64 { self.parent_longitude() } fn set_location(&self, latitude: f64, longitude: f64) { self.parent_set_location(latitude, longitude) } } mod sealed { pub trait Sealed {} impl Sealed for T {} } pub trait LocationImplExt: sealed::Sealed + ObjectSubclass { fn parent_latitude(&self) -> f64 { unsafe { let type_data = Self::type_data(); let parent_iface = type_data.as_ref().parent_interface::() as *const ffi::ShumateLocationInterface; let func = (*parent_iface) .get_latitude .expect("no parent \"get_latitude\" implementation"); func(self.obj().unsafe_cast_ref::().to_glib_none().0) } } fn parent_longitude(&self) -> f64 { unsafe { let type_data = Self::type_data(); let parent_iface = type_data.as_ref().parent_interface::() as *const ffi::ShumateLocationInterface; let func = (*parent_iface) .get_longitude .expect("no parent \"get_longitude\" implementation"); func(self.obj().unsafe_cast_ref::().to_glib_none().0) } } fn parent_set_location(&self, latitude: f64, longitude: f64) { unsafe { let type_data = Self::type_data(); let parent_iface = type_data.as_ref().parent_interface::() as *const ffi::ShumateLocationInterface; let func = (*parent_iface) .set_location .expect("no parent \"set_location\" implementation"); func( self.obj().unsafe_cast_ref::().to_glib_none().0, latitude, longitude, ) } } } impl LocationImplExt for T {} unsafe impl IsImplementable for Location { fn interface_init(iface: &mut glib::Interface) { let iface = iface.as_mut(); iface.get_latitude = Some(location_get_latitude::); iface.get_longitude = Some(location_get_longitude::); iface.set_location = Some(location_set_location::); } } unsafe extern "C" fn location_get_latitude( location: *mut ffi::ShumateLocation, ) -> f64 { let instance = &*(location as *mut T::Instance); let imp = instance.imp(); imp.latitude() } unsafe extern "C" fn location_get_longitude( location: *mut ffi::ShumateLocation, ) -> f64 { let instance = &*(location as *mut T::Instance); let imp = instance.imp(); imp.longitude() } unsafe extern "C" fn location_set_location( location: *mut ffi::ShumateLocation, latitude: f64, longitude: f64, ) { let instance = &*(location as *mut T::Instance); let imp = instance.imp(); imp.set_location(latitude, longitude) } libshumate-0.7.0/src/subclass/map_source.rs000064400000000000000000000113531046102023000171010ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. // rustdoc-stripper-ignore-next //! Traits intended for subclassing [`MapSource`](crate::MapSource). use crate::{prelude::*, MapSource, Tile}; use gio::{AsyncResult, Cancellable}; use glib::subclass::prelude::*; use glib::translate::*; use std::{future::Future, pin::Pin}; pub trait MapSourceImpl: ObjectImpl { fn fill_tile_future( &self, tile: &Tile, ) -> Pin> + 'static>>; } mod sealed { pub trait Sealed {} impl Sealed for T {} } pub trait MapSourceImplExt: sealed::Sealed + ObjectSubclass { #[allow(clippy::type_complexity)] fn parent_fill_tile_async, C: FnOnce(&AsyncResult) + Send + 'static>( &self, tile: &Tile, cancellable: Option<&Q>, callback: C, ) { unsafe { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::ShumateMapSourceClass; let f = (*parent_class) .fill_tile_async .expect("no parent \"fill_tile_async\" implementation"); let user_data: Box = Box::new(callback); unsafe extern "C" fn parent_fill_tile_async_trampoline< C: FnOnce(&AsyncResult) + Send + 'static, >( _source_object_ptr: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer, ) { let res = AsyncResult::from_glib_borrow(res); let cb: Box = Box::from_raw(user_data as *mut _); cb(&res) } let cancellable = cancellable.map(|p| p.as_ref()); let callback = parent_fill_tile_async_trampoline::; f( self.obj().unsafe_cast_ref::().to_glib_none().0, tile.to_glib_none().0, cancellable.to_glib_none().0, Some(callback), Box::into_raw(user_data) as *mut _, ); } } fn parent_fill_tile_future( &self, tile: &Tile, ) -> Pin> + 'static>> { let tile = tile.clone(); Box::pin(gio::GioFuture::new( &self.ref_counted(), move |imp, cancellable, send| { imp.parent_fill_tile_async(&tile, Some(cancellable), move |res| { send.resolve(res.legacy_propagate_error()); }); }, )) } } impl MapSourceImplExt for T {} unsafe impl IsSubclassable for MapSource { fn class_init(class: &mut glib::Class) { Self::parent_class_init::(class); let klass = class.as_mut(); klass.fill_tile_async = Some(map_source_fill_tile_async::); klass.fill_tile_finish = Some(map_source_fill_tile_finish); } } unsafe extern "C" fn map_source_fill_tile_async( ptr: *mut ffi::ShumateMapSource, tile: *mut ffi::ShumateTile, cancellable_ptr: *mut gio::ffi::GCancellable, callback: gio::ffi::GAsyncReadyCallback, user_data: glib::ffi::gpointer, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); let cancellable: Option = from_glib_none(cancellable_ptr); let closure = move |result: gio::LocalTask, source_object: Option<&MapSource>| { let result: *mut gio::ffi::GAsyncResult = result .unsafe_cast_ref::() .to_glib_none() .0; let source_object = source_object .map(|o| o.unsafe_cast_ref::()) .to_glib_none() .0; callback.unwrap()(source_object, result, user_data) }; let t = gio::LocalTask::new(None, cancellable.as_ref(), closure); glib::MainContext::default().spawn_local(async move { let res = imp.fill_tile_future(&from_glib_none(tile)).await; match res { Ok(_) => t.return_result(Ok(true)), Err(e) => t.return_result(Err(e)), } }); } unsafe extern "C" fn map_source_fill_tile_finish( _ptr: *mut ffi::ShumateMapSource, res_ptr: *mut gio::ffi::GAsyncResult, error_ptr: *mut *mut glib::ffi::GError, ) -> glib::ffi::gboolean { let res: gio::AsyncResult = from_glib_none(res_ptr); let task = res.downcast::>().unwrap(); match task.propagate() { Ok(v) => { assert!(v); true.into_glib() } Err(e) => { *error_ptr = e.into_glib_ptr(); false.into_glib() } } } libshumate-0.7.0/src/subclass/marker.rs000064400000000000000000000005551046102023000162270ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. // rustdoc-stripper-ignore-next //! Traits intended for subclassing [`Marker`](crate::Marker). use crate::Marker; use glib::subclass::prelude::*; use gtk::subclass::prelude::WidgetImpl; pub trait MarkerImpl: WidgetImpl {} unsafe impl IsSubclassable for Marker {} libshumate-0.7.0/src/subclass/mod.rs000064400000000000000000000011611046102023000155170ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. // rustdoc-stripper-ignore-next //! Traits intended for creating custom types. pub mod data_source; pub mod location; pub mod map_source; pub mod marker; // rustdoc-stripper-ignore-next /// Traits intended for blanket imports. pub mod prelude { #[doc(hidden)] pub use gtk::subclass::prelude::*; pub use super::data_source::{DataSourceImpl, DataSourceImplExt}; pub use super::location::{LocationImpl, LocationImplExt}; pub use super::map_source::{MapSourceImpl, MapSourceImplExt}; pub use super::marker::MarkerImpl; }