Draft new layout API

This commit is contained in:
Héctor Ramón Jiménez 2019-11-10 01:55:32 +01:00
parent 839e039dbf
commit 2303111e09
30 changed files with 247 additions and 596 deletions

View file

@ -1,31 +1,30 @@
use crate::{Primitive, Renderer};
use iced_native::{
checkbox, text, text::HorizontalAlignment, text::VerticalAlignment, Align,
Background, Checkbox, Column, Layout, Length, MouseCursor, Node,
Point, Rectangle, Row, Text, Widget,
checkbox, layout, text, text::HorizontalAlignment, text::VerticalAlignment,
Background, Checkbox, Layout, MouseCursor, Point, Rectangle, Text,
};
const SIZE: f32 = 28.0;
impl checkbox::Renderer for Renderer {
fn node<Message>(&self, checkbox: &Checkbox<Message>) -> Node {
Row::<(), Self>::new()
.width(Length::Fill)
.spacing(15)
.align_items(Align::Center)
.push(
Column::new()
.width(Length::Units(SIZE as u16))
.height(Length::Units(SIZE as u16)),
)
.push(Text::new(&checkbox.label))
.node(self)
fn layout<Message>(
&self,
checkbox: &Checkbox<Message>,
limits: &layout::Limits,
) -> Layout {
// TODO
Layout::new(Rectangle {
x: 0.0,
y: 0.0,
width: 0.0,
height: 0.0,
})
}
fn draw<Message>(
&mut self,
checkbox: &Checkbox<Message>,
layout: Layout<'_>,
layout: &Layout,
cursor_position: Point,
) -> Self::Output {
let bounds = layout.bounds();