in ComponentKit/LayoutComponents/CenterLayoutComponentBuilder.h [28:95]
class __attribute__((__may_alias__)) CenterLayoutComponentBuilder
: public ComponentBuilderBaseSizeOnly<CenterLayoutComponentBuilder, PropsBitmap> {
public:
CenterLayoutComponentBuilder() = default;
~CenterLayoutComponentBuilder() = default;
/**
Specifies how the child component should be aligned within the layout bounds. See \c CKCenterLayoutComponentCenteringOptions.
*/
auto ¢eringOptions(CKCenterLayoutComponentCenteringOptions o) {
constexpr auto centeringOptionsNotSet = !PropBitmap::isSet(PropsBitmap, CenterLayoutComponentPropId::centeringOptions);
static_assert(centeringOptionsNotSet, "Property 'centeringOptions' is already set.");
_centeringOptions = o;
return reinterpret_cast<CenterLayoutComponentBuilder<PropsBitmap | CenterLayoutComponentPropId::centeringOptions> &>(*this);
}
/**
Specifies how the child component should be sized. See \c CKCenterLayoutComponentSizingOptions.
*/
auto &sizingOptions(CKCenterLayoutComponentSizingOptions o) {
constexpr auto sizingOptionsNotSet = !PropBitmap::isSet(PropsBitmap, CenterLayoutComponentPropId::sizingOptions);
static_assert(sizingOptionsNotSet, "Property 'sizingOptions' is already set.");
_sizingOptions = o;
return reinterpret_cast<CenterLayoutComponentBuilder<PropsBitmap | CenterLayoutComponentPropId::sizingOptions> &>(*this);
}
/**
The child to center.
*/
auto &child(NS_RELEASES_ARGUMENT CKComponent *c) {
constexpr auto childNotSet = !PropBitmap::isSet(PropsBitmap, CenterLayoutComponentPropId::child);
static_assert(childNotSet, "Property 'child' is already set.");
_child = c;
return reinterpret_cast<CenterLayoutComponentBuilder<PropsBitmap | CenterLayoutComponentPropId::child> &>(*this);
}
private:
friend BuilderBase<CenterLayoutComponentBuilder, PropsBitmap>;
/**
Creates a new component instance with specified properties.
@note This method must @b not be called more than once on a given component builder instance.
*/
NS_RETURNS_RETAINED auto _build() noexcept -> CKCenterLayoutComponent *
{
constexpr auto childIsSet = PropBitmap::isSet(PropsBitmap, CenterLayoutComponentPropId::child);
static_assert(childIsSet, "Required property 'child' is not set.");
if (PropBitmap::isSet(PropsBitmap, ComponentBuilderBaseSizeOnlyPropId::size)) {
return [[CKCenterLayoutComponent alloc] initWithCenteringOptions:_centeringOptions
sizingOptions:_sizingOptions
child:_child
size:this->_size];
} else {
return [[CKCenterLayoutComponent alloc] initWithCenteringOptions:_centeringOptions
sizingOptions:_sizingOptions
child:_child
size:{}];
}
}
private:
CKCenterLayoutComponentCenteringOptions _centeringOptions{};
CKCenterLayoutComponentSizingOptions _sizingOptions{};
CKComponent *_child;
};