summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-04-12 06:43:58 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-04-12 06:43:58 +0200
commitb505b7203563b8a75a65451f47a3386c50864e6d (patch)
tree28a65baa0ca11927c39300e2b4a4ebb986a4699a /examples
parent4fdd76c07c15f85a518c240aca0e55f482b18bc3 (diff)
downloadiced-b505b7203563b8a75a65451f47a3386c50864e6d.tar.gz
iced-b505b7203563b8a75a65451f47a3386c50864e6d.tar.bz2
iced-b505b7203563b8a75a65451f47a3386c50864e6d.zip
Move `radio` example to `Radio` docs
Diffstat (limited to 'examples')
-rw-r--r--examples/radio/Cargo.toml10
-rw-r--r--examples/radio/src/main.rs86
2 files changed, 0 insertions, 96 deletions
diff --git a/examples/radio/Cargo.toml b/examples/radio/Cargo.toml
deleted file mode 100644
index a8c7f351..00000000
--- a/examples/radio/Cargo.toml
+++ /dev/null
@@ -1,10 +0,0 @@
-[package]
-name = "radio"
-version = "0.1.0"
-authors = ["Aaron Honeycutt <aaronhoneycutt@proton.me>"]
-edition = "2021"
-
-# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
-
-[dependencies]
-iced = { path = "../.." }
diff --git a/examples/radio/src/main.rs b/examples/radio/src/main.rs
deleted file mode 100644
index 3b19924e..00000000
--- a/examples/radio/src/main.rs
+++ /dev/null
@@ -1,86 +0,0 @@
-use iced::widget::{column, container, radio};
-use iced::{Element, Length, Sandbox, Settings};
-
-pub fn main() -> iced::Result {
- Example::run(Settings::default())
-}
-
-#[derive(Default)]
-struct Example {
- radio: Option<Choice>,
-}
-
-#[derive(Debug, Clone, Copy)]
-enum Message {
- RadioSelected(Choice),
-}
-
-impl Sandbox for Example {
- type Message = Message;
-
- fn new() -> Self {
- Default::default()
- }
-
- fn title(&self) -> String {
- String::from("Radio - Iced")
- }
-
- fn update(&mut self, message: Message) {
- match message {
- Message::RadioSelected(value) => {
- self.radio = Some(value);
- }
- }
- }
-
- fn view(&self) -> Element<Message> {
- let a_checkbox = radio(
- "A",
- Choice::A,
- self.radio,
- Message::RadioSelected,
- );
-
- let b_checkbox = radio(
- "B",
- Choice::B,
- self.radio,
- Message::RadioSelected,
- );
-
- let c_checkbox = radio(
- "C",
- Choice::C,
- self.radio,
- Message::RadioSelected,
- );
-
- let all_checkbox = radio("All of the above", Choice::All, self.radio, Message::RadioSelected);
-
- let content = column![
- a_checkbox,
- b_checkbox,
- c_checkbox,
- all_checkbox,
- ]
- .spacing(20)
- .padding(20)
- .max_width(600);
-
- container(content)
- .width(Length::Fill)
- .height(Length::Fill)
- .center_x()
- .center_y()
- .into()
- }
-}
-
-#[derive(Debug, Clone, Copy, PartialEq, Eq)]
-enum Choice {
- A,
- B,
- C,
- All,
-}