struct CCL::IVisualStyle

Overview

A visual style holds colors, fonts, metrics, etc. More…

#include <ivisualstyle.h>

struct IVisualStyle: public CCL::IUnknown
{
    // typedefs

    typedef float Metric;
    typedef int Options;

    // methods

    virtual StringID CCL_API getName () const = 0;

    virtual ColorRef CCL_API getColor (
        StringID name,
        ColorRef defaultColor = Colors::kBlack
    ) 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 void CCL_API setFont (StringID name, FontRef font) = 0;
    virtual Metric CCL_API getMetric (StringID name, Metric defaultValue = 0) const = 0;
    virtual void CCL_API setMetric (StringID name, Metric value) = 0;

    virtual CString CCL_API getString (
        StringID name,
        StringID defaultValue = CString::kEmpty
    ) 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 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;
    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;
    IVisualStyle DECLARE_STRINGID_MEMBER (kColors) 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;

    bool getMetric (StringID name, bool defaultValue) const;
};

Inherited Members

public:
    // 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;

Detailed Documentation

A visual style holds colors, fonts, metrics, etc.

describing the appearance of an UI element.

Typedefs

typedef float Metric

Metric type.

typedef int Options

Options type.

Methods

virtual StringID CCL_API getName () const = 0

Get name of visual style.

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

Get color by name.

If color does not exist, the default color is returned.

virtual void CCL_API setColor (StringID name, ColorRef color) = 0

Set color by name.

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

Get font by name.

If font does not exist, the default font is returned.

virtual void CCL_API setFont (StringID name, FontRef font) = 0

Set font by name.

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

Get metric by name.

If it does not exist, the default value is returned.

virtual void CCL_API setMetric (StringID name, Metric value) = 0

Set metric by name.

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

Get string by name.

If it does not exist, the default value is returned.

virtual void CCL_API setString (StringID name, StringID value) = 0

Set string by name.

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

Get options by name.

If it does not exist, the default options are returned.

virtual void CCL_API setOptions (StringID name, Options options) = 0

Set options by name.

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

Get image by name.

virtual void CCL_API setImage (StringID name, IImage* image) = 0

Set image by name.

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

Get gradient by name.

virtual void CCL_API setGradient (StringID name, IGradient* gradient) = 0

Set gradient by name.

virtual tbool CCL_API hasReferences (IColorScheme& scheme) const = 0

Check if style has references to given color scheme.

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>).

IVisualStyle DECLARE_STRINGID_MEMBER (kColors) const

< fonts [IArrayObject]

< metrics [IArrayObject] < strings [IArrayObject] < options [IArrayObject] < images [IArrayObject] < gradients [IArrayObject] Get foreground color

Color getBackColor () const

Get background color.

Color getHiliteColor () const

Get hilite color.

Color getTextColor () const

Get text color.

Metric getStrokeWidth () const

Get stroke width.

Pen getForePen () const

Get foreground pen.

Pen getBackPen () const

Get background pen.

Brush getForeBrush () const

Get foreground brush (solid or gradient)

Brush getBackBrush () const

Get background brush (solid or gradient)

Brush getTextBrush () const

Get text brush (solid or gradient)

Font getTextFont () const

Get text font.

Alignment getTextAlignment () const

Get text alignment.

Options getTextOptions () const

Get text options.

TextFormat getTextFormat () const

Get text format.

IImage* getBackgroundImage () const

Get background image.

void getPadding (Rect& padding) const

Get padding.