AdgDress

AdgDress — The ADG way to associate styles to entities

Synopsis

gboolean            adg_dress_are_related               (AdgDress dress1,
                                                         AdgDress dress2);
AdgDress            adg_dress_from_name                 (const gchar *name);
GType               adg_dress_get_ancestor_type         (AdgDress dress);
AdgStyle *          adg_dress_get_fallback              (AdgDress dress);
const gchar *       adg_dress_get_name                  (AdgDress dress);
AdgDress            adg_dress_new                       (const gchar *name,
                                                         AdgStyle *fallback);
AdgDress            adg_dress_new_full                  (const gchar *name,
                                                         AdgStyle *fallback,
                                                         GType ancestor_type);
gboolean            adg_dress_set                       (AdgDress *dress,
                                                         AdgDress src);
void                adg_dress_set_fallback              (AdgDress dress,
                                                         AdgStyle *fallback);
gboolean            adg_dress_style_is_compatible       (AdgDress dress,
                                                         AdgStyle *style);
GParamSpec *        adg_param_spec_dress                (const gchar *name,
                                                         const gchar *nick,
                                                         const gchar *blurb,
                                                         AdgDress dress,
                                                         GParamFlags flags);

Description

The dress is a virtualization of an AdgStyle instance. AdgEntity objects do not directly refer to AdgStyle but use AdgDress values instead. This allows some advanced operations, such as overriding a dress only in a specific entity branch of the hierarchy or customize multiple entities at once.

Details

adg_dress_are_related ()

gboolean            adg_dress_are_related               (AdgDress dress1,
                                                         AdgDress dress2);

Checks whether dress1 and dress2 are related, that is if they have the same ancestor type as returned by adg_dress_get_ancestor_type().

dress1 :

an AdgDress

dress2 :

another AdgDress

Returns :

TRUE if the dresses are related, FALSE otherwise

Since 1.0


adg_dress_from_name ()

AdgDress            adg_dress_from_name                 (const gchar *name);

Gets the dress bound to a name string. No warnings are raised if the dress is not found.

name :

the name of a dress. [transfer none]

Returns :

the AdgDress code or ADG_DRESS_UNDEFINED if not found. [transfer none]

Since 1.0


adg_dress_get_ancestor_type ()

GType               adg_dress_get_ancestor_type         (AdgDress dress);

Gets the base type that should be present in every AdgStyle acceptable by dress. No warnings are raised if dress is not found.

dress :

an AdgDress

Returns :

the ancestor type or 0 on errors

Since 1.0


adg_dress_get_fallback ()

AdgStyle *          adg_dress_get_fallback              (AdgDress dress);

Gets the fallback style associated to dress. No warnings are raised if the dress is not found. The returned style is owned by dress and should not be freed or modified.

dress :

an AdgDress

Returns :

the requested AdgStyle derived instance or NULL if not set. [transfer none]

Since 1.0


adg_dress_get_name ()

const gchar *       adg_dress_get_name                  (AdgDress dress);

Gets the name associated to dress. No warnings are raised if dress is not found.

dress :

an AdgDress

Returns :

the requested name or NULL if not found

Since 1.0


adg_dress_new ()

AdgDress            adg_dress_new                       (const gchar *name,
                                                         AdgStyle *fallback);

Creates a new dress. It is a convenient wrapper of adg_dress_new_full() that uses as ancestor the G_TYPE_FROM_INSTANCE() of fallback.

After a succesfull call, a new reference is added to fallback.

name :

the dress name

fallback :

the fallback style

Returns :

the new AdgDress value or ADG_DRESS_UNDEFINED on errors. [type gint][transfer full]

Since 1.0


adg_dress_new_full ()

AdgDress            adg_dress_new_full                  (const gchar *name,
                                                         AdgStyle *fallback,
                                                         GType ancestor_type);

Creates a new dress, explicitely setting the ancestor type. If fallback is not NULL, ancestor_type must be present in its hierarchy: check out the adg_dress_style_is_compatible() documentation to know what the ancestor type is used for.

fallback can be NULL, in which case a "transparent" dress is created. This kind of dress does not change the cairo context because there is no style to apply. Any entity could override it to change this behavior though.

After a succesfull call, a new reference is added to fallback if needed.

name :

the dress name

fallback :

the fallback style

ancestor_type :

the common ancestor type

Returns :

the new AdgDress value or ADG_DRESS_UNDEFINED on errors. [type gint][transfer full]

Since 1.0


adg_dress_set ()

gboolean            adg_dress_set                       (AdgDress *dress,
                                                         AdgDress src);

Copies src in dress. This operation can be succesful only if dress is ADG_DRESS_UNDEFINED or if it contains a dress related to src, that is adg_dress_are_related() returns TRUE.

dress :

a pointer to an AdgDress

src :

the source dress

Returns :

TRUE on copy done, FALSE on copy failed or not needed

Since 1.0


adg_dress_set_fallback ()

void                adg_dress_set_fallback              (AdgDress dress,
                                                         AdgStyle *fallback);

Associates a new fallback style to dress. If the dress does not exist (it was not previously created by adg_dress_new()), a warning message is raised and the function fails.

fallback is checked for compatibily with dress. Any dress holds an ancestor type: if this type is not found in the fallback hierarchy, a warning message is raised and the function fails.

After a succesfull call, the reference to the previous fallback (if any) is dropped while a new reference to fallback is added.

dress :

an AdgDress

fallback :

the new fallback style

Since 1.0


adg_dress_style_is_compatible ()

gboolean            adg_dress_style_is_compatible       (AdgDress dress,
                                                         AdgStyle *style);

Checks whether style is compatible with dress, that is if style has the ancestor style type (as returned by adg_dress_get_ancestor_type()) in its hierarchy.

dress :

an AdgDress

style :

the AdgStyle to check

Returns :

TRUE if dress can accept style, FALSE otherwise

Since 1.0


adg_param_spec_dress ()

GParamSpec *        adg_param_spec_dress                (const gchar *name,
                                                         const gchar *nick,
                                                         const gchar *blurb,
                                                         AdgDress dress,
                                                         GParamFlags flags);

Creates a param spec to hold a dress value.

name :

canonical name

nick :

nickname of the param

blurb :

brief desciption

dress :

the AdgDress dress

flags :

a combination of GParamFlags

Returns :

the newly allocated GParamSpec. [transfer none]

Since 1.0