1 /*
2  * Copyright 2021 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.compose.ui.node
18 
19 import androidx.compose.runtime.CompositionLocalMap
20 import androidx.compose.ui.Modifier
21 import androidx.compose.ui.layout.MeasurePolicy
22 import androidx.compose.ui.platform.ViewConfiguration
23 import androidx.compose.ui.unit.Density
24 import androidx.compose.ui.unit.LayoutDirection
25 
26 /** Interface extracted from LayoutNode to not mark the whole LayoutNode class as @PublishedApi. */
27 @PublishedApi
28 internal interface ComposeUiNode {
29     var measurePolicy: MeasurePolicy
30     var layoutDirection: LayoutDirection
31     var density: Density
32     var modifier: Modifier
33     var viewConfiguration: ViewConfiguration
34     var compositionLocalMap: CompositionLocalMap
35     var compositeKeyHash: Int
36 
37     /** Object of pre-allocated lambdas used to make use with ComposeNode allocation-less. */
38     companion object {
39         val Constructor: () -> ComposeUiNode = LayoutNode.Constructor
<lambda>null40         val VirtualConstructor: () -> ComposeUiNode = { LayoutNode(isVirtual = true) }
<lambda>null41         val SetModifier: ComposeUiNode.(Modifier) -> Unit = { this.modifier = it }
<lambda>null42         val SetDensity: ComposeUiNode.(Density) -> Unit = { this.density = it }
<lambda>null43         val SetResolvedCompositionLocals: ComposeUiNode.(CompositionLocalMap) -> Unit = {
44             this.compositionLocalMap = it
45         }
<lambda>null46         val SetMeasurePolicy: ComposeUiNode.(MeasurePolicy) -> Unit = { this.measurePolicy = it }
<lambda>null47         val SetLayoutDirection: ComposeUiNode.(LayoutDirection) -> Unit = {
48             this.layoutDirection = it
49         }
<lambda>null50         val SetViewConfiguration: ComposeUiNode.(ViewConfiguration) -> Unit = {
51             this.viewConfiguration = it
52         }
<lambda>null53         val SetCompositeKeyHash: ComposeUiNode.(Int) -> Unit = { this.compositeKeyHash = it }
54     }
55 }
56