summaryrefslogtreecommitdiffstats
path: root/examples/combo_box
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-07-10 02:50:47 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-07-10 02:52:00 +0200
commit73b8ae8e5e7f57c608c775272a2980995ab22bb3 (patch)
tree1315ae257af6598389750c392b0e52fd1a3cbf39 /examples/combo_box
parent2118a726f8b6134820e1ca5b7b802fa1344e453a (diff)
downloadiced-73b8ae8e5e7f57c608c775272a2980995ab22bb3.tar.gz
iced-73b8ae8e5e7f57c608c775272a2980995ab22bb3.tar.bz2
iced-73b8ae8e5e7f57c608c775272a2980995ab22bb3.zip
Rename `ComboBox` to `PickList`
Diffstat (limited to 'examples/combo_box')
-rw-r--r--examples/combo_box/Cargo.toml11
-rw-r--r--examples/combo_box/README.md18
-rw-r--r--examples/combo_box/src/main.rs121
3 files changed, 0 insertions, 150 deletions
diff --git a/examples/combo_box/Cargo.toml b/examples/combo_box/Cargo.toml
deleted file mode 100644
index 7e1e4133..00000000
--- a/examples/combo_box/Cargo.toml
+++ /dev/null
@@ -1,11 +0,0 @@
-[package]
-name = "combo_box"
-version = "0.1.0"
-authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
-edition = "2018"
-publish = false
-
-[dependencies]
-iced = { path = "../..", features = ["debug"] }
-iced_native = { path = "../../native" }
-iced_wgpu = { path = "../../wgpu" }
diff --git a/examples/combo_box/README.md b/examples/combo_box/README.md
deleted file mode 100644
index 4d9fc5b9..00000000
--- a/examples/combo_box/README.md
+++ /dev/null
@@ -1,18 +0,0 @@
-## Counter
-
-The classic counter example explained in the [`README`](../../README.md).
-
-The __[`main`]__ file contains all the code of the example.
-
-<div align="center">
- <a href="https://gfycat.com/fairdeadcatbird">
- <img src="https://thumbs.gfycat.com/FairDeadCatbird-small.gif">
- </a>
-</div>
-
-You can run it with `cargo run`:
-```
-cargo run --package counter
-```
-
-[`main`]: src/main.rs
diff --git a/examples/combo_box/src/main.rs b/examples/combo_box/src/main.rs
deleted file mode 100644
index 416e9f76..00000000
--- a/examples/combo_box/src/main.rs
+++ /dev/null
@@ -1,121 +0,0 @@
-use iced::{
- button, combo_box, scrollable, Align, Button, ComboBox, Container, Element,
- Length, Sandbox, Scrollable, Settings, Space, Text,
-};
-
-pub fn main() {
- Example::run(Settings::default())
-}
-
-#[derive(Default)]
-struct Example {
- scroll: scrollable::State,
- button: button::State,
- combo_box: combo_box::State,
- selected_language: Language,
-}
-
-#[derive(Debug, Clone, Copy)]
-enum Message {
- ButtonPressed,
- LanguageSelected(Language),
-}
-
-impl Sandbox for Example {
- type Message = Message;
-
- fn new() -> Self {
- Self::default()
- }
-
- fn title(&self) -> String {
- String::from("Combo box - Iced")
- }
-
- fn update(&mut self, message: Message) {
- match message {
- Message::ButtonPressed => {}
- Message::LanguageSelected(language) => {
- self.selected_language = language;
- }
- }
- }
-
- fn view(&mut self) -> Element<Message> {
- let combo_box = ComboBox::new(
- &mut self.combo_box,
- &Language::ALL[..],
- Some(self.selected_language),
- Message::LanguageSelected,
- );
-
- let button = Button::new(&mut self.button, Text::new("Press me!"))
- .on_press(Message::ButtonPressed);
-
- let mut content = Scrollable::new(&mut self.scroll)
- .width(Length::Fill)
- .align_items(Align::Center)
- .spacing(10)
- .push(Space::with_height(Length::Units(800)))
- .push(Text::new("Which is your favorite language?"))
- .push(combo_box);
-
- content = content
- .push(button)
- .push(Space::with_height(Length::Units(800)));
-
- Container::new(content)
- .width(Length::Fill)
- .height(Length::Fill)
- .center_x()
- .center_y()
- .into()
- }
-}
-
-#[derive(Debug, Clone, Copy, PartialEq, Eq)]
-pub enum Language {
- Rust,
- Elm,
- Ruby,
- Haskell,
- C,
- Javascript,
- Other,
-}
-
-impl Language {
- const ALL: [Language; 7] = [
- Language::C,
- Language::Elm,
- Language::Ruby,
- Language::Haskell,
- Language::Rust,
- Language::Javascript,
- Language::Other,
- ];
-}
-
-impl Default for Language {
- fn default() -> Language {
- Language::Rust
- }
-}
-
-impl std::fmt::Display for Language {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- write!(
- f,
- "{}",
- match self {
- Language::Rust => "Rust",
- Language::Elm => "Elm",
- Language::Ruby => "Ruby",
- Language::Haskell => "Haskell",
- Language::C => "C",
- Language::Javascript => "Javascript",
- Language::Other => "Some other language",
- }
- )
- }
-}