scoop:scoop.ui.style:0.1.0
src/theme/parts.scoop
Selected production source · src/theme/parts.scoop
1
package scoop.ui.style3
import scoop.graphics.*5
public struct SurfaceMetrics(6
val suggestedSize: Size,7
val minimumSize: Size,8
val padding: Insets,9
val borderInsets: Insets,10
val corners: CornerRadii,11
val focusOutset: Double12
) {13
public val contentInsets: Insets14
get() = Insets(15
padding.left + borderInsets.left,16
padding.top + borderInsets.top,17
padding.right + borderInsets.right,18
padding.bottom + borderInsets.bottom19
)20
}22
public class SurfaceOptions internal constructor(23
public val suggestedSize: Size? = None,24
public val minimumSize: Size? = None,25
public val padding: Insets? = None,26
public val style: StyleOverride = styleOverride(),27
public val focus: OutlineStyle? = None,28
public val validation: OutlineStyle? = None29
) {30
public fun copy(configure: SurfaceOptionsBuilder.() -> Unit = {}): SurfaceOptions =31
configureSurfaceOptions(this, configure)32
}34
public class SurfaceGeometry public constructor(35
public val bounds: Rect,36
public val outline: RoundedOutline,37
public val borderInner: RoundedOutline,38
public val content: Rect,39
public val ring: OutlineRing?,40
public val style: Style,41
public val opacity: Double = 1.042
) {43
public val contentStyle: Style44
get() = Style(45
corners = Corners.Physical(outline.radii),46
contentEffects = style.contentEffects,47
clipContent = style.clipContent48
)49
}51
public struct CheckboxMetrics(52
val suggestedSize: Size,53
val minimumSize: Size,54
val borderInsets: Insets,55
val corners: CornerRadii,56
val markInset: Double,57
val markWidth: Double,58
val focusOutset: Double59
)61
public class CheckboxOptions internal constructor(62
public val size: Double? = None,63
public val minimumSize: Double? = None,64
public val markInset: Double? = None,65
public val style: StyleOverride = styleOverride(),66
public val markColor: Color? = None,67
public val focus: OutlineStyle? = None,68
public val validation: OutlineStyle? = None69
) {70
public fun copy(configure: CheckboxOptionsBuilder.() -> Unit = {}): CheckboxOptions =71
configureCheckboxOptions(this, configure)72
}74
public class CheckboxGeometry public constructor(75
public val bounds: Rect,76
public val outline: RoundedOutline,77
public val interior: RoundedOutline,78
public val markBounds: Rect,79
public val tick: StrokeSegment,80
public val mixed: RoundedOutline,81
public val ring: OutlineRing?,82
public val style: Style,83
public val markColor: Color,84
public val selection: Double,85
public val opacity: Double = 1.0,86
public val stateLayer: MarkerStateLayerGeometry? = None87
)89
public struct RadioMetrics(90
val suggestedSize: Size,91
val minimumSize: Size,92
val ringWidth: Double,93
val dotInset: Double,94
val focusOutset: Double95
)97
public class RadioOptions internal constructor(98
public val size: Double? = None,99
public val minimumSize: Double? = None,100
public val dotInset: Double? = None,101
public val background: StyleValue<Paint?> = StyleValue.Inherit,102
public val border: StyleValue<BorderEdge?> = StyleValue.Inherit,103
public val dotColor: Color? = None,104
public val focus: OutlineStyle? = None,105
public val validation: OutlineStyle? = None106
) {107
public fun copy(configure: RadioOptionsBuilder.() -> Unit = {}): RadioOptions =108
configureRadioOptions(this, configure)109
}111
public class RadioGeometry public constructor(112
public val bounds: Rect,113
public val outer: Circle,114
public val interior: Circle,115
public val dot: Circle,116
public val ring: OutlineRing?,117
public val style: Style,118
public val dotColor: Color,119
public val selection: Double,120
public val opacity: Double = 1.0,121
public val stateLayer: MarkerStateLayerGeometry? = None122
)124
public struct ScrollbarMetrics(125
val thickness: Double,126
val minimumThumbLength: Double,127
val trackInset: Double,128
val thumbInset: Double,129
val cornerRadius: Double,130
val buttonLength: Double?131
)133
public class ScrollbarOptions internal constructor(134
public val thickness: Double? = None,135
public val minimumThumbLength: Double? = None,136
public val trackInset: Double? = None,137
public val thumbInset: Double? = None,138
public val buttonLength: StyleValue<Double?> = StyleValue.Inherit139
) {140
public fun copy(configure: ScrollbarOptionsBuilder.() -> Unit = {}): ScrollbarOptions =141
configureScrollbarOptions(this, configure)142
}144
public struct ScrollbarButtonGeometry(val outline: RoundedOutline, val arrow: StrokeSegment)146
public class ScrollbarGeometry public constructor(147
public val bounds: Rect,148
public val orientation: Orientation,149
public val track: RoundedOutline,150
public val thumb: RoundedOutline,151
public val decrement: ScrollbarButtonGeometry?,152
public val increment: ScrollbarButtonGeometry?,153
public val travelStart: Point,154
public val travel: Double,155
public val thumbLength: Double,156
public val position: Double,157
public val visibleFraction: Double158
)160
/** Concrete descriptions shared by the shape-based themes and custom presets. */161
public class SurfacePart internal constructor(162
public val metrics: SurfaceMetrics,163
public val fill: StateColors,164
public val border: StateColors,165
public val foreground: StateColors,166
public val focus: OutlineStyle,167
public val shadows: Array<BoxShadow> = [],168
/** None inherits shadows; an empty array removes the hover elevation. */169
public val hoverShadows: Array<BoxShadow>? = None170
) {171
public fun copy(configure: SurfacePartBuilder.() -> Unit = {}): SurfacePart =172
configureSurfacePart(this, configure)173
}175
public class SurfaceParts internal constructor(176
public val plain: SurfacePart,177
public val action: SurfacePart,178
public val outlinedAction: SurfacePart,179
public val elevated: SurfacePart180
) {181
public fun copy(configure: SurfacePartsBuilder.() -> Unit = {}): SurfaceParts =182
configureSurfaceParts(this, configure)184
public fun get(kind: SurfaceKind): SurfacePart = when (kind) {185
case Plain -> plain;186
case Action -> action;187
case OutlinedAction -> outlinedAction;188
case Elevated -> elevated189
}190
}192
/** A circular interaction layer behind a selection marker, independent of its hit target. */193
public struct MarkerStateLayer(val size: Double, val empty: StateColors, val selected: StateColors)195
/** Resolved drawing data; the painter does not recalculate interaction or selection. */196
public struct MarkerStateLayerGeometry(val circle: Circle, val color: Color)198
public class MarkerAppearance internal constructor(199
public val empty: StateColors,200
public val selected: StateColors,201
public val border: StateColors,202
public val selectedBorder: StateColors,203
public val mark: StateColors,204
public val focus: OutlineStyle,205
public val shadows: Array<BoxShadow> = [],206
public val stateLayer: MarkerStateLayer? = None207
) {208
public fun copy(configure: MarkerAppearanceBuilder.() -> Unit = {}): MarkerAppearance =209
configureMarkerAppearance(this, configure)210
}212
public class CheckboxPart internal constructor(213
public val metrics: CheckboxMetrics,214
public val appearance: MarkerAppearance,215
/** None keeps the same appearance for checked and mixed states. */216
public val mixedAppearance: MarkerAppearance? = None,217
public val mixedShape: MixedMarkShape = MixedMarkShape.Bar218
) {219
public fun copy(configure: CheckboxPartBuilder.() -> Unit = {}): CheckboxPart =220
configureCheckboxPart(this, configure)221
}223
public class RadioPart internal constructor(224
public val metrics: RadioMetrics,225
public val appearance: MarkerAppearance226
) {227
public fun copy(configure: RadioPartBuilder.() -> Unit = {}): RadioPart = configureRadioPart(228
this,229
configure230
)231
}233
public class ScrollbarPart internal constructor(234
public val metrics: ScrollbarMetrics,235
public val track: StateColors,236
public val thumb: StateColors,237
public val button: StateColors,238
public val arrow: StateColors,239
public val arrowWidth: Double = 1.5240
) {241
public fun copy(configure: ScrollbarPartBuilder.() -> Unit = {}): ScrollbarPart =242
configureScrollbarPart(this, configure)243
}