struct CCL::IVisualStyle

Overview

A visual style describes the appearance of an UI element. More…

#include <ivisualstyle.h>

struct IVisualStyle: public CCL::IVisualStyleData
{
    // methods

    virtual tbool CCL_API copyFrom (const IVisualStyle& other) = 0;
    virtual const IVisualStyle*CCL_API getInherited () const = 0;
    virtual const IVisualStyle*CCL_API getOriginal () const = 0;
    virtual const IContainer&CCL_API getStyleConditions () const = 0;
    virtual const IVisualStyleData*CCL_API getStyleCondition (StringID name) const = 0;

    virtual tbool CCL_API getColor (
        Color& color,
        StringID name,
        IStyleConditionContext* context
    ) const = 0;

    virtual tbool CCL_API getFont (
        Font& font,
        StringID name,
        IStyleConditionContext* context
    ) const = 0;

    virtual tbool CCL_API getMetric (
        Metric& value,
        StringID name,
        IStyleConditionContext* context
    ) const = 0;

    virtual tbool CCL_API getDesignMetric (
        DesignCoord& value,
        StringID name,
        IStyleConditionContext* context
    ) const = 0;

    virtual tbool CCL_API getString (
        MutableCString& string,
        StringID name,
        IStyleConditionContext* context
    ) const = 0;

    virtual tbool CCL_API getOptions (
        Options& options,
        StringID name,
        IStyleConditionContext* context
    ) const = 0;

    virtual IImage*CCL_API getImage (StringID name, IStyleConditionContext* context) const = 0;

    virtual IGradient*CCL_API getGradient (
        StringID name,
        IStyleConditionContext* context
    ) const = 0;

    IVisualStyle Color getForeColor () const;
    Color getBackColor () const;
    Color getHiliteColor () const;
    Color getTextColor () const;
    Metric getStrokeWidth () const;
    Pen getForePen () const;
    Pen getBackPen () const;
    Brush getForeBrush () const;
    Brush getBackBrush () const;
    Brush getTextBrush () const;
    Font getTextFont () const;
    Alignment getTextAlignment () const;
    Options getTextOptions () const;
    TextFormat getTextFormat () const;
    IImage* getBackgroundImage () const;
    void getPadding (Rect& padding) const;

    template  <typename T>
    T getMetric (StringID name, T defaultValue) const;

    virtual ColorRef CCL_API getColor (
        StringID name,
        ColorRef defaultColor = Colors::kBlack
    ) const;

    virtual tbool CCL_API getColor (Color& color, StringID name) const;

    virtual FontRef CCL_API getFont (
        StringID name,
        FontRef defaultFont = Font::getDefaultFont ()
    ) const;

    virtual tbool CCL_API getFont (Font& font, StringID name) const;
    virtual Metric CCL_API getMetric (StringID name, Metric defaultValue = 0) const;
    virtual tbool CCL_API getMetric (Metric& value, StringID name) const;

    virtual DesignCoord CCL_API getDesignMetric (
        StringID name,
        DesignCoordRef defaultValue = DesignCoord::kUndefined
    ) const;

    virtual tbool CCL_API getDesignMetric (DesignCoord& value, StringID name) const;

    virtual CString CCL_API getString (
        StringID name,
        StringID defaultValue = CString::kEmpty
    ) const;

    virtual tbool CCL_API getString (MutableCString& string, StringID name) const;
    virtual Options CCL_API getOptions (StringID name, Options defaultOptions = 0) const;
    virtual tbool CCL_API getOptions (Options& options, StringID name) const;
    virtual IImage*CCL_API getImage (StringID name) const;
    virtual IGradient*CCL_API getGradient (StringID name) const;
};

Inherited Members

public:
    // typedefs

    typedef VisualStyleMetric Metric;
    typedef VisualStyleOptions Options;

    // methods

    virtual tresult CCL_API queryInterface (UIDRef iid, void** ptr) = 0;
    virtual unsigned int CCL_API retain () = 0;
    virtual unsigned int CCL_API release () = 0;
    virtual StringID CCL_API getName () const = 0;
    virtual void CCL_API setName (StringID name) = 0;

    virtual ColorRef CCL_API getColor (
        StringID name,
        ColorRef defaultColor = Colors::kBlack
    ) const = 0;

    virtual tbool CCL_API getColor (Color& color, StringID name) const = 0;
    virtual void CCL_API setColor (StringID name, ColorRef color) = 0;

    virtual FontRef CCL_API getFont (
        StringID name,
        FontRef defaultFont = Font::getDefaultFont ()
    ) const = 0;

    virtual tbool CCL_API getFont (Font& font, StringID name) const = 0;
    virtual void CCL_API setFont (StringID name, FontRef font) = 0;
    virtual Metric CCL_API getMetric (StringID name, Metric defaultValue = 0) const = 0;
    virtual tbool CCL_API getMetric (Metric& value, StringID name) const = 0;
    virtual void CCL_API setMetric (StringID name, Metric value) = 0;

    virtual DesignCoord CCL_API getDesignMetric (
        StringID name,
        DesignCoordRef defaultValue = DesignCoord::kUndefined
    ) const = 0;

    virtual tbool CCL_API getDesignMetric (DesignCoord& value, StringID name) const = 0;
    virtual void CCL_API setDesignMetric (StringID name, DesignCoordRef value) = 0;

    virtual CString CCL_API getString (
        StringID name,
        StringID defaultValue = CString::kEmpty
    ) const = 0;

    virtual tbool CCL_API getString (MutableCString& string, StringID name) const = 0;
    virtual void CCL_API setString (StringID name, StringID value) = 0;
    virtual Options CCL_API getOptions (StringID name, Options defaultOptions = 0) const = 0;
    virtual tbool CCL_API getOptions (Options& options, StringID name) const = 0;
    virtual void CCL_API setOptions (StringID name, Options options) = 0;
    virtual IImage*CCL_API getImage (StringID name) const = 0;
    virtual void CCL_API setImage (StringID name, IImage* image) = 0;
    virtual IGradient*CCL_API getGradient (StringID name) const = 0;
    virtual void CCL_API setGradient (StringID name, IGradient* gradient) = 0;
    virtual tbool CCL_API hasReferences (IColorScheme& scheme) const = 0;

Detailed Documentation

A visual style describes the appearance of an UI element.

Methods

virtual tbool CCL_API copyFrom (const IVisualStyle& other) = 0

Copy columns from other style.

virtual const IVisualStyle*CCL_API getInherited () const = 0

Get inherited visual style.

virtual const IVisualStyle*CCL_API getOriginal () const = 0

Get original visual style (usually this, or a source style this one delegates to, e.g.

for a <styleselector>).

virtual const IContainer&CCL_API getStyleConditions () const = 0

Get container with nested visual style conditions.

virtual const IVisualStyleData*CCL_API getStyleCondition (StringID name) const = 0

Get visual style data for given named condition.

virtual tbool CCL_API getColor (
    Color& color,
    StringID name,
    IStyleConditionContext* context
) const = 0

Get color with conditon context, returns false if not found.

virtual tbool CCL_API getFont (
    Font& font,
    StringID name,
    IStyleConditionContext* context
) const = 0

Get font with conditon context, returns false if not found.

virtual tbool CCL_API getMetric (
    Metric& value,
    StringID name,
    IStyleConditionContext* context
) const = 0

Get metric with conditon context (float), returns false if not found.

virtual tbool CCL_API getDesignMetric (
    DesignCoord& value,
    StringID name,
    IStyleConditionContext* context
) const = 0

Get metric with conditon context (DesignCoord), returns false if not found.

virtual tbool CCL_API getString (
    MutableCString& string,
    StringID name,
    IStyleConditionContext* context
) const = 0

Get string with conditon context, returns false if not found.

virtual tbool CCL_API getOptions (
    Options& options,
    StringID name,
    IStyleConditionContext* context
) const = 0

Get options with conditon context, returns false if not found.

virtual IImage*CCL_API getImage (StringID name, IStyleConditionContext* context) const = 0

Get image with conditon context.

virtual IGradient*CCL_API getGradient (
    StringID name,
    IStyleConditionContext* context
) const = 0

Get gradient with conditon context.

virtual ColorRef CCL_API getColor (
    StringID name,
    ColorRef defaultColor = Colors::kBlack
) const

Get color by name, returns default color if not found.

virtual tbool CCL_API getColor (Color& color, StringID name) const

Get color by name, returns false if not found.

virtual FontRef CCL_API getFont (
    StringID name,
    FontRef defaultFont = Font::getDefaultFont ()
) const

Get font by name, returns default font if not found.

virtual tbool CCL_API getFont (Font& font, StringID name) const

Get font by name, returns false if not found.

virtual Metric CCL_API getMetric (StringID name, Metric defaultValue = 0) const

Get metric by name (float), returns default value if not found.

virtual tbool CCL_API getMetric (Metric& value, StringID name) const

Get metric by name (float), returns false if not found.

virtual DesignCoord CCL_API getDesignMetric (
    StringID name,
    DesignCoordRef defaultValue = DesignCoord::kUndefined
) const

Get metric by name (DesignCoord), returns default value if not found.

virtual tbool CCL_API getDesignMetric (DesignCoord& value, StringID name) const

Get metric by name (DesignCoord), returns false if not found.

virtual CString CCL_API getString (
    StringID name,
    StringID defaultValue = CString::kEmpty
) const

Get string by name, returns default value if not found.

virtual tbool CCL_API getString (MutableCString& string, StringID name) const

Get string by name, returns false if not found.

virtual Options CCL_API getOptions (StringID name, Options defaultOptions = 0) const

Get options by name, returns default value if not found.

virtual tbool CCL_API getOptions (Options& options, StringID name) const

Get options by name, returns false if not found.

virtual IImage*CCL_API getImage (StringID name) const

Get image by name.

virtual IGradient*CCL_API getGradient (StringID name) const

Get gradient by name.