From b704bcfc2b9b0fee5cf6424bd3f242f30fe86ca7 Mon Sep 17 00:00:00 2001 From: Ultraxime Date: Tue, 27 Aug 2024 16:44:21 +0200 Subject: [PATCH 1/2] Mouving example from workspace member to example --- Cargo.lock | 310 +----------------- Cargo.toml | 99 ++++-- examples/WidgetIDReturn/Cargo.toml | 15 - examples/{badge/src/main.rs => badge.rs} | 4 + examples/badge/Cargo.toml | 15 - examples/{card/src/main.rs => card.rs} | 4 + examples/card/Cargo.toml | 14 - .../src/main.rs => color_picker.rs} | 4 + examples/color_picker/Cargo.toml | 14 - .../src/main.rs => context_menu.rs} | 4 + examples/context_menu/Cargo.toml | 13 - .../src/main.rs => date_picker.rs} | 4 + examples/date_picker/Cargo.toml | 12 - .../{drop_down/src/main.rs => drop_down.rs} | 4 + examples/drop_down/Cargo.toml | 13 - examples/{grid/src/main.rs => grid.rs} | 4 + examples/grid/Cargo.toml | 9 - examples/{menu/src/main.rs => menu.rs} | 2 + examples/menu/Cargo.toml | 13 - .../src/main.rs => number_input.rs} | 4 + examples/number_input/Cargo.toml | 15 - .../src/main.rs => selection_list.rs} | 4 + examples/selection_list/Cargo.toml | 16 - examples/{sidebar/src => side_bar}/counter.rs | 0 examples/{sidebar/src => side_bar}/ferris.rs | 15 +- .../{sidebar => side_bar}/fonts/LICENSE.txt | 0 .../{sidebar => side_bar}/fonts/config.json | 0 .../{sidebar => side_bar}/fonts/icons.ttf | Bin .../{sidebar => side_bar}/images/ferris.png | Bin examples/{sidebar/src => side_bar}/login.rs | 0 examples/{sidebar/src => side_bar}/main.rs | 2 +- .../{sidebar/src => side_bar}/settings.rs | 0 examples/sidebar/Cargo.toml | 12 - .../{sliderbar/src/main.rs => slide_bar.rs} | 4 + examples/sliderbar/Cargo.toml | 16 - examples/{spinner/src/main.rs => spinner.rs} | 4 + examples/spinner/Cargo.toml | 15 - examples/{tab_bar/src/main.rs => tab_bar.rs} | 4 + examples/tab_bar/Cargo.toml | 11 - examples/tabs/Cargo.toml | 12 - examples/tabs/{src => }/counter.rs | 0 examples/tabs/{src => }/ferris.rs | 15 +- examples/tabs/{src => }/login.rs | 0 examples/tabs/{src => }/main.rs | 6 +- examples/tabs/{src => }/settings.rs | 0 .../src/main.rs => time_picker.rs} | 4 + examples/time_picker/Cargo.toml | 13 - .../src/main.rs => typed_input.rs} | 4 + examples/typed_input/Cargo.toml | 15 - .../src => widget_id_return}/main.rs | 4 + .../src => widget_id_return}/numberinput.rs | 0 examples/{wrap/src/main.rs => wrap.rs} | 4 + examples/wrap/Cargo.toml | 16 - src/lib.rs | 22 ++ 54 files changed, 189 insertions(+), 605 deletions(-) delete mode 100644 examples/WidgetIDReturn/Cargo.toml rename examples/{badge/src/main.rs => badge.rs} (96%) delete mode 100644 examples/badge/Cargo.toml rename examples/{card/src/main.rs => card.rs} (95%) delete mode 100644 examples/card/Cargo.toml rename examples/{color_picker/src/main.rs => color_picker.rs} (94%) delete mode 100644 examples/color_picker/Cargo.toml rename examples/{context_menu/src/main.rs => context_menu.rs} (94%) delete mode 100644 examples/context_menu/Cargo.toml rename examples/{date_picker/src/main.rs => date_picker.rs} (93%) delete mode 100644 examples/date_picker/Cargo.toml rename examples/{drop_down/src/main.rs => drop_down.rs} (95%) delete mode 100644 examples/drop_down/Cargo.toml rename examples/{grid/src/main.rs => grid.rs} (97%) delete mode 100644 examples/grid/Cargo.toml rename examples/{menu/src/main.rs => menu.rs} (99%) delete mode 100644 examples/menu/Cargo.toml rename examples/{number_input/src/main.rs => number_input.rs} (90%) delete mode 100644 examples/number_input/Cargo.toml rename examples/{selection_list/src/main.rs => selection_list.rs} (95%) delete mode 100644 examples/selection_list/Cargo.toml rename examples/{sidebar/src => side_bar}/counter.rs (100%) rename examples/{sidebar/src => side_bar}/ferris.rs (85%) rename examples/{sidebar => side_bar}/fonts/LICENSE.txt (100%) rename examples/{sidebar => side_bar}/fonts/config.json (100%) rename examples/{sidebar => side_bar}/fonts/icons.ttf (100%) rename examples/{sidebar => side_bar}/images/ferris.png (100%) rename examples/{sidebar/src => side_bar}/login.rs (100%) rename examples/{sidebar/src => side_bar}/main.rs (98%) rename examples/{sidebar/src => side_bar}/settings.rs (100%) delete mode 100644 examples/sidebar/Cargo.toml rename examples/{sliderbar/src/main.rs => slide_bar.rs} (91%) delete mode 100644 examples/sliderbar/Cargo.toml rename examples/{spinner/src/main.rs => spinner.rs} (90%) delete mode 100644 examples/spinner/Cargo.toml rename examples/{tab_bar/src/main.rs => tab_bar.rs} (97%) delete mode 100644 examples/tab_bar/Cargo.toml delete mode 100644 examples/tabs/Cargo.toml rename examples/tabs/{src => }/counter.rs (100%) rename examples/tabs/{src => }/ferris.rs (85%) rename examples/tabs/{src => }/login.rs (100%) rename examples/tabs/{src => }/main.rs (95%) rename examples/tabs/{src => }/settings.rs (100%) rename examples/{time_picker/src/main.rs => time_picker.rs} (93%) delete mode 100644 examples/time_picker/Cargo.toml rename examples/{typed_input/src/main.rs => typed_input.rs} (90%) delete mode 100644 examples/typed_input/Cargo.toml rename examples/{WidgetIDReturn/src => widget_id_return}/main.rs (92%) rename examples/{WidgetIDReturn/src => widget_id_return}/numberinput.rs (100%) rename examples/{wrap/src/main.rs => wrap.rs} (97%) delete mode 100644 examples/wrap/Cargo.toml diff --git a/Cargo.lock b/Cargo.lock index 0528d017..4be6470f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -288,20 +288,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" -[[package]] -name = "badge" -version = "0.1.0" -dependencies = [ - "iced", - "iced_aw", -] - -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - [[package]] name = "bit-set" version = "0.5.3" @@ -468,14 +454,6 @@ dependencies = [ "wayland-client", ] -[[package]] -name = "card" -version = "0.1.0" -dependencies = [ - "iced", - "iced_aw", -] - [[package]] name = "cc" version = "1.1.7" @@ -573,14 +551,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "color_picker" -version = "0.1.0" -dependencies = [ - "iced", - "iced_aw", -] - [[package]] name = "color_quant" version = "1.1.0" @@ -637,14 +607,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "context_menu" -version = "0.1.0" -dependencies = [ - "iced", - "iced_aw", -] - [[package]] name = "core-foundation" version = "0.9.4" @@ -692,7 +654,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59fd57d82eb4bfe7ffa9b1cec0c05e2fd378155b47f255a67983cb4afe0e80c2" dependencies = [ "bitflags 2.6.0", - "fontdb 0.16.2", + "fontdb", "log", "rangemap", "rayon", @@ -806,20 +768,6 @@ dependencies = [ "zbus", ] -[[package]] -name = "data-url" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c297a1c74b71ae29df00c3e22dd9534821d60eb9af5a0192823fa2acea70c2a" - -[[package]] -name = "date_picker" -version = "0.1.0" -dependencies = [ - "iced", - "iced_aw", -] - [[package]] name = "dconf_rs" version = "0.3.0" @@ -942,14 +890,6 @@ dependencies = [ "linux-raw-sys 0.6.4", ] -[[package]] -name = "drop_down" -version = "0.1.0" -dependencies = [ - "iced", - "iced_aw", -] - [[package]] name = "either" version = "1.13.0" @@ -1092,12 +1032,6 @@ dependencies = [ "miniz_oxide", ] -[[package]] -name = "float-cmp" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" - [[package]] name = "float_next_after" version = "1.0.0" @@ -1145,20 +1079,6 @@ dependencies = [ "ttf-parser 0.20.0", ] -[[package]] -name = "fontdb" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e32eac81c1135c1df01d4e6d4233c47ba11f6a6d07f33e0bba09d18797077770" -dependencies = [ - "fontconfig-parser", - "log", - "memmap2", - "slotmap", - "tinyvec", - "ttf-parser 0.21.1", -] - [[package]] name = "foreign-types" version = "0.5.0" @@ -1432,14 +1352,6 @@ dependencies = [ "bitflags 2.6.0", ] -[[package]] -name = "grid" -version = "0.1.0" -dependencies = [ - "iced", - "iced_aw", -] - [[package]] name = "guillotiere" version = "0.6.2" @@ -1562,10 +1474,12 @@ dependencies = [ "cfg-if", "chrono", "iced", + "iced_aw", "itertools", "num-format", "num-traits", "once_cell", + "rand", "time", ] @@ -1655,9 +1569,8 @@ dependencies = [ "bytemuck", "cosmic-text", "iced_graphics", - "kurbo 0.10.4", + "kurbo", "log", - "resvg", "rustc-hash 2.0.0", "softbuffer", "tiny-skia", @@ -1678,7 +1591,6 @@ dependencies = [ "log", "lyon", "once_cell", - "resvg", "rustc-hash 2.0.0", "thiserror", "wgpu", @@ -1735,12 +1647,6 @@ dependencies = [ "tiff", ] -[[package]] -name = "imagesize" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "029d73f573d8e8d63e6d5020011d3255b28c3ba85d6cf870a07184ed23de9284" - [[package]] name = "indexmap" version = "2.3.0" @@ -1860,16 +1766,6 @@ dependencies = [ "smallvec", ] -[[package]] -name = "kurbo" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5aa9f0f96a938266bdb12928a67169e8d22c6a786fda8ed984b85e6ba93c3c" -dependencies = [ - "arrayvec", - "smallvec", -] - [[package]] name = "lebe" version = "0.5.2" @@ -2048,14 +1944,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "menu" -version = "0.1.0" -dependencies = [ - "iced", - "iced_aw", -] - [[package]] name = "metal" version = "0.27.0" @@ -2225,14 +2113,6 @@ dependencies = [ "libc", ] -[[package]] -name = "number_input" -version = "0.1.0" -dependencies = [ - "iced", - "iced_aw", -] - [[package]] name = "objc" version = "0.2.7" @@ -2648,15 +2528,9 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" dependencies = [ - "siphasher 0.3.11", + "siphasher", ] -[[package]] -name = "pico-args" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" - [[package]] name = "pin-project" version = "1.1.5" @@ -2928,31 +2802,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" -[[package]] -name = "resvg" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "944d052815156ac8fa77eaac055220e95ba0b01fa8887108ca710c03805d9051" -dependencies = [ - "gif", - "jpeg-decoder", - "log", - "pico-args", - "rgb", - "svgtypes", - "tiny-skia", - "usvg", -] - -[[package]] -name = "rgb" -version = "0.8.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f86ae463694029097b846d8f99fd5536740602ae00022c0c50c5600720b2f71" -dependencies = [ - "bytemuck", -] - [[package]] name = "roxmltree" version = "0.20.0" @@ -3045,14 +2894,6 @@ dependencies = [ "tiny-skia", ] -[[package]] -name = "selection_list" -version = "0.1.0" -dependencies = [ - "iced", - "iced_aw", -] - [[package]] name = "self_cell" version = "1.0.4" @@ -3101,14 +2942,6 @@ dependencies = [ "digest", ] -[[package]] -name = "sidebar" -version = "0.1.0" -dependencies = [ - "iced", - "iced_aw", -] - [[package]] name = "signal-hook-registry" version = "1.4.2" @@ -3124,27 +2957,12 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" -[[package]] -name = "simplecss" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a11be7c62927d9427e9f40f3444d5499d868648e2edbc4e2116de69e7ec0e89d" -dependencies = [ - "log", -] - [[package]] name = "siphasher" version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" -[[package]] -name = "siphasher" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" - [[package]] name = "skrifa" version = "0.20.0" @@ -3164,14 +2982,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "slidebar" -version = "0.1.0" -dependencies = [ - "iced", - "iced_aw", -] - [[package]] name = "slotmap" version = "1.0.7" @@ -3299,14 +3109,6 @@ dependencies = [ "lock_api", ] -[[package]] -name = "spinner" -version = "0.1.0" -dependencies = [ - "iced", - "iced_aw", -] - [[package]] name = "spirv" version = "0.3.0+sdk-1.3.268.0" @@ -3327,9 +3129,6 @@ name = "strict-num" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" -dependencies = [ - "float-cmp", -] [[package]] name = "svg_fmt" @@ -3337,16 +3136,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20e16a0f46cf5fd675563ef54f26e83e20f2366bcf027bcb3cc3ed2b98aaf2ca" -[[package]] -name = "svgtypes" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "794de53cc48eaabeed0ab6a3404a65f40b3e38c067e4435883a65d2aa4ca000e" -dependencies = [ - "kurbo 0.11.0", - "siphasher 1.0.1", -] - [[package]] name = "swash" version = "0.1.18" @@ -3389,22 +3178,6 @@ dependencies = [ "libc", ] -[[package]] -name = "tab_bar" -version = "0.1.0" -dependencies = [ - "iced", - "iced_aw", -] - -[[package]] -name = "tabs" -version = "0.1.0" -dependencies = [ - "iced", - "iced_aw", -] - [[package]] name = "tempfile" version = "3.10.1" @@ -3478,14 +3251,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" -[[package]] -name = "time_picker" -version = "0.1.0" -dependencies = [ - "iced", - "iced_aw", -] - [[package]] name = "tiny-skia" version = "0.11.4" @@ -3606,14 +3371,6 @@ version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8686b91785aff82828ed725225925b33b4fde44c4bb15876e5f7c832724c420a" -[[package]] -name = "typed_input" -version = "0.1.0" -dependencies = [ - "iced", - "iced_aw", -] - [[package]] name = "typenum" version = "1.17.0" @@ -3679,12 +3436,6 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" -[[package]] -name = "unicode-vo" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94" - [[package]] name = "unicode-width" version = "0.1.13" @@ -3697,33 +3448,6 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" -[[package]] -name = "usvg" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b84ea542ae85c715f07b082438a4231c3760539d902e11d093847a0b22963032" -dependencies = [ - "base64", - "data-url", - "flate2", - "fontdb 0.18.0", - "imagesize", - "kurbo 0.11.0", - "log", - "pico-args", - "roxmltree", - "rustybuzz", - "simplecss", - "siphasher 1.0.1", - "strict-num", - "svgtypes", - "tiny-skia-path", - "unicode-bidi", - "unicode-script", - "unicode-vo", - "xmlwriter", -] - [[package]] name = "version_check" version = "0.9.5" @@ -4100,15 +3824,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" -[[package]] -name = "widget_id" -version = "0.1.0" -dependencies = [ - "iced", - "iced_aw", - "num-traits", -] - [[package]] name = "winapi" version = "0.3.9" @@ -4438,15 +4153,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "wrap" -version = "0.1.0" -dependencies = [ - "iced", - "iced_aw", - "rand", -] - [[package]] name = "x11-dl" version = "2.21.0" @@ -4520,12 +4226,6 @@ version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "791978798f0597cfc70478424c2b4fdc2b7a8024aaff78497ef00f24ef674193" -[[package]] -name = "xmlwriter" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" - [[package]] name = "yazi" version = "0.1.6" diff --git a/Cargo.toml b/Cargo.toml index ad04e3c5..922c3a34 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -78,36 +78,85 @@ features = ["advanced"] [profile.dev.package."*"] opt-level = 2 -[workspace] -members = [ - "examples/badge", - "examples/card", - "examples/number_input", - "examples/typed_input", - "examples/date_picker", - "examples/color_picker", - "examples/grid", - "examples/tab_bar", - "examples/tabs", - "examples/time_picker", - "examples/sliderbar", - "examples/wrap", - "examples/selection_list", - "examples/context_menu", - "examples/spinner", - "examples/WidgetIDReturn", - "examples/drop_down", - "examples/menu", - "examples/sidebar", -] +[dev-dependencies] +num-traits = "0.2.16" # For widget_id_return example +rand = "0.8" # For wrap example -[workspace.dependencies.iced] +[dev-dependencies.iced] git = "https://github.com/iced-rs/iced.git" #rev = "b474a2b7a763dcde6a377cb409001a7b5285ee8d" version = "0.13.0-dev" #default-features = false -features = ["advanced", "wgpu"] +features = ["advanced", "wgpu", "image"] -[workspace.dependencies.iced_aw] +[dev-dependencies.iced_aw] path = "./" default-features = false + +[[example]] +name = "badge" +required-features = ["badge"] + +[[example]] +name = "card" +required-features = ["card"] + +[[example]] +name = "color_picker" +required-features = ["color_picker"] + +[[example]] +name = "date_picker" +required-features = ["date_picker"] + +[[example]] +name = "grid" +required-features = ["grid"] + +[[example]] +name = "menu" +required-features = ["menu"] + +[[example]] +name = "number_input" +required-features = ["number_input"] + +[[example]] +name = "selection_list" +required-features = ["selection_list"] + +[[example]] +name = "side_bar" +required-features = ["sidebar"] + +[[example]] +name = "slide_bar" +required-features = ["slide_bar"] + +[[example]] +name = "spinner" +required-features = ["spinner"] + +[[example]] +name = "tab_bar" +required-features = ["tab_bar"] + +[[example]] +name = "tabs" +required-features = ["tabs"] + +[[example]] +name = "time_picker" +required-features = ["time_picker"] + +[[example]] +name = "typed_input" +required-features = ["typed_input"] + +[[example]] +name = "widget_id_return" +required-features = ["number_input"] + +[[example]] +name = "wrap" +required-features = ["wrap", "number_input"] diff --git a/examples/WidgetIDReturn/Cargo.toml b/examples/WidgetIDReturn/Cargo.toml deleted file mode 100644 index dd9feb5b..00000000 --- a/examples/WidgetIDReturn/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "widget_id" -version = "0.1.0" -authors = ["Andrew Wheeler "] -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -iced_aw = { workspace = true, features = [ - "number_input", - "icons", -] } -iced.workspace=true -num-traits = "0.2.16" diff --git a/examples/badge/src/main.rs b/examples/badge.rs similarity index 96% rename from examples/badge/src/main.rs rename to examples/badge.rs index a7619c52..f1abf2cf 100644 --- a/examples/badge/src/main.rs +++ b/examples/badge.rs @@ -1,3 +1,7 @@ +// This example demonstrates how to use the `badge` widget. +// +// It was written by Kaiden42 + use iced::{ widget::{Column, Container, Row, Text}, Alignment, Element, Length, diff --git a/examples/badge/Cargo.toml b/examples/badge/Cargo.toml deleted file mode 100644 index a5d9acef..00000000 --- a/examples/badge/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "badge" -version = "0.1.0" -authors = ["Kaiden42 "] -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -iced_aw = { workspace = true, features = [ - "badge", - "icons", -] } - -iced.workspace=true diff --git a/examples/card/src/main.rs b/examples/card.rs similarity index 95% rename from examples/card/src/main.rs rename to examples/card.rs index c4666a96..0391afeb 100644 --- a/examples/card/src/main.rs +++ b/examples/card.rs @@ -1,3 +1,7 @@ +// This example demonstrates how to use the `card` widget +// +// It was written by Kaiden42 + use iced::{ widget::{Button, Column, Container, Scrollable, Text}, Element, Length, diff --git a/examples/card/Cargo.toml b/examples/card/Cargo.toml deleted file mode 100644 index 41df7eec..00000000 --- a/examples/card/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "card" -version = "0.1.0" -authors = ["Kaiden42 "] -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -iced_aw = { workspace = true, default-features = false , features = [ - "card" -] } -iced.workspace=true - diff --git a/examples/color_picker/src/main.rs b/examples/color_picker.rs similarity index 94% rename from examples/color_picker/src/main.rs rename to examples/color_picker.rs index 6c923ca6..9b504b22 100644 --- a/examples/color_picker/src/main.rs +++ b/examples/color_picker.rs @@ -1,3 +1,7 @@ +// This example demonstrates how to use the `color_picker` widget +// +// It was written by Kaiden42 + use iced::{ widget::{Button, Container, Row, Text}, Alignment, Color, Element, Length, diff --git a/examples/color_picker/Cargo.toml b/examples/color_picker/Cargo.toml deleted file mode 100644 index aca43735..00000000 --- a/examples/color_picker/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "color_picker" -version = "0.1.0" -authors = ["Kaiden42 "] -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -iced_aw = { workspace = true, features = [ - "color_picker", -] } -iced.workspace=true - diff --git a/examples/context_menu/src/main.rs b/examples/context_menu.rs similarity index 94% rename from examples/context_menu/src/main.rs rename to examples/context_menu.rs index 1bfb7154..2e9bb561 100644 --- a/examples/context_menu/src/main.rs +++ b/examples/context_menu.rs @@ -1,3 +1,7 @@ +// This example demonstrates how to use the `ContextMenu` widget +// +// It was written by wiiznokes + use iced::{ widget::{column, Button, Container, Row, Text}, Alignment, Element, diff --git a/examples/context_menu/Cargo.toml b/examples/context_menu/Cargo.toml deleted file mode 100644 index dbc0a3d9..00000000 --- a/examples/context_menu/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "context_menu" -version = "0.1.0" -authors = ["wiiznokes "] -edition = "2021" - - -[dependencies] -iced_aw = { workspace = true, features = [ - "context_menu", - "icons", -] } -iced.workspace = true diff --git a/examples/date_picker/src/main.rs b/examples/date_picker.rs similarity index 93% rename from examples/date_picker/src/main.rs rename to examples/date_picker.rs index 7f17c6c4..b1f5e4ed 100644 --- a/examples/date_picker/src/main.rs +++ b/examples/date_picker.rs @@ -1,3 +1,7 @@ +// This example demonstrates how to use the [`date_picker`] widget. +// +// It was written by Kaiden42 + use iced::{ widget::{Button, Container, Row, Text}, Alignment, Element, Length, diff --git a/examples/date_picker/Cargo.toml b/examples/date_picker/Cargo.toml deleted file mode 100644 index 316dc641..00000000 --- a/examples/date_picker/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "date_picker" -version = "0.1.0" -authors = ["Kaiden42 "] -edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -iced_aw = { workspace = true, features = [ - "date_picker", -] } -iced.workspace = true \ No newline at end of file diff --git a/examples/drop_down/src/main.rs b/examples/drop_down.rs similarity index 95% rename from examples/drop_down/src/main.rs rename to examples/drop_down.rs index 41b43750..dc601257 100644 --- a/examples/drop_down/src/main.rs +++ b/examples/drop_down.rs @@ -1,3 +1,7 @@ +// This example demonstrates how to use the [`DropDown`] widget +// +// It was written by wiiznokes + use std::fmt::Display; use iced::{ diff --git a/examples/drop_down/Cargo.toml b/examples/drop_down/Cargo.toml deleted file mode 100644 index 7e647a9e..00000000 --- a/examples/drop_down/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "drop_down" -version = "0.1.0" -authors = ["wiiznokes "] -edition = "2021" - - -[dependencies] -iced_aw = { workspace = true, features = [ - "drop_down", - "icons", -] } -iced.workspace=true diff --git a/examples/grid/src/main.rs b/examples/grid.rs similarity index 97% rename from examples/grid/src/main.rs rename to examples/grid.rs index 460be30b..02fa2ea9 100644 --- a/examples/grid/src/main.rs +++ b/examples/grid.rs @@ -1,3 +1,7 @@ +// This example demonstrates how to use the grid widget +// +// It was written by Alexander van Saase + use iced::widget::{checkbox, container, pick_list, row, slider}; use iced::Padding; use iced::{ diff --git a/examples/grid/Cargo.toml b/examples/grid/Cargo.toml deleted file mode 100644 index 05ff7847..00000000 --- a/examples/grid/Cargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "grid" -version = "0.1.0" -authors = ["Alexander van Saase "] -edition = "2021" - -[dependencies] -iced_aw = { workspace = true, features = ["grid", "icons"] } -iced.workspace = true diff --git a/examples/menu/src/main.rs b/examples/menu.rs similarity index 99% rename from examples/menu/src/main.rs rename to examples/menu.rs index 9032256f..00686359 100644 --- a/examples/menu/src/main.rs +++ b/examples/menu.rs @@ -1,3 +1,5 @@ +// This example demonstrates how to use the menu widget + use iced::border::Radius; use iced::widget::{ button, checkbox, container, horizontal_space, row, scrollable, slider, text, text_input, diff --git a/examples/menu/Cargo.toml b/examples/menu/Cargo.toml deleted file mode 100644 index b62673bb..00000000 --- a/examples/menu/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "menu" -version = "0.1.0" -edition = "2021" -publish = false - -[dependencies] -iced_aw = { workspace = true, features = [ - "menu", - "quad", - "icons" -] } -iced = {workspace = true, features = ["svg"]} diff --git a/examples/number_input/src/main.rs b/examples/number_input.rs similarity index 90% rename from examples/number_input/src/main.rs rename to examples/number_input.rs index ea64b44a..edbdc8da 100644 --- a/examples/number_input/src/main.rs +++ b/examples/number_input.rs @@ -1,3 +1,7 @@ +// This example demonstrates how to use the number input widget +// +// It was written by leang27 <52003343+leang27@users.noreply.github.com> + use iced::{ widget::{Container, Row, Text}, Alignment, Element, Length, diff --git a/examples/number_input/Cargo.toml b/examples/number_input/Cargo.toml deleted file mode 100644 index b54e685e..00000000 --- a/examples/number_input/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "number_input" -version = "0.1.0" -authors = ["leang27 <52003343+leang27@users.noreply.github.com>"] -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -iced_aw = { workspace = true, features = [ - "number_input", - "icons", -] } - -iced.workspace=true diff --git a/examples/selection_list/src/main.rs b/examples/selection_list.rs similarity index 95% rename from examples/selection_list/src/main.rs rename to examples/selection_list.rs index e5924b3d..9da1001f 100644 --- a/examples/selection_list/src/main.rs +++ b/examples/selection_list.rs @@ -1,3 +1,7 @@ +// This example demonstrates how to use the selection list widget +// +// It was written by Héctor Ramón Jiménez and Andrew Wheeler + use iced::{ widget::{button, Column, Container, Text}, Alignment, Element, Font, Length, diff --git a/examples/selection_list/Cargo.toml b/examples/selection_list/Cargo.toml deleted file mode 100644 index a0c8bdb0..00000000 --- a/examples/selection_list/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -[package] -name = "selection_list" -version = "0.1.0" -authors = [ - "Héctor Ramón Jiménez ", - "Andrew Wheeler ", -] -edition = "2021" -publish = false - -[dependencies] -iced_aw = { workspace = true, features = [ - "selection_list", - "icons", -] } -iced.workspace = true diff --git a/examples/sidebar/src/counter.rs b/examples/side_bar/counter.rs similarity index 100% rename from examples/sidebar/src/counter.rs rename to examples/side_bar/counter.rs diff --git a/examples/sidebar/src/ferris.rs b/examples/side_bar/ferris.rs similarity index 85% rename from examples/sidebar/src/ferris.rs rename to examples/side_bar/ferris.rs index 5a0a20cb..bd227636 100644 --- a/examples/sidebar/src/ferris.rs +++ b/examples/side_bar/ferris.rs @@ -1,5 +1,6 @@ use iced::{ - widget::{Column, Container, Image, Slider, Text}, + advanced::image::Bytes, + widget::{image::Handle, Column, Container, Image, Slider, Text}, Alignment, Element, Length, }; use iced_aw::sidebar::TabLabel; @@ -68,12 +69,12 @@ impl Tab for FerrisTab { } fn ferris<'a>(width: f32) -> Container<'a, FerrisMessage> { - Container::new(if cfg!(target_arch = "wasm32") { - Image::new("images/ferris.png") - } else { - Image::new(format!("{}/images/ferris.png", env!("CARGO_MANIFEST_DIR"))) - .width(Length::Fixed(width)) - }) + Container::new( + Image::new(Handle::from_bytes(Bytes::from_static(include_bytes!( + "./images/ferris.png" + )))) + .width(Length::Fixed(width)), + ) .width(Length::Fill) .center_x(Length::Fill) } diff --git a/examples/sidebar/fonts/LICENSE.txt b/examples/side_bar/fonts/LICENSE.txt similarity index 100% rename from examples/sidebar/fonts/LICENSE.txt rename to examples/side_bar/fonts/LICENSE.txt diff --git a/examples/sidebar/fonts/config.json b/examples/side_bar/fonts/config.json similarity index 100% rename from examples/sidebar/fonts/config.json rename to examples/side_bar/fonts/config.json diff --git a/examples/sidebar/fonts/icons.ttf b/examples/side_bar/fonts/icons.ttf similarity index 100% rename from examples/sidebar/fonts/icons.ttf rename to examples/side_bar/fonts/icons.ttf diff --git a/examples/sidebar/images/ferris.png b/examples/side_bar/images/ferris.png similarity index 100% rename from examples/sidebar/images/ferris.png rename to examples/side_bar/images/ferris.png diff --git a/examples/sidebar/src/login.rs b/examples/side_bar/login.rs similarity index 100% rename from examples/sidebar/src/login.rs rename to examples/side_bar/login.rs diff --git a/examples/sidebar/src/main.rs b/examples/side_bar/main.rs similarity index 98% rename from examples/sidebar/src/main.rs rename to examples/side_bar/main.rs index f71b6dad..ba7026fe 100644 --- a/examples/sidebar/src/main.rs +++ b/examples/side_bar/main.rs @@ -18,7 +18,7 @@ use settings::{style_from_index, SettingsMessage, SettingsTab, SidebarPosition}; const HEADER_SIZE: u16 = 32; const TAB_PADDING: u16 = 16; -const ICON_BYTES: &[u8] = include_bytes!("../fonts/icons.ttf"); +const ICON_BYTES: &[u8] = include_bytes!("fonts/icons.ttf"); const ICON: Font = Font::with_name("icons"); enum Icon { diff --git a/examples/sidebar/src/settings.rs b/examples/side_bar/settings.rs similarity index 100% rename from examples/sidebar/src/settings.rs rename to examples/side_bar/settings.rs diff --git a/examples/sidebar/Cargo.toml b/examples/sidebar/Cargo.toml deleted file mode 100644 index bcfb7216..00000000 --- a/examples/sidebar/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "sidebar" -version = "0.1.0" -authors = ["Kaiden42 ", "Rizzen Yazston"] -edition = "2021" -publish = false - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -iced_aw = { workspace = true, features = ["sidebar", "icons"] } -iced = { workspace = true, features = [ "image"] } diff --git a/examples/sliderbar/src/main.rs b/examples/slide_bar.rs similarity index 91% rename from examples/sliderbar/src/main.rs rename to examples/slide_bar.rs index 6f4ec64c..2b51c0d6 100644 --- a/examples/sliderbar/src/main.rs +++ b/examples/slide_bar.rs @@ -1,3 +1,7 @@ +// This example demonstrates how to use the slide bar widget +// +// It was written by Andrew Wheeler + use iced::{ widget::{Column, Container, Text}, Element, Length, diff --git a/examples/sliderbar/Cargo.toml b/examples/sliderbar/Cargo.toml deleted file mode 100644 index a95e5220..00000000 --- a/examples/sliderbar/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -[package] -name = "slidebar" -version = "0.1.0" -authors = ["Andrew Wheeler "] -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -iced_aw = { workspace = true, features = [ - "slide_bar", - "icons", - "number_input", -] } -iced.workspace=true - diff --git a/examples/spinner/src/main.rs b/examples/spinner.rs similarity index 90% rename from examples/spinner/src/main.rs rename to examples/spinner.rs index 67615e8f..5f0818f7 100644 --- a/examples/spinner/src/main.rs +++ b/examples/spinner.rs @@ -1,3 +1,7 @@ +// This example demonstrates how to use the spinner widget +// +// This was written by Iohann Rabeson + use iced::widget::PickList; use iced::{ widget::{column, container}, diff --git a/examples/spinner/Cargo.toml b/examples/spinner/Cargo.toml deleted file mode 100644 index 682a0505..00000000 --- a/examples/spinner/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "spinner" -version = "0.1.0" -authors = [ - "Iohann Rabeson ", -] -edition = "2021" -publish = false - -[dependencies] -iced_aw = { workspace = true, features = [ - "spinner", - "icons", -] } -iced.workspace = true diff --git a/examples/tab_bar/src/main.rs b/examples/tab_bar.rs similarity index 97% rename from examples/tab_bar/src/main.rs rename to examples/tab_bar.rs index 74be7616..d993b4eb 100644 --- a/examples/tab_bar/src/main.rs +++ b/examples/tab_bar.rs @@ -1,3 +1,7 @@ +// This example demonstrates how to use the tab bar widget +// +// It was written by Kaiden42 + use iced::{ widget::{Button, Column, Row, Text, TextInput}, Alignment, Element, Length, diff --git a/examples/tab_bar/Cargo.toml b/examples/tab_bar/Cargo.toml deleted file mode 100644 index 2180884d..00000000 --- a/examples/tab_bar/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "tab_bar" -version = "0.1.0" -authors = ["Kaiden42 "] -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -iced_aw = { workspace = true, features = ["tab_bar", "icons"] } -iced.workspace = true diff --git a/examples/tabs/Cargo.toml b/examples/tabs/Cargo.toml deleted file mode 100644 index 68e290d5..00000000 --- a/examples/tabs/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "tabs" -version = "0.1.0" -authors = ["Kaiden42 "] -edition = "2021" -publish = false - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -iced_aw = { workspace = true, features = ["tabs", "icons"] } -iced = { workspace = true, features = [ "image"] } diff --git a/examples/tabs/src/counter.rs b/examples/tabs/counter.rs similarity index 100% rename from examples/tabs/src/counter.rs rename to examples/tabs/counter.rs diff --git a/examples/tabs/src/ferris.rs b/examples/tabs/ferris.rs similarity index 85% rename from examples/tabs/src/ferris.rs rename to examples/tabs/ferris.rs index 756de9af..f5f0dd4f 100644 --- a/examples/tabs/src/ferris.rs +++ b/examples/tabs/ferris.rs @@ -1,5 +1,6 @@ use iced::{ - widget::{Column, Container, Image, Slider, Text}, + advanced::image::Bytes, + widget::{image::Handle, Column, Container, Image, Slider, Text}, Alignment, Element, Length, }; use iced_aw::tab_bar::TabLabel; @@ -68,12 +69,12 @@ impl Tab for FerrisTab { } fn ferris<'a>(width: f32) -> Container<'a, FerrisMessage> { - Container::new(if cfg!(target_arch = "wasm32") { - Image::new("images/ferris.png") - } else { - Image::new(format!("{}/images/ferris.png", env!("CARGO_MANIFEST_DIR"))) - .width(Length::Fixed(width)) - }) + Container::new( + Image::new(Handle::from_bytes(Bytes::from_static(include_bytes!( + "./images/ferris.png" + )))) + .width(Length::Fixed(width)), + ) .width(Length::Fill) .center_x(Length::Fill) } diff --git a/examples/tabs/src/login.rs b/examples/tabs/login.rs similarity index 100% rename from examples/tabs/src/login.rs rename to examples/tabs/login.rs diff --git a/examples/tabs/src/main.rs b/examples/tabs/main.rs similarity index 95% rename from examples/tabs/src/main.rs rename to examples/tabs/main.rs index 6ddc9c35..657dc54d 100644 --- a/examples/tabs/src/main.rs +++ b/examples/tabs/main.rs @@ -1,3 +1,7 @@ +// This example demonstrates how to use the tabs widget +// +// This was written by Kaiden42 + mod login; use iced::{ alignment::{Horizontal, Vertical}, @@ -18,7 +22,7 @@ use settings::{style_from_index, SettingsMessage, SettingsTab, TabBarPosition}; const HEADER_SIZE: u16 = 32; const TAB_PADDING: u16 = 16; -const ICON_BYTES: &[u8] = include_bytes!("../fonts/icons.ttf"); +const ICON_BYTES: &[u8] = include_bytes!("./fonts/icons.ttf"); const ICON: Font = Font::with_name("icons"); enum Icon { diff --git a/examples/tabs/src/settings.rs b/examples/tabs/settings.rs similarity index 100% rename from examples/tabs/src/settings.rs rename to examples/tabs/settings.rs diff --git a/examples/time_picker/src/main.rs b/examples/time_picker.rs similarity index 93% rename from examples/time_picker/src/main.rs rename to examples/time_picker.rs index 8e7079cd..3b8dccdd 100644 --- a/examples/time_picker/src/main.rs +++ b/examples/time_picker.rs @@ -1,3 +1,7 @@ +// This example demonstrates how to use the time_picker widget +// +// It was written by Kaiden42 + use iced::{ widget::{Button, Container, Row, Text}, Alignment, Element, Length, diff --git a/examples/time_picker/Cargo.toml b/examples/time_picker/Cargo.toml deleted file mode 100644 index 9dca88f8..00000000 --- a/examples/time_picker/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "time_picker" -version = "0.1.0" -authors = ["Kaiden42 "] -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -iced_aw = { workspace = true, features = [ - "time_picker", -] } -iced.workspace = true diff --git a/examples/typed_input/src/main.rs b/examples/typed_input.rs similarity index 90% rename from examples/typed_input/src/main.rs rename to examples/typed_input.rs index 7d298751..b9c67130 100644 --- a/examples/typed_input/src/main.rs +++ b/examples/typed_input.rs @@ -1,3 +1,7 @@ +// This example demonstrates how to use the typed_input widget +// +// This was written by Ultraxime <36888699+Ultraxime@users.noreply.github.com> + use iced::{ widget::{Container, Row, Text}, Alignment, Element, Length, diff --git a/examples/typed_input/Cargo.toml b/examples/typed_input/Cargo.toml deleted file mode 100644 index 37a785cd..00000000 --- a/examples/typed_input/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "typed_input" -version = "0.1.0" -authors = ["Ultraxime <36888699+Ultraxime@users.noreply.github.com>"] -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -iced_aw = { workspace = true, features = [ - "typed_input", - "icons", -] } - -iced.workspace=true diff --git a/examples/WidgetIDReturn/src/main.rs b/examples/widget_id_return/main.rs similarity index 92% rename from examples/WidgetIDReturn/src/main.rs rename to examples/widget_id_return/main.rs index 763ac533..71f3d2de 100644 --- a/examples/WidgetIDReturn/src/main.rs +++ b/examples/widget_id_return/main.rs @@ -1,3 +1,7 @@ +// This example demonstrates how to use the widget_id_return +// +// It was written by Andrew Wheeler + use iced::{ widget::{Column, Container, Row, Text}, Alignment, Element, Length, diff --git a/examples/WidgetIDReturn/src/numberinput.rs b/examples/widget_id_return/numberinput.rs similarity index 100% rename from examples/WidgetIDReturn/src/numberinput.rs rename to examples/widget_id_return/numberinput.rs diff --git a/examples/wrap/src/main.rs b/examples/wrap.rs similarity index 97% rename from examples/wrap/src/main.rs rename to examples/wrap.rs index 19e8517f..e027a070 100644 --- a/examples/wrap/src/main.rs +++ b/examples/wrap.rs @@ -1,3 +1,7 @@ +// This example demonstrates how to use the Wrap widget +// +// It was written by Downtime + use std::fmt::Display; use iced::{ diff --git a/examples/wrap/Cargo.toml b/examples/wrap/Cargo.toml deleted file mode 100644 index 968180bb..00000000 --- a/examples/wrap/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -[package] -name = "wrap" -version = "0.1.0" -authors = ["Downtime "] -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -iced_aw = { workspace = true, features = [ - "wrap", - "number_input", - "icons", -] } -rand = "0.8" -iced.workspace = true diff --git a/src/lib.rs b/src/lib.rs index f0f7a94e..d87e42e4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,26 @@ //! Additional widgets for the Iced GUI library. +//! +//! # Examples +//! +//! * `badge` (Author: Kaiden42 ) +//! * `card` (Author: Kaiden42 ) +//! * `color_picker` (Author: Kaiden42 ) +//! * `context_menu` (Author: wiiznokes ) +//! * `date_picker` (Author: Kaiden42 ) +//! * `drop_down` (Author: wiiznokes ) +//! * `grid` (Author: Alexander van Saase ) +//! * `menu` +//! * `number_input` (Author: leang27 <52003343+leang27@users.noreply.github.com>) +//! * `selection_list` (Author: Héctor Ramón Jiménez and Andrew Wheeler ) +//! * `side_bar` (Author: Kaiden42 and Rizzen Yazston) +//! * `slide_bar` (Author: Andrew Wheeler ) +//! * `spinner` (Author: Iohann Rabeson ) +//! * `tab_bar` (Author: Kaiden42 ) +//! * `tabs` (Author: Kaiden42 ) +//! * `time_picker` (Author: Kaiden42 ) +//! * `typed_input` (Author: Ultraxime <36888699+Ultraxime@users.noreply.github.com>) +//! * `widget_id_return` (Author: Andrew Wheeler ) +//! * `wrap` (Author: owntime ) #![deny(missing_docs)] #![deny(unused_results)] #![forbid(unsafe_code)] From 1c9196c6db5ead08ef6bacb900cd3d651cd45488 Mon Sep 17 00:00:00 2001 From: Ultraxime Date: Tue, 27 Aug 2024 23:01:10 +0200 Subject: [PATCH 2/2] Mouving `iced_aw::widgets` to `iced_aw::widget` to mimic iced Updating `.vscode/lauch.json` to handle the new position of the examples Adding a pre-commit config --- .gitignore | 1 - .pre-commit-config.yaml | 49 ++ .vscode/launch.json | 671 ++++++++++-------- CHANGELOG.md | 25 +- Cargo.lock | 144 +--- Cargo.toml | 10 +- README.md | 9 +- examples/side_bar/fonts/LICENSE.txt | 2 - examples/side_bar/fonts/config.json | 2 +- examples/tabs/fonts/LICENSE.txt | 2 - examples/tabs/fonts/config.json | 2 +- src/core/icons.rs | 2 +- src/lib.rs | 49 +- src/style.rs | 2 +- src/style/badge.rs | 32 +- src/style/card.rs | 46 +- src/style/color_picker.rs | 20 +- src/style/context_menu.rs | 8 +- src/style/date_picker.rs | 20 +- src/style/menu_bar.rs | 4 +- src/style/number_input.rs | 12 +- src/style/selection_list.rs | 4 +- src/style/sidebar.rs | 20 +- src/style/status.rs | 2 +- src/style/tab_bar.rs | 20 +- src/style/time_picker.rs | 26 +- src/widget.rs | 104 +++ src/{widgets => widget}/badge.rs | 2 +- src/{widgets => widget}/card.rs | 24 +- src/{widgets => widget}/color_picker.rs | 0 src/{widgets => widget}/common.rs | 0 src/{widgets => widget}/context_menu.rs | 4 +- src/{widgets => widget}/date_picker.rs | 2 +- src/{widgets => widget}/drop_down.rs | 0 src/{widgets => widget}/grid/layout.rs | 2 +- src/{widgets => widget}/grid/mod.rs | 2 +- src/{widgets => widget}/grid/types.rs | 6 +- src/{widgets => widget}/grid/widget.rs | 0 src/{widgets => widget}/helpers.rs | 8 +- src/{widgets => widget}/menu.rs | 22 +- src/{widgets => widget}/menu/common.rs | 4 +- src/{widgets => widget}/menu/flex.rs | 0 src/{widgets => widget}/menu/menu_bar.rs | 4 +- .../menu/menu_bar_overlay.rs | 0 src/{widgets => widget}/menu/menu_tree.rs | 0 src/{widgets => widget}/number_input.rs | 9 +- .../overlay/color_picker.rs | 34 +- .../overlay/context_menu.rs | 10 +- .../overlay/date_picker.rs | 32 +- src/{widgets => widget}/overlay/mod.rs | 2 +- .../overlay/time_picker.rs | 30 +- src/{widgets => widget}/quad.rs | 2 +- src/{widgets => widget}/selection_list.rs | 2 +- .../selection_list/list.rs | 0 src/{widgets => widget}/sidebar.rs | 2 +- src/{widgets => widget}/sidebar/column.rs | 30 +- src/{widgets => widget}/sidebar/row.rs | 30 +- src/{widgets => widget}/sidebar/sidebar.rs | 62 +- src/{widgets => widget}/slide_bar.rs | 24 +- src/{widgets => widget}/spinner.rs | 0 src/{widgets => widget}/tab_bar.rs | 18 +- src/{widgets => widget}/tab_bar/tab_label.rs | 0 src/{widgets => widget}/tabs.rs | 72 +- .../tabs/tab_bar_position.rs | 8 +- src/{widgets => widget}/time_picker.rs | 4 +- src/{widgets => widget}/typed_input.rs | 0 src/{widgets => widget}/wrap.rs | 6 +- src/widgets.rs | 139 ---- 68 files changed, 913 insertions(+), 971 deletions(-) create mode 100644 .pre-commit-config.yaml create mode 100644 src/widget.rs rename src/{widgets => widget}/badge.rs (98%) rename src/{widgets => widget}/card.rs (96%) rename src/{widgets => widget}/color_picker.rs (100%) rename src/{widgets => widget}/common.rs (100%) rename src/{widgets => widget}/context_menu.rs (98%) rename src/{widgets => widget}/date_picker.rs (99%) rename src/{widgets => widget}/drop_down.rs (100%) rename src/{widgets => widget}/grid/layout.rs (99%) rename src/{widgets => widget}/grid/mod.rs (60%) rename src/{widgets => widget}/grid/types.rs (97%) rename src/{widgets => widget}/grid/widget.rs (100%) rename src/{widgets => widget}/helpers.rs (99%) rename src/{widgets => widget}/menu.rs (88%) rename src/{widgets => widget}/menu/common.rs (94%) rename src/{widgets => widget}/menu/flex.rs (100%) rename src/{widgets => widget}/menu/menu_bar.rs (99%) rename src/{widgets => widget}/menu/menu_bar_overlay.rs (100%) rename src/{widgets => widget}/menu/menu_tree.rs (100%) rename src/{widgets => widget}/number_input.rs (98%) rename src/{widgets => widget}/overlay/color_picker.rs (98%) rename src/{widgets => widget}/overlay/context_menu.rs (94%) rename src/{widgets => widget}/overlay/date_picker.rs (97%) rename src/{widgets => widget}/overlay/mod.rs (90%) rename src/{widgets => widget}/overlay/time_picker.rs (98%) rename src/{widgets => widget}/quad.rs (98%) rename src/{widgets => widget}/selection_list.rs (99%) rename src/{widgets => widget}/selection_list/list.rs (100%) rename src/{widgets => widget}/sidebar.rs (82%) rename src/{widgets => widget}/sidebar/column.rs (93%) rename src/{widgets => widget}/sidebar/row.rs (93%) rename src/{widgets => widget}/sidebar/sidebar.rs (96%) rename src/{widgets => widget}/slide_bar.rs (94%) rename src/{widgets => widget}/spinner.rs (100%) rename src/{widgets => widget}/tab_bar.rs (97%) rename src/{widgets => widget}/tab_bar/tab_label.rs (100%) rename src/{widgets => widget}/tabs.rs (88%) rename src/{widgets => widget}/tabs/tab_bar_position.rs (80%) rename src/{widgets => widget}/time_picker.rs (98%) rename src/{widgets => widget}/typed_input.rs (100%) rename src/{widgets => widget}/wrap.rs (98%) delete mode 100644 src/widgets.rs diff --git a/.gitignore b/.gitignore index 7fd137db..97c2e73d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,3 @@ pkg/ .idea .DS_Store .vscode/settings.json - diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..199c01f6 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,49 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + exclude: "(.*).pem" + - id: mixed-line-ending + exclude: "(.*).pem" + args: ['--fix=lf'] + description: Forces to replace line ending by the UNIX 'lf' character. + - id: check-case-conflict + - id: check-merge-conflict + - id: detect-private-key + - id: requirements-txt-fixer + - id: check-added-large-files + - id: check-symlinks + - id: check-toml + + - repo: https://github.com/jumanjihouse/pre-commit-hooks + rev: 3.0.0 + hooks: + - id: markdownlint + args: ['-r ~MD013'] + + - repo: https://github.com/Lucas-C/pre-commit-hooks + rev: v1.5.5 + hooks: + - id: remove-crlf + - id: remove-tabs + + - repo: https://github.com/doublify/pre-commit-rust + rev: v1.0 + hooks: + - id: cargo-check + - id: clippy + + - repo: https://github.com/DevinR528/cargo-sort + rev: v1.0.9 + hooks: + - id: cargo-sort + - repo: local + hooks: + - id: rustfmt + name: rustfmt + description: Check if all files follow the rustfmt style + entry: cargo fmt --all -- --color always + language: system + pass_filenames: false diff --git a/.vscode/launch.json b/.vscode/launch.json index 7395ab2d..13744cd4 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,314 +1,359 @@ { - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'badge'", - "cargo": { - "args": [ - "build", - "--bin=badge", - "--package=badge" - ], - "filter": { - "name": "badge", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'slidebar'", - "cargo": { - "args": [ - "build", - "--bin=slidebar", - "--package=slidebar" - ], - "filter": { - "name": "slidebar", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'card'", - "cargo": { - "args": [ - "build", - "--bin=card", - "--package=card" - ], - "filter": { - "name": "card", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'color_picker'", - "cargo": { - "args": [ - "build", - "--bin=color_picker", - "--package=color_picker" - ], - "filter": { - "name": "color_picker", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'date_picker'", - "cargo": { - "args": [ - "build", - "--bin=date_picker", - "--package=date_picker" - ], - "filter": { - "name": "date_picker", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'grid'", - "cargo": { - "args": [ - "build", - "--bin=grid", - "--package=grid" - ], - "filter": { - "name": "grid", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'tab_bar'", - "cargo": { - "args": [ - "build", - "--bin=tab_bar", - "--package=tab_bar" - ], - "filter": { - "name": "tab_bar", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'tabs'", - "cargo": { - "args": [ - "build", - "--bin=tabs", - "--package=tabs" - ], - "filter": { - "name": "tabs", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'tabstest'", - "cargo": { - "args": [ - "build", - "--bin=tabstest", - "--package=tabstest" - ], - "filter": { - "name": "tabstest", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'widget_id'", - "cargo": { - "args": [ - "build", - "--bin=widget_id", - "--package=widget_id" - ], - "filter": { - "name": "widget_id", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'time_picker'", - "cargo": { - "args": [ - "build", - "--bin=time_picker", - "--package=time_picker" - ], - "filter": { - "name": "time_picker", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'wrap'", - "cargo": { - "args": [ - "build", - "--bin=wrap", - "--package=wrap" - ], - "filter": { - "name": "wrap", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'number_input'", - "cargo": { - "args": [ - "build", - "--bin=number_input", - "--package=number_input" - ], - "filter": { - "name": "number_input", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'selection_list'", - "cargo": { - "args": [ - "build", - "--bin=selection_list", - "--package=selection_list" - ], - "filter": { - "name": "selection_list", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'menu'", - "cargo": { - "args": [ - "build", - "--bin=menu", - "--package=menu" - ], - "filter": { - "name": "menu", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'context_menu'", - "cargo": { - "args": [ - "build", - "--bin=context_menu", - "--package=context_menu" - ], - "filter": { - "name": "context_menu", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'spinner'", - "cargo": { - "args": [ - "build", - "--bin=spinner", - "--package=spinner" - ], - "filter": { - "name": "spinner", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - ] -} \ No newline at end of file + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "lldb", + "request": "launch", + "name": "Debug example 'badge'", + "cargo": { + "args": [ + "build", + "--example=badge" + ], + "filter": { + "name": "badge", + "kind": "example" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug example 'card'", + "cargo": { + "args": [ + "build", + "--example=card" + ], + "filter": { + "name": "card", + "kind": "example" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug example 'color_picker'", + "cargo": { + "args": [ + "build", + "--example=color_picker" + ], + "filter": { + "name": "color_picker", + "kind": "example" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug example 'context_menu'", + "cargo": { + "args": [ + "build", + "--example=context_menu" + ], + "filter": { + "name": "context_menu", + "kind": "example" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug example 'date_picker'", + "cargo": { + "args": [ + "build", + "--example=date_picker" + ], + "filter": { + "name": "date_picker", + "kind": "example" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug example 'drop_down'", + "cargo": { + "args": [ + "build", + "--example=drop_down" + ], + "filter": { + "name": "drop_down", + "kind": "example" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug example 'grid'", + "cargo": { + "args": [ + "build", + "--example=grid" + ], + "filter": { + "name": "grid", + "kind": "example" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug example 'menu'", + "cargo": { + "args": [ + "build", + "--example=menu" + ], + "filter": { + "name": "menu", + "kind": "example" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug example 'number_input'", + "cargo": { + "args": [ + "build", + "--example=number_input" + ], + "filter": { + "name": "number_input", + "kind": "example" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug example 'selection_list'", + "cargo": { + "args": [ + "build", + "--example=selection_list" + ], + "filter": { + "name": "selection_list", + "kind": "example" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug example 'side_bar'", + "cargo": { + "args": [ + "build", + "--example=side_bar", + "--features=iced/image" + ], + "filter": { + "name": "side_bar", + "kind": "example" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug example 'slide_bar'", + "cargo": { + "args": [ + "build", + "--example=slide_bar" + ], + "filter": { + "name": "slide_bar", + "kind": "example" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug example 'spinner'", + "cargo": { + "args": [ + "build", + "--example=spinner" + ], + "filter": { + "name": "spinner", + "kind": "example" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug example 'tab_bar'", + "cargo": { + "args": [ + "build", + "--example=tab_bar" + ], + "filter": { + "name": "tab_bar", + "kind": "example" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug example 'tabs'", + "cargo": { + "args": [ + "build", + "--example=tabs", + "--features=iced/image" + ], + "filter": { + "name": "tabs", + "kind": "example" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug example 'time_picker'", + "cargo": { + "args": [ + "build", + "--example=time_picker" + ], + "filter": { + "name": "time_picker", + "kind": "example" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug example 'typed_input'", + "cargo": { + "args": [ + "build", + "--example=typed_input" + ], + "filter": { + "name": "typed_input", + "kind": "example" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug example 'widget_id_return'", + "cargo": { + "args": [ + "build", + "--example=widget_id_return" + ], + "filter": { + "name": "widget_id_return", + "kind": "example" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug example 'wrap'", + "cargo": { + "args": [ + "build", + "--example=wrap" + ], + "filter": { + "name": "wrap", + "kind": "example" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + } + ], + "compounds": [ + { + "name": "Run all examples", + "configurations": [ + "Debug example 'badge'", + "Debug example 'card'", + "Debug example 'color_picker'", + "Debug example 'context_menu'", + "Debug example 'date_picker'", + "Debug example 'drop_down'", + "Debug example 'grid'", + "Debug example 'menu'", + "Debug example 'number_input'", + "Debug example 'selection_list'", + "Debug example 'side_bar'", + "Debug example 'slide_bar'", + "Debug example 'spinner'", + "Debug example 'tab_bar'", + "Debug example 'tabs'", + "Debug example 'time_picker'", + "Debug example 'typed_input'", + "Debug example 'widget_id_return'", + "Debug example 'wrap'" + ] + } + ] +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 87b23d1b..937cf32c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # Changelog + All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), @@ -7,42 +8,50 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Changes + - Split removed in favor of Iced pane grid - Modal and Floating element removed in favor of Iced Stack. -- Segmented Button Removed use iced button. +- Segmented Button Removed use iced button. - cupertino Removed as we are not going to support these anymore. ## [0.9.3] - 2024-05-08 ### Fixed + - pub mod required being renamed to pub mod bootstrap via cfg. ## [0.9.2] - 2024-05-08 ### Fixed + - missing Bootstrap ## [0.9.1] - 2024-05-07 ### Added -- ability to disable scroll events for NumberInput. @airblast-dev + +- ability to disable scroll events for NumberInput. @airblast-dev ### Fixed + - number input over/underflow when T is set to Max and Min and T is signed. ## [0.9.0] - 2024-05-07 ### Added + - font loading example @Redhawk18 - Add font size to date_picker @Strosel ### Changed + - Replace Length with impl Into in width/height APIs @TitouanReal - use bounds directly for segmented_button @spamviech - Updated bootstrap fonts @RedHawk. - Migrated SF_UI fonts under extended fonts type removing cupertino feature requirement to use them. ### Fixed + - number input over/underflow @TitouanReal - Numberinput fixes & shortcut support @the-marenga - hide all fill_quad-calls behind intersects(viewport) or width/height>0 checks @spamviech @@ -55,19 +64,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - fixed tabs ## [0.8.0] - 2024-02-24 + ### Added + - Tab bar now follows native iced theme @Redhawk. - Added nerd fonts @RedHawk - Slider Bar widget. - DropDown Widget @wiiznokes. ### Changed + - Updated `Menu` @latidoremi. - Updated to latest iced 0.12.0. - Updated bootstrap fonts @RedHawk. - Updated to support latest winit changes for input. ### Fixed + - Tabs Icons and text not rendering correctly. - use_24h not working on time picker. - Tabs content offset not taking into consideration the Tabs height. @@ -77,29 +90,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.7.0] - 2023-08-30 ### Added + - DynamicHeight to menu bar @latidoremi . - [Breaking] Custom Style Options for all widgets. - Align Option for modal @wiiznokes . - width setting to `NumberInput`.` ### Changed + - Changed current width to content_width for `NumberInput`. - (Breaking) Removed `Icon_text`, Use `Iced::widget::Text` instead. ### Fixed + - TabBars hieght issue within container. - number input buttons not rendering correctly when they are oversized. - Fixed SFUIRounded family name to be correct. -- number input scrolling to be normal scrolling instead of inversed scrolling @Redhawk18. +- number input scrolling to be normal scrolling instead of inversed scrolling @Redhawk18. ## [0.6.0] - 2023-07-28 ### Added + - Selection List now will clear Selected if a new Item is added to the same ID location as the last and its Hash is different. - Manual Override will always be used over the internal selected if set to Some(). If the # doesn't exist it defaults Selected to None. - Added Helper functions for Widgets. ### Changed + - Breaking Selection List now Takes in Font and Manual Selected override on new_with. - Breaking Selection list Message Type is now Name((usize, T)) for on_select. - Upgraded to Latest Iced 0.10.0. @@ -107,4 +125,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Switched lazy_static to OnceCell ### Fixed + - Floating Element Position is corrected. Original position issue was due to Center_x containing both X and Width/2. diff --git a/Cargo.lock b/Cargo.lock index 4be6470f..688ea628 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -303,12 +303,6 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" -[[package]] -name = "bit_field" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" - [[package]] name = "bitflags" version = "1.3.2" @@ -551,12 +545,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "color_quant" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" - [[package]] name = "com" version = "0.6.0" @@ -985,22 +973,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "exr" -version = "1.72.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "887d93f60543e9a9362ef8a21beedd0a833c5d9610e18c67abe15a5963dcb1a4" -dependencies = [ - "bit_field", - "flume", - "half", - "lebe", - "miniz_oxide", - "rayon-core", - "smallvec", - "zune-inflate", -] - [[package]] name = "fast-srgb8" version = "1.0.0" @@ -1038,15 +1010,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8bf7cc16383c4b8d58b9905a8509f02926ce3058053c056376248d958c9df1e8" -[[package]] -name = "flume" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" -dependencies = [ - "spin", -] - [[package]] name = "font-types" version = "0.6.0" @@ -1240,16 +1203,6 @@ dependencies = [ "wasi", ] -[[package]] -name = "gif" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb2d69b19215e18bb912fa30f7ce15846e301408695e44e0ef719f1da9e19f2" -dependencies = [ - "color_quant", - "weezl", -] - [[package]] name = "gl_generator" version = "0.14.0" @@ -1463,13 +1416,12 @@ dependencies = [ "iced_renderer", "iced_widget", "iced_winit", - "image", "thiserror", ] [[package]] name = "iced_aw" -version = "0.9.3" +version = "0.9.4" dependencies = [ "cfg-if", "chrono", @@ -1526,8 +1478,6 @@ dependencies = [ "half", "iced_core", "iced_futures", - "image", - "kamadak-exif", "log", "lyon_path", "once_cell", @@ -1629,24 +1579,6 @@ dependencies = [ "winit", ] -[[package]] -name = "image" -version = "0.24.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d" -dependencies = [ - "bytemuck", - "byteorder", - "color_quant", - "exr", - "gif", - "jpeg-decoder", - "num-traits", - "png", - "qoi", - "tiff", -] - [[package]] name = "indexmap" version = "2.3.0" @@ -1712,15 +1644,6 @@ dependencies = [ "libc", ] -[[package]] -name = "jpeg-decoder" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" -dependencies = [ - "rayon", -] - [[package]] name = "js-sys" version = "0.3.69" @@ -1730,15 +1653,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "kamadak-exif" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef4fc70d0ab7e5b6bafa30216a6b48705ea964cdfc29c050f2412295eba58077" -dependencies = [ - "mutate_once", -] - [[package]] name = "khronos-egl" version = "6.0.0" @@ -1766,12 +1680,6 @@ dependencies = [ "smallvec", ] -[[package]] -name = "lebe" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" - [[package]] name = "libc" version = "0.2.155" @@ -1969,12 +1877,6 @@ dependencies = [ "simd-adler32", ] -[[package]] -name = "mutate_once" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16cf681a23b4d0a43fc35024c176437f9dcd818db34e0f42ab456a0ee5ad497b" - [[package]] name = "naga" version = "0.19.2" @@ -2653,15 +2555,6 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43d84d1d7a6ac92673717f9f6d1518374ef257669c24ebc5ac25d5033828be58" -[[package]] -name = "qoi" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" -dependencies = [ - "bytemuck", -] - [[package]] name = "quick-xml" version = "0.34.0" @@ -3100,15 +2993,6 @@ dependencies = [ "x11rb", ] -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -dependencies = [ - "lock_api", -] - [[package]] name = "spirv" version = "0.3.0+sdk-1.3.268.0" @@ -3219,17 +3103,6 @@ dependencies = [ "syn 2.0.72", ] -[[package]] -name = "tiff" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba1310fcea54c6a9a4fd1aad794ecc02c31682f6bfbecdf460bf19533eed1e3e" -dependencies = [ - "flate2", - "jpeg-decoder", - "weezl", -] - [[package]] name = "time" version = "0.3.36" @@ -3705,12 +3578,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "weezl" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" - [[package]] name = "wgpu" version = "0.19.4" @@ -4341,15 +4208,6 @@ dependencies = [ "syn 2.0.72", ] -[[package]] -name = "zune-inflate" -version = "0.2.54" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" -dependencies = [ - "simd-adler32", -] - [[package]] name = "zvariant" version = "4.2.0" diff --git a/Cargo.toml b/Cargo.toml index 922c3a34..d8a83da5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iced_aw" -version = "0.9.3" +version = "0.9.4" authors = [ "Kaiden42 ", "Andrew Wheeler ", @@ -65,8 +65,8 @@ chrono = { version = "0.4.34", optional = true } itertools = { version = "0.12.1", optional = true } num-format = { version = "0.4.4", optional = true } num-traits = { version = "0.2.18", optional = true } -time = { version = "0.3.34", features = ["local-offset"], optional = true } once_cell = { version = "1.19.0", optional = true } +time = { version = "0.3.34", features = ["local-offset"], optional = true } [dependencies.iced] git = "https://github.com/iced-rs/iced.git" @@ -87,7 +87,7 @@ git = "https://github.com/iced-rs/iced.git" #rev = "b474a2b7a763dcde6a377cb409001a7b5285ee8d" version = "0.13.0-dev" #default-features = false -features = ["advanced", "wgpu", "image"] +features = ["advanced", "wgpu"] [dev-dependencies.iced_aw] path = "./" @@ -127,7 +127,7 @@ required-features = ["selection_list"] [[example]] name = "side_bar" -required-features = ["sidebar"] +required-features = ["sidebar", "iced/image"] [[example]] name = "slide_bar" @@ -143,7 +143,7 @@ required-features = ["tab_bar"] [[example]] name = "tabs" -required-features = ["tabs"] +required-features = ["tabs", "iced/image"] [[example]] name = "time_picker" diff --git a/README.md b/README.md index 1b33ebe1..e561c565 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,10 @@ This crate contains additional widgets for the GUI library [Iced](https://github Every widget is hidden by a feature gate. This allows you to cherry pick the widgets you actually need. -## Usage: +## Usage Include `iced_aw` as a dependency in your `Cargo.toml`: + ```toml [dependencies] iced = "0.12.0" @@ -32,7 +33,7 @@ iced_aw = { version = "0.9.3", default-features = false, features = [...] } ### Badge
- + ![Badge showcase](./images/showcase/badge.png)
@@ -43,7 +44,7 @@ Enable this widget with the feature `badge`. ### Card
- + ![Card showcase](./images/showcase/card.png)
@@ -65,7 +66,7 @@ Enable this widget with the feature `color_picker`. ### Date Picker
- + ![Date Picker showcase](./images/showcase/date_picker.png)
diff --git a/examples/side_bar/fonts/LICENSE.txt b/examples/side_bar/fonts/LICENSE.txt index 8fa3da36..9a34ddc3 100644 --- a/examples/side_bar/fonts/LICENSE.txt +++ b/examples/side_bar/fonts/LICENSE.txt @@ -8,5 +8,3 @@ Font license info Author: Dave Gandy License: SIL () Homepage: http://fortawesome.github.com/Font-Awesome/ - - diff --git a/examples/side_bar/fonts/config.json b/examples/side_bar/fonts/config.json index dfc22c08..58592163 100644 --- a/examples/side_bar/fonts/config.json +++ b/examples/side_bar/fonts/config.json @@ -37,4 +37,4 @@ "src": "fontawesome" } ] -} \ No newline at end of file +} diff --git a/examples/tabs/fonts/LICENSE.txt b/examples/tabs/fonts/LICENSE.txt index 8fa3da36..9a34ddc3 100644 --- a/examples/tabs/fonts/LICENSE.txt +++ b/examples/tabs/fonts/LICENSE.txt @@ -8,5 +8,3 @@ Font license info Author: Dave Gandy License: SIL () Homepage: http://fortawesome.github.com/Font-Awesome/ - - diff --git a/examples/tabs/fonts/config.json b/examples/tabs/fonts/config.json index dfc22c08..58592163 100644 --- a/examples/tabs/fonts/config.json +++ b/examples/tabs/fonts/config.json @@ -37,4 +37,4 @@ "src": "fontawesome" } ] -} \ No newline at end of file +} diff --git a/src/core/icons.rs b/src/core/icons.rs index 34bd9cd2..4abcaaf0 100644 --- a/src/core/icons.rs +++ b/src/core/icons.rs @@ -1,4 +1,4 @@ -//! The default icon font of the widgets of this library. +//! The default icon font of the widget of this library. use cfg_if::cfg_if; use iced::Font; diff --git a/src/lib.rs b/src/lib.rs index d87e42e4..2dd65133 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -//! Additional widgets for the Iced GUI library. +//! Additional widget for the Iced GUI library. //! //! # Examples //! @@ -71,7 +71,9 @@ clippy::let_unit_value )] -pub mod widgets; +pub mod widget; +#[deprecated(since = "0.9.4", note = "use `widget` instead")] +pub use widget as widgets; pub mod core; pub mod style; @@ -82,7 +84,7 @@ pub use iced::Element; mod platform { #[allow(unused_imports)] pub use crate::style; - pub use crate::widgets::helpers; + pub use crate::widget::helpers; cfg_if::cfg_if! { if #[cfg(feature = "icons")] { @@ -97,85 +99,88 @@ mod platform { #[doc(no_inline)] #[cfg(feature = "badge")] - pub use {crate::widgets::badge, badge::Badge}; + pub use {crate::widget::badge, badge::Badge}; #[doc(no_inline)] #[cfg(feature = "card")] - pub use {crate::widgets::card, card::Card}; + pub use {crate::widget::card, card::Card}; #[doc(no_inline)] #[cfg(feature = "color_picker")] - pub use {crate::widgets::color_picker, color_picker::ColorPicker}; + pub use {crate::widget::color_picker, color_picker::ColorPicker}; #[doc(no_inline)] #[cfg(feature = "date_picker")] - pub use {crate::widgets::date_picker, date_picker::DatePicker}; + pub use {crate::widget::date_picker, date_picker::DatePicker}; #[doc(no_inline)] #[cfg(feature = "grid")] - pub use crate::widgets::grid::{Grid, GridRow}; + pub use { + crate::widget::{grid, grid_row}, + grid::{Grid, GridRow}, + }; #[doc(no_inline)] #[cfg(feature = "tab_bar")] pub use { - crate::widgets::tab_bar, + crate::widget::tab_bar, tab_bar::{TabBar, TabLabel}, }; #[doc(no_inline)] #[cfg(feature = "tabs")] pub use { - crate::widgets::tabs, + crate::widget::tabs, tabs::{TabBarPosition, Tabs}, }; #[doc(no_inline)] #[cfg(feature = "time_picker")] - pub use {crate::widgets::time_picker, time_picker::TimePicker}; + pub use {crate::widget::time_picker, time_picker::TimePicker}; #[doc(no_inline)] #[cfg(feature = "wrap")] - pub use {crate::widgets::wrap, wrap::direction, wrap::Wrap}; + pub use {crate::widget::wrap, wrap::direction, wrap::Wrap}; #[doc(no_inline)] #[cfg(feature = "number_input")] - pub use {crate::widgets::number_input, number_input::NumberInput}; + pub use {crate::widget::number_input, number_input::NumberInput}; #[doc(no_inline)] #[cfg(feature = "typed_input")] - pub use {crate::widgets::typed_input, typed_input::TypedInput}; + pub use {crate::widget::typed_input, typed_input::TypedInput}; #[doc(no_inline)] #[cfg(feature = "selection_list")] - pub use {crate::widgets::selection_list, selection_list::SelectionList}; + pub use {crate::widget::selection_list, selection_list::SelectionList}; #[doc(no_inline)] #[cfg(feature = "menu")] - pub use crate::widgets::menu; + pub use {crate::widget::menu, menu::Menu, menu::MenuBar}; #[doc(no_inline)] #[cfg(feature = "quad")] - pub use crate::widgets::quad; + pub use {crate::widget::quad, quad::Quad}; #[doc(no_inline)] #[cfg(feature = "spinner")] - pub use {crate::widgets::spinner, spinner::Spinner}; + pub use {crate::widget::spinner, spinner::Spinner}; #[doc(no_inline)] #[cfg(feature = "slide_bar")] - pub use crate::widgets::SlideBar; + pub use crate::widget::SlideBar; #[doc(no_inline)] #[cfg(feature = "context_menu")] - pub use {crate::widgets::context_menu, context_menu::ContextMenu}; + pub use {crate::widget::context_menu, context_menu::ContextMenu}; #[doc(no_inline)] #[cfg(feature = "drop_down")] - pub use {crate::widgets::drop_down, drop_down::DropDown}; + pub use {crate::widget::drop_down, drop_down::DropDown}; #[doc(no_inline)] #[cfg(feature = "sidebar")] - pub use crate::widgets::sidebar; + pub use crate::widget::sidebar; } #[doc(no_inline)] diff --git a/src/style.rs b/src/style.rs index 294f4a02..7213cb4b 100644 --- a/src/style.rs +++ b/src/style.rs @@ -1,4 +1,4 @@ -//! The appearance of the widgets +//! The appearance of the widget pub mod colors; pub mod status; diff --git a/src/style/badge.rs b/src/style/badge.rs index d1b6c9b3..c271a16e 100644 --- a/src/style/badge.rs +++ b/src/style/badge.rs @@ -4,27 +4,27 @@ use super::{colors, Status, StyleFn}; use iced::{theme::palette, Background, Color, Theme}; -/// The style of a [`Badge`](crate::widgets::badge::Badge). +/// The style of a [`Badge`](crate::widget::badge::Badge). #[derive(Clone, Copy, Debug)] pub struct Style { - /// The background of the [`Badge`](crate::widgets::badge::Badge). + /// The background of the [`Badge`](crate::widget::badge::Badge). pub background: Background, - /// The border radius of the [`Badge`](crate::widgets::badge::Badge). + /// The border radius of the [`Badge`](crate::widget::badge::Badge). /// If no radius is specified the default one will be used. pub border_radius: Option, - /// The border with of the [`Badge`](crate::widgets::badge::Badge). + /// The border with of the [`Badge`](crate::widget::badge::Badge). pub border_width: f32, - /// The border color of the [`Badge`](crate::widgets::badge::Badge). + /// The border color of the [`Badge`](crate::widget::badge::Badge). pub border_color: Option, - /// The default text color of the [`Badge`](crate::widgets::badge::Badge). + /// The default text color of the [`Badge`](crate::widget::badge::Badge). pub text_color: Color, } -/// The Catalog of a [`Badge`](crate::widgets::badge::Badge). +/// The Catalog of a [`Badge`](crate::widget::badge::Badge). pub trait Catalog { ///Style for the trait to use. type Class<'a>; @@ -60,7 +60,7 @@ impl Catalog for Theme { } } -/// The primary theme of a [`Badge`](crate::widgets::badge::Badge). +/// The primary theme of a [`Badge`](crate::widget::badge::Badge). #[must_use] pub fn primary(theme: &Theme, status: Status) -> Style { let palette = theme.extended_palette(); @@ -76,7 +76,7 @@ pub fn primary(theme: &Theme, status: Status) -> Style { } } -/// The secondary theme of a [`Badge`](crate::widgets::badge::Badge). +/// The secondary theme of a [`Badge`](crate::widget::badge::Badge). #[must_use] pub fn secondary(theme: &Theme, status: Status) -> Style { let palette = theme.extended_palette(); @@ -92,7 +92,7 @@ pub fn secondary(theme: &Theme, status: Status) -> Style { } } -/// The success theme of a [`Badge`](crate::widgets::badge::Badge). +/// The success theme of a [`Badge`](crate::widget::badge::Badge). #[must_use] pub fn success(theme: &Theme, status: Status) -> Style { let palette = theme.extended_palette(); @@ -108,7 +108,7 @@ pub fn success(theme: &Theme, status: Status) -> Style { } } -/// The danger theme of a [`Badge`](crate::widgets::badge::Badge). +/// The danger theme of a [`Badge`](crate::widget::badge::Badge). #[must_use] pub fn danger(theme: &Theme, status: Status) -> Style { let palette = theme.extended_palette(); @@ -124,7 +124,7 @@ pub fn danger(theme: &Theme, status: Status) -> Style { } } -/// The warning theme of a [`Badge`](crate::widgets::badge::Badge). +/// The warning theme of a [`Badge`](crate::widget::badge::Badge). #[must_use] pub fn warning(_theme: &Theme, status: Status) -> Style { let base = from_color(colors::WARNING, colors::BLACK); @@ -135,7 +135,7 @@ pub fn warning(_theme: &Theme, status: Status) -> Style { } } -/// The info theme of a [`Badge`](crate::widgets::badge::Badge). +/// The info theme of a [`Badge`](crate::widget::badge::Badge). #[must_use] pub fn info(_theme: &Theme, status: Status) -> Style { let base = from_color(colors::INFO, colors::BLACK); @@ -146,7 +146,7 @@ pub fn info(_theme: &Theme, status: Status) -> Style { } } -/// The light theme of a [`Badge`](crate::widgets::badge::Badge). +/// The light theme of a [`Badge`](crate::widget::badge::Badge). #[must_use] pub fn light(_theme: &Theme, status: Status) -> Style { let base = from_color(colors::LIGHT, colors::BLACK); @@ -157,7 +157,7 @@ pub fn light(_theme: &Theme, status: Status) -> Style { } } -/// The dark theme of a [`Badge`](crate::widgets::badge::Badge). +/// The dark theme of a [`Badge`](crate::widget::badge::Badge). #[must_use] pub fn dark(_theme: &Theme, status: Status) -> Style { let base = from_color(colors::DARK, colors::WHITE); @@ -168,7 +168,7 @@ pub fn dark(_theme: &Theme, status: Status) -> Style { } } -/// The white theme of a [`Badge`](crate::widgets::badge::Badge). +/// The white theme of a [`Badge`](crate::widget::badge::Badge). #[must_use] pub fn white(_theme: &Theme, status: Status) -> Style { let base = from_color(colors::WHITE, colors::BLACK); diff --git a/src/style/card.rs b/src/style/card.rs index 93ef71b6..c2057da8 100644 --- a/src/style/card.rs +++ b/src/style/card.rs @@ -1,48 +1,48 @@ -//! Displays a [`Card`](crate::widgets::Card). +//! Displays a [`Card`](crate::widget::Card). //! //! *This API requires the following crate features to be activated: card* use super::{colors, Status, StyleFn}; use iced::{Background, Color, Theme}; -/// The appearance of a [`Card`](crate::widgets::card::Card). +/// The appearance of a [`Card`](crate::widget::card::Card). #[derive(Clone, Copy, Debug)] pub struct Style { - /// The background of the [`Card`](crate::widgets::card::Card). + /// The background of the [`Card`](crate::widget::card::Card). pub background: Background, - /// The border radius of the [`Card`](crate::widgets::card::Card). + /// The border radius of the [`Card`](crate::widget::card::Card). pub border_radius: f32, - /// The border width of the [`Card`](crate::widgets::card::Card). + /// The border width of the [`Card`](crate::widget::card::Card). pub border_width: f32, - /// The border color of the [`Card`](crate::widgets::card::Card). + /// The border color of the [`Card`](crate::widget::card::Card). pub border_color: Color, - /// The background of the head of the [`Card`](crate::widgets::card::Card). + /// The background of the head of the [`Card`](crate::widget::card::Card). pub head_background: Background, - /// The text color of the head of the [`Card`](crate::widgets::card::Card). + /// The text color of the head of the [`Card`](crate::widget::card::Card). pub head_text_color: Color, - /// The background of the body of the [`Card`](crate::widgets::card::Card). + /// The background of the body of the [`Card`](crate::widget::card::Card). pub body_background: Background, - /// The text color of the body of the [`Card`](crate::widgets::card::Card). + /// The text color of the body of the [`Card`](crate::widget::card::Card). pub body_text_color: Color, - /// The background of the foot of the [`Card`](crate::widgets::card::Card). + /// The background of the foot of the [`Card`](crate::widget::card::Card). pub foot_background: Background, - /// The text color of the foot of the [`Card`](crate::widgets::card::Card). + /// The text color of the foot of the [`Card`](crate::widget::card::Card). pub foot_text_color: Color, - /// The color of the close icon of the [`Card`](crate::widgets::card::Card). + /// The color of the close icon of the [`Card`](crate::widget::card::Card). pub close_color: Color, } -/// The appearance of a [`Card`](crate::widgets::card::Card). +/// The appearance of a [`Card`](crate::widget::card::Card). pub trait Catalog { ///Style for the trait to use. type Class<'a>; @@ -84,55 +84,55 @@ impl Catalog for Theme { } } -/// The primary theme of a [`Card`](crate::widgets::card::Card). +/// The primary theme of a [`Card`](crate::widget::card::Card). #[must_use] pub fn primary(theme: &Theme, _status: Status) -> Style { backing_with_text(theme, colors::PRIMARY, colors::WHITE) } -/// The secondary theme of a [`Card`](crate::widgets::card::Card). +/// The secondary theme of a [`Card`](crate::widget::card::Card). #[must_use] pub fn secondary(theme: &Theme, _status: Status) -> Style { backing_with_text(theme, colors::SECONDARY, colors::WHITE) } -/// The success theme of a [`Card`](crate::widgets::card::Card). +/// The success theme of a [`Card`](crate::widget::card::Card). #[must_use] pub fn success(theme: &Theme, _status: Status) -> Style { backing_with_text(theme, colors::SUCCESS, colors::WHITE) } -/// The danger theme of a [`Card`](crate::widgets::card::Card). +/// The danger theme of a [`Card`](crate::widget::card::Card). #[must_use] pub fn danger(theme: &Theme, _status: Status) -> Style { backing_with_text(theme, colors::DANGER, colors::WHITE) } -/// The warning theme of a [`Card`](crate::widgets::card::Card). +/// The warning theme of a [`Card`](crate::widget::card::Card). #[must_use] pub fn warning(theme: &Theme, _status: Status) -> Style { backing_only(theme, colors::WARNING) } -/// The info theme of a [`Card`](crate::widgets::card::Card). +/// The info theme of a [`Card`](crate::widget::card::Card). #[must_use] pub fn info(theme: &Theme, _status: Status) -> Style { backing_only(theme, colors::INFO) } -/// The light theme of a [`Card`](crate::widgets::card::Card). +/// The light theme of a [`Card`](crate::widget::card::Card). #[must_use] pub fn light(theme: &Theme, _status: Status) -> Style { backing_only(theme, colors::LIGHT) } -/// The dark theme of a [`Card`](crate::widgets::card::Card). +/// The dark theme of a [`Card`](crate::widget::card::Card). #[must_use] pub fn dark(theme: &Theme, _status: Status) -> Style { backing_with_text(theme, colors::DARK, colors::WHITE) } -/// The white theme of a [`Card`](crate::widgets::card::Card). +/// The white theme of a [`Card`](crate::widget::card::Card). #[must_use] pub fn white(theme: &Theme, _status: Status) -> Style { backing_only(theme, colors::WHITE) diff --git a/src/style/color_picker.rs b/src/style/color_picker.rs index 42946f9c..83b601ee 100644 --- a/src/style/color_picker.rs +++ b/src/style/color_picker.rs @@ -5,32 +5,32 @@ use super::{Status, StyleFn}; use iced::{Background, Color, Theme}; -/// The appearance of a [`ColorPicker`](crate::widgets::ColorPicker). +/// The appearance of a [`ColorPicker`](crate::widget::ColorPicker). #[derive(Clone, Copy, Debug)] pub struct Style { - /// The background of the [`ColorPicker`](crate::widgets::ColorPicker). + /// The background of the [`ColorPicker`](crate::widget::ColorPicker). pub background: Background, - /// The border radius of the [`ColorPicker`](crate::widgets::ColorPicker). + /// The border radius of the [`ColorPicker`](crate::widget::ColorPicker). pub border_radius: f32, - /// The border with of the [`ColorPicker`](crate::widgets::ColorPicker). + /// The border with of the [`ColorPicker`](crate::widget::ColorPicker). pub border_width: f32, - /// The border color of the [`ColorPicker`](crate::widgets::ColorPicker). + /// The border color of the [`ColorPicker`](crate::widget::ColorPicker). pub border_color: Color, - /// The border radius of the bars of the [`ColorPicker`](crate::widgets::ColorPicker). + /// The border radius of the bars of the [`ColorPicker`](crate::widget::ColorPicker). pub bar_border_radius: f32, - /// The border width of the bars of the [`ColorPicker`](crate::widgets::ColorPicker). + /// The border width of the bars of the [`ColorPicker`](crate::widget::ColorPicker). pub bar_border_width: f32, - /// The border color of the bars of the [`ColorPicker`](crate::widgets::ColorPicker). + /// The border color of the bars of the [`ColorPicker`](crate::widget::ColorPicker). pub bar_border_color: Color, } -/// The Catalog of a [`ColorPicker`](crate::widgets::ColorPicker). +/// The Catalog of a [`ColorPicker`](crate::widget::ColorPicker). pub trait Catalog { ///Style for the trait to use. type Class<'a>; @@ -54,7 +54,7 @@ impl Catalog for Theme { } } -/// The primary theme of a [`Badge`](crate::widgets::badge::Badge). +/// The primary theme of a [`Badge`](crate::widget::badge::Badge). #[must_use] pub fn primary(theme: &Theme, status: Status) -> Style { let palette = theme.extended_palette(); diff --git a/src/style/context_menu.rs b/src/style/context_menu.rs index f84e7dc0..58884c95 100644 --- a/src/style/context_menu.rs +++ b/src/style/context_menu.rs @@ -4,10 +4,10 @@ use super::{Status, StyleFn}; use iced::{Background, Color, Theme}; -/// The style of a [`ContextMenu`](crate::widgets::ContextMenu). +/// The style of a [`ContextMenu`](crate::widget::ContextMenu). #[derive(Clone, Copy, Debug)] pub struct Style { - /// The background of the [`ContextMenu`](crate::widgets::ContextMenu). + /// The background of the [`ContextMenu`](crate::widget::ContextMenu). /// /// This is used to color the backdrop of the modal. pub background: Background, @@ -21,7 +21,7 @@ impl Default for Style { } } -/// The Catalog of a [`ContextMenu`](crate::widgets::ContextMenu). +/// The Catalog of a [`ContextMenu`](crate::widget::ContextMenu). pub trait Catalog { ///Style for the trait to use. type Class<'a>; @@ -45,7 +45,7 @@ impl Catalog for Theme { } } -/// The primary theme of a [`ContextMenu`](crate::widgets::ContextMenu). +/// The primary theme of a [`ContextMenu`](crate::widget::ContextMenu). #[must_use] pub fn primary(theme: &Theme, _status: Status) -> Style { let palette = theme.extended_palette(); diff --git a/src/style/date_picker.rs b/src/style/date_picker.rs index 395d333a..7e1e8d45 100644 --- a/src/style/date_picker.rs +++ b/src/style/date_picker.rs @@ -4,34 +4,34 @@ use super::{Status, StyleFn}; use iced::{Background, Color, Theme}; -/// The appearance of a [`DatePicker`](crate::widgets::DatePicker). +/// The appearance of a [`DatePicker`](crate::widget::DatePicker). #[derive(Clone, Copy, Debug)] pub struct Style { - /// The background of the [`DatePicker`](crate::widgets::DatePicker). + /// The background of the [`DatePicker`](crate::widget::DatePicker). pub background: Background, - /// The border radius of the [`DatePicker`](crate::widgets::DatePicker). + /// The border radius of the [`DatePicker`](crate::widget::DatePicker). pub border_radius: f32, - /// The border with of the [`DatePicker`](crate::widgets::DatePicker). + /// The border with of the [`DatePicker`](crate::widget::DatePicker). pub border_width: f32, - /// The border color of the [`DatePicker`](crate::widgets::DatePicker). + /// The border color of the [`DatePicker`](crate::widget::DatePicker). pub border_color: Color, - /// The text color of the [`DatePicker`](crate::widgets::DatePicker). + /// The text color of the [`DatePicker`](crate::widget::DatePicker). pub text_color: Color, /// The attenuated color of the days which are not in the selected month - /// of the [`DatePicker`](crate::widgets::DatePicker). + /// of the [`DatePicker`](crate::widget::DatePicker). pub text_attenuated_color: Color, /// The background of the days in the calender of the - /// [`DatePicker`](crate::widgets::DatePicker). + /// [`DatePicker`](crate::widget::DatePicker). pub day_background: Background, } -/// The Catalog of a [`DatePicker`](crate::widgets::DatePicker). +/// The Catalog of a [`DatePicker`](crate::widget::DatePicker). pub trait Catalog { ///Style for the trait to use. type Class<'a>; @@ -55,7 +55,7 @@ impl Catalog for Theme { } } -/// The primary theme of a [`Badge`](crate::widgets::badge::Badge). +/// The primary theme of a [`Badge`](crate::widget::badge::Badge). #[must_use] pub fn primary(theme: &Theme, status: Status) -> Style { let palette = theme.extended_palette(); diff --git a/src/style/menu_bar.rs b/src/style/menu_bar.rs index e5a6b38c..37ca6a5f 100644 --- a/src/style/menu_bar.rs +++ b/src/style/menu_bar.rs @@ -60,7 +60,7 @@ impl std::default::Default for Style { } } -/// The Catalog of a [`Menu`](crate::widgets::menu::Menu). +/// The Catalog of a [`Menu`](crate::widget::menu::Menu). pub trait Catalog { ///Style for the trait to use. type Class<'a>; @@ -84,7 +84,7 @@ impl Catalog for Theme { } } -/// The primary theme of a [`Menu`](crate::widgets::menu::Menu). +/// The primary theme of a [`Menu`](crate::widget::menu::Menu). #[must_use] pub fn primary(theme: &Theme, _status: Status) -> Style { let palette = theme.extended_palette(); diff --git a/src/style/number_input.rs b/src/style/number_input.rs index e5d2656a..c7d69f4f 100644 --- a/src/style/number_input.rs +++ b/src/style/number_input.rs @@ -5,12 +5,12 @@ use super::{Status, StyleFn}; use iced::{widget, Background, Color, Theme}; -/// The appearance of a [`NumberInput`](crate::widgets::number_input::NumberInput). +/// The appearance of a [`NumberInput`](crate::widget::number_input::NumberInput). #[derive(Clone, Copy, Debug)] pub struct Style { - /// The background of the [`NumberInput`](crate::widgets::number_input::NumberInput). + /// The background of the [`NumberInput`](crate::widget::number_input::NumberInput). pub button_background: Option, - /// The Color of the arrows of [`NumberInput`](crate::widgets::number_input::NumberInput). + /// The Color of the arrows of [`NumberInput`](crate::widget::number_input::NumberInput). pub icon_color: Color, } @@ -23,7 +23,7 @@ impl Default for Style { } } -/// The Catalog of a [`NumberInput`](crate::widgets::number_input::NumberInput). +/// The Catalog of a [`NumberInput`](crate::widget::number_input::NumberInput). pub trait Catalog { ///Style for the trait to use. type Class<'a>; @@ -47,7 +47,7 @@ impl Catalog for Theme { } } -/// The Extended Catalog of a [`NumberInput`](crate::widgets::number_input::NumberInput). +/// The Extended Catalog of a [`NumberInput`](crate::widget::number_input::NumberInput). pub trait ExtendedCatalog: widget::text_input::Catalog + widget::container::Catalog + widget::text::Catalog + self::Catalog { @@ -67,7 +67,7 @@ impl ExtendedCatalog for Theme { } } -/// The primary theme of a [`Badge`](crate::widgets::badge::Badge). +/// The primary theme of a [`Badge`](crate::widget::badge::Badge). #[must_use] pub fn primary(theme: &Theme, status: Status) -> Style { let palette = theme.extended_palette(); diff --git a/src/style/selection_list.rs b/src/style/selection_list.rs index 34497789..dda3e836 100644 --- a/src/style/selection_list.rs +++ b/src/style/selection_list.rs @@ -29,7 +29,7 @@ impl std::default::Default for Style { } } -/// The Catalog of a [`Badge`](crate::widgets::selection_list::SelectionList). +/// The Catalog of a [`Badge`](crate::widget::selection_list::SelectionList). pub trait Catalog { ///Style for the trait to use. type Class<'a>; @@ -53,7 +53,7 @@ impl Catalog for Theme { } } -/// The primary theme of a [`Badge`](crate::widgets::selection_list::SelectionList). +/// The primary theme of a [`Badge`](crate::widget::selection_list::SelectionList). #[must_use] pub fn primary(_theme: &Theme, status: Status) -> Style { let base = Style::default(); diff --git a/src/style/sidebar.rs b/src/style/sidebar.rs index 50af00dd..02f83ce5 100644 --- a/src/style/sidebar.rs +++ b/src/style/sidebar.rs @@ -1,12 +1,12 @@ -//! This is the style for [`Sidebar`](crate::widgets::sidebar::Sidebar) and -//! [`SidebarWithContent`](crate::widgets::sidebar::SidebarWithContent). +//! This is the style for [`Sidebar`](crate::widget::sidebar::Sidebar) and +//! [`SidebarWithContent`](crate::widget::sidebar::SidebarWithContent). //! //! *This API requires the following crate features to be activated: `sidebar`* use super::{Status, StyleFn}; use iced::{border::Radius, Background, Color, Theme}; -/// The appearance of a [`Sidebar`](crate::widgets::sidebar::Sidebar). +/// The appearance of a [`Sidebar`](crate::widget::sidebar::Sidebar). #[derive(Clone, Copy, Debug)] pub struct Style { /// The background of the sidebar. @@ -56,7 +56,7 @@ impl Default for Style { } } } -/// The Catalog of a [`Sidebar`](crate::widgets::sidebar::Sidebar). +/// The Catalog of a [`Sidebar`](crate::widget::sidebar::Sidebar). pub trait Catalog { ///Style for the trait to use. type Class<'a>; @@ -80,7 +80,7 @@ impl Catalog for Theme { } } -/// The primary theme of a [`Sidebar`](crate::widgets::sidebar::Sidebar). +/// The primary theme of a [`Sidebar`](crate::widget::sidebar::Sidebar). #[must_use] pub fn primary(theme: &Theme, status: Status) -> Style { let mut base = Style::default(); @@ -103,7 +103,7 @@ pub fn primary(theme: &Theme, status: Status) -> Style { base } -/// The dark theme of a [`Sidebar`](crate::widgets::sidebar::Sidebar). +/// The dark theme of a [`Sidebar`](crate::widget::sidebar::Sidebar). #[must_use] pub fn dark(_theme: &Theme, status: Status) -> Style { let mut base = Style { @@ -121,7 +121,7 @@ pub fn dark(_theme: &Theme, status: Status) -> Style { base } -/// The red theme of a [`Sidebar`](crate::widgets::sidebar::Sidebar). +/// The red theme of a [`Sidebar`](crate::widget::sidebar::Sidebar). #[must_use] pub fn red(_theme: &Theme, status: Status) -> Style { let mut base = Style { @@ -142,7 +142,7 @@ pub fn red(_theme: &Theme, status: Status) -> Style { base } -/// The blue theme of a [`Sidebar`](crate::widgets::sidebar::Sidebar). +/// The blue theme of a [`Sidebar`](crate::widget::sidebar::Sidebar). #[must_use] pub fn blue(_theme: &Theme, status: Status) -> Style { let mut base = Style { @@ -161,7 +161,7 @@ pub fn blue(_theme: &Theme, status: Status) -> Style { base } -/// The blue theme of a [`Sidebar`](crate::widgets::sidebar::Sidebar). +/// The blue theme of a [`Sidebar`](crate::widget::sidebar::Sidebar). #[must_use] pub fn green(_theme: &Theme, status: Status) -> Style { let mut base = Style { @@ -185,7 +185,7 @@ pub fn green(_theme: &Theme, status: Status) -> Style { base } -/// The purple theme of a [`Sidebar`](crate::widgets::sidebar::Sidebar). +/// The purple theme of a [`Sidebar`](crate::widget::sidebar::Sidebar). #[must_use] pub fn purple(_theme: &Theme, status: Status) -> Style { let mut base = Style { diff --git a/src/style/status.rs b/src/style/status.rs index c6a91d87..d6d51959 100644 --- a/src/style/status.rs +++ b/src/style/status.rs @@ -17,5 +17,5 @@ pub enum Status { Selected, } -/// The style function of widgets. +/// The style function of widget. pub type StyleFn<'a, Theme, Style> = Box Style + 'a>; diff --git a/src/style/tab_bar.rs b/src/style/tab_bar.rs index 0fdeb1c8..794eb209 100644 --- a/src/style/tab_bar.rs +++ b/src/style/tab_bar.rs @@ -1,15 +1,15 @@ -//! Displays a [`TabBar`](crate::widgets::tab_bar::TabBar) to select the content +//! Displays a [`TabBar`](crate::widget::tab_bar::TabBar) to select the content //! to be displayed. //! //! You have to manage the logic to show the contend by yourself or you may want -//! to use the [`Tabs`](crate::widgets::tabs::Tabs) widget instead. +//! to use the [`Tabs`](crate::widget::tabs::Tabs) widget instead. //! //! *This API requires the following crate features to be activated: `tab_bar`* use super::{Status, StyleFn}; use iced::{border::Radius, Background, Color, Theme}; -/// The appearance of a [`TabBar`](crate::widgets::tab_bar::TabBar). +/// The appearance of a [`TabBar`](crate::widget::tab_bar::TabBar). #[derive(Clone, Copy, Debug)] pub struct Style { /// The background of the tab bar. @@ -59,7 +59,7 @@ impl Default for Style { } } } -/// The Catalog of a [`TabBar`](crate::widgets::tab_bar::TabBar). +/// The Catalog of a [`TabBar`](crate::widget::tab_bar::TabBar). pub trait Catalog { ///Style for the trait to use. type Class<'a>; @@ -83,7 +83,7 @@ impl Catalog for Theme { } } -/// The primary theme of a [`TabBar`](crate::widgets::tab_bar::TabBar). +/// The primary theme of a [`TabBar`](crate::widget::tab_bar::TabBar). #[must_use] pub fn primary(theme: &Theme, status: Status) -> Style { let mut base = Style::default(); @@ -106,7 +106,7 @@ pub fn primary(theme: &Theme, status: Status) -> Style { base } -/// The dark theme of a [`TabBar`](crate::widgets::tab_bar::TabBar). +/// The dark theme of a [`TabBar`](crate::widget::tab_bar::TabBar). #[must_use] pub fn dark(_theme: &Theme, status: Status) -> Style { let mut base = Style { @@ -124,7 +124,7 @@ pub fn dark(_theme: &Theme, status: Status) -> Style { base } -/// The red theme of a [`TabBar`](crate::widgets::tab_bar::TabBar). +/// The red theme of a [`TabBar`](crate::widget::tab_bar::TabBar). #[must_use] pub fn red(_theme: &Theme, status: Status) -> Style { let mut base = Style { @@ -145,7 +145,7 @@ pub fn red(_theme: &Theme, status: Status) -> Style { base } -/// The blue theme of a [`TabBar`](crate::widgets::tab_bar::TabBar). +/// The blue theme of a [`TabBar`](crate::widget::tab_bar::TabBar). #[must_use] pub fn blue(_theme: &Theme, status: Status) -> Style { let mut base = Style { @@ -164,7 +164,7 @@ pub fn blue(_theme: &Theme, status: Status) -> Style { base } -/// The blue theme of a [`TabBar`](crate::widgets::tab_bar::TabBar). +/// The blue theme of a [`TabBar`](crate::widget::tab_bar::TabBar). #[must_use] pub fn green(_theme: &Theme, status: Status) -> Style { let mut base = Style { @@ -188,7 +188,7 @@ pub fn green(_theme: &Theme, status: Status) -> Style { base } -/// The purple theme of a [`TabBar`](crate::widgets::tab_bar::TabBar). +/// The purple theme of a [`TabBar`](crate::widget::tab_bar::TabBar). #[must_use] pub fn purple(_theme: &Theme, status: Status) -> Style { let mut base = Style { diff --git a/src/style/time_picker.rs b/src/style/time_picker.rs index 44937b74..fcc8ce89 100644 --- a/src/style/time_picker.rs +++ b/src/style/time_picker.rs @@ -5,46 +5,46 @@ use super::{Status, StyleFn}; use iced::{Background, Color, Theme}; -/// The style of a [`TimePicker`](crate::widgets::TimePicker). +/// The style of a [`TimePicker`](crate::widget::TimePicker). #[derive(Clone, Copy, Debug)] pub struct Style { - /// The background of the [`TimePicker`](crate::widgets::TimePicker). + /// The background of the [`TimePicker`](crate::widget::TimePicker). pub background: Background, - /// The border radius of the [`TimePicker`](crate::widgets::TimePicker). + /// The border radius of the [`TimePicker`](crate::widget::TimePicker). pub border_radius: f32, - /// The border width of the [`TimePicker`](crate::widgets::TimePicker). + /// The border width of the [`TimePicker`](crate::widget::TimePicker). pub border_width: f32, - /// The border color of the [`TimePicker`](crate::widgets::TimePicker). + /// The border color of the [`TimePicker`](crate::widget::TimePicker). pub border_color: Color, - /// The text color of the [`TimePicker`](crate::widgets::TimePicker). + /// The text color of the [`TimePicker`](crate::widget::TimePicker). pub text_color: Color, /// The color of the clock numbers of the - /// [`TimePicker`](crate::widgets::TimePicker). + /// [`TimePicker`](crate::widget::TimePicker). pub clock_number_color: Color, /// The background of the clock numbers of the - /// [`TimePicker`](crate::widgets::TimePicker). + /// [`TimePicker`](crate::widget::TimePicker). pub clock_number_background: Color, /// The color of the dots on the clock of the - /// [`TimePicker`](crate::widgets::TimePicker). + /// [`TimePicker`](crate::widget::TimePicker). pub clock_dots_color: Color, /// The color of the hands of the clock of the - /// [`TimePicker`](crate::widgets::TimePicker). + /// [`TimePicker`](crate::widget::TimePicker). pub clock_hand_color: Color, /// The with of the hands of the clock of the - /// [`TimePicker](crate::widgets::TimePicker). + /// [`TimePicker](crate::widget::TimePicker). pub clock_hand_width: f32, } -/// The Catalog of a [`TimePicker`](crate::widgets::TimePicker). +/// The Catalog of a [`TimePicker`](crate::widget::TimePicker). pub trait Catalog { ///Style for the trait to use. type Class<'a>; @@ -68,7 +68,7 @@ impl Catalog for Theme { } } -/// The primary theme of a [`TimePicker`](crate::widgets::TimePicker). +/// The primary theme of a [`TimePicker`](crate::widget::TimePicker). #[must_use] pub fn primary(theme: &Theme, status: Status) -> Style { let palette = theme.extended_palette(); diff --git a/src/widget.rs b/src/widget.rs new file mode 100644 index 00000000..44219783 --- /dev/null +++ b/src/widget.rs @@ -0,0 +1,104 @@ +//! Stateless, pure widget for iced +//use iced_widget::{renderer, style}; +pub mod helpers; +#[allow(unused_imports)] +pub use helpers::*; + +pub mod overlay; + +pub mod common; + +pub use common::InnerBounds; + +#[cfg(feature = "badge")] +pub mod badge; +#[cfg(feature = "badge")] +pub use badge::Badge; + +#[cfg(feature = "number_input")] +pub mod number_input; +#[cfg(feature = "number_input")] +pub use number_input::NumberInput; + +#[cfg(feature = "typed_input")] +pub mod typed_input; +#[cfg(feature = "typed_input")] +pub use typed_input::TypedInput; + +#[cfg(feature = "card")] +pub mod card; +#[cfg(feature = "card")] +pub use card::Card; + +#[cfg(feature = "color_picker")] +pub mod color_picker; +#[cfg(feature = "color_picker")] +pub use color_picker::ColorPicker; + +#[cfg(feature = "date_picker")] +pub mod date_picker; +#[cfg(feature = "date_picker")] +pub use date_picker::DatePicker; + +#[cfg(feature = "selection_list")] +pub mod selection_list; +#[cfg(feature = "selection_list")] +pub use selection_list::{List, SelectionList}; + +#[cfg(feature = "grid")] +pub mod grid; +#[cfg(feature = "grid")] +pub use grid::{Grid, GridRow}; + +#[cfg(feature = "tab_bar")] +pub mod tab_bar; +#[cfg(feature = "tab_bar")] +pub use tab_bar::{TabBar, TabLabel}; + +#[cfg(feature = "tabs")] +pub mod tabs; +#[cfg(feature = "tabs")] +pub use tabs::{TabBarPosition, Tabs}; + +#[cfg(feature = "time_picker")] +pub mod time_picker; +#[cfg(feature = "time_picker")] +pub use time_picker::TimePicker; + +#[cfg(feature = "wrap")] +pub mod wrap; +#[cfg(feature = "wrap")] +pub use wrap::Wrap; + +#[cfg(feature = "menu")] +pub mod menu; +#[cfg(feature = "menu")] +pub use menu::Menu; + +#[cfg(feature = "quad")] +pub mod quad; + +#[cfg(feature = "spinner")] +pub mod spinner; +#[cfg(feature = "spinner")] +pub use spinner::Spinner; + +#[cfg(feature = "context_menu")] +pub mod context_menu; +#[cfg(feature = "context_menu")] +pub use context_menu::ContextMenu; + +#[cfg(feature = "slide_bar")] +pub mod slide_bar; +#[cfg(feature = "slide_bar")] +pub use slide_bar::SlideBar; + +#[cfg(feature = "drop_down")] +pub mod drop_down; +#[cfg(feature = "drop_down")] +pub use drop_down::DropDown; + +#[cfg(feature = "sidebar")] +pub mod sidebar; +#[cfg(feature = "sidebar")] +pub use sidebar::{Sidebar, SidebarWithContent}; diff --git a/src/widgets/badge.rs b/src/widget/badge.rs similarity index 98% rename from src/widgets/badge.rs rename to src/widget/badge.rs index f94f2170..a3317602 100644 --- a/src/widgets/badge.rs +++ b/src/widget/badge.rs @@ -194,7 +194,7 @@ where layout .children() .next() - .expect("widgets: Layout should have a children layout for a badge."), + .expect("widget: Layout should have a children layout for a badge."), cursor, renderer, clipboard, diff --git a/src/widgets/card.rs b/src/widget/card.rs similarity index 96% rename from src/widgets/card.rs rename to src/widget/card.rs index d78cced0..d94ee35b 100644 --- a/src/widgets/card.rs +++ b/src/widget/card.rs @@ -318,14 +318,14 @@ where let head_layout = children .next() - .expect("widgets: Layout should have a head layout"); + .expect("widget: Layout should have a head layout"); let mut head_children = head_layout.children(); let head_status = self.head.as_widget_mut().on_event( &mut state.children[0], event.clone(), head_children .next() - .expect("widgets: Layout should have a head content layout"), + .expect("widget: Layout should have a head content layout"), cursor, renderer, clipboard, @@ -358,14 +358,14 @@ where let body_layout = children .next() - .expect("widgets: Layout should have a body layout"); + .expect("widget: Layout should have a body layout"); let mut body_children = body_layout.children(); let body_status = self.body.as_widget_mut().on_event( &mut state.children[1], event.clone(), body_children .next() - .expect("widgets: Layout should have a body content layout"), + .expect("widget: Layout should have a body content layout"), cursor, renderer, clipboard, @@ -375,7 +375,7 @@ where let foot_layout = children .next() - .expect("widgets: Layout should have a foot layout"); + .expect("widget: Layout should have a foot layout"); let mut foot_children = foot_layout.children(); let foot_status = self.foot.as_mut().map_or(event::Status::Ignored, |foot| { foot.as_widget_mut().on_event( @@ -383,7 +383,7 @@ where event, foot_children .next() - .expect("widgets: Layout should have a foot content layout"), + .expect("widget: Layout should have a foot content layout"), cursor, renderer, clipboard, @@ -410,12 +410,12 @@ where let head_layout = children .next() - .expect("widgets: Layout should have a head layout"); + .expect("widget: Layout should have a head layout"); let mut head_children = head_layout.children(); let head = head_children .next() - .expect("widgets: Layout should have a head layout"); + .expect("widget: Layout should have a head layout"); let close_layout = head_children.next(); let is_mouse_over_close = close_layout.map_or(false, |layout| { @@ -431,12 +431,12 @@ where let body_layout = children .next() - .expect("widgets: Layout should have a body layout"); + .expect("widget: Layout should have a body layout"); let mut body_children = body_layout.children(); let foot_layout = children .next() - .expect("widgets: Layout should have a foot layout"); + .expect("widget: Layout should have a foot layout"); let mut foot_children = foot_layout.children(); mouse_interaction @@ -452,7 +452,7 @@ where &state.children[1], body_children .next() - .expect("widgets: Layout should have a body content layout"), + .expect("widget: Layout should have a body content layout"), cursor, viewport, renderer, @@ -466,7 +466,7 @@ where &state.children[2], foot_children .next() - .expect("widgets: Layout should have a foot content layout"), + .expect("widget: Layout should have a foot content layout"), cursor, viewport, renderer, diff --git a/src/widgets/color_picker.rs b/src/widget/color_picker.rs similarity index 100% rename from src/widgets/color_picker.rs rename to src/widget/color_picker.rs diff --git a/src/widgets/common.rs b/src/widget/common.rs similarity index 100% rename from src/widgets/common.rs rename to src/widget/common.rs diff --git a/src/widgets/context_menu.rs b/src/widget/context_menu.rs similarity index 98% rename from src/widgets/context_menu.rs rename to src/widget/context_menu.rs index 9219634a..deb43f72 100644 --- a/src/widgets/context_menu.rs +++ b/src/widget/context_menu.rs @@ -17,7 +17,7 @@ pub use crate::style::{ status::{Status, StyleFn}, }; -use crate::widgets::overlay::ContextMenuOverlay; +use crate::widget::overlay::ContextMenuOverlay; /// A context menu /// @@ -88,7 +88,7 @@ where self } - /// Sets the class of the input of the [`Badge`]. + /// Sets the class of the input of the [`ContextMenu`]. #[must_use] pub fn class(mut self, class: impl Into>) -> Self { self.class = class.into(); diff --git a/src/widgets/date_picker.rs b/src/widget/date_picker.rs similarity index 99% rename from src/widgets/date_picker.rs rename to src/widget/date_picker.rs index 06759c88..a416f1e0 100644 --- a/src/widgets/date_picker.rs +++ b/src/widget/date_picker.rs @@ -102,7 +102,7 @@ where /// * a message that will be send when the cancel button of the [`DatePicker`] /// is pressed. /// * a function that will be called when the submit button of the [`DatePicker`] - /// is pressed, which takes the picked [`Date`](crate::date_picker::Date) value. + /// is pressed, which takes the picked [`Date`] value. pub fn new( show_picker: bool, date: impl Into, diff --git a/src/widgets/drop_down.rs b/src/widget/drop_down.rs similarity index 100% rename from src/widgets/drop_down.rs rename to src/widget/drop_down.rs diff --git a/src/widgets/grid/layout.rs b/src/widget/grid/layout.rs similarity index 99% rename from src/widgets/grid/layout.rs rename to src/widget/grid/layout.rs index cb082bd1..495d7c45 100644 --- a/src/widgets/grid/layout.rs +++ b/src/widget/grid/layout.rs @@ -74,7 +74,7 @@ where allocate_space(&mut column_widths, column_lengths, available_width); allocate_space(&mut row_heights, row_lengths, available_height); - // Lay out the widgets + // Lay out the widget create_grid_layout( tree, element_count, diff --git a/src/widgets/grid/mod.rs b/src/widget/grid/mod.rs similarity index 60% rename from src/widgets/grid/mod.rs rename to src/widget/grid/mod.rs index 026fd79f..c8c5512c 100644 --- a/src/widgets/grid/mod.rs +++ b/src/widget/grid/mod.rs @@ -1,4 +1,4 @@ -//! A container to layout widgets in a grid. +//! A container to layout widget in a grid. mod layout; mod types; diff --git a/src/widgets/grid/types.rs b/src/widget/grid/types.rs similarity index 97% rename from src/widgets/grid/types.rs rename to src/widget/grid/types.rs index 5cd6ba56..7ce99b04 100644 --- a/src/widgets/grid/types.rs +++ b/src/widget/grid/types.rs @@ -67,7 +67,7 @@ where self } - /// Sets the horizontal alignment of the widgets within their cells. Default: + /// Sets the horizontal alignment of the widget within their cells. Default: /// [`Horizontal::Left`] #[must_use] pub fn horizontal_alignment(mut self, align: Horizontal) -> Self { @@ -75,7 +75,7 @@ where self } - /// Sets the vertical alignment of the widgets within their cells. Default: + /// Sets the vertical alignment of the widget within their cells. Default: /// [`Vertical::Center`] #[must_use] pub fn vertical_alignment(mut self, align: Vertical) -> Self { @@ -228,7 +228,7 @@ where Self::default() } - /// Creates a new [`GridRow`] with the given widgets. + /// Creates a new [`GridRow`] with the given widget. #[must_use] pub fn with_elements(children: Vec>>) -> Self { Self { diff --git a/src/widgets/grid/widget.rs b/src/widget/grid/widget.rs similarity index 100% rename from src/widgets/grid/widget.rs rename to src/widget/grid/widget.rs diff --git a/src/widgets/helpers.rs b/src/widget/helpers.rs similarity index 99% rename from src/widgets/helpers.rs rename to src/widget/helpers.rs index 07fa125a..48655016 100644 --- a/src/widgets/helpers.rs +++ b/src/widget/helpers.rs @@ -26,7 +26,7 @@ macro_rules! grid { ); } -/// Creates a [`GridRow`] with the given widgets. +/// Creates a [`GridRow`] with the given widget. /// /// [`GridRow`]: crate::GridRow #[cfg(feature = "grid")] @@ -73,7 +73,7 @@ macro_rules! wrap_vertical { /// [`Item`]: crate::menu::Item /// /// Syntax: -/// ``` +/// ```ignore /// menu_items!( /// (widget) /// (widget) @@ -108,7 +108,7 @@ macro_rules! menu_items { /// [`Menu`]: crate::menu::Menu /// /// Syntax: -/// ``` +/// ```ignore /// menu!( /// (widget) /// (widget) @@ -132,7 +132,7 @@ macro_rules! menu { /// [`MenuBar`]: crate::menu::MenuBar /// /// Syntax: -/// ``` +/// ```ignore /// menu_bar!( /// (widget, menu) /// (widget, menu) diff --git a/src/widgets/menu.rs b/src/widget/menu.rs similarity index 88% rename from src/widgets/menu.rs rename to src/widget/menu.rs index 3c24a139..436153cd 100644 --- a/src/widgets/menu.rs +++ b/src/widget/menu.rs @@ -52,17 +52,17 @@ //! //! ``` //! -//! Alterwidgetsly you can use the helper macros +//! Alterwidgetly you can use the helper macros //! //! ## Example 2 //! ``` //! use iced::widget::button; -//! use iced_aw::menu::{Menu} -//! use iced_aw::{menu_bar, menu_items} +//! use iced_aw::menu::{Menu, Item, MenuBar}; +//! use iced_aw::{menu_bar, menu_items}; //! //! let menu_template = |items| Menu::new(items).max_width(180.0).offset(6.0); //! -//! let menu_bar = menu_bar!( +//! let menu_bar: MenuBar<'_, (), iced::Theme, iced::Renderer> = menu_bar!( //! (button("Menu 1"),menu_template(menu_items!( //! (button("item_1")) //! (button("item_2")) @@ -83,7 +83,7 @@ //! (button("item_2")) //! (button("item_3")) //! ))) -//! ) +//! ); //! ``` //! //! Here a menu_template function/closure is used in example 2, @@ -95,7 +95,8 @@ //! ## Example 3 //! //! ``` -//! use iced_aw::{menu}; +//! use iced::widget::button; +//! use iced_aw::{menu, Menu}; //! //! macro_rules! menu_template { //! ($($x:tt)+) => { @@ -104,7 +105,7 @@ //! } //! //! // then you can just write -//! let m = menu_template!( +//! let m: Menu<'_, (), iced::Theme, iced::Renderer> = menu_template!( //! (button("item_1")) //! (button("item_2")) //! (button("sub menu"), menu_template!( @@ -122,17 +123,20 @@ //! ## Example 4 //! //! ``` +//! use iced_aw::{menu, Menu}; +//! use iced::widget::button; +//! //! fn menu_template<'a, Message, Theme, Renderer>( //! menu: Menu<'a, Message, Theme, Renderer> //! ) -> Menu<'a, Message, Theme, Renderer> //! where -//! Theme: iced_aw::menu::StyleSheet, +//! Theme: iced_aw::menu::Catalog, //! Renderer: iced::advanced::Renderer, //! { //! menu.max_width(180.0).offset(6.0) //! } //! -//! let m = menu_template(menu!( +//! let m: Menu<'_, (), iced::Theme, iced::Renderer> = menu_template(menu!( //! (button("item_1")) //! (button("item_2")) //! (button("item_3")) diff --git a/src/widgets/menu/common.rs b/src/widget/menu/common.rs similarity index 94% rename from src/widgets/menu/common.rs rename to src/widget/menu/common.rs index 01aee96e..2e90e2df 100644 --- a/src/widgets/menu/common.rs +++ b/src/widget/menu/common.rs @@ -21,9 +21,9 @@ pub struct CloseCondition { /// useful when you want to customize the styling of each item in the path, /// or you simple want the look of the items when they are hovered over. /// -/// The downside is when some widgets in the path don't response to hovering, +/// The downside is when some widget in the path don't response to hovering, /// the path won't be fully drawn, and when you want uniform path styling -/// but some widgets response to hovering differently. +/// but some widget response to hovering differently. /// /// ## Backdrop: /// diff --git a/src/widgets/menu/flex.rs b/src/widget/menu/flex.rs similarity index 100% rename from src/widgets/menu/flex.rs rename to src/widget/menu/flex.rs diff --git a/src/widgets/menu/menu_bar.rs b/src/widget/menu/menu_bar.rs similarity index 99% rename from src/widgets/menu/menu_bar.rs rename to src/widget/menu/menu_bar.rs index 4d5b968f..f7c5453f 100644 --- a/src/widgets/menu/menu_bar.rs +++ b/src/widget/menu/menu_bar.rs @@ -114,7 +114,7 @@ where self } - /// Sets the style of the [`Badge`]. + /// Sets the style of the [`MenuBar`]. pub fn style(mut self, style: impl Fn(&Theme, Status) -> Style + 'a) -> Self where Theme::Class<'a>: From>, @@ -123,7 +123,7 @@ where self } - /// Sets the class of the input of the [`Badge`]. + /// Sets the class of the input of the [`MenuBar`]. pub fn class(mut self, class: impl Into>) -> Self { self.class = class.into(); self diff --git a/src/widgets/menu/menu_bar_overlay.rs b/src/widget/menu/menu_bar_overlay.rs similarity index 100% rename from src/widgets/menu/menu_bar_overlay.rs rename to src/widget/menu/menu_bar_overlay.rs diff --git a/src/widgets/menu/menu_tree.rs b/src/widget/menu/menu_tree.rs similarity index 100% rename from src/widgets/menu/menu_tree.rs rename to src/widget/menu/menu_tree.rs diff --git a/src/widgets/number_input.rs b/src/widget/number_input.rs similarity index 98% rename from src/widgets/number_input.rs rename to src/widget/number_input.rs index 5df21630..ae670ed8 100644 --- a/src/widgets/number_input.rs +++ b/src/widget/number_input.rs @@ -30,7 +30,7 @@ use std::{ }; use crate::style::{self, Status}; -use crate::widgets::typed_input::TypedInput; +use crate::widget::typed_input::TypedInput; pub use crate::{ core::icons::{bootstrap::icon_to_string, Bootstrap, BOOTSTRAP_FONT}, style::{ @@ -142,8 +142,9 @@ where /// Sets the minimum & maximum value (bound) of the [`NumberInput`]. /// # Example /// ``` + /// use iced_aw::widget::number_input; /// // Creates a range from -5 till 5. - /// number_input(my_value, my_message).bounds(-5..=5) + /// let input: iced_aw::NumberInput<'_, _, _, iced::Theme, iced::Renderer> = number_input(4 /* my_value */, 0..=4, |_| () /* my_message */).bounds(-5..=5); /// ``` #[must_use] pub fn bounds(mut self, bounds: impl RangeBounds) -> Self { @@ -162,8 +163,8 @@ where /// Sets the [`Font`] of the [`Text`]. /// - /// [`Font`]: core::Font - /// [`Text`]: core::widget::Text + /// [`Font`]: iced::Font + /// [`Text`]: iced::widget::Text #[allow(clippy::needless_pass_by_value)] #[must_use] pub fn font(mut self, font: Renderer::Font) -> Self { diff --git a/src/widgets/overlay/color_picker.rs b/src/widget/overlay/color_picker.rs similarity index 98% rename from src/widgets/overlay/color_picker.rs rename to src/widget/overlay/color_picker.rs index 55960522..4b98f01d 100644 --- a/src/widgets/overlay/color_picker.rs +++ b/src/widget/overlay/color_picker.rs @@ -48,7 +48,7 @@ const HUE_STEP: i32 = 1; /// The step value of the keyboard change of the RGBA color values. const RGBA_STEP: i16 = 1; -/// The overlay of the [`ColorPicker`](crate::widgets::ColorPicker). +/// The overlay of the [`ColorPicker`](crate::widget::ColorPicker). #[allow(missing_debug_implementations)] pub struct ColorPickerOverlay<'a, 'b, Message, Theme> where @@ -138,11 +138,11 @@ where let sat_value_bounds = hsv_color_children .next() - .expect("widgets: Layout should have a sat/value layout") + .expect("widget: Layout should have a sat/value layout") .bounds(); let hue_bounds = hsv_color_children .next() - .expect("widgets: Layout should have a hue layout") + .expect("widget: Layout should have a hue layout") .bounds(); match event { @@ -249,42 +249,42 @@ where let mut red_row_children = rgba_color_children .next() - .expect("widgets: Layout should have a red row layout") + .expect("widget: Layout should have a red row layout") .children(); let _ = red_row_children.next(); let red_bar_bounds = red_row_children .next() - .expect("widgets: Layout should have a red bar layout") + .expect("widget: Layout should have a red bar layout") .bounds(); let mut green_row_children = rgba_color_children .next() - .expect("widgets: Layout should have a green row layout") + .expect("widget: Layout should have a green row layout") .children(); let _ = green_row_children.next(); let green_bar_bounds = green_row_children .next() - .expect("widgets: Layout should have a green bar layout") + .expect("widget: Layout should have a green bar layout") .bounds(); let mut blue_row_children = rgba_color_children .next() - .expect("widgets: Layout should have a blue row layout") + .expect("widget: Layout should have a blue row layout") .children(); let _ = blue_row_children.next(); let blue_bar_bounds = blue_row_children .next() - .expect("widgets: Layout should have a blue bar layout") + .expect("widget: Layout should have a blue bar layout") .bounds(); let mut alpha_row_children = rgba_color_children .next() - .expect("widgets: Layout should have an alpha row layout") + .expect("widget: Layout should have an alpha row layout") .children(); let _ = alpha_row_children.next(); let alpha_bar_bounds = alpha_row_children .next() - .expect("widgets: Layout should have an alpha bar layout") + .expect("widget: Layout should have an alpha bar layout") .bounds(); match event { @@ -630,20 +630,20 @@ where // ----------- Block 1 ---------------------- let block1_layout = children .next() - .expect("widgets: Layout should have a 1. block layout"); + .expect("widget: Layout should have a 1. block layout"); let hsv_color_status = self.on_event_hsv_color(&event, block1_layout, cursor); // ----------- Block 1 end ------------------ // ----------- Block 2 ---------------------- let mut block2_children = children .next() - .expect("widgets: Layout should have a 2. block layout") + .expect("widget: Layout should have a 2. block layout") .children(); // ----------- RGB Color ----------------------- let rgba_color_layout = block2_children .next() - .expect("widgets: Layout should have a RGBA color layout"); + .expect("widget: Layout should have a RGBA color layout"); let rgba_color_status = self.on_event_rgba_color(&event, rgba_color_layout, cursor); let mut fake_messages: Vec = Vec::new(); @@ -651,12 +651,12 @@ where // ----------- Text input ---------------------- let _text_input_layout = block2_children .next() - .expect("widgets: Layout should have a hex text layout"); + .expect("widget: Layout should have a hex text layout"); // ----------- Buttons ------------------------- let cancel_button_layout = block2_children .next() - .expect("widgets: Layout should have a cancel button layout for a ColorPicker"); + .expect("widget: Layout should have a cancel button layout for a ColorPicker"); let cancel_button_status = self.cancel_button.on_event( &mut self.tree.children[0], event.clone(), @@ -670,7 +670,7 @@ where let submit_button_layout = block2_children .next() - .expect("widgets: Layout should have a submit button layout for a ColorPicker"); + .expect("widget: Layout should have a submit button layout for a ColorPicker"); let submit_button_status = self.submit_button.on_event( &mut self.tree.children[1], event, diff --git a/src/widgets/overlay/context_menu.rs b/src/widget/overlay/context_menu.rs similarity index 94% rename from src/widgets/overlay/context_menu.rs rename to src/widget/overlay/context_menu.rs index c72375dd..42f0d0e8 100644 --- a/src/widgets/overlay/context_menu.rs +++ b/src/widget/overlay/context_menu.rs @@ -20,7 +20,7 @@ use iced::{ touch, window, Border, Color, Element, Event, Point, Rectangle, Shadow, Size, }; -/// The overlay of the [`ContextMenu`](crate::widgets::ContextMenu). +/// The overlay of the [`ContextMenu`](crate::widget::ContextMenu). #[allow(missing_debug_implementations)] pub struct ContextMenuOverlay<'a, 'b, Message, Theme = iced::Theme, Renderer = iced::Renderer> where @@ -37,7 +37,7 @@ where content: Element<'a, Message, Theme, Renderer>, /// The style of the [`ContextMenuOverlay`]. class: &'a Theme::Class<'b>, - /// The state shared between [`ContextMenu`](crate::widgets::ContextMenu) and [`ContextMenuOverlay`]. + /// The state shared between [`ContextMenu`](crate::widget::ContextMenu) and [`ContextMenuOverlay`]. state: &'a mut context_menu::State, } @@ -137,7 +137,7 @@ where let content_layout = layout .children() .next() - .expect("widgets: Layout should have a content layout."); + .expect("widget: Layout should have a content layout."); // Modal self.content.as_widget().draw( @@ -163,7 +163,7 @@ where let layout_children = layout .children() .next() - .expect("widgets: Layout should have a content layout."); + .expect("widget: Layout should have a content layout."); let mut forward_event_to_children = true; @@ -237,7 +237,7 @@ where layout .children() .next() - .expect("widgets: Layout should have a content layout."), + .expect("widget: Layout should have a content layout."), cursor, viewport, renderer, diff --git a/src/widgets/overlay/date_picker.rs b/src/widget/overlay/date_picker.rs similarity index 97% rename from src/widgets/overlay/date_picker.rs rename to src/widget/overlay/date_picker.rs index 04225035..2bf441aa 100644 --- a/src/widgets/overlay/date_picker.rs +++ b/src/widget/overlay/date_picker.rs @@ -52,7 +52,7 @@ const DAY_CELL_PADDING: Padding = Padding::new(7.0); /// The spacing between the buttons. const BUTTON_SPACING: Pixels = Pixels(5.0); -/// The overlay of the [`DatePicker`](crate::widgets::DatePicker). +/// The overlay of the [`DatePicker`](crate::widget::DatePicker). #[allow(missing_debug_implementations)] pub struct DatePickerOverlay<'a, 'b, Message, Theme> where @@ -154,20 +154,20 @@ where // ----------- Month ---------------------- let month_layout = children .next() - .expect("widgets: Layout should have a month layout"); + .expect("widget: Layout should have a month layout"); let mut month_children = month_layout.children(); let left_bounds = month_children .next() - .expect("widgets: Layout should have a left month arrow layout") + .expect("widget: Layout should have a left month arrow layout") .bounds(); let _center_bounds = month_children .next() - .expect("widgets: Layout should have a center month layout") + .expect("widget: Layout should have a center month layout") .bounds(); let right_bounds = month_children .next() - .expect("widgets: Layout should have a right month arrow layout") + .expect("widget: Layout should have a right month arrow layout") .bounds(); match event { @@ -191,20 +191,20 @@ where // ----------- Year ----------------------- let year_layout = children .next() - .expect("widgets: Layout should have a year layout"); + .expect("widget: Layout should have a year layout"); let mut year_children = year_layout.children(); let left_bounds = year_children .next() - .expect("widgets: Layout should have a left year arrow layout") + .expect("widget: Layout should have a left year arrow layout") .bounds(); let _center_bounds = year_children .next() - .expect("widgets: Layout should have a center year layout") + .expect("widget: Layout should have a center year layout") .bounds(); let right_bounds = year_children .next() - .expect("widgets: Layout should have a right year arrow layout") + .expect("widget: Layout should have a right year arrow layout") .bounds(); match event { @@ -239,7 +239,7 @@ where let _day_labels_layout = children .next() - .expect("widgets: Layout should have a day label layout"); + .expect("widget: Layout should have a day label layout"); let mut status = event::Status::Ignored; @@ -562,28 +562,28 @@ where let mut date_children = children .next() - .expect("widgets: Layout should have date children") + .expect("widget: Layout should have date children") .children(); // ----------- Year/Month---------------------- let month_year_layout = date_children .next() - .expect("widgets: Layout should have a month/year layout"); + .expect("widget: Layout should have a month/year layout"); let month_year_status = self.on_event_month_year(&event, month_year_layout, cursor); // ----------- Days ---------------------- let days_layout = date_children .next() - .expect("widgets: Layout should have a days table parent") + .expect("widget: Layout should have a days table parent") .children() .next() - .expect("widgets: Layout should have a days table layout"); + .expect("widget: Layout should have a days table layout"); let days_status = self.on_event_days(&event, days_layout, cursor); // ----------- Buttons ------------------------ let cancel_button_layout = children .next() - .expect("widgets: Layout should have a cancel button layout for a DatePicker"); + .expect("widget: Layout should have a cancel button layout for a DatePicker"); let cancel_status = self.cancel_button.on_event( &mut self.tree.children[0], @@ -598,7 +598,7 @@ where let submit_button_layout = children .next() - .expect("widgets: Layout should have a submit button layout for a DatePicker"); + .expect("widget: Layout should have a submit button layout for a DatePicker"); let mut fake_messages: Vec = Vec::new(); diff --git a/src/widgets/overlay/mod.rs b/src/widget/overlay/mod.rs similarity index 90% rename from src/widgets/overlay/mod.rs rename to src/widget/overlay/mod.rs index d6ccbced..1e2cbf9f 100644 --- a/src/widgets/overlay/mod.rs +++ b/src/widget/overlay/mod.rs @@ -1,4 +1,4 @@ -//! Display interactive elements on top of other widgets. +//! Display interactive elements on top of other widget. #[cfg(feature = "color_picker")] pub mod color_picker; diff --git a/src/widgets/overlay/time_picker.rs b/src/widget/overlay/time_picker.rs similarity index 98% rename from src/widgets/overlay/time_picker.rs rename to src/widget/overlay/time_picker.rs index ec8e914a..e1919867 100644 --- a/src/widgets/overlay/time_picker.rs +++ b/src/widget/overlay/time_picker.rs @@ -69,7 +69,7 @@ const NUMBER_SIZE_PERCENTAGE: f32 = 0.15; /// The percentage size of the period. const PERIOD_SIZE_PERCENTAGE: f32 = 0.2; -/// The overlay of the [`TimePicker`](crate::widgets::TimePicker). +/// The overlay of the [`TimePicker`](crate::widget::TimePicker). #[allow(missing_debug_implementations)] pub struct TimePickerOverlay<'a, 'b, Message, Theme> where @@ -328,31 +328,31 @@ where let hour_layout = digital_clock_children .next() - .expect("widgets: Layout should have a hour layout"); + .expect("widget: Layout should have a hour layout"); let mut hour_children = hour_layout.children(); let hour_up_arrow = hour_children .next() - .expect("widgets: Layout should have an up arrow for hours"); + .expect("widget: Layout should have an up arrow for hours"); let _ = hour_children.next(); let hour_down_arrow = hour_children .next() - .expect("widgets: Layout should have a down arrow for hours"); + .expect("widget: Layout should have a down arrow for hours"); let _ = digital_clock_children.next(); let minute_layout = digital_clock_children .next() - .expect("widgets: Layout should have a minute layout"); + .expect("widget: Layout should have a minute layout"); let mut minute_children = minute_layout.children(); let minute_up_arrow = minute_children .next() - .expect("widgets: Layout should have an up arrow for minutes"); + .expect("widget: Layout should have an up arrow for minutes"); let _ = minute_children.next(); let minute_down_arrow = minute_children .next() - .expect("widgets: Layout should have a down arrow for minutes"); + .expect("widget: Layout should have a down arrow for minutes"); let calculate_time = |time: &mut NaiveTime, up_arrow: Layout<'_>, @@ -402,16 +402,16 @@ where let second_layout = digital_clock_children .next() - .expect("widgets: Layout should have a second layout"); + .expect("widget: Layout should have a second layout"); let mut second_children = second_layout.children(); let second_up_arrow = second_children .next() - .expect("widgets: Layout should have an up arrow for seconds"); + .expect("widget: Layout should have an up arrow for seconds"); let _ = second_children.next(); let second_down_arrow = second_children .next() - .expect("widgets: Layout should have a down arrow for seconds"); + .expect("widget: Layout should have a down arrow for seconds"); match event { Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)) @@ -624,23 +624,23 @@ where // Clock canvas let clock_layout = children .next() - .expect("widgets: Layout should have a clock canvas layout"); + .expect("widget: Layout should have a clock canvas layout"); let clock_status = self.on_event_clock(&event, clock_layout, cursor); // ----------- Digital clock ------------------ let digital_clock_layout = children .next() - .expect("widgets: Layout should have a digital clock parent") + .expect("widget: Layout should have a digital clock parent") .children() .next() - .expect("widgets: Layout should have a digital clock layout"); + .expect("widget: Layout should have a digital clock layout"); let digital_clock_status = self.on_event_digital_clock(&event, digital_clock_layout, cursor); // ----------- Buttons ------------------------ let cancel_button_layout = children .next() - .expect("widgets: Layout should have a cancel button layout for a TimePicker"); + .expect("widget: Layout should have a cancel button layout for a TimePicker"); let cancel_status = self.cancel_button.on_event( &mut self.tree.children[0], @@ -655,7 +655,7 @@ where let submit_button_layout = children .next() - .expect("widgets: Layout should have a submit button layout for a TimePicker"); + .expect("widget: Layout should have a submit button layout for a TimePicker"); let mut fake_messages: Vec = Vec::new(); diff --git a/src/widgets/quad.rs b/src/widget/quad.rs similarity index 98% rename from src/widgets/quad.rs rename to src/widget/quad.rs index c1bbf5ed..679d713e 100644 --- a/src/widgets/quad.rs +++ b/src/widget/quad.rs @@ -2,7 +2,7 @@ //! //! *This API requires the following crate features to be activated: `quad`* -use crate::widgets::InnerBounds; +use crate::widget::InnerBounds; use iced::{ advanced::{ layout::{Limits, Node}, diff --git a/src/widgets/selection_list.rs b/src/widget/selection_list.rs similarity index 99% rename from src/widgets/selection_list.rs rename to src/widget/selection_list.rs index 27ee8082..7949bb90 100644 --- a/src/widgets/selection_list.rs +++ b/src/widget/selection_list.rs @@ -349,7 +349,7 @@ pub struct State { } impl State

{ - /// Creates a new [`State`], representing an unfocused [`TextInput`]. + /// Creates a new [`State`], representing an unfocused [`TextInput`](iced::widget::TextInput). pub fn new(options: &[T]) -> Self where T: Clone + Display + Eq + Hash, diff --git a/src/widgets/selection_list/list.rs b/src/widget/selection_list/list.rs similarity index 100% rename from src/widgets/selection_list/list.rs rename to src/widget/selection_list/list.rs diff --git a/src/widgets/sidebar.rs b/src/widget/sidebar.rs similarity index 82% rename from src/widgets/sidebar.rs rename to src/widget/sidebar.rs index de90e9a2..f59e3b3d 100644 --- a/src/widgets/sidebar.rs +++ b/src/widget/sidebar.rs @@ -1,4 +1,4 @@ -//! Contains the sidebar related widgets and data enums. +//! Contains the sidebar related widget and data enums. #[allow(clippy::module_inception)] pub mod sidebar; diff --git a/src/widgets/sidebar/column.rs b/src/widget/sidebar/column.rs similarity index 93% rename from src/widgets/sidebar/column.rs rename to src/widget/sidebar/column.rs index 539b93ae..765606f2 100644 --- a/src/widgets/sidebar/column.rs +++ b/src/widget/sidebar/column.rs @@ -36,19 +36,19 @@ impl<'a, Message: 'a, Theme: 'a, Renderer> FlushColumn<'a, Message, Theme, Rende where Renderer: iced::advanced::Renderer + 'a, { - /// Creates an empty [`Column`]. + /// Creates an empty [`FlushColumn`]. #[must_use] pub fn new() -> Self { Self::from_vec(Vec::new()) } - /// Creates a [`Column`] with the given capacity. + /// Creates a [`FlushColumn`] with the given capacity. #[must_use] pub fn with_capacity(capacity: usize) -> Self { Self::from_vec(Vec::with_capacity(capacity)) } - /// Creates a [`Column`] with the given elements. + /// Creates a [`FlushColumn`] with the given elements. #[must_use] pub fn with_children( children: impl IntoIterator>, @@ -57,13 +57,13 @@ where Self::with_capacity(iterator.size_hint().0).extend(iterator) } - /// Creates a [`Column`] from an already allocated [`Vec`]. + /// Creates a [`FlushColumn`] from an already allocated [`Vec`]. /// - /// Keep in mind that the [`Column`] will not inspect the [`Vec`], which means + /// Keep in mind that the [`FlushColumn`] will not inspect the [`Vec`], which means /// it won't automatically adapt to the sizing strategy of its contents. /// /// If any of the children have a [`Length::Fill`] strategy, you will need to - /// call [`Column::width`] or [`Column::height`] accordingly. + /// call [`FlushColumn::width`] or [`FlushColumn::height`] accordingly. #[must_use] pub fn from_vec(children: Vec>) -> Self { let children = children @@ -94,42 +94,42 @@ where self } - /// Sets the [`Padding`] of the [`Column`]. + /// Sets the [`Padding`] of the [`FlushColumn`]. #[must_use] pub fn padding>(mut self, padding: P) -> Self { self.padding = padding.into(); self } - /// Sets the width of the [`Column`]. + /// Sets the width of the [`FlushColumn`]. #[must_use] pub fn width(mut self, width: impl Into) -> Self { self.width = width.into(); self } - /// Sets the height of the [`Column`]. + /// Sets the height of the [`FlushColumn`]. #[must_use] pub fn height(mut self, height: impl Into) -> Self { self.height = height.into(); self } - /// Sets the maximum width of the [`Column`]. + /// Sets the maximum width of the [`FlushColumn`]. #[must_use] pub fn max_width(mut self, max_width: impl Into) -> Self { self.max_width = max_width.into().0; self } - /// Sets the horizontal alignment of the contents of the [`Column`] . + /// Sets the horizontal alignment of the contents of the [`FlushColumn`] . #[must_use] pub fn align_x(mut self, align: impl Into) -> Self { self.align = Alignment::from(align.into()); self } - /// Sets whether the contents of the [`Column`] should be clipped on + /// Sets whether the contents of the [`FlushColumn`] should be clipped on /// overflow. #[must_use] pub fn clip(mut self, clip: bool) -> Self { @@ -146,7 +146,7 @@ where self } - /// Adds an element to the [`Column`]. + /// Adds an element to the [`FlushColumn`]. #[must_use] pub fn push(mut self, child: impl Into>) -> Self { let child = child.into(); @@ -157,7 +157,7 @@ where self } - /// Adds an element to the [`Column`], if `Some`. + /// Adds an element to the [`FlushColumn`], if `Some`. #[must_use] pub fn push_maybe(self, child: Option>>) -> Self { if let Some(child) = child { @@ -167,7 +167,7 @@ where } } - /// Extends the [`Column`] with the given children. + /// Extends the [`FlushColumn`] with the given children. #[must_use] pub fn extend( self, diff --git a/src/widgets/sidebar/row.rs b/src/widget/sidebar/row.rs similarity index 93% rename from src/widgets/sidebar/row.rs rename to src/widget/sidebar/row.rs index 5e7ee6bf..54450f1e 100644 --- a/src/widgets/sidebar/row.rs +++ b/src/widget/sidebar/row.rs @@ -36,19 +36,19 @@ impl<'a, Message: 'a, Theme: 'a, Renderer> FlushRow<'a, Message, Theme, Renderer where Renderer: iced::advanced::Renderer + 'a, { - /// Creates an empty [`Row`]. + /// Creates an empty [`FlushRow`]. #[must_use] pub fn new() -> Self { Self::from_vec(Vec::new()) } - /// Creates a [`Row`] with the given capacity. + /// Creates a [`FlushRow`] with the given capacity. #[must_use] pub fn with_capacity(capacity: usize) -> Self { Self::from_vec(Vec::with_capacity(capacity)) } - /// Creates a [`Row`] with the given elements. + /// Creates a [`FlushRow`] with the given elements. #[must_use] pub fn with_children( children: impl IntoIterator>, @@ -57,13 +57,13 @@ where Self::with_capacity(iterator.size_hint().0).extend(iterator) } - /// Creates a [`Row`] from an already allocated [`Vec`]. + /// Creates a [`FlushRow`] from an already allocated [`Vec`]. /// - /// Keep in mind that the [`Row`] will not inspect the [`Vec`], which means + /// Keep in mind that the [`FlushRow`] will not inspect the [`Vec`], which means /// it won't automatically adapt to the sizing strategy of its contents. /// /// If any of the children have a [`Length::Fill`] strategy, you will need to - /// call [`Row::width`] or [`Row::height`] accordingly. + /// call [`FlushRow::width`] or [`FlushRow::height`] accordingly. #[must_use] pub fn from_vec(children: Vec>) -> Self { let children = children @@ -94,42 +94,42 @@ where self } - /// Sets the [`Padding`] of the [`Row`]. + /// Sets the [`Padding`] of the [`FlushRow`]. #[must_use] pub fn padding>(mut self, padding: P) -> Self { self.padding = padding.into(); self } - /// Sets the width of the [`Row`]. + /// Sets the width of the [`FlushRow`]. #[must_use] pub fn width(mut self, width: impl Into) -> Self { self.width = width.into(); self } - /// Sets the height of the [`Row`]. + /// Sets the height of the [`FlushRow`]. #[must_use] pub fn height(mut self, height: impl Into) -> Self { self.height = height.into(); self } - /// Sets the maximum width of the [`Row`]. + /// Sets the maximum width of the [`FlushRow`]. #[must_use] pub fn max_height(mut self, max_height: impl Into) -> Self { self.max_height = max_height.into().0; self } - /// Sets the horizontal alignment of the contents of the [`Row`] . + /// Sets the horizontal alignment of the contents of the [`FlushRow`] . #[must_use] pub fn align_y(mut self, align: impl Into) -> Self { self.align = Alignment::from(align.into()); self } - /// Sets whether the contents of the [`Row`] should be clipped on + /// Sets whether the contents of the [`FlushRow`] should be clipped on /// overflow. #[must_use] pub fn clip(mut self, clip: bool) -> Self { @@ -146,7 +146,7 @@ where self } - /// Adds an element to the [`Row`]. + /// Adds an element to the [`FlushRow`]. #[must_use] pub fn push(mut self, child: impl Into>) -> Self { let child = child.into(); @@ -157,7 +157,7 @@ where self } - /// Adds an element to the [`Row`], if `Some`. + /// Adds an element to the [`FlushRow`], if `Some`. #[must_use] pub fn push_maybe( self, @@ -170,7 +170,7 @@ where } } - /// Extends the [`Row`] with the given children. + /// Extends the [`FlushRow`] with the given children. #[must_use] pub fn extend( self, diff --git a/src/widgets/sidebar/sidebar.rs b/src/widget/sidebar/sidebar.rs similarity index 96% rename from src/widgets/sidebar/sidebar.rs rename to src/widget/sidebar/sidebar.rs index 9cc12292..3ca41ece 100644 --- a/src/widgets/sidebar/sidebar.rs +++ b/src/widget/sidebar/sidebar.rs @@ -50,7 +50,7 @@ const DEFAULT_PADDING: Padding = Padding::new(1.0); const DEFAULT_SPACING: Pixels = Pixels::ZERO; /// A [`TabLabel`] showing an icon and/or a text on a tab -/// on a [`TabBar`](super::TabBar). +/// on a [`Sidebar`]. #[allow(missing_debug_implementations)] #[derive(Clone, Hash)] pub enum TabLabel { @@ -176,7 +176,7 @@ where Self::with_tab_labels(Vec::new(), on_select) } - /// Similar to `new` but with a given Vector of the [`TabLabel`](crate::sidebar::TabLabel)s. + /// Similar to `new` but with a given Vector of the [`TabLabel`]s. /// /// It expects: /// * the index of the currently active tab. @@ -219,7 +219,7 @@ where } /// Sets the size of the close icon of the - /// [`TabLabel`](crate::sidebar::TabLabel)s of the [`Sidebar`]. + /// [`TabLabel`]s of the [`Sidebar`]. #[must_use] pub fn close_size(mut self, close_size: f32) -> Self { self.close_size = close_size; @@ -258,14 +258,14 @@ where } /// Sets the font of the icons of the - /// [`TabLabel`](crate::sidebar::TabLabel)s of the [`Sidebar`]. + /// [`TabLabel`]s of the [`Sidebar`]. #[must_use] pub fn icon_font(mut self, font: Font) -> Self { self.font = Some(font); self } - /// Sets the icon size of the [`TabLabel`](crate::sidebar::TabLabel)s of the [`Sidebar`]. + /// Sets the icon size of the [`TabLabel`]s of the [`Sidebar`]. #[must_use] pub fn icon_size(mut self, icon_size: f32) -> Self { self.icon_size = icon_size; @@ -292,7 +292,7 @@ where self } - /// Pushes a [`TabLabel`](crate::sidebar::TabLabel) to the [`Sidebar`]. + /// Pushes a [`TabLabel`] to the [`Sidebar`]. #[must_use] pub fn push(mut self, id: TabId, tab_label: TabLabel) -> Self { self.tab_labels.push(tab_label); @@ -314,14 +314,14 @@ where } /// Sets the font of the text of the - /// [`TabLabel`](crate::sidebar::TabLabel)s of the [`Sidebar`]. + /// [`TabLabel`]s of the [`Sidebar`]. #[must_use] pub fn text_font(mut self, text_font: Font) -> Self { self.text_font = Some(text_font); self } - /// Sets the text size of the [`TabLabel`](crate::sidebar::TabLabel)s of the [`Sidebar`]. + /// Sets the text size of the [`TabLabel`]s of the [`Sidebar`]. #[must_use] pub fn text_size(mut self, text_size: f32) -> Self { self.text_size = text_size; @@ -546,8 +546,8 @@ where self.on_close .as_ref() .filter(|_on_close| { - let tab_layout = layout.children().nth(new_selected).expect("widgets: Layout should have a tab layout at the selected index"); - let cross_layout = tab_layout.children().nth(1).expect("widgets: Layout should have a close layout"); + let tab_layout = layout.children().nth(new_selected).expect("widget: Layout should have a tab layout at the selected index"); + let cross_layout = tab_layout.children().nth(1).expect("widget: Layout should have a close layout"); cursor.position().map_or(false, |pos| cross_layout.bounds().contains(pos) ) }) @@ -1000,7 +1000,7 @@ where } /// Similar to `new` but with a given Vector of the - /// [`TabLabel`](super::sidebar::TabLabel) along with the tab's content. + /// [`TabLabel`] along with the tab's content. /// /// It expects: /// * the index of the currently active tab. @@ -1034,8 +1034,8 @@ where } /// Sets the size of the close icon of the - /// [`TabLabel`](super::sidebar::TabLabel) of the - /// [`Sidebar`](super::sidebar::Sidebar). + /// [`TabLabel`] of the + /// [`Sidebar`]. #[must_use] pub fn close_size(mut self, close_size: f32) -> Self { self.sidebar = self.sidebar.close_size(close_size); @@ -1050,8 +1050,8 @@ where } /// Sets the Icon render Position for the - /// [`TabLabel`](super::sidebar::TabLabel) of the - /// [`Sidebar`](super::sidebar::Sidebar). + /// [`TabLabel`] of the + /// [`Sidebar`]. #[must_use] pub fn tab_icon_position(mut self, position: Position) -> Self { self.sidebar = self.sidebar.set_position(position); @@ -1059,7 +1059,7 @@ where } /// Sets the close icon render Position for the tab of the - /// [`Sidebar`](super::sidebar::Sidebar). + /// [`Sidebar`]. #[must_use] pub fn close_icon_position(mut self, position: Position) -> Self { self.sidebar = self.sidebar.set_close_position(position); @@ -1074,16 +1074,16 @@ where } /// Sets the font of the icons of the - /// [`TabLabel`](super::sidebar::TabLabel)s of the - /// [`Sidebar`](super::sidebar::Sidebar). + /// [`TabLabel`]s of the + /// [`Sidebar`]. #[must_use] pub fn icon_font(mut self, font: Font) -> Self { self.sidebar = self.sidebar.icon_font(font); self } - /// Sets the icon size of the [`TabLabel`](super::sidebar::TabLabel) of the - /// [`Sidebar`](super::sidebar::Sidebar). + /// Sets the icon size of the [`TabLabel`] of the + /// [`Sidebar`]. #[must_use] pub fn icon_size(mut self, icon_size: f32) -> Self { self.sidebar = self.sidebar.icon_size(icon_size); @@ -1103,7 +1103,7 @@ where self } - /// Pushes a [`TabLabel`](super::sidebar::TabLabel) along with the tabs + /// Pushes a [`TabLabel`] along with the tabs /// content to the [`SidebarWithContent`]. #[must_use] pub fn push(mut self, id: TabId, tab_label: TabLabel, element: E) -> Self @@ -1123,28 +1123,28 @@ where self } - /// Sets the height of the [`Sidebar`](super::sidebar::Sidebar) of the [`SidebarWithContent`]. + /// Sets the height of the [`Sidebar`] of the [`SidebarWithContent`]. #[must_use] pub fn sidebar_height(mut self, height: Length) -> Self { self.sidebar = self.sidebar.height(height); self } - /// Sets the width of the [`Sidebar`](super::sidebar::Sidebar) of the [`SidebarWithContent`]. + /// Sets the width of the [`Sidebar`] of the [`SidebarWithContent`]. #[must_use] pub fn sidebar_width(mut self, width: Length) -> Self { self.sidebar = self.sidebar.width(width); self } - /// Sets the [`SidebarPosition`] of the [`Sidebar`](super::sidebar::Sidebar). + /// Sets the [`SidebarPosition`] of the [`Sidebar`]. #[must_use] pub fn sidebar_position(mut self, position: SidebarPosition) -> Self { self.sidebar_position = position; self } - /// Sets the style of the [`Sidebar`](super::sidebar::Sidebar). + /// Sets the style of the [`Sidebar`]. #[must_use] pub fn sidebar_style(mut self, style: impl Fn(&Theme, Status) -> Style + 'a) -> Self where @@ -1154,7 +1154,7 @@ where self } - /// Sets the padding of the tabs of the [`Sidebar`](super::sidebar::Sidebar). + /// Sets the padding of the tabs of the [`Sidebar`]. #[must_use] pub fn tab_label_padding(mut self, padding: impl Into) -> Self { self.sidebar = self.sidebar.padding(padding); @@ -1162,7 +1162,7 @@ where } /// Sets the spacing between the tabs of the - /// [`Sidebar`](super::sidebar::Sidebar). + /// [`Sidebar`]. #[must_use] pub fn tab_label_spacing(mut self, spacing: impl Into) -> Self { self.sidebar = self.sidebar.spacing(spacing); @@ -1170,16 +1170,16 @@ where } /// Sets the font of the text of the - /// [`TabLabel`](super::sidebar::TabLabel)s of the - /// [`Sidebar`](super::sidebar::Sidebar). + /// [`TabLabel`]s of the + /// [`Sidebar`]. #[must_use] pub fn text_font(mut self, text_font: Font) -> Self { self.sidebar = self.sidebar.text_font(text_font); self } - /// Sets the text size of the [`TabLabel`](super::sidebar::TabLabel) of the - /// [`Sidebar`](super::sidebar::Sidebar). + /// Sets the text size of the [`TabLabel`] of the + /// [`Sidebar`]. #[must_use] pub fn text_size(mut self, text_size: f32) -> Self { self.sidebar = self.sidebar.text_size(text_size); diff --git a/src/widgets/slide_bar.rs b/src/widget/slide_bar.rs similarity index 94% rename from src/widgets/slide_bar.rs rename to src/widget/slide_bar.rs index 0efb0e19..e80f05f4 100644 --- a/src/widgets/slide_bar.rs +++ b/src/widget/slide_bar.rs @@ -16,7 +16,7 @@ use iced::{ use std::ops::RangeInclusive; -/// Constant Default height of `SliderBar`. +/// Constant Default height of `SlideBar`. pub const DEFAULT_HEIGHT: f32 = 30.0; /// A widget that draws a `SlideBar` @@ -56,13 +56,13 @@ where T: Copy + From + std::cmp::PartialOrd, Message: Clone, { - /// Creates a new [`SliderBar`]. + /// Creates a new [`SlideBar`]. /// /// It expects: /// * an inclusive range of possible values - /// * the current value of the [`SliderBar`] - /// * a function that will be called when the [`SliderBar`] is dragged. - /// * the new value of the [`SliderBar`] and must produce a `Message`. + /// * the current value of the [`SlideBar`] + /// * a function that will be called when the [`SlideBar`] is dragged. + /// * the new value of the [`SlideBar`] and must produce a `Message`. /// pub fn new(range: RangeInclusive, value: T, on_change: F) -> Self where @@ -96,7 +96,7 @@ where } } - /// Sets the release message of the [`Slider`]. + /// Sets the release message of the [`SlideBar`]. /// This is called when the mouse is released from the slider. /// /// Typically, the user's interaction with the slider is finished when this message is produced. @@ -108,21 +108,21 @@ where self } - /// Sets the width of the [`Slider`]. + /// Sets the width of the [`SlideBar`]. #[must_use] pub fn width(mut self, width: impl Into) -> Self { self.width = width.into(); self } - /// Sets the height of the [`Slider`]. + /// Sets the height of the [`SlideBar`]. #[must_use] pub fn height(mut self, height: Option) -> Self { self.height = height; self } - /// Sets the step size of the [`Slider`]. + /// Sets the step size of the [`SlideBar`]. #[must_use] pub fn step(mut self, step: impl Into) -> Self { self.step = step.into(); @@ -204,7 +204,7 @@ where } } -/// Processes an [`Event`] and updates the [`State`] of a [`SliderBar`] +/// Processes an [`Event`] and updates the [`State`] of a [`SlideBar`] /// accordingly. #[allow(clippy::too_many_arguments)] pub fn update( @@ -290,7 +290,7 @@ where event::Status::Ignored } -/// Draws a [`SliderBar`]. +/// Draws a [`SlideBar`]. pub fn draw( renderer: &mut R, layout: Layout<'_>, @@ -367,7 +367,7 @@ where } } -/// The local state of a [`SliderBar`]. +/// The local state of a [`SlideBar`]. #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] pub struct State { is_dragging: bool, diff --git a/src/widgets/spinner.rs b/src/widget/spinner.rs similarity index 100% rename from src/widgets/spinner.rs rename to src/widget/spinner.rs diff --git a/src/widgets/tab_bar.rs b/src/widget/tab_bar.rs similarity index 97% rename from src/widgets/tab_bar.rs rename to src/widget/tab_bar.rs index 0ca2683f..f0276a0f 100644 --- a/src/widgets/tab_bar.rs +++ b/src/widget/tab_bar.rs @@ -153,7 +153,7 @@ where Self::with_tab_labels(Vec::new(), on_select) } - /// Similar to `new` but with a given Vector of the [`TabLabel`](crate::tab_bar::TabLabel)s. + /// Similar to [`new`](Self::new) but with a given Vector of the [`TabLabel`]s. /// /// It expects: /// * the index of the currently active tab. @@ -188,7 +188,7 @@ where } /// Sets the size of the close icon of the - /// [`TabLabel`](crate::tab_bar::TabLabel)s of the [`TabBar`]. + /// [`TabLabel`]s of the [`TabBar`]. #[must_use] pub fn close_size(mut self, close_size: f32) -> Self { self.close_size = close_size; @@ -227,14 +227,14 @@ where } /// Sets the font of the icons of the - /// [`TabLabel`](crate::tab_bar::TabLabel)s of the [`TabBar`]. + /// [`TabLabel`]s of the [`TabBar`]. #[must_use] pub fn icon_font(mut self, font: Font) -> Self { self.font = Some(font); self } - /// Sets the icon size of the [`TabLabel`](crate::tab_bar::TabLabel)s of the [`TabBar`]. + /// Sets the icon size of the [`TabLabel`]s of the [`TabBar`]. #[must_use] pub fn icon_size(mut self, icon_size: f32) -> Self { self.icon_size = icon_size; @@ -268,7 +268,7 @@ where self } - /// Pushes a [`TabLabel`](crate::tab_bar::TabLabel) to the [`TabBar`]. + /// Pushes a [`TabLabel`] to the [`TabBar`]. #[must_use] pub fn push(mut self, id: TabId, tab_label: TabLabel) -> Self { self.tab_labels.push(tab_label); @@ -290,14 +290,14 @@ where } /// Sets the font of the text of the - /// [`TabLabel`](crate::tab_bar::TabLabel)s of the [`TabBar`]. + /// [`TabLabel`]s of the [`TabBar`]. #[must_use] pub fn text_font(mut self, text_font: Font) -> Self { self.text_font = Some(text_font); self } - /// Sets the text size of the [`TabLabel`](crate::tab_bar::TabLabel)s of the [`TabBar`]. + /// Sets the text size of the [`TabLabel`]s of the [`TabBar`]. #[must_use] pub fn text_size(mut self, text_size: f32) -> Self { self.text_size = text_size; @@ -556,8 +556,8 @@ where self.on_close .as_ref() .filter(|_on_close| { - let tab_layout = layout.children().nth(new_selected).expect("widgets: Layout should have a tab layout at the selected index"); - let cross_layout = tab_layout.children().nth(1).expect("widgets: Layout should have a close layout"); + let tab_layout = layout.children().nth(new_selected).expect("widget: Layout should have a tab layout at the selected index"); + let cross_layout = tab_layout.children().nth(1).expect("widget: Layout should have a close layout"); cursor.position().map_or(false, |pos| cross_layout.bounds().contains(pos) ) }) diff --git a/src/widgets/tab_bar/tab_label.rs b/src/widget/tab_bar/tab_label.rs similarity index 100% rename from src/widgets/tab_bar/tab_label.rs rename to src/widget/tab_bar/tab_label.rs diff --git a/src/widgets/tabs.rs b/src/widget/tabs.rs similarity index 88% rename from src/widgets/tabs.rs rename to src/widget/tabs.rs index ce594158..32a12fea 100644 --- a/src/widgets/tabs.rs +++ b/src/widget/tabs.rs @@ -1,7 +1,7 @@ //! Displays a [`Tabs`] widget to select the content to be displayed. //! -//! This is a wrapper around the [`TabBar`](super::tab_bar::TabBar) widget. -//! Unlike the [`TabBar`](super::tab_bar::TabBar) widget it will also handle +//! This is a wrapper around the [`TabBar`] widget. +//! Unlike the [`TabBar`] widget it will also handle //! the content of the tabs. //! //! *This API requires the following crate features to be activated: tabs* @@ -13,7 +13,7 @@ use crate::{ tab_bar::{Catalog, Style}, Status, StyleFn, }, - widgets::tab_bar::TabBar, + widget::tab_bar::TabBar, TabLabel, }; @@ -35,7 +35,7 @@ use iced::{ pub use tab_bar_position::TabBarPosition; -/// A [`Tabs`] widget for showing a [`TabBar`](super::tab_bar::TabBar) +/// A [`Tabs`] widget for showing a [`TabBar`] /// along with the tab's content. /// /// # Example @@ -69,15 +69,15 @@ where Theme: Catalog, TabId: Eq + Clone, { - /// The [`TabBar`](crate::widgets::TabBar) of the [`Tabs`]. + /// The [`TabBar`](crate::widget::TabBar) of the [`Tabs`]. tab_bar: TabBar<'a, Message, TabId, Theme, Renderer>, /// The vector containing the content of the tabs. tabs: Vec>, /// The vector containing the indices of the tabs. indices: Vec, - /// The position of the [`TabBar`](crate::widgets::TabBar). + /// The position of the [`TabBar`](crate::widget::TabBar). tab_bar_position: TabBarPosition, - /// The position of the [`TabBar`](crate::widgets::TabBar) Icon. + /// The position of the [`TabBar`](crate::widget::TabBar) Icon. tab_icon_position: Position, /// the width of the [`Tabs`]. width: Length, @@ -106,7 +106,7 @@ where } /// Similar to `new` but with a given Vector of the - /// [`TabLabel`](super::tab_bar::TabLabel) along with the tab's content. + /// [`TabLabel`] along with the tab's content. /// /// It expects: /// * the index of the currently active tab. @@ -146,8 +146,8 @@ where } /// Sets the size of the close icon of the - /// [`TabLabel`](super::tab_bar::TabLabel) of the - /// [`TabBar`](super::tab_bar::TabBar). + /// [`TabLabel`] of the + /// [`TabBar`]. #[must_use] pub fn close_size(mut self, close_size: f32) -> Self { self.tab_bar = self.tab_bar.close_size(close_size); @@ -155,8 +155,8 @@ where } /// Sets the Tabs Icon render Position - /// [`TabLabel`](super::tab_bar::TabLabel) of the - /// [`TabBar`](super::tab_bar::TabBar). + /// [`TabLabel`] of the + /// [`TabBar`]. #[must_use] pub fn tab_icon_position(mut self, position: Position) -> Self { self.tab_icon_position = position; @@ -171,16 +171,16 @@ where } /// Sets the font of the icons of the - /// [`TabLabel`](super::tab_bar::TabLabel)s of the - /// [`TabBar`](super::tab_bar::TabBar). + /// [`TabLabel`]s of the + /// [`TabBar`]. #[must_use] pub fn icon_font(mut self, font: Font) -> Self { self.tab_bar = self.tab_bar.icon_font(font); self } - /// Sets the icon size of the [`TabLabel`](super::tab_bar::TabLabel) of the - /// [`TabBar`](super::tab_bar::TabBar). + /// Sets the icon size of the [`TabLabel`] of the + /// [`TabBar`]. #[must_use] pub fn icon_size(mut self, icon_size: f32) -> Self { self.tab_bar = self.tab_bar.icon_size(icon_size); @@ -200,7 +200,7 @@ where self } - /// Pushes a [`TabLabel`](super::tab_bar::TabLabel) along with the tabs + /// Pushes a [`TabLabel`] along with the tabs /// content to the [`Tabs`]. #[must_use] pub fn push(mut self, id: TabId, tab_label: TabLabel, element: E) -> Self @@ -223,35 +223,35 @@ where self } - /// Sets the height of the [`TabBar`](super::tab_bar::TabBar) of the [`Tabs`]. + /// Sets the height of the [`TabBar`] of the [`Tabs`]. #[must_use] pub fn tab_bar_height(mut self, height: Length) -> Self { self.tab_bar = self.tab_bar.height(height); self } - /// Sets the maximum height of the [`TabBar`](super::tab_bar::TabBar) of the [`Tabs`]. + /// Sets the maximum height of the [`TabBar`] of the [`Tabs`]. #[must_use] pub fn tab_bar_max_height(mut self, max_height: f32) -> Self { self.tab_bar = self.tab_bar.max_height(max_height); self } - /// Sets the width of the [`TabBar`](super::tab_bar::TabBar) of the [`Tabs`]. + /// Sets the width of the [`TabBar`] of the [`Tabs`]. #[must_use] pub fn tab_bar_width(mut self, width: Length) -> Self { self.tab_bar = self.tab_bar.width(width); self } - /// Sets the [`TabBarPosition`] of the [`TabBar`](super::tab_bar::TabBar). + /// Sets the [`TabBarPosition`] of the [`TabBar`]. #[must_use] pub fn tab_bar_position(mut self, position: TabBarPosition) -> Self { self.tab_bar_position = position; self } - /// Sets the style of the [`TabBar`](super::tab_bar::TabBar). + /// Sets the style of the [`TabBar`]. #[must_use] pub fn tab_bar_style(mut self, style: impl Fn(&Theme, Status) -> Style + 'a) -> Self where @@ -261,7 +261,7 @@ where self } - /// Sets the padding of the tabs of the [`TabBar`](super::tab_bar::TabBar). + /// Sets the padding of the tabs of the [`TabBar`]. #[must_use] pub fn tab_label_padding(mut self, padding: impl Into) -> Self { self.tab_bar = self.tab_bar.padding(padding); @@ -269,7 +269,7 @@ where } /// Sets the spacing between the tabs of the - /// [`TabBar`](super::tab_bar::TabBar). + /// [`TabBar`]. #[must_use] pub fn tab_label_spacing(mut self, spacing: impl Into) -> Self { self.tab_bar = self.tab_bar.spacing(spacing); @@ -277,16 +277,16 @@ where } /// Sets the font of the text of the - /// [`TabLabel`](super::tab_bar::TabLabel)s of the - /// [`TabBar`](super::tab_bar::TabBar). + /// [`TabLabel`]s of the + /// [`TabBar`]. #[must_use] pub fn text_font(mut self, text_font: Font) -> Self { self.tab_bar = self.tab_bar.text_font(text_font); self } - /// Sets the text size of the [`TabLabel`](super::tab_bar::TabLabel) of the - /// [`TabBar`](super::tab_bar::TabBar). + /// Sets the text size of the [`TabLabel`] of the + /// [`TabBar`]. #[must_use] pub fn text_size(mut self, text_size: f32) -> Self { self.tab_bar = self.tab_bar.text_size(text_size); @@ -411,19 +411,19 @@ where TabBarPosition::Top => { let tab_bar_layout = children .next() - .expect("widgets: Layout should have a TabBar layout at top position"); + .expect("widget: Layout should have a TabBar layout at top position"); let tab_content_layout = children .next() - .expect("widgets: Layout should have a tab content layout at top position"); + .expect("widget: Layout should have a tab content layout at top position"); (tab_bar_layout, tab_content_layout) } TabBarPosition::Bottom => { let tab_content_layout = children .next() - .expect("widgets: Layout should have a tab content layout at bottom position"); + .expect("widget: Layout should have a tab content layout at bottom position"); let tab_bar_layout = children .next() - .expect("widgets: Layout should have a TabBar layout at bottom position"); + .expect("widget: Layout should have a TabBar layout at bottom position"); (tab_bar_layout, tab_content_layout) } }; @@ -471,10 +471,10 @@ where let tab_bar_layout = match self.tab_bar_position { TabBarPosition::Top => children .next() - .expect("widgets: There should be a TabBar at the top position"), + .expect("widget: There should be a TabBar at the top position"), TabBarPosition::Bottom => children .last() - .expect("widgets: There should be a TabBar at the bottom position"), + .expect("widget: There should be a TabBar at the bottom position"), }; let mut mouse_interaction = mouse::Interaction::default(); @@ -532,10 +532,10 @@ where let tab_bar_layout = match self.tab_bar_position { TabBarPosition::Top => children .next() - .expect("widgets: There should be a TabBar at the top position"), + .expect("widget: There should be a TabBar at the top position"), TabBarPosition::Bottom => children .last() - .expect("widgets: There should be a TabBar at the bottom position"), + .expect("widget: There should be a TabBar at the bottom position"), }; self.tab_bar.draw( diff --git a/src/widgets/tabs/tab_bar_position.rs b/src/widget/tabs/tab_bar_position.rs similarity index 80% rename from src/widgets/tabs/tab_bar_position.rs rename to src/widget/tabs/tab_bar_position.rs index 206f3d1c..8b2c97f1 100644 --- a/src/widgets/tabs/tab_bar_position.rs +++ b/src/widget/tabs/tab_bar_position.rs @@ -1,16 +1,16 @@ -//! A [`TabBarPosition`] for defining the position of a [`TabBar`](crate::widgets::tab_bar::TabBar). +//! A [`TabBarPosition`] for defining the position of a [`TabBar`](crate::widget::tab_bar::TabBar). //! //! *This API requires the following crate features to be activated: tabs* -/// A [`TabBarPosition`] for defining the position of a [`TabBar`](crate::widgets::tab_bar::TabBar). +/// A [`TabBarPosition`] for defining the position of a [`TabBar`](crate::widget::tab_bar::TabBar). #[derive(Clone, Hash)] #[allow(missing_debug_implementations)] pub enum TabBarPosition { - /// A [`TabBarPosition`] for placing the [`TabBar`](crate::widgets::tab_bar::TabBar) + /// A [`TabBarPosition`] for placing the [`TabBar`](crate::widget::tab_bar::TabBar) /// on top of its content. Top, - /// A [`TabBarPosition`] for placing the [`TabBar`](crate::widgets::tab_bar::TabBar) + /// A [`TabBarPosition`] for placing the [`TabBar`](crate::widget::tab_bar::TabBar) /// on bottom of its content. Bottom, } diff --git a/src/widgets/time_picker.rs b/src/widget/time_picker.rs similarity index 98% rename from src/widgets/time_picker.rs rename to src/widget/time_picker.rs index 287a2901..1a34ea7c 100644 --- a/src/widgets/time_picker.rs +++ b/src/widget/time_picker.rs @@ -97,7 +97,7 @@ where /// will be wrapped around. /// * a message that will be send when the cancel button of the [`TimePicker`] is pressed. /// * a function that will be called when the submit button of the [`TimePicker`] - /// is pressed, which takes the picked [`Time`](crate::time_picker::Time) value. + /// is pressed, which takes the picked [`Time`] value. pub fn new( show_picker: bool, time: impl Into