## st-theme-context

st-theme-context — holds global information about a tree of styled objects

## Synopsis

                        StThemeContextClass;
    const PangoFontDescription * st_theme_context_get_font  (StThemeContext *context);
    StThemeContext *    st_theme_context_get_for_stage      (ClutterStage *stage);
    double              st_theme_context_get_resolution     (StThemeContext *context);
    StThemeNode *       st_theme_context_get_root_node      (StThemeContext *context);
    StTheme *           st_theme_context_get_theme          (StThemeContext *context);
    StThemeContext *    st_theme_context_new                (void);
    void                st_theme_context_set_default_resolution
                                                            (StThemeContext *context);
    void                st_theme_context_set_font           (StThemeContext *context,
                                                             const PangoFontDescription *font);
    void                st_theme_context_set_resolution     (StThemeContext *context,
                                                             gdouble resolution);
    void                st_theme_context_set_theme          (StThemeContext *context,
                                                             StTheme *theme);

## Description

StThemeContext is responsible for managing information global to a tree of styled objects, such as the set of stylesheets or the default font. In normal usage, a StThemeContext is bound to a ClutterStage; a singleton StThemeContext can be obtained for a ClutterStage by using `st_theme_context_get_for_stage()`.

## Details

### StThemeContextClass

    typedef struct _StThemeContextClass StThemeContextClass;

### st_theme_context_get_font ()

    const PangoFontDescription * st_theme_context_get_font  (StThemeContext *context);

Gets the default font for the theme context. See `st_theme_context_set_font()`.

`context` : | a StThemeContext
Returns : | the default font for the theme context.

### st_theme_context_get_for_stage ()

    StThemeContext *    st_theme_context_get_for_stage      (ClutterStage *stage);

Gets a singleton theme context associated with the stage.

`stage` : | a ClutterStage
Returns : | the singleton theme context for the stage. [transfer none]

### st_theme_context_get_resolution ()

    double              st_theme_context_get_resolution     (StThemeContext *context);

Gets the current resolution of the theme context. See `st_theme_context_set_resolution()`.

`context` : | a StThemeContext
Returns : | the resolution (in dots-per-"inch")

### st_theme_context_get_root_node ()

    StThemeNode *       st_theme_context_get_root_node      (StThemeContext *context);

Gets the root node of the tree of theme style nodes that associated with this context. For the node tree associated with a stage, this node represents styles applied to the stage itself.

`context` : | a StThemeContext
Returns : | the root node of the context's style tree. [transfer none]

### st_theme_context_get_theme ()

    StTheme *           st_theme_context_get_theme          (StThemeContext *context);

Gets the default theme for the context. See `st_theme_context_set_theme()`

`context` : | a StThemeContext
Returns : | the default theme for the context. [transfer none]

### st_theme_context_new ()

    StThemeContext *    st_theme_context_new                (void);

Create a new theme context not associated with any ClutterStage. This can be useful in testing scenarios, or if using StThemeContext with something other than ClutterActor objects, but you generally should use `st_theme_context_get_for_stage()` instead.

### st_theme_context_set_default_resolution ()

    void                st_theme_context_set_default_resolution
                                                            (StThemeContext *context);

Sets the resolution of the theme context to the default value of 96. See `st_theme_context_set_resolution()`.

`context` : | a StThemeContext

### st_theme_context_set_font ()

    void                st_theme_context_set_font           (StThemeContext *context,
                                                             const PangoFontDescription *font);

Sets the default font for the theme context. This is the font that is inherited by the root node of the tree of theme nodes. If the font is not overriden, then this font will be used. If the font is partially modified (for example, with 'font-size: 110%', then that modification is based on this font.

`context` : | a StThemeContext
`font` : | the default font for theme context

### st_theme_context_set_resolution ()

    void                st_theme_context_set_resolution     (StThemeContext *context,
                                                             gdouble resolution);

Sets the resolution of the theme context. This is the scale factor used to convert between points and the length units pt, in, and cm. This does not necessarily need to correspond to the actual number resolution of the device. A value of 72. means that points and pixels are identical. The default value is 96.

`context` : | a StThemeContext
`resolution` : | resolution of the context (number of pixels in an "inch")

### st_theme_context_set_theme ()

    void                st_theme_context_set_theme          (StThemeContext *context,
                                                             StTheme *theme);

Sets the default set of theme stylesheets for the context. This theme will be used for the root node and for nodes descending from it, unless some other style is explicitely specified.

`context` : | a StThemeContext