class Layout::Block
- Layout::Block
- Reference
- Object
Overview
A 2-dimensional region within the layout.
You can constrain the different Primitive
s on a block
in order to properly position it.
Example
The follow will create a 100x100 square that is offset from the top left corner of the screen by half it's width.
region = Block.new
region.height.eq 100
region.width.eq 100
region.top.eq region.width / 2
region.left.eq region.width / 2
Included Modules
Defined in:
block.crConstructors
-
.new(label : String)
Initialize with a label for easier debugging.
- .new
Instance Method Summary
- #bottom : Layout::Primitive
- #center_x : Layout::Primitive
- #center_y : Layout::Primitive
-
#children : Array(Layout::Block)
You can encapsulate blocks inside of each other as children.
-
#children=(children : Array(Layout::Block))
You can encapsulate blocks inside of each other as children.
-
#each(&block : Block -> )
Enumerate over all blocks in this block's hierarchy.
-
#each_constraint(&block : Kiwi::Constraint -> )
Enumerate over all constraints in this block's hierarchy
- #height : Layout::Primitive
-
#label : String
This is a unique or manually set identifier to help in debugging
-
#label=(label : String)
Re-assign the label of this block.
- #left : Layout::Primitive
- #right : Layout::Primitive
- #top : Layout::Primitive
- #width : Layout::Primitive
-
#x : Layout::Primitive
An alias to the
#left
primitive -
#y : Layout::Primitive
An alias to the
#top
primitive
Constructor Detail
Instance Method Detail
You can encapsulate blocks inside of each other as children. This makes it easier to compose complex layout blocks.
You can encapsulate blocks inside of each other as children. This makes it easier to compose complex layout blocks.
Enumerate over all constraints in this block's hierarchy
Re-assign the label of this block.
Providing a label helps to provide context when debugging.
You can also add a label in #initialize