pub unsafe trait GCSwitchPositionInput: NSObjectProtocol {
// Provided methods
unsafe fn positionDidChangeHandler(
&self,
) -> *mut DynBlock<dyn Fn(NonNull<ProtocolObject<dyn GCPhysicalInputElement>>, NonNull<ProtocolObject<dyn GCSwitchPositionInput>>, NSInteger)>
where Self: Sized + Message { ... }
unsafe fn setPositionDidChangeHandler(
&self,
position_did_change_handler: Option<&DynBlock<dyn Fn(NonNull<ProtocolObject<dyn GCPhysicalInputElement>>, NonNull<ProtocolObject<dyn GCSwitchPositionInput>>, NSInteger)>>,
)
where Self: Sized + Message { ... }
unsafe fn position(&self) -> NSInteger
where Self: Sized + Message { ... }
unsafe fn positionRange(&self) -> NSRange
where Self: Sized + Message { ... }
unsafe fn isSequential(&self) -> bool
where Self: Sized + Message { ... }
unsafe fn canWrap(&self) -> bool
where Self: Sized + Message { ... }
unsafe fn lastPositionTimestamp(&self) -> NSTimeInterval
where Self: Sized + Message { ... }
unsafe fn lastPositionLatency(&self) -> NSTimeInterval
where Self: Sized + Message { ... }
unsafe fn sources(
&self,
) -> Retained<NSSet<ProtocolObject<dyn GCPhysicalInputSource>>>
where Self: Sized + Message { ... }
}GCSwitchPositionInput only.Expand description
Provided Methods§
Sourceunsafe fn positionDidChangeHandler(
&self,
) -> *mut DynBlock<dyn Fn(NonNull<ProtocolObject<dyn GCPhysicalInputElement>>, NonNull<ProtocolObject<dyn GCSwitchPositionInput>>, NSInteger)>
Available on crate features GCPhysicalInputElement and block2 only.
unsafe fn positionDidChangeHandler( &self, ) -> *mut DynBlock<dyn Fn(NonNull<ProtocolObject<dyn GCPhysicalInputElement>>, NonNull<ProtocolObject<dyn GCSwitchPositionInput>>, NSInteger)>
GCPhysicalInputElement and block2 only.Set this block if you want to be notified when the value on the switch changes.
Parameter input: the element that has been modified.
See: value
§Safety
- The returned block’s argument 1 must be a valid pointer.
- The returned block’s argument 2 must be a valid pointer.
Sourceunsafe fn setPositionDidChangeHandler(
&self,
position_did_change_handler: Option<&DynBlock<dyn Fn(NonNull<ProtocolObject<dyn GCPhysicalInputElement>>, NonNull<ProtocolObject<dyn GCSwitchPositionInput>>, NSInteger)>>,
)
Available on crate features GCPhysicalInputElement and block2 only.
unsafe fn setPositionDidChangeHandler( &self, position_did_change_handler: Option<&DynBlock<dyn Fn(NonNull<ProtocolObject<dyn GCPhysicalInputElement>>, NonNull<ProtocolObject<dyn GCSwitchPositionInput>>, NSInteger)>>, )
GCPhysicalInputElement and block2 only.Setter for positionDidChangeHandler.
This is copied when set.
Sourceunsafe fn positionRange(&self) -> NSRange
unsafe fn positionRange(&self) -> NSRange
The (inclusive) bounds of possible position values for the switch.
Sourceunsafe fn isSequential(&self) -> bool
unsafe fn isSequential(&self) -> bool
YESif the switch input can only transition to positions that are adjacent
to the current position.
Sourceunsafe fn canWrap(&self) -> bool
unsafe fn canWrap(&self) -> bool
Check if the position input value can “roll over” when reaching either of its bounds.
This will always be
YESfor non-sequential switch inputs.
Sourceunsafe fn lastPositionTimestamp(&self) -> NSTimeInterval
unsafe fn lastPositionTimestamp(&self) -> NSTimeInterval
The timestamp of the last value.
This time interval is not relative to any specific point in time. You can subtract a previous timestamp from the returned timestamp to determine the time (in seconds) between changes to the value.
Sourceunsafe fn lastPositionLatency(&self) -> NSTimeInterval
unsafe fn lastPositionLatency(&self) -> NSTimeInterval
The interval (in seconds) between the timestamp of the last event 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.
Sourceunsafe fn sources(
&self,
) -> Retained<NSSet<ProtocolObject<dyn GCPhysicalInputSource>>>
Available on crate feature GCPhysicalInputSource only.
unsafe fn sources( &self, ) -> Retained<NSSet<ProtocolObject<dyn GCPhysicalInputSource>>>
GCPhysicalInputSource only.An object describing the physical action(s) the user performs to manipulate this input.