use crate::*;
use accesskit::Role;
pub trait Modifiers: View + Sized {
fn anim<F: Fn(&mut Context, f32) + 'static + Clone>(self, func: F) -> AnimView<Self, F> {
AnimView::new(self, func)
}
fn background<BG: View>(self, background: BG) -> Background<Self, BG> {
Background::new(self, background)
}
fn command<F: Fn(&mut Context) + 'static>(
self,
name: &str,
key: Option<HotKey>,
f: F,
) -> Command<Self, F> {
Command::new(self, name.into(), key, f)
}
fn command_group<T: CommandTuple>(self, cmds: T) -> CommandGroup<Self, T> {
CommandGroup::new(self, cmds)
}
fn drag<F: Fn(&mut Context, LocalOffset, GestureState, Option<MouseButton>) + 'static>(
self,
f: F,
) -> Drag<Self, F> {
Drag::new(self, f)
}
fn drag_s<
T: 'static,
B: Binding<T>,
F: Fn(&mut T, LocalOffset, GestureState, Option<MouseButton>) + 'static,
>(
self,
s: B,
f: F,
) -> DragS<Self, F, B, T> {
DragS::new(self, s, f)
}
fn hover<F: Fn(&mut Context, bool) + 'static>(self, f: F) -> Hover<Self, F> {
Hover::new(self, f)
}
fn env<E: Clone + 'static>(self, value: E) -> SetenvView<Self, E> {
SetenvView::new(self, value)
}
fn flex(self) -> Flex<Self> {
Flex::new(self)
}
fn fullscreen(self) -> FullscreenView<Self> {
FullscreenView::new(self)
}
fn geom<F: Fn(&mut Context, LocalSize, LocalToWorld) + 'static>(self, f: F) -> Geom<Self, F> {
Geom::new(self, f)
}
fn key<F: Fn(&mut Context, Key) + 'static>(self, f: F) -> KeyView<Self, F> {
KeyView::new(self, f)
}
fn offset<Off: Into<LocalOffset>>(self, offset: Off) -> Offset<Self> {
Offset::new(self, offset.into())
}
fn padding(self, param: impl Into<PaddingParam>) -> Padding<Self> {
Padding::new(self, param.into())
}
fn role(self, role: Role) -> RoleView<Self> {
RoleView::new(self, role)
}
fn size<Sz: Into<LocalSize>>(self, size: Sz) -> Size<Self> {
Size::new(self, size.into())
}
fn tap<A: 'static, F: Fn(&mut Context) -> A + 'static>(self, f: F) -> Tap<Self, F> {
Tap::new(self, f)
}
fn tap_a<A: 'static>(self, action: A) -> TapA<Self, A> {
TapA::new(self, action)
}
fn window_title(self, title: &str) -> TitleView<Self> {
TitleView::new(self, title)
}
fn handle<A: 'static, F: Fn(&mut Context, &A) + 'static>(
self,
handler: F,
) -> Handle<Self, F, A> {
Handle::new(self, handler)
}
fn clip(self) -> Clip<Self> {
Clip::new(self)
}
}
impl<V: View> Modifiers for V {}