Trait GCPressedStateInput

Source
pub unsafe trait GCPressedStateInput: NSObjectProtocol {
    // Provided methods
    unsafe fn pressedDidChangeHandler(
        &self,
    ) -> *mut DynBlock<dyn Fn(NonNull<ProtocolObject<dyn GCPhysicalInputElement>>, NonNull<ProtocolObject<dyn GCPressedStateInput>>, Bool)>
       where Self: Sized + Message { ... }
    unsafe fn setPressedDidChangeHandler(
        &self,
        pressed_did_change_handler: Option<&DynBlock<dyn Fn(NonNull<ProtocolObject<dyn GCPhysicalInputElement>>, NonNull<ProtocolObject<dyn GCPressedStateInput>>, Bool)>>,
    )
       where Self: Sized + Message { ... }
    unsafe fn isPressed(&self) -> bool
       where Self: Sized + Message { ... }
    unsafe fn lastPressedStateTimestamp(&self) -> NSTimeInterval
       where Self: Sized + Message { ... }
    unsafe fn lastPressedStateLatency(&self) -> NSTimeInterval
       where Self: Sized + Message { ... }
    unsafe fn sources(
        &self,
    ) -> Retained<NSSet<ProtocolObject<dyn GCPhysicalInputSource>>>
       where Self: Sized + Message { ... }
}
Available on crate feature GCPressedStateInput only.
Expand description

An object conforming to GCPressedStateInputrepresents the pressed state of an element, typically a button.

See also Apple’s documentation

Provided Methods§

Source

unsafe fn pressedDidChangeHandler( &self, ) -> *mut DynBlock<dyn Fn(NonNull<ProtocolObject<dyn GCPhysicalInputElement>>, NonNull<ProtocolObject<dyn GCPressedStateInput>>, Bool)>
where Self: Sized + Message,

Available on crate features GCPhysicalInputElement and block2 only.

Set this block if you want to be notified when the pressed state changes.

Source

unsafe fn setPressedDidChangeHandler( &self, pressed_did_change_handler: Option<&DynBlock<dyn Fn(NonNull<ProtocolObject<dyn GCPhysicalInputElement>>, NonNull<ProtocolObject<dyn GCPressedStateInput>>, Bool)>>, )
where Self: Sized + Message,

Available on crate features GCPhysicalInputElement and block2 only.
Source

unsafe fn isPressed(&self) -> bool
where Self: Sized + Message,

Buttons are mostly used in a digital sense, thus we have a recommended method for checking for pressed state instead of interpreting the value.

As a general guideline a button is pressed if the value exceeds 0. However there may be hysteresis applied to counter noisy input values, thus incidental values around the threshold value may not trigger a change in pressed state.

Other buttons may support two-stage actuation, where the button reports a value between 0 and 1 but is only considered pressed when its value is greater than some threshold other than 0.

See: pressedDidChangeHandler

Source

unsafe fn lastPressedStateTimestamp(&self) -> NSTimeInterval
where Self: Sized + Message,

The timestamp of the last pressed state change.

This time interval is not relative to any specific point in time. You can subtract a previous timestamp from the current timestamp to determine the time (in seconds) between changes to the value.

Source

unsafe fn lastPressedStateLatency(&self) -> NSTimeInterval
where Self: Sized + Message,

The interval (in seconds) between the timestamp of the last pressed state change and the current time.

This should be treated as a lower bound of the event latency. It may not include (wired or wireless) transmission latency, or latency accrued on the device before the event was transmitted to the host.

Source

unsafe fn sources( &self, ) -> Retained<NSSet<ProtocolObject<dyn GCPhysicalInputSource>>>
where Self: Sized + Message,

Available on crate feature GCPhysicalInputSource only.

An object describing the physical action(s) the user performs to manipulate this input.

Trait Implementations§

Source§

impl ProtocolType for dyn GCPressedStateInput

Source§

const NAME: &'static str = "GCPressedStateInput"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn GCPressedStateInput

Implementations on Foreign Types§

Source§

impl<T> GCPressedStateInput for ProtocolObject<T>

Implementors§