scoop:scoop.ui.component:0.1.0
src/builders/frame.scoop
Selected production source · src/builders/frame.scoop
1
package scoop.ui.component3
import scoop.graphics.*4
import scoop.ui.*5
import scoop.ui.style.*7
public class FrameBuilder internal constructor() {8
public var width: Double? = None9
public var height: Double? = None10
public var maxWidth: Double? = None11
public var maxHeight: Double? = None12
public var padding: Insets? = None13
public var logicalPadding: LogicalInsets? = None14
public var alignment: Alignment = Alignment()15
public var style: StyleOverride = styleOverride()16
public var surface: SurfaceKind? = None17
public var theme: ThemeSource? = None18
public var key: ViewKey = ViewKey.Position20
public fun style(configure: StyleOverrideBuilder.() -> Unit): Unit {21
style = style.copy(configure)22
}23
internal fun snapshot(content: View): FrameProps =24
FrameProps(25
content,26
width,27
height,28
padding,29
alignment,30
style,31
surface,32
theme,33
logicalPadding,34
maxWidth,35
maxHeight36
)37
}39
internal fun makeFrame(content: View, configure: FrameBuilder.() -> Unit): View {40
val builder = FrameBuilder()41
builder.configure()42
return component(43
builder.snapshot(content),44
{ props, mount -> Frame(props, scope = mount) },45
builder.key46
)47
}