Max API
8.2.0
|
Styles provide a means by which to inherit attribute values from a patcher that are consistently used across many objects. More...
Macros | |
#define | FILL_ATTR_SAVE |
Flag indicating we want this fill attribute saved (creates attrs). More... | |
#define | CLASS_ATTR_STYLE_RGBA_NOSAVE(c, attrname, flags, structname, structmember, label) |
Define an RGBA style attribute with standard settings. More... | |
#define | CLASS_ATTR_STYLE_RGBA(c, attrname, flags, structname, structmember, label) |
Define an RGBA style attribute with standard settings. More... | |
#define | CLASS_ATTR_STYLE_RGBA_PREVIEW(c, attrname, flags, structname, structmember, label, previewtype) |
Define an RGBA style attribute with standard settings. More... | |
#define | CLASS_ATTR_STYLE_ALIAS_NOSAVE(c, attrname, aliasname) |
Define an unsaved alias. More... | |
#define | CLASS_ATTR_STYLE_ALIAS_COMPATIBILITY(c, attrname, aliasname) |
Define a Max 5/6 saved compatibility alias. More... | |
#define | CLASS_ATTR_STYLE_ALIAS_RGBA_LEGACY(c, attrname, aliasname) |
Define a Max 4 legacy RGB attribute alias. More... | |
Functions | |
BEGIN_USING_C_LINKAGE void | class_attr_setstyle (t_class *c, const char *s) |
Add an attribute to the current style. More... | |
void | class_attr_style_alias (t_class *c, const char *name, const char *aliasname, long legacy) |
Add an alias to the current style. More... | |
void | class_attr_setfill (t_class *c, const char *name, long flags) |
Specify that an attr requires a fill. More... | |
void | jgraphics_attr_fillrect (t_object *b, t_jgraphics *g, t_symbol *attrname, t_rect *area) |
Fill using the current value of a named style color that exists either in the object or the defined style. More... | |
t_jpattern * | jgraphics_attr_setfill (t_object *b, t_jgraphics *g, t_symbol *attrname, t_rect *area) |
Fill using the current value of a named style color that exists either in the object or the defined style. More... | |
void | object_attr_getfillcolor_atposition (t_object *b, const char *attrname, double pos, t_jrgba *c) |
Determine the color at a given position in a fill. More... | |
long | object_attr_getfill (t_object *obj, t_symbol *attrname) |
Determine if an attribute is a fill. More... | |
void | class_attr_stylemap (t_class *c, const char *attrname, const char *mapname) |
Associate the name of an attribute of your class with the name of an attribute of a style. More... | |
Styles provide a means by which to inherit attribute values from a patcher that are consistently used across many objects.
#define CLASS_ATTR_STYLE_ALIAS_COMPATIBILITY | ( | c, | |
attrname, | |||
aliasname | |||
) |
Define a Max 5/6 saved compatibility alias.
c | The class whose attribute will be added to the style. |
attrname | The name of the attribute of your class. |
aliasname | The name of the alias. |
#define CLASS_ATTR_STYLE_ALIAS_NOSAVE | ( | c, | |
attrname, | |||
aliasname | |||
) |
Define an unsaved alias.
c | The class whose attribute will be added to the style. |
attrname | The name of the attribute of your class. |
aliasname | The name of the alias. |
#define CLASS_ATTR_STYLE_ALIAS_RGBA_LEGACY | ( | c, | |
attrname, | |||
aliasname | |||
) |
Define a Max 4 legacy RGB attribute alias.
c | The class whose attribute will be added to the style. |
attrname | The name of the attribute of your class. |
aliasname | The name of the alias. |
#define CLASS_ATTR_STYLE_RGBA | ( | c, | |
attrname, | |||
flags, | |||
structname, | |||
structmember, | |||
label | |||
) |
Define an RGBA style attribute with standard settings.
c | The class whose attribute will be added to the style. |
attrname | The name of the attribute of your class. |
flags | Any flags you wish to declare for this attribute, as defined in e_max_attrflags. |
structname | The C identifier for the struct (containing a valid t_object header) representing an instance of this class. |
structmember | The C identifier of the member in the struct that holds the value of this attribute. |
label | A human-friendly label for the Max inspector. |
#define CLASS_ATTR_STYLE_RGBA_NOSAVE | ( | c, | |
attrname, | |||
flags, | |||
structname, | |||
structmember, | |||
label | |||
) |
Define an RGBA style attribute with standard settings.
c | The class whose attribute will be added to the style. |
attrname | The name of the attribute of your class. |
flags | Any flags you wish to declare for this attribute, as defined in e_max_attrflags. |
structname | The C identifier for the struct (containing a valid t_object header) representing an instance of this class. |
structmember | The C identifier of the member in the struct that holds the value of this attribute. |
label | A human-friendly label for the Max inspector. |
#define CLASS_ATTR_STYLE_RGBA_PREVIEW | ( | c, | |
attrname, | |||
flags, | |||
structname, | |||
structmember, | |||
label, | |||
previewtype | |||
) |
Define an RGBA style attribute with standard settings.
c | The class whose attribute will be added to the style. |
attrname | The name of the attribute of your class. |
flags | Any flags you wish to declare for this attribute, as defined in e_max_attrflags. |
structname | The C identifier for the struct (containing a valid t_object header) representing an instance of this class. |
structmember | The C identifier of the member in the struct that holds the value of this attribute. |
label | A human-friendly label for the Max inspector. |
previewtype | Type of preview to use in the style bar, e.g. "triangle_fill" |
#define FILL_ATTR_SAVE |
Flag indicating we want this fill attribute saved (creates attrs).
void class_attr_setfill | ( | t_class * | c, |
const char * | name, | ||
long | flags | ||
) |
Specify that an attr requires a fill.
c | The class whose attribute is a fill. |
name | The name of the attribute. |
flags | 0 for none, or FILL_ATTR_SAVE. |
BEGIN_USING_C_LINKAGE void class_attr_setstyle | ( | t_class * | c, |
const char * | s | ||
) |
Add an attribute to the current style.
c | The class whose attribute will be added to the style. |
s | The name of the attribute to be added to the style. |
void class_attr_style_alias | ( | t_class * | c, |
const char * | name, | ||
const char * | aliasname, | ||
long | legacy | ||
) |
Add an alias to the current style.
This is used for backward compatibility where an attribute using an old name will want a style applied to it from a different name. Typically you will use one of the macros such as CLASS_ATTR_STYLE_ALIAS_NOSAVE rather than using this function directly.
c | The class for whom the alias will be created. |
name | The name of the attribute of the style. |
aliasname | The name of the alias. |
legacy | Always pass 0 for this argument. |
void class_attr_stylemap | ( | t_class * | c, |
const char * | attrname, | ||
const char * | mapname | ||
) |
Associate the name of an attribute of your class with the name of an attribute of a style.
c | The class whose attribute will be added to the style. |
attrname | The name of the attribute of your class. |
mapname | The name of the attribute from the style. |
void jgraphics_attr_fillrect | ( | t_object * | b, |
t_jgraphics * | g, | ||
t_symbol * | attrname, | ||
t_rect * | area | ||
) |
Fill using the current value of a named style color that exists either in the object or the defined style.
Abdridged example from the 'attrui' object:
b | The instance of your object. |
g | The jgraphics context. |
attrname | The name of the attribute whose fill style you want. |
area | The rect area to be filled. |
t_jpattern* jgraphics_attr_setfill | ( | t_object * | b, |
t_jgraphics * | g, | ||
t_symbol * | attrname, | ||
t_rect * | area | ||
) |
Fill using the current value of a named style color that exists either in the object or the defined style.
Example from the 'panel' object:
b | The instance of your object. |
g | The jgraphics context. |
attrname | The name of the attribute whose fill style you want. |
area | The rect area to be filled. |
Determine if an attribute is a fill.
obj | The instance of your object. |
attrname | The name of the attribute to query. |
void object_attr_getfillcolor_atposition | ( | t_object * | b, |
const char * | attrname, | ||
double | pos, | ||
t_jrgba * | c | ||
) |
Determine the color at a given position in a fill.
b | The instance of your object. |
attrname | The name of the attribute to query. |
pos | The position in a range of [0.0, 1.0]. |
c | A valid t_jrgba whose members will be filled-in upon return. |