class CCL::SpriteBuilder

Overview

Helps building a sprite consisting of items that can have an icon and a text. More…

#include <spritebuilder.h>

class SpriteBuilder
{
public:
    // enums

    enum
    {
        kMaxItems = 100,
    };

    enum Options;

    // fields

     textBrush;
    TextBrush PROPERTY_BOOL (createSpriteSuspended, CreateSpriteSuspended) protected IView* view;
    int numItems;

    // construction

    SpriteBuilder (IView* view = nullptr);

    // methods

    void addHeader (StringRef text, int group = 0);
    void addHeader (IImage* icon, StringRef text, int group = 0);

    bool addItem (
        StringRef text,
        int group = 0,
        Font* font = nullptr,
        SolidBrush* textBrush = nullptr
    );

    bool addItem (
        IImage* icon,
        StringRef text,
        int group = 0,
        Font* font = nullptr,
        SolidBrush* textBrush = nullptr
    );

    int getLastGroup ();
    bool hasGroup (int group) const;
    ISprite* createSprite (int options = 0);
    Point getDefaultOffset () const;
    Point getTouchOffset () const;
    IImage* getWarningIcon ();
    void replaceItemText (ISprite& sprite, int index, StringRef text);
    String getItemText (ISprite& sprite, int index) const;
    void setBackgroundBrush (BrushRef brush);
    void setBorderPen (PenRef pen);
    void setBackgroundImage (IImage* image);
    void setMargin (Coord margin);
    void setSpacing (Coord spacing);
    void setRadius (Coord radius);
    void setMinWidth (Coord width);
    PROPERTY_OBJECT (Font, font, Font);
    const IVisualStyle& getVisualStyle ();
    StandardSpriteDrawable* getDrawable ();
};

Detailed Documentation

Helps building a sprite consisting of items that can have an icon and a text.

Methods

Point getDefaultOffset () const

recommended offset from mouse cursor

Point getTouchOffset () const

recommended offset from fingertip