Scoop API

scoop:scoop.ui.component:0.1.0

src/builders/frame.scoop

Selected production source · src/builders/frame.scoop

1package scoop.ui.component
3import scoop.graphics.*
4import scoop.ui.*
5import scoop.ui.style.*
7public class FrameBuilder internal constructor() {
8 public var width: Double? = None
9 public var height: Double? = None
10 public var maxWidth: Double? = None
11 public var maxHeight: Double? = None
12 public var padding: Insets? = None
13 public var logicalPadding: LogicalInsets? = None
14 public var alignment: Alignment = Alignment()
15 public var style: StyleOverride = styleOverride()
16 public var surface: SurfaceKind? = None
17 public var theme: ThemeSource? = None
18 public var key: ViewKey = ViewKey.Position
20 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 maxHeight
36 )
39internal 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.key
46 )