net.kernelpanicsoft.archie.gui.layout¶
Types¶
AbsoluteAlignment¶
object AbsoluteAlignment
A collection of common Alignments unaware of the layout direction.
Alignment¶
@Stable
fun interface Alignment
An interface to calculate the position of a sized box inside an available space. Alignment is often used to define the alignment of a layout inside a parent layout.
Arrangement¶
@Immutable
object Arrangement
Used to specify the arrangement of the layout's children in layouts like Row or Column in the main axis direction (horizontal and vertical, respectively).
BiasAbsoluteAlignment¶
@Immutable
data class BiasAbsoluteAlignment(horizontalBias: Float, verticalBias: Float) : Alignment
An Alignment specified by bias: for example, a bias of -1 represents alignment to the left/top, a bias of 0 will represent centering, and a bias of 1 will represent right/bottom. Any value can be specified to obtain an alignment. Inside the -1, 1 range, the obtained alignment will position the aligned size fully inside the available space, while outside the range it will the aligned size will be positioned partially or completely outside.
BiasAlignment¶
@Immutable
data class BiasAlignment(val horizontalBias: Float, val verticalBias: Float) : Alignment
An Alignment specified by bias: for example, a bias of -1 represents alignment to the start/top, a bias of 0 will represent centering, and a bias of 1 will represent end/bottom. Any value can be specified to obtain an alignment. Inside the -1, 1 range, the obtained alignment will position the aligned size fully inside the available space, while outside the range it will the aligned size will be positioned partially or completely outside.
Dp¶
IntCoordinates¶
@JvmInline
value class IntCoordinates(val pair: Long)
IntOffset¶
typealias IntOffset = IntCoordinates
IntSize¶
LayoutDirection¶
enum LayoutDirection : Enum<LayoutDirection>
A class for defining layout directions.
LayoutNode¶
class LayoutNode(nodeName: String = "LayoutNode") : Measurable, Placeable, AUINode, MeasureScope
The concrete node type that forms Archie's UI scene graph.
Measurable¶
interface Measurable
A node that can participate in a layout pass by returning a Placeable.
MeasurePolicy¶
@Stable
fun interface MeasurePolicy
Defines how a LayoutNode measures itself and its children.
MeasureResult¶
data class MeasureResult(
val width: Int,
val height: Int,
val placer: Placer
)
The result of a MeasurePolicy.measure call, containing the intrinsic dimensions of the node and a Placer that positions child nodes within those bounds.
MeasureScope¶
interface MeasureScope
Marker interface implemented by LayoutNode and passed as the first argument to MeasurePolicy.measure. Measure policies may cast this to LayoutNode to access node-level properties such as padding or margin modifiers during layout.
Placeable¶
interface Placeable
The result of measuring a node, which can subsequently be positioned via placeAt.
Placer¶
@Stable
fun interface Placer
A deferred child-placement action returned inside a MeasureResult.
Renderer¶
@Stable
interface Renderer
Defines the rendering behaviour of a LayoutNode.
RowColumnMeasurePolicy¶
abstract class RowColumnMeasurePolicy(
val sumWidth: Boolean = false,
val sumHeight: Boolean = false,
val arrangementSpacing: Int = 0
) : MeasurePolicy
Base MeasurePolicy for Row and Column layouts.
Size¶
Properties¶
dp¶
EmptyRenderer¶
val EmptyRenderer: Renderer
A Renderer that performs no drawing — the default for layout-only nodes.
Functions¶
Box¶
A layout composable that stacks its children on top of each other, aligned within its bounds.
Column¶
@Composable
fun Column(
modifier: Modifier = Modifier,
verticalArrangement: Arrangement.Vertical = Arrangement.Top,
horizontalAlignment: Alignment.Horizontal = Alignment.Start,
content: @Composable
() -> Unit
)
A layout component that places contents in a column top-to-bottom.
Layout¶
@Composable
inline fun Layout(
measurePolicy: MeasurePolicy,
renderer: Renderer = EmptyRenderer,
modifier: Modifier = Modifier,
content: @Composable
() -> Unit = {}
)
The fundamental building block for creating custom Compose-based UI elements in Archie.
Row¶
@Composable
fun Row(
modifier: Modifier = Modifier,
horizontalArrangement: Arrangement.Horizontal = Arrangement.Start,
verticalAlignment: Alignment.Vertical = Alignment.Top,
content: @Composable
() -> Unit
)
A layout composable that arranges its children in a horizontal sequence from left to right.