Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layers #235

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Initial layers support
JCapucho committed Mar 26, 2020

Verified

This commit was signed with the committer’s verified signature.
andyrichardson Andy Richardson
commit 4fc27b888b5e8f2bf12849159a421264caa64085
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -54,6 +54,7 @@ members = [
"examples/svg",
"examples/todos",
"examples/tour",
"examples/alert_widget",
]

[dependencies]
19 changes: 19 additions & 0 deletions core/src/depth.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/// The nesting relative to some container
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Depth {
/// Same as the container
// TODO: Rethink
None,
/// Above the container
Above,
/// Below the container
Below,
/// Above everything (Global)
Topmost,
}

impl Default for Depth {
fn default() -> Self {
Depth::None
}
}
2 changes: 2 additions & 0 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ pub mod keyboard;
mod align;
mod background;
mod color;
mod depth;
mod font;
mod length;
mod point;
@@ -29,6 +30,7 @@ mod vector;
pub use align::{Align, HorizontalAlignment, VerticalAlignment};
pub use background::Background;
pub use color::Color;
pub use depth::Depth;
pub use font::Font;
pub use length::Length;
pub use point::Point;
12 changes: 12 additions & 0 deletions examples/alert_widget/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "alert_widget"
version = "0.1.0"
authors = ["Capucho <[email protected]>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
iced = { path = "../.." }
iced_native = { path = "../../native" }
iced_wgpu = { path = "../../wgpu" }
13 changes: 13 additions & 0 deletions examples/alert_widget/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Alert widget

A demonstration of how to build a custom widget with layer so that it stays at the top

The **[`main`]** file contains all the code of the example.

You can run it with `cargo run`:

```
cargo run --package custom_widget
```

[`main`]: src/main.rs
Loading