summaryrefslogtreecommitdiffstats
path: root/wgpu/src/renderer/widget/radio.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-11-10 06:05:20 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-11-11 03:08:00 +0100
commit0240c3981b716c82ecb3364945815335b420a63e (patch)
tree441eebaa9441649a4e878bde71cdec20d4a67391 /wgpu/src/renderer/widget/radio.rs
parent2303111e09d806ef2a652bddc2b73be6dccf6ae2 (diff)
downloadiced-0240c3981b716c82ecb3364945815335b420a63e.tar.gz
iced-0240c3981b716c82ecb3364945815335b420a63e.tar.bz2
iced-0240c3981b716c82ecb3364945815335b420a63e.zip
Draft custom layout engine based on `druid`
Diffstat (limited to 'wgpu/src/renderer/widget/radio.rs')
-rw-r--r--wgpu/src/renderer/widget/radio.rs25
1 files changed, 14 insertions, 11 deletions
diff --git a/wgpu/src/renderer/widget/radio.rs b/wgpu/src/renderer/widget/radio.rs
index 9f3c528f..1f17ba28 100644
--- a/wgpu/src/renderer/widget/radio.rs
+++ b/wgpu/src/renderer/widget/radio.rs
@@ -1,7 +1,7 @@
use crate::{Primitive, Renderer};
use iced_native::{
- layout, radio, text, Background, Layout, MouseCursor, Point, Radio,
- Rectangle, Text,
+ layout, radio, text, Align, Background, Column, Layout, Length,
+ MouseCursor, Point, Radio, Rectangle, Row, Text, Widget,
};
const SIZE: f32 = 28.0;
@@ -12,20 +12,23 @@ impl radio::Renderer for Renderer {
&self,
radio: &Radio<Message>,
limits: &layout::Limits,
- ) -> Layout {
- // TODO
- Layout::new(Rectangle {
- x: 0.0,
- y: 0.0,
- width: 0.0,
- height: 0.0,
- })
+ ) -> layout::Node {
+ Row::<(), Self>::new()
+ .spacing(15)
+ .align_items(Align::Center)
+ .push(
+ Column::new()
+ .width(Length::Units(SIZE as u16))
+ .height(Length::Units(SIZE as u16)),
+ )
+ .push(Text::new(&radio.label))
+ .layout(self, limits)
}
fn draw<Message>(
&mut self,
radio: &Radio<Message>,
- layout: &Layout,
+ layout: Layout<'_>,
cursor_position: Point,
) -> Self::Output {
let bounds = layout.bounds();