pub struct CreatesCommandBindingViaEvent<C> { /* private fields */ }Expand description
Binds a command to an event of a control of type C (CreatesCommandBindingViaEvent):
executed with the latest command parameter each time the event is raised, if the command can
execute with it.
The events are registered by name (with_event). Without an event name,
the command binds to the first of DEFAULT_COMMAND_EVENTS that is registered, then to the
first registered event.
The affinity is BindingAffinity::EXPLICIT for a named event and
BindingAffinity::DEFAULT_EVENT for a default event, for a control of type C only.
Implementations§
Source§impl<C: 'static> CreatesCommandBindingViaEvent<C>
impl<C: 'static> CreatesCommandBindingViaEvent<C>
Sourcepub fn with_event<A: ?Sized + 'static>(
self,
name: impl Into<String>,
event: fn(&C) -> &Event<A>,
) -> Self
pub fn with_event<A: ?Sized + 'static>( self, name: impl Into<String>, event: fn(&C) -> &Event<A>, ) -> Self
Registers the event named name that event reads from a control.
Sourcepub fn with_event_subscription(
self,
name: impl Into<String>,
subscription: ControlEventSubscription<C>,
) -> Self
pub fn with_event_subscription( self, name: impl Into<String>, subscription: ControlEventSubscription<C>, ) -> Self
Registers the event named name that subscription adds a handler to.
Trait Implementations§
Source§impl<C> Debug for CreatesCommandBindingViaEvent<C>
impl<C> Debug for CreatesCommandBindingViaEvent<C>
Source§impl<C: 'static> Default for CreatesCommandBindingViaEvent<C>
impl<C: 'static> Default for CreatesCommandBindingViaEvent<C>
Source§impl<C: 'static> ICreatesCommandBinding for CreatesCommandBindingViaEvent<C>
impl<C: 'static> ICreatesCommandBinding for CreatesCommandBindingViaEvent<C>
Source§fn get_affinity_for_object(
&self,
target_type: TypeId,
has_event_target: bool,
) -> i32
fn get_affinity_for_object( &self, target_type: TypeId, has_event_target: bool, ) -> i32
A positive number when this plugin can bind a command to an object of the type
target_type, the highest number winning among the plugins; zero or less when it cannot
(GetAffinityForObject<T>(bool hasEventTarget)). has_event_target says whether the caller
names the event to bind to.Source§fn bind_command_to_object(
&self,
command: Option<Rc<dyn ICommand>>,
target: Option<Rc<dyn Any>>,
command_parameter: Rc<dyn IObservable<CommandParameter>>,
) -> Option<Rc<dyn IDisposable>>
fn bind_command_to_object( &self, command: Option<Rc<dyn ICommand>>, target: Option<Rc<dyn Any>>, command_parameter: Rc<dyn IObservable<CommandParameter>>, ) -> Option<Rc<dyn IDisposable>>
Binds
command to target through the default event of the target (Click, …), executed
with the latest value of command_parameter; None when no binding was made, as for a
missing command (BindCommandToObject<T>). Disposing the result unbinds the command.Source§fn bind_command_to_object_event(
&self,
command: Option<Rc<dyn ICommand>>,
target: Option<Rc<dyn Any>>,
command_parameter: Rc<dyn IObservable<CommandParameter>>,
event_name: &str,
) -> Option<Rc<dyn IDisposable>>
fn bind_command_to_object_event( &self, command: Option<Rc<dyn ICommand>>, target: Option<Rc<dyn Any>>, command_parameter: Rc<dyn IObservable<CommandParameter>>, event_name: &str, ) -> Option<Rc<dyn IDisposable>>
Binds
command to the event named event_name of target
(BindCommandToObject<T, TEventArgs>(..., string eventName)).Source§fn bind_command_to_object_with_handlers(
&self,
command: Option<Rc<dyn ICommand>>,
target: Option<Rc<dyn Any>>,
command_parameter: Rc<dyn IObservable<CommandParameter>>,
subscription: CommandEventSubscription,
) -> Option<Rc<dyn IDisposable>>
fn bind_command_to_object_with_handlers( &self, command: Option<Rc<dyn ICommand>>, target: Option<Rc<dyn Any>>, command_parameter: Rc<dyn IObservable<CommandParameter>>, subscription: CommandEventSubscription, ) -> Option<Rc<dyn IDisposable>>
Binds
command to the event that subscription adds a handler to
(BindCommandToObject<T, TEventArgs>(..., addHandler, removeHandler)).Auto Trait Implementations§
impl<C> !RefUnwindSafe for CreatesCommandBindingViaEvent<C>
impl<C> !Send for CreatesCommandBindingViaEvent<C>
impl<C> !Sync for CreatesCommandBindingViaEvent<C>
impl<C> !UnwindSafe for CreatesCommandBindingViaEvent<C>
impl<C> Freeze for CreatesCommandBindingViaEvent<C>
impl<C> Unpin for CreatesCommandBindingViaEvent<C>
impl<C> UnsafeUnpin for CreatesCommandBindingViaEvent<C>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more