Draft Panes widget and panes example
This commit is contained in:
parent
02091267bf
commit
012b4adec7
17 changed files with 801 additions and 396 deletions
|
|
@ -2,6 +2,7 @@ mod button;
|
|||
mod checkbox;
|
||||
mod column;
|
||||
mod container;
|
||||
mod panes;
|
||||
mod progress_bar;
|
||||
mod radio;
|
||||
mod row;
|
||||
|
|
|
|||
34
wgpu/src/renderer/widget/panes.rs
Normal file
34
wgpu/src/renderer/widget/panes.rs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
use crate::{Primitive, Renderer};
|
||||
use iced_native::{panes, Element, Layout, MouseCursor, Point};
|
||||
|
||||
impl panes::Renderer for Renderer {
|
||||
fn draw<Message>(
|
||||
&mut self,
|
||||
defaults: &Self::Defaults,
|
||||
content: &[Element<'_, Message, Self>],
|
||||
layout: Layout<'_>,
|
||||
cursor_position: Point,
|
||||
) -> Self::Output {
|
||||
let mut mouse_cursor = MouseCursor::OutOfBounds;
|
||||
|
||||
(
|
||||
Primitive::Group {
|
||||
primitives: content
|
||||
.iter()
|
||||
.zip(layout.children())
|
||||
.map(|(child, layout)| {
|
||||
let (primitive, new_mouse_cursor) =
|
||||
child.draw(self, defaults, layout, cursor_position);
|
||||
|
||||
if new_mouse_cursor > mouse_cursor {
|
||||
mouse_cursor = new_mouse_cursor;
|
||||
}
|
||||
|
||||
primitive
|
||||
})
|
||||
.collect(),
|
||||
},
|
||||
mouse_cursor,
|
||||
)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue