crystal.BasicJoint

A Joint with common padding and alignment options.

This type of joint is used by several built-in element types, like Overlay, Widget, Switcher and Painter.

Constructor

Like all other Joint classes, BasicJoint are created by calling add_child or set_child. The type of joint being created depends on the type of the container/wrapper.

Methods

Alignment

Name Description
alignment Returns horizontal and vertical alignment.
horizontal_alignment Returns horizontal alignment.
set_alignment Sets horizontal and vertical alignment.
set_horizontal_alignment Sets horizontal alignment.
set_vertical_alignment Sets vertical alignment.
vertical_alignment Returns vertical alignment.

Padding

BasicJoint objects transparently expose a Padding object, using the aliasing mechanism. Refer to the Padding documentation for a list of these methods.

Advanced Functionality

Methods below are useful when implementing your own Wrapper or Container types.

Name Description
compute_desired_size Computes the desired size of the joint’s child element.
compute_relative_position Computes the position of the joint’s child element relative to its parent.

Examples

local overlay = crystal.Overlay:new();

local top_left = overlay:add_child(crystal.Image:new());
top_left:set_image_size(64, 64);
top_left:set_alignment("left", "top");

local bottom_right = overlay:add_child(crystal.Image:new());
bottom_right:set_image_size(64, 64);
bottom_right:set_alignment("right", "bottom");

local center = overlay:add_child(crystal.Image:new());
center:set_image_size(32, 32);
center:set_padding(100);
center:set_alignment("center", "center");

This site uses Just the Docs, a documentation theme for Jekyll.