in ComponentKit/Core/ComponentBuilder.h [767:902]
class __attribute__((__may_alias__)) ComponentBuilderBase : public ViewConfigBuilderBase<Derived, PropsBitmap>, public BuilderBase<Derived, PropsBitmap> {
protected:
ComponentBuilderBase() = default;
ComponentBuilderBase(const CK::ComponentSpecContext& context)
: BuilderBase<Derived, PropsBitmap>{context} { }
ComponentBuilderBase(const ComponentBuilderBase &) = default;
auto operator=(const ComponentBuilderBase &) -> ComponentBuilderBase& = default;
public:
/**
Specifies a complete view configuration which will be used to create a view for the component.
@param c A struct describing the view for this component.
@note Calling this method on a builder that already has a view class or any of the view properties set will trigger
a compilation error.
@note This method only accepts temporaries as its argument. If you need to pass an existing variable use
@c std::move().
*/
auto &view(CKComponentViewConfiguration &&c)
{
constexpr auto viewConfigurationOverridesExistingViewClass =
PropBitmap::isSet(PropsBitmap, ViewConfigBuilderPropId::viewClass);
static_assert(!viewConfigurationOverridesExistingViewClass,
"Setting view configuration overrides existing view class");
_viewConfig = std::move(c);
return reinterpret_cast<Derived<PropsBitmap | ViewConfigBuilderPropId::viewConfig> &>(*this);
}
/**
The width of the component relative to its parent's size.
*/
auto &width(RCRelativeDimension w)
{
_size.width = w;
return reinterpret_cast<Derived<PropsBitmap | ComponentBuilderBasePropId::size> &>(*this);
}
/**
The width of the component.
*/
auto &width(CGFloat w)
{
_size.width = w;
return reinterpret_cast<Derived<PropsBitmap | ComponentBuilderBasePropId::size> &>(*this);
}
/**
The height of the component relative to its parent's size.
*/
auto &height(RCRelativeDimension h)
{
_size.height = h;
return reinterpret_cast<Derived<PropsBitmap | ComponentBuilderBasePropId::size> &>(*this);
}
/**
The height of the component.
*/
auto &height(CGFloat h)
{
_size.height = h;
return reinterpret_cast<Derived<PropsBitmap | ComponentBuilderBasePropId::size> &>(*this);
}
/**
The minumum allowable width of the component relative to its parent's size.
*/
auto &minWidth(RCRelativeDimension w)
{
_size.minWidth = w;
return reinterpret_cast<Derived<PropsBitmap | ComponentBuilderBasePropId::size> &>(*this);
}
/**
The minumum allowable height of the component relative to its parent's size.
*/
auto &minHeight(RCRelativeDimension h)
{
_size.minHeight = h;
return reinterpret_cast<Derived<PropsBitmap | ComponentBuilderBasePropId::size> &>(*this);
}
/**
The maximum allowable width of the component relative to its parent's size.
*/
auto &maxWidth(RCRelativeDimension w)
{
_size.maxWidth = w;
return reinterpret_cast<Derived<PropsBitmap | ComponentBuilderBasePropId::size> &>(*this);
}
/**
The maximum allowable height of the component relative to its parent's size.
*/
auto &maxHeight(RCRelativeDimension h)
{
_size.maxHeight = h;
return reinterpret_cast<Derived<PropsBitmap | ComponentBuilderBasePropId::size> &>(*this);
}
/**
Specifies a size constraint that should apply to this component.
*/
auto &size(RCComponentSize &&s)
{
_size = std::move(s);
return reinterpret_cast<Derived<PropsBitmap | ComponentBuilderBasePropId::size> &>(*this);
}
/**
Specifies a size constraint that should apply to this component.
*/
auto &size(const RCComponentSize &s)
{
_size = s;
return reinterpret_cast<Derived<PropsBitmap | ComponentBuilderBasePropId::size> &>(*this);
}
/**
Specifies a size constraint that should apply to this component.
*/
auto &size(const CGSize &s)
{
_size = RCComponentSize::fromCGSize(s);
return reinterpret_cast<Derived<PropsBitmap | ComponentBuilderBasePropId::size> &>(*this);
}
protected:
CKComponentViewConfiguration _viewConfig{};
RCComponentSize _size{};
};