AdgDress — The ADG way to associate styles to entities
#define ADG_TYPE_DRESS #define ADG_VALUE_HOLDS_DRESS (value) AdgDress adg_dress_new (const gchar *name, AdgStyle *fallback); AdgDress adg_dress_new_full (const gchar *name, AdgStyle *fallback, GType ancestor_type); AdgDress adg_dress_from_name (const gchar *name); gboolean adg_dress_set (AdgDress *dress, AdgDress src); gboolean adg_dress_are_related (AdgDress dress1, AdgDress dress2); const gchar * adg_dress_get_name (AdgDress dress); GType adg_dress_get_ancestor_type (AdgDress dress); void adg_dress_set_fallback (AdgDress dress, AdgStyle *fallback); AdgStyle * adg_dress_get_fallback (AdgDress dress); 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);
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.
#define ADG_TYPE_DRESS (adg_dress_get_type())
The type used to express a dress index. It is defined only for GObject internal and should not be used directly (at least, as far as I know).
#define ADG_VALUE_HOLDS_DRESS(value) (G_TYPE_CHECK_VALUE_TYPE((value), ADG_TYPE_DRESS))
Checks whether a GValue is actually holding an AdgDress value or not.
|
|
a GValue |
|
Returns : |
TRUE is value is holding an AdgDress, FALSE otherwise
|
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.
|
|
the dress name |
|
|
the fallback style |
|
Returns : |
the new AdgDress value or ADG_DRESS_UNDEFINED on errors |
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.
|
|
the dress name |
|
|
the fallback style |
|
|
the common ancestor type |
|
Returns : |
the new AdgDress value or ADG_DRESS_UNDEFINED on errors |
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.
|
|
the name of a dress |
|
Returns : |
the AdgDress code or ADG_DRESS_UNDEFINED if not found |
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.
|
|
a pointer to an AdgDress |
|
|
the source dress |
|
Returns : |
TRUE on copy done, FALSE on copy failed or not needed |
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().
const gchar * adg_dress_get_name (AdgDress dress);
Gets the name associated to dress. No warnings are raised if
dress is not found.
|
|
an AdgDress |
|
Returns : |
the requested name or NULL if not found |
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.
|
|
an AdgDress |
|
Returns : |
the ancestor type or 0 on errors |
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.
|
|
an AdgDress |
|
|
the new fallback style |
AdgStyle * adg_dress_get_fallback (AdgDress dress);
Gets the fallback style associated to dress. No warnings
are raised if the dress is not found.
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.
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.
|
|
canonical name |
|
|
nickname of the param |
|
|
brief desciption |
|
|
the AdgDress dress |
|
|
a combination of GParamFlags |
|
Returns : |
the newly allocated GParamSpec |