Scoop API

scoop:scoop.window:0.1.0

src/window_attributes_builder.scoop

Selected production source · src/window_attributes_builder.scoop

1package scoop.window
3/** Configures one complete value; execution remains explicit. */
4public fun windowAttributes(configure: WindowAttributesBuilder.() -> Unit = {}): WindowAttributes {
5 val builder = WindowAttributesBuilder()
6 builder.configure()
7 return builder.snapshot()
8}
10public fun WindowAttributes.copy(
11 configure: WindowAttributesBuilder.() -> Unit = {}
12): WindowAttributes {
13 val builder = WindowAttributesBuilder()
14 builder.title = this.title
15 builder.size = this.size
16 builder.visible = this.visible
17 builder.frame = this.frame
18 builder.resizable = this.resizable
19 builder.transparent = this.transparent
20 builder.requestActivation = this.requestActivation
21 builder.constraints = this.constraints
22 builder.position = this.position
23 builder.resizeIncrements = this.resizeIncrements
24 builder.buttons = this.buttons
25 builder.level = this.level
26 builder.theme = this.theme
27 builder.blur = this.blur
28 builder.contentProtected = this.contentProtected
29 builder.shadow = this.shadow
30 builder.relation = this.relation
31 builder.role = this.role
32 builder.titlebarFlags = this.titlebarFlags
33 builder.configure()
34 return builder.snapshot()
37public class WindowAttributesBuilder internal constructor() {
38 internal var titlebarFlags: Int = 0
39 public var title: String = "Scoop"
40 public var size: LogicalSize = LogicalSize(800.0, 600.0)
41 public var visible: Boolean = true
42 public var frame: WindowFrame = WindowFrame.System(WindowContentMode.Standard)
43 public var resizable: Boolean = true
44 public var transparent: Boolean = false
45 public var requestActivation: Boolean = true
46 public var constraints: WindowSizeConstraints = WindowSizeConstraints()
47 public var position: DesktopPosition? = None
48 public var resizeIncrements: LogicalSize? = None
49 public var buttons: WindowButtons = WindowButtons()
50 public var level: WindowLevel = WindowLevel.Normal
51 public var theme: Theme? = None
52 public var blur: Boolean = false
53 public var contentProtected: Boolean = false
54 public var shadow: WindowShadow = WindowShadow.System
55 public var relation: WindowRelation = WindowRelation.Independent
56 public var role: WindowRole = WindowRole.Normal
57 internal fun snapshot(): WindowAttributes =
58 WindowAttributes(
59 title,
60 size,
61 visible,
62 frame,
63 resizable,
64 transparent,
65 requestActivation,
66 constraints,
67 position,
68 resizeIncrements,
69 buttons,
70 level,
71 theme,
72 blur,
73 contentProtected,
74 shadow,
75 relation,
76 role,
77 titlebarFlags
78 )