gog-theme

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

Synopsis

                    GogTheme;
gboolean            gog_theme_delete                    (GogTheme *theme);
GogTheme *          gog_theme_dup                       (GogTheme *theme);
GogTheme *          gog_theme_edit                      (GogTheme *theme,
                                                         GOCmdContext *cc);
void                gog_theme_foreach                   (GFunc handler,
                                                         gpointer user_data);
void                gog_theme_fillin_style              (GogTheme const *theme,
                                                         GOStyle *style,
                                                         GogObject const *obj,
                                                         int ind,
                                                         GOStyleFlag relevant_fields);
GogAxisColorMap const * gog_theme_get_color_map         (GogTheme const *theme,
                                                         gboolean discrete);
char const *        gog_theme_get_description           (GogTheme const *theme);
char const *        gog_theme_get_id                    (GogTheme const *theme);
char const *        gog_theme_get_name                  (GogTheme const *theme);
GoResourceType      gog_theme_get_resource_type         (GogTheme const *theme);
GSList *            gog_theme_registry_get_theme_names  (void);
GogTheme *          gog_theme_registry_lookup           (char const *name);
void                gog_theme_save_to_home_dir          (GogTheme *theme);

Object Hierarchy

  GObject
   +----GogTheme

Implemented Interfaces

GogTheme implements GOPersist.

Properties

  "resource-type"            GoResourceType        : Read / Write / Construct Only

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 root element needs to have an Id which should be unique. The uuid command provides such Ids.

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</td></tr> <tr><td>GogRegEqn</td><td></td><td>outline, fill, font, text_layout</td></tr> <tr><td>GogSeriesLabels</td><td></td><td>outline, fill, font, text_layout</td></tr> <tr><td>GogRegEqn</td><td></td><td>outline, fill, font, text_layout</td></tr> <tr><td>GogSeriesLabel</td><td></td><td>outline, fill, font, text_layout</td></tr> <tr><td>GogDataLabel</td><td></td><td>outline, fill, font, text_layout</td></tr> <tr><td>GogEquation</td><td></td><td>outline, 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

GogTheme

typedef struct _GogTheme GogTheme;


gog_theme_delete ()

gboolean            gog_theme_delete                    (GogTheme *theme);

Destroys the theme and remove it from the user directory and from the database.

theme :

a GogTheme

Returns :

TRUE on success.

gog_theme_dup ()

GogTheme *          gog_theme_dup                       (GogTheme *theme);

Duplicates theme with a new Id.

theme :

a GogTheme

Returns :

the new theme. [transfer full]

gog_theme_edit ()

GogTheme *          gog_theme_edit                      (GogTheme *theme,
                                                         GOCmdContext *cc);

Displays a dialog box to edit the theme. This can be done only for locally installed themes that are writeable.

theme :

the GogTheme to edit or NULL to create a new one.

cc :

a GOCmdContext or NULL.

Returns :

The edited theme or NULL if the edition has been cancelled. [transfer none]

gog_theme_foreach ()

void                gog_theme_foreach                   (GFunc handler,
                                                         gpointer user_data);

Executes handler to each theme installed on the system, including built-in themes.

handler :

a GFunc using a theme as first argument. [scope call]

user_data :

data to pass to handler

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_get_color_map ()

GogAxisColorMap const * gog_theme_get_color_map         (GogTheme const *theme,
                                                         gboolean discrete);

Retrieves the themed color map. Each theme has a discrete color map and a continuous one.

theme :

GogTheme

discrete :

whether the map is for a discrete axis.

Returns :

the requested color map. [transfer none]

gog_theme_get_description ()

char const *        gog_theme_get_description           (GogTheme const *theme);

theme :

Returns :


gog_theme_get_id ()

char const *        gog_theme_get_id                    (GogTheme const *theme);

Retrieves the theme Id.

theme :

a GogTheme

Returns :

the GogTheme Id.

gog_theme_get_name ()

char const *        gog_theme_get_name                  (GogTheme const *theme);

theme :

a GogTheme

Returns :

the GogTheme name.

gog_theme_get_resource_type ()

GoResourceType      gog_theme_get_resource_type         (GogTheme const *theme);

theme :

Returns :


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]

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_save_to_home_dir ()

void                gog_theme_save_to_home_dir          (GogTheme *theme);

Writes the theme to the user directory so that it becomes permanently available.

theme :

the GogTheme to save

Property Details

The "resource-type" property

  "resource-type"            GoResourceType        : Read / Write / Construct Only

The resource type for the theme.

Default value: GO_RESOURCE_INVALID