RE ADD CONTEXT
This commit is contained in:
1 parent
dc2be7f688
commit
0b8a93c5ce
39 files changed
+925
-713
No files matched your search
@@ -1,16 +1,16 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
pub struct Pad {
|
||||
pub struct Pad<State> {
|
||||
pub padding: Padding,
|
||||
pub inner: WidgetHandle,
|
||||
pub inner: WidgetHandle<State>,
|
||||
}
|
||||
|
||||
impl Widget for Pad {
|
||||
fn draw(&mut self, painter: &mut Painter) {
|
||||
impl<State: 'static> Widget<State> for Pad<State> {
|
||||
fn draw(&mut self, painter: &mut Painter<State>) {
|
||||
painter.widget_within(&self.inner, self.padding.region());
|
||||
}
|
||||
|
||||
fn desired_width(&mut self, ctx: &mut SizeCtx) -> Len {
|
||||
fn desired_width(&mut self, ctx: &mut SizeCtx<State>) -> Len {
|
||||
let width = self.padding.left + self.padding.right;
|
||||
let height = self.padding.top + self.padding.bottom;
|
||||
ctx.outer.x.abs -= width;
|
||||
@@ -20,7 +20,7 @@ impl Widget for Pad {
|
||||
size
|
||||
}
|
||||
|
||||
fn desired_height(&mut self, ctx: &mut SizeCtx) -> Len {
|
||||
fn desired_height(&mut self, ctx: &mut SizeCtx<State>) -> Len {
|
||||
let width = self.padding.left + self.padding.right;
|
||||
let height = self.padding.top + self.padding.bottom;
|
||||
ctx.outer.x.abs -= width;
|
||||
|
||||
Reference in new issue
Block a user