gog-theme

gog-theme — a list of default styles to apply to appropriate graph elements.

Synopsis

char const *        gog_theme_get_name                  (GogTheme const *theme);
char const *        gog_theme_get_local_name            (GogTheme const *theme);
char const *        gog_theme_get_description           (GogTheme const *theme);
void                gog_theme_fillin_style              (GogTheme const *theme,
                                                         GOStyle *style,
                                                         GogObject const *obj,
                                                         int ind,
                                                         GOStyleFlag relevant_fields);
GogTheme *          gog_theme_registry_lookup           (char const *name);
GSList *            gog_theme_registry_get_theme_names  (void);

Description

The library provides two hard coded themes, "Default", and "Guppi". Other themes are described in files, some of which might be distributed with the library.

A file defining a theme is an xml file with a <GogTheme> root node. The contents must be: _name|name+, _description?|description*, GOStyle+.

_name and name nodes:

The _name node should be used for themes distributed with goffice, localized names will be in *.po files and only the default name for "C" locale needs to be there. Other files need at least one name node for the default name, and might have some translated names with an appropriate "xml:lang" attribute.

_description and description nodes:

These work just like name nodes. The difference is that no description node is mandatory. A theme can work perfectly without a description.

GOStyle nodes:

These nodes actually define the theme. Attributes and contents are: attributes: class, role. contents: (line|outline)?, fill?, marker?, font?, text_layout?

The attributes define the target for the style. You might have a class and a role attribute, or just one of them. If the role attribute is given, the class attribute, if given, represents the class of the parent object. A GOStyle node with no class or role will be used as default when another style is missing. If several such nodes exist, the last one will be used. If no default style exists, the "Default" theme is applied for missing nodes. The list of GOStyle nodes might be: <table style="border-spacing:1cm 2mm"> <thead><tr><td>class</td><td>role</td><td>contents</td><td>comments</td></tr></thead> <tr><td>GogGraph</td><td></td><td>outline, fill</td></tr> <tr><td>GogGraph</td><td>Title</td><td>outline, fill, font, text_layout</td><td>The graph title</td></tr> <tr><td>GogChart</td><td></td><td>outline, fill</td></tr> <tr><td>GogChart</td><td>Title</td><td>outline, fill, font, text_layout</td><td>The chart title</td></tr> <tr><td>GogLegend</td><td></td><td>outline, fill, font</td></tr> <tr><td>GogAxis</td><td></td><td>line, font, text_layout</td></tr> <tr><td>GogAxisLine</td><td></td><td>line, font</td></tr> <tr><td>GogGrid</td><td></td><td>outline, fill</td><td>GogGrid is actually the back plane</td></tr> <tr><td> </td><td>MajorGrid</td><td>line, fill</td></tr> <tr><td> </td><td>MinorGrid</td><td>line, fill</td></tr> <tr><td>GogLabel</td><td></td><td>outline, fill, font, text_layout</td></tr> <tr><td>GogSeries</td><td></td><td>line, fill, marker</td><td>One is needed for each entry in the palette</td></tr> <tr><td>GogTrendLine</td><td></td><td>line, fill</td></tr> <tr><td>GogReqEqn</td><td></td><td>line, fill, font, text_layout</td></tr> </table>

The line and outline nodes are actually the same so using line in place of outline is not an issue. A color is specified either using the format RR:GG::BB:AA or a string as defined in rgb.txt, so black can be specified as "black" or "00:00:00:FF".

"line" or "outline" node:

<table style="border-spacing:1cm 2mm"> <thead><tr><td>attribute</td><td>value</td></tr><td>comments</td></thead> <tr><td>dash</td><td>one of "none", "solid", "s-dot", "s-dash-dot", "s-dash-dot-dot", "dash-dot-dot-dot", "dot", "s-dash", "dash", "l-dash", "dash-dot", or "dash-dot-dot"</td></tr> <tr><td>color</td><td>any color as described above</td></tr> <tr><td>width</td><td>float</td><td>not always taken into account</td></tr> </table>

"fill" node

contents: (pattern|gradient)? <table style="border-spacing:1cm 2mm"> <thead><tr><td>attribute</td><td>value</td><td>comments</td></tr></thead> <tr><td>type</td><td>one of "none", "pattern", or "gradient"</td></tr> </table>

"pattern" node

Should be included in the fill node if type is pattern. <table style="border-spacing:1cm 2mm"> <thead><tr><td>attribute</td><td>value</td></tr></thead> <tr><td>type</td><td>one of "solid", "grey75", "grey50", "grey25", "grey12.5", "grey6.25", "horiz", "vert", "rev-diag", "diag", "diag-cross", "thick-diag-cross", "thin-horiz", "thin-vert", "thin-rev-diag", "thin-diag", "thin-horiz-cross", "thin-diag-cross", "foreground-solid", "small-circles","semi-circles", "thatch", "large-circles", or "bricks"</td></tr> <tr><td>fore</td><td>any color as described above</td></tr> <tr><td>back</td><td>any color as described above</td></tr> </table>

"gradient" node

Should be included in the fill node if type is gradient. <table style="border-spacing:1cm 2mm"> <thead><tr><td>attribute</td><td>value</td><td>comments</td></tr></thead> <tr><td>direction</td><td>one of "n-s", "s-n", "n-s-mirrored", "s-n-mirrored", "w-e", "e-w", "w-e-mirrored", "e-w-mirrored", "nw-se", "se-nw", "nw-se-mirrored", "se-nw-mirrored", "ne-sw", "sw-ne", "sw-ne-mirrored", or "ne-sw-mirrored" </td><td></td></tr> <tr><td>start_color</td><td>any color as described above</td><td></td></tr> <tr><td>brightness</td><td>float</td><td>meaningful only for monocolor gradients</td></tr> <tr><td>end_color</td><td>any color as described above</td><td>meaningful only for bicolor gradients</td></tr> </table>

"marker" node

<table style="border-spacing:1cm 2mm"> <thead><tr><td>attribute</td><td>value</td><td>comments</td></tr></thead> <tr><td>shape</td><td>one of "none", "square", "diamond", "triangle-down", "triangle-up", "triangle-right", "triangle-left", "circle", "x", "cross", "asterisk", "bar", "half-bar", "butterfly", "hourglass", or "lefthalf-bar"</td><td></td></tr> <tr><td>fill-color</td><td>any color as described above</td><td></td></tr> <tr><td>outline-color</td><td>any color as described above</td><td></td></tr> <tr><td>size</td><td>float</td><td>not always taken into account</td></tr> </table>

"font" node <table style="border-spacing:1cm 2mm"> <thead><tr><td>attribute</td><td>value</td></tr></thead> <tr><td>color</td><td>any color as described above</td></tr> <tr><td>font</td><td>a string describing the font such as "Sans 10"</td></tr> </table>

"text_layout" node <table style="border-spacing:1cm 2mm"> <thead><tr><td>attribute</td><td>value</td><td>comments</td></tr></thead> <tr><td>angle</td><td>float</td><td>expressed in degrees</td></tr> </table>

Details

gog_theme_get_name ()

char const *        gog_theme_get_name                  (GogTheme const *theme);

theme :

a GogTheme

Returns :

the GogTheme name.

gog_theme_get_local_name ()

char const *        gog_theme_get_local_name            (GogTheme const *theme);

theme :

a GogTheme

Returns :

the localized GogTheme name.

gog_theme_get_description ()

char const *        gog_theme_get_description           (GogTheme const *theme);

theme :

Returns :


gog_theme_fillin_style ()

void                gog_theme_fillin_style              (GogTheme const *theme,
                                                         GOStyle *style,
                                                         GogObject const *obj,
                                                         int ind,
                                                         GOStyleFlag relevant_fields);

Fill in the auto aspects of style based on theme 's element for objects of type/role similar to obj with index ind. If relevant_fields is GO_STYLE_ALL, fillin the entire style, not just the auto portions included in relevant_fields.

theme :

GogTheme

style :

GOStyle to initialize

obj :

GogObject The object associated with style

ind :

an optional index

relevant_fields :

GOStyleFlag

gog_theme_registry_lookup ()

GogTheme *          gog_theme_registry_lookup           (char const *name);

name :

a theme name

Returns :

a GogTheme from theme registry. [transfer none]

gog_theme_registry_get_theme_names ()

GSList *            gog_theme_registry_get_theme_names  (void);

Returns :

a newly allocated theme name list from theme registry. [element-type utf8][transfer container utf8]