1 /*
2  * Copyright 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package androidx.xr.runtime.internal
18 
19 import androidx.annotation.RestrictTo
20 
21 /** Component to enable pointer capture. */
22 @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
23 public interface PointerCaptureComponent : Component {
24     /** The possible states of pointer capture. */
25     @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
26     public annotation class PointerCaptureState {
27         public companion object {
28             public const val POINTER_CAPTURE_STATE_PAUSED: Int = 0
29             public const val POINTER_CAPTURE_STATE_ACTIVE: Int = 1
30             public const val POINTER_CAPTURE_STATE_STOPPED: Int = 2
31         }
32     }
33 
34     /** Functional interface for receiving updates about the state of pointer capture. */
35     public fun interface StateListener {
36         /**
37          * Called when the state of pointer capture changes.
38          *
39          * @param newState The new state of pointer capture.
40          */
onStateChangednull41         public fun onStateChanged(@PointerCaptureState newState: Int)
42     }
43 }
44