abuse macros..
This commit is contained in:
@@ -64,7 +64,7 @@ impl DefaultAppState for Client {
|
||||
.on(CursorSense::click(), move |ctx| {
|
||||
let child = image(include_bytes!("assets/sungals.png"))
|
||||
.center()
|
||||
.add(ctx.state);
|
||||
.add(ctx);
|
||||
(span_add.r)(ctx).children.push(child);
|
||||
})
|
||||
.sized((150, 150))
|
||||
@@ -119,9 +119,7 @@ impl DefaultAppState for Client {
|
||||
.text_align(Align::LEFT)
|
||||
.wrap(true)
|
||||
.attr::<Selectable>(());
|
||||
let msg_box = text
|
||||
.background(rect(Color::WHITE.darker(0.5)))
|
||||
.add(ctx.state);
|
||||
let msg_box = text.background(rect(Color::WHITE.darker(0.5))).add(ctx);
|
||||
(texts.r)(ctx).children.push(msg_box);
|
||||
})
|
||||
.handles(&mut rsc);
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::prelude::*;
|
||||
pub mod eventable {
|
||||
use super::*;
|
||||
widget_trait! {
|
||||
pub trait Eventable<State: HasEvents + 'static>;
|
||||
pub trait Eventable<State: HasEvents + StateLike<State> + 'static>;
|
||||
fn on<E: EventLike>(
|
||||
self,
|
||||
event: E,
|
||||
|
||||
@@ -151,7 +151,7 @@ pub struct SpanBuilder<State, const LEN: usize, Wa: WidgetArrLike<State, LEN, Ta
|
||||
_pd: PhantomData<(State, Tag)>,
|
||||
}
|
||||
|
||||
impl<State, const LEN: usize, Wa: WidgetArrLike<State, LEN, Tag>, Tag> FnOnce<(&mut State,)>
|
||||
impl<State: StateLike<State>, const LEN: usize, Wa: WidgetArrLike<State, LEN, Tag>, Tag> FnOnce<(&mut State,)>
|
||||
for SpanBuilder<State, LEN, Wa, Tag>
|
||||
{
|
||||
type Output = Span;
|
||||
|
||||
@@ -48,7 +48,7 @@ pub struct StackBuilder<State, const LEN: usize, Wa: WidgetArrLike<State, LEN, T
|
||||
_pd: PhantomData<(State, Tag)>,
|
||||
}
|
||||
|
||||
impl<State, const LEN: usize, Wa: WidgetArrLike<State, LEN, Tag>, Tag> FnOnce<(&mut State,)>
|
||||
impl<State: StateLike<State>, const LEN: usize, Wa: WidgetArrLike<State, LEN, Tag>, Tag> FnOnce<(&mut State,)>
|
||||
for StackBuilder<State, LEN, Wa, Tag>
|
||||
{
|
||||
type Output = Stack;
|
||||
|
||||
@@ -51,7 +51,7 @@ impl<State, O, H: WidgetOption<State>> TextBuilder<State, O, H> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<State: HasUi + 'static, O> TextBuilder<State, O> {
|
||||
impl<State: HasUi + StateLike<State>, O> TextBuilder<State, O> {
|
||||
pub fn hint<W: WidgetLike<State, Tag>, Tag>(
|
||||
self,
|
||||
hint: W,
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::prelude::*;
|
||||
|
||||
// these methods should "not require any context" (require unit) because they're in core
|
||||
widget_trait! {
|
||||
pub trait CoreWidget<State: HasUi + 'static>;
|
||||
pub trait CoreWidget<State: HasUi + StateLike<State> + 'static>;
|
||||
|
||||
fn pad(self, padding: impl Into<Padding>) -> impl WidgetFn<State, Pad> {
|
||||
|state| Pad {
|
||||
|
||||
Reference in New Issue
Block a user