Struct rui::Handle

source ·
pub struct Handle<V, F, A> { /* private fields */ }
Expand description

Struct for an action handler.

Implementations§

source§

impl<V, F, A> Handle<V, F, A>where V: View, F: Fn(&mut Context, &A) + 'static,

source

pub fn new(v: V, f: F) -> Self

Trait Implementations§

source§

impl<V, F, A> View for Handle<V, F, A>where V: View, F: Fn(&mut Context, &A) + 'static, A: 'static,

source§

fn process( &self, event: &Event, vid: ViewId, cx: &mut Context, actions: &mut Vec<Box<dyn Any>> )

Processes an event.
source§

fn draw(&self, id: ViewId, args: &mut DrawArgs<'_>)

Draws the view using vger.
source§

fn layout(&self, id: ViewId, args: &mut LayoutArgs<'_>) -> LocalSize

Lays out subviews and return the size of the view. Read more
source§

fn hittest( &self, id: ViewId, pt: LocalPoint, cx: &mut Context ) -> Option<ViewId>

Returns the topmost view which the point intersects.
source§

fn commands(&self, id: ViewId, cx: &mut Context, cmds: &mut Vec<CommandInfo>)

Accumulates information about menu bar commands.
source§

fn gc(&self, id: ViewId, cx: &mut Context, map: &mut Vec<ViewId>)

Gets IDs for views currently in use. Read more
source§

fn access( &self, id: ViewId, cx: &mut Context, nodes: &mut Vec<(NodeId, Node)> ) -> Option<NodeId>

Builds an AccessKit tree. The node ID for the subtree is returned. All generated nodes are accumulated.
source§

fn dirty(&self, _id: ViewId, _xform: LocalToWorld, _cx: &mut Context)

Determines dirty regions which need repainting.
source§

fn is_flexible(&self) -> bool

For detecting flexible sized things in stacks.
source§

fn tid(&self) -> TypeId

Returns the type ID of the underlying view.

Auto Trait Implementations§

§

impl<V, F, A> RefUnwindSafe for Handle<V, F, A>where A: RefUnwindSafe, F: RefUnwindSafe, V: RefUnwindSafe,

§

impl<V, F, A> Send for Handle<V, F, A>where A: Send, F: Send, V: Send,

§

impl<V, F, A> Sync for Handle<V, F, A>where A: Sync, F: Sync, V: Sync,

§

impl<V, F, A> Unpin for Handle<V, F, A>where A: Unpin, F: Unpin, V: Unpin,

§

impl<V, F, A> UnwindSafe for Handle<V, F, A>where A: UnwindSafe, F: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<V> Modifiers for Vwhere V: View,

source§

fn anim<F: Fn(&mut Context, f32) + 'static + Clone>( self, func: F ) -> AnimView<Self, F>

Calls a closure after rendering with context and delta time.
source§

fn background<BG: View>(self, background: BG) -> Background<Self, BG>

Puts a view behind another. The background view inherits the size of the view.
source§

fn command<F: Fn(&mut Context) + 'static>( self, name: &str, key: Option<HotKey>, f: F ) -> Command<Self, F>

Adds a menu command.
source§

fn command_group<T: CommandTuple>(self, cmds: T) -> CommandGroup<Self, T>

Adds a group of menu commands.
source§

fn drag<F: Fn(&mut Context, LocalOffset, GestureState, Option<MouseButton>) + 'static>( self, f: F ) -> Drag<Self, F>

Calls a function in response to a drag.
source§

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>

Calls a function in response to a drag. Version which passes in a binding.
source§

fn hover<F: Fn(&mut Context, bool) + 'static>(self, f: F) -> Hover<Self, F>

Calls a function in response to a mouse hovering.
source§

fn env<E: Clone + 'static>(self, value: E) -> SetenvView<Self, E>

Add an environment value.
source§

fn flex(self) -> Flex<Self>

Indicates that this item can expand within a stack.
source§

fn fullscreen(self) -> FullscreenView<Self>

Make the window full screen.
source§

fn geom<F: Fn(&mut Context, LocalSize, LocalToWorld) + 'static>( self, f: F ) -> Geom<Self, F>

Calls a function with the view’s geometry after layout runs. Currently only the view’s size is returned.
source§

fn key<F: Fn(&mut Context, Key) + 'static>(self, f: F) -> KeyView<Self, F>

Responds to keyboard events
source§

fn offset<Off: Into<LocalOffset>>(self, offset: Off) -> Offset<Self>

Applies an offset to the view in local space.
source§

fn padding(self, param: impl Into<PaddingParam>) -> Padding<Self>

Adds space around a view. Can be either Auto or Px(number_of_pixels)
source§

fn role(self, role: Role) -> RoleView<Self>

Specify an accessiblity role.
source§

fn size<Sz: Into<LocalSize>>(self, size: Sz) -> Size<Self>

Constrains the size of a view.
source§

fn tap<A: 'static, F: Fn(&mut Context) -> A + 'static>( self, f: F ) -> Tap<Self, F>

Calls a function in response to a tap.
source§

fn tap_a<A: 'static>(self, action: A) -> TapA<Self, A>

Version of tap which takes an action type instead of a function.
source§

fn window_title(self, title: &str) -> TitleView<Self>

Specify the title of the window.
source§

fn handle<A: 'static, F: Fn(&mut Context, &A) + 'static>( self, handler: F ) -> Handle<Self, F, A>

Handle an action from a child view.
source§

fn clip(self) -> Clip<Self>

Clip to bounds.
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>