本文整理汇总了C++中ComponentBuilder类的典型用法代码示例。如果您正苦于以下问题:C++ ComponentBuilder类的具体用法?C++ ComponentBuilder怎么用?C++ ComponentBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ComponentBuilder类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: refreshFromValueTree
//==============================================================================
void DrawableImage::refreshFromValueTree (const ValueTree& tree, ComponentBuilder& builder)
{
const ValueTreeWrapper controller (tree);
setComponentID (controller.getID());
const float newOpacity = controller.getOpacity();
const Colour newOverlayColour (controller.getOverlayColour());
Image newImage;
const var imageIdentifier (controller.getImageIdentifier());
jassert (builder.getImageProvider() != 0 || imageIdentifier.isVoid()); // if you're using images, you need to provide something that can load and save them!
if (builder.getImageProvider() != nullptr)
newImage = builder.getImageProvider()->getImageForIdentifier (imageIdentifier);
const RelativeParallelogram newBounds (controller.getBoundingBox());
if (bounds != newBounds || newOpacity != opacity
|| overlayColour != newOverlayColour || image != newImage)
{
repaint();
opacity = newOpacity;
overlayColour = newOverlayColour;
if (image != newImage)
setImage (newImage);
setBoundingBox (newBounds);
}
}
示例2: registerDrawableTypeHandlers
void Drawable::registerDrawableTypeHandlers (ComponentBuilder& builder)
{
builder.registerTypeHandler (new DrawableTypeHandler <DrawablePath>());
builder.registerTypeHandler (new DrawableTypeHandler <DrawableComposite>());
builder.registerTypeHandler (new DrawableTypeHandler <DrawableRectangle>());
builder.registerTypeHandler (new DrawableTypeHandler <DrawableImage>());
builder.registerTypeHandler (new DrawableTypeHandler <DrawableText>());
}
示例3: builder
Drawable* Drawable::createFromValueTree (const ValueTree& tree, ComponentBuilder::ImageProvider* imageProvider)
{
ComponentBuilder builder (tree);
builder.setImageProvider (imageProvider);
registerDrawableTypeHandlers (builder);
ScopedPointer<Component> comp (builder.createComponent());
Drawable* const d = dynamic_cast<Drawable*> (static_cast <Component*> (comp));
if (d != nullptr)
comp.release();
return d;
}
示例4: upImageIdentifier
void ImageButton::refreshFromValueTree (const ValueTree& state, ComponentBuilder& builder)
{
Button::refreshFromValueTree (state, builder);
const var upImageIdentifier (state [Ids::upImage]),
overImageIdentifier (state [Ids::overImage]),
downImageIdentifier (state [Ids::downImage]);
ComponentBuilder::ImageProvider* const imageProvider = builder.getImageProvider();
jassert (imageProvider != nullptr || upImageIdentifier.isVoid());
Image newUpImage, newOverImage, newDownImage;
if (imageProvider != nullptr)
{
newUpImage = imageProvider->getImageForIdentifier (upImageIdentifier);
newOverImage = imageProvider->getImageForIdentifier (overImageIdentifier);
newDownImage = imageProvider->getImageForIdentifier (downImageIdentifier);
}
using namespace ImageButtonHelpers;
setImages (false, true, true,
newUpImage, getOpacityFromVar (state[Ids::upOpacity]), getColourFromVar (state[Ids::upOverlay]),
newOverImage, getOpacityFromVar (state[Ids::overOpacity]), getColourFromVar (state[Ids::overOverlay]),
newDownImage, getOpacityFromVar (state[Ids::downOpacity]), getColourFromVar (state[Ids::downOverlay]));
}
示例5: refreshFromValueTree
//==============================================================================
void DrawableRectangle::refreshFromValueTree (const ValueTree& tree, ComponentBuilder& builder)
{
ValueTreeWrapper v (tree);
setComponentID (v.getID());
refreshFillTypes (v, builder.getImageProvider());
setStrokeType (v.getStrokeType());
setRectangle (v.getRectangle());
setCornerSize (v.getCornerSize());
}
示例6: updateComponent
static void updateComponent (ComponentBuilder& builder, const ValueTree& state)
{
if (Component* topLevelComp = builder.getManagedComponent())
{
ComponentBuilder::TypeHandler* const type = builder.getHandlerForState (state);
const String uid (getStateId (state));
if (type == nullptr || uid.isEmpty())
{
// ..handle the case where a child of the actual state node has changed.
if (state.getParent().isValid())
updateComponent (builder, state.getParent());
}
else
{
if (Component* const changedComp = findComponentWithID (*topLevelComp, uid))
type->updateComponentFromState (changedComp, state);
}
}
}
示例7: refreshFromValueTree
//==============================================================================
void DrawablePath::refreshFromValueTree (const ValueTree& tree, ComponentBuilder& builder)
{
ValueTreeWrapper v (tree);
setComponentID (v.getID());
refreshFillTypes (v, builder.getImageProvider());
setStrokeType (v.getStrokeType());
RelativePointPath newRelativePath;
v.writeTo (newRelativePath);
setPath (newRelativePath);
}
示例8: refreshFromValueTree
//==============================================================================
void DrawableComposite::refreshFromValueTree (const ValueTree& tree, ComponentBuilder& builder)
{
const ValueTreeWrapper wrapper (tree);
setComponentID (wrapper.getID());
wrapper.getMarkerList (true).applyTo (markersX);
wrapper.getMarkerList (false).applyTo (markersY);
setBoundingBox (wrapper.getBoundingBox());
builder.updateChildComponents (*this, wrapper.getChildList());
}