summaryrefslogtreecommitdiffstats
path: root/wgpu/src/widget
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2020-03-20 12:10:52 +0100
committerLibravatar GitHub <noreply@github.com>2020-03-20 12:10:52 +0100
commitf7ec679fec1b69c6dc5bc12d60627629f086bf22 (patch)
tree58ec4dd11e50f11ef85b972fee211930e7a0e7c0 /wgpu/src/widget
parent93f5640a2dc06d8f1bf2b0d033d45c62f8985380 (diff)
parentfb744a338c1b7566a3db9a3d24c03729b4858217 (diff)
downloadiced-f7ec679fec1b69c6dc5bc12d60627629f086bf22.tar.gz
iced-f7ec679fec1b69c6dc5bc12d60627629f086bf22.tar.bz2
iced-f7ec679fec1b69c6dc5bc12d60627629f086bf22.zip
Merge pull request #224 from hecrj/feature/panes-widget
Pane grid widget
Diffstat (limited to 'wgpu/src/widget')
-rw-r--r--wgpu/src/widget/canvas/layer/cache.rs14
-rw-r--r--wgpu/src/widget/pane_grid.rs17
2 files changed, 30 insertions, 1 deletions
diff --git a/wgpu/src/widget/canvas/layer/cache.rs b/wgpu/src/widget/canvas/layer/cache.rs
index 6b69f01e..f7002459 100644
--- a/wgpu/src/widget/canvas/layer/cache.rs
+++ b/wgpu/src/widget/canvas/layer/cache.rs
@@ -19,7 +19,6 @@ pub struct Cache<T: Drawable> {
state: RefCell<State>,
}
-#[derive(Debug)]
enum State {
Empty,
Filled {
@@ -97,3 +96,16 @@ where
primitive
}
}
+
+impl std::fmt::Debug for State {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ match self {
+ State::Empty => write!(f, "Empty"),
+ State::Filled { primitive, bounds } => f
+ .debug_struct("Filled")
+ .field("primitive", primitive)
+ .field("bounds", bounds)
+ .finish(),
+ }
+ }
+}
diff --git a/wgpu/src/widget/pane_grid.rs b/wgpu/src/widget/pane_grid.rs
new file mode 100644
index 00000000..7bc2f7c5
--- /dev/null
+++ b/wgpu/src/widget/pane_grid.rs
@@ -0,0 +1,17 @@
+//! Let your users split regions of your application and organize layout dynamically.
+//!
+//! [![Pane grid - Iced](https://thumbs.gfycat.com/MixedFlatJellyfish-small.gif)](https://gfycat.com/mixedflatjellyfish)
+use crate::Renderer;
+
+pub use iced_native::pane_grid::{
+ Axis, Direction, DragEvent, Focus, KeyPressEvent, Pane, ResizeEvent, Split,
+ State,
+};
+
+/// A collection of panes distributed using either vertical or horizontal splits
+/// to completely fill the space available.
+///
+/// [![Pane grid - Iced](https://thumbs.gfycat.com/MixedFlatJellyfish-small.gif)](https://gfycat.com/mixedflatjellyfish)
+///
+/// This is an alias of an `iced_native` pane grid with an `iced_wgpu::Renderer`.
+pub type PaneGrid<'a, Message> = iced_native::PaneGrid<'a, Message, Renderer>;