objc2_gameplay_kit/generated/
GKState.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// Represents a single state in a state machine.
12    /// By default, states allow transitions freely to and from the states in the machine.
13    ///
14    /// If a more restricted set of valid transitions are needed in the state machine, you may override isValidNextState: where applicable.
15    ///
16    ///
17    /// See: GKStateMachine
18    ///
19    /// See: isValidNextState:
20    ///
21    /// See also [Apple's documentation](https://developer.apple.com/documentation/gameplaykit/gkstate?language=objc)
22    #[unsafe(super(NSObject))]
23    #[derive(Debug, PartialEq, Eq, Hash)]
24    pub struct GKState;
25);
26
27extern_conformance!(
28    unsafe impl NSObjectProtocol for GKState {}
29);
30
31impl GKState {
32    extern_methods!(
33        #[cfg(feature = "GKStateMachine")]
34        /// The state machine that this state is associated with.
35        /// This is nil if this state hasn't been added to a state machine yet.
36        #[unsafe(method(stateMachine))]
37        #[unsafe(method_family = none)]
38        pub unsafe fn stateMachine(&self) -> Option<Retained<GKStateMachine>>;
39
40        /// Creates a new state to be used in a state machine.
41        ///
42        ///
43        /// See: GKStateMachine
44        #[unsafe(method(state))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn state() -> Retained<Self>;
47
48        #[unsafe(method(init))]
49        #[unsafe(method_family = init)]
50        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
51
52        /// Returns YES if the given class is a valid next state to enter.
53        ///
54        /// By default GKState will return YES for any class that is subclass of GKState.
55        /// Override this in a subclass to enforce limited edge traversals in the state machine.
56        ///
57        ///
58        /// See: GKStateMachine.canEnterState:
59        ///
60        /// See: GKStateMachine.enterState:
61        ///
62        ///
63        /// Parameter `stateClass`: the class to be checked
64        ///
65        /// Returns: YES if the class is kind of GKState and the state transition is valid, else NO.
66        ///
67        /// # Safety
68        ///
69        /// `state_class` probably has further requirements.
70        #[unsafe(method(isValidNextState:))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn isValidNextState(&self, state_class: &AnyClass) -> bool;
73
74        /// Called by GKStateMachine when this state is entered.
75        ///
76        ///
77        /// Parameter `previousState`: the state that was exited to enter this state.  This is nil if this is the state machine's first entered state.
78        ///
79        /// See: stateMachineWithStates:initialStateClass:
80        #[unsafe(method(didEnterWithPreviousState:))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn didEnterWithPreviousState(&self, previous_state: Option<&GKState>);
83
84        /// Called by GKStateMachine when it is updated
85        ///
86        ///
87        /// Parameter `seconds`: the time in seconds since the last update
88        #[unsafe(method(updateWithDeltaTime:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn updateWithDeltaTime(&self, seconds: NSTimeInterval);
91
92        /// Called by GKStateMachine when this state is exited
93        ///
94        ///
95        /// Parameter `nextState`: the state that is being entered next
96        #[unsafe(method(willExitWithNextState:))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn willExitWithNextState(&self, next_state: &GKState);
99    );
100}
101
102/// Methods declared on superclass `NSObject`.
103impl GKState {
104    extern_methods!(
105        #[unsafe(method(new))]
106        #[unsafe(method_family = new)]
107        pub unsafe fn new() -> Retained<Self>;
108    );
109}