github.com/256dpi/max-go@v0.7.0/lib/max/ext_dynamiccolor.h (about)

     1  //
     2  //  ext_dynamiccolor.h
     3  //  max4
     4  //
     5  //  Created by Jeremy Bernstein on 19.10.19.
     6  //
     7  
     8  #ifndef ext_dynamiccolor_h
     9  #define ext_dynamiccolor_h
    10  
    11  #include "jgraphics.h"
    12  
    13  BEGIN_USING_C_LINKAGE
    14  
    15  t_bool object_attr_dynamiccolor_supported(t_object *x, t_symbol *attrname);
    16  t_bool object_attr_dynamiccolor_setsym_setup(t_object *x, t_symbol *attrname, long ac, t_atom *av);
    17  
    18  // Note: object_attr_dynamiccolor_apply needs to be called after setters to make the final color available in the base attribute
    19  t_symbol *object_attr_dynamiccolor_getname(t_object *x, t_symbol *attrname);
    20  t_max_err object_attr_dynamiccolor_setname(t_object *x, t_symbol *attrname, t_symbol *colorname);
    21  t_bool object_attr_dynamiccolor_geton(t_object *x, t_symbol *attrname);
    22  t_max_err object_attr_dynamiccolor_seton(t_object *x, t_symbol *attrname, t_bool on);
    23  t_max_err object_attr_dynamiccolor_getregular(t_object *x, t_symbol *attrname, long *argc, t_atom **argv);
    24  t_max_err object_attr_dynamiccolor_setregular(t_object *x, t_symbol *attrname, long argc, t_atom *argv);
    25  t_jrgba object_attr_dynamiccolor_getregularrgba(t_object *x, t_symbol *attrname);
    26  t_max_err object_attr_dynamiccolor_setregularrgba(t_object *x, t_symbol *attrname, t_jrgba *color);
    27  
    28  t_symbol *object_attr_dynamiccolor_gethumanname(t_object *x, t_symbol *attrname);
    29  
    30  t_jpopupmenu *dynamiccolor_getmenu(t_object *context, t_symbol *current, long mask, long *selecteditem, long *headercount, t_bool filtered);
    31  void dynamiccolor_handlemenu(t_object *context, long itemindex, t_symbol **current, t_bool filtered);
    32  
    33  void object_attr_dynamiccolor_apply(t_object *x, t_symbol *attrname);
    34  
    35  typedef enum {
    36  	DYNAMICCOLOR_FLAGS_NONE = 0x0000,
    37  	DYNAMICCOLOR_FLAGS_LIVE = 0x0001 // should only be linked in a Live context
    38  } t_dynamiccolor_flags;
    39  
    40  t_max_err class_attr_dynamiccolor_init(t_class *c, t_symbol *name, t_dynamiccolor_flags flags);
    41  
    42  // Adds an attr_attr to this attribute that is not saved to disk but only used to hold the default dynamic color name and to check if this attribute has dynamic color enabled.
    43  #define CLASS_ATTR_DYNAMICCOLOR_FLAGS(c, name, flags, semflags, color_parsestring) \
    44  	class_attr_addattr_parse(c, name, "dynamiccolor_default", gensym("symbol"), flags, color_parsestring); \
    45  	class_attr_dynamiccolor_init(c, gensym(name), semflags);
    46  
    47  #define CLASS_ATTR_DYNAMICCOLOR(c, name, flags, color_parsestring) \
    48  	CLASS_ATTR_DYNAMICCOLOR_FLAGS(c, name, flags, DYNAMICCOLOR_FLAGS_NONE, color_parsestring);
    49  
    50  END_USING_C_LINKAGE
    51  
    52  #endif /* ext_dynamiccolor_h */
    53