Merge unnecessary split widget modules
This commit is contained in:
parent
c2e0c52ce0
commit
e618091248
28 changed files with 1032 additions and 1037 deletions
42
graphics/src/widget/column.rs
Normal file
42
graphics/src/widget/column.rs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
use crate::{Backend, Primitive, Renderer};
|
||||
use iced_native::column;
|
||||
use iced_native::mouse;
|
||||
use iced_native::{Element, Layout, Point};
|
||||
|
||||
pub type Column<'a, Message, Backend> =
|
||||
iced_native::Column<'a, Message, Renderer<Backend>>;
|
||||
|
||||
impl<B> column::Renderer for Renderer<B>
|
||||
where
|
||||
B: Backend,
|
||||
{
|
||||
fn draw<Message>(
|
||||
&mut self,
|
||||
defaults: &Self::Defaults,
|
||||
content: &[Element<'_, Message, Self>],
|
||||
layout: Layout<'_>,
|
||||
cursor_position: Point,
|
||||
) -> Self::Output {
|
||||
let mut mouse_interaction = mouse::Interaction::default();
|
||||
|
||||
(
|
||||
Primitive::Group {
|
||||
primitives: content
|
||||
.iter()
|
||||
.zip(layout.children())
|
||||
.map(|(child, layout)| {
|
||||
let (primitive, new_mouse_interaction) =
|
||||
child.draw(self, defaults, layout, cursor_position);
|
||||
|
||||
if new_mouse_interaction > mouse_interaction {
|
||||
mouse_interaction = new_mouse_interaction;
|
||||
}
|
||||
|
||||
primitive
|
||||
})
|
||||
.collect(),
|
||||
},
|
||||
mouse_interaction,
|
||||
)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue