CicmWrapper  Beta 0.4
A wrapper for Pure Data
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules Pages
eclass.h
1 /*
2  * CicmWrapper
3  * Copyright (C) 2013 Pierre Guillot, CICM - Université Paris 8
4  * All rights reserved.
5  * Website : https://github.com/CICM/CicmWrapper
6  * Contacts : cicm.mshparisnord@gmail.com
7  * For information on usage and redistribution, and for a DISCLAIMER OF ALL
8  * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
9  */
10 
17 #ifndef DEF_ECLASS
18 #define DEF_ECLASS
19 
20 #include "edefine.h"
21 
39 t_eclass* eclass_new(const char *name, t_typ_method newm, t_typ_method freem, size_t size, int flags, t_atomtype arg1, int arg2);
40 
48 void eclass_guiinit(t_eclass* c, long flags);
49 
58 void eclass_init(t_eclass* c, long flags) _FUNCTION_DEPRECTAED_;
59 
68 
75 void eclass_dspinit(t_eclass* c);
76 
87 void eclass_addmethod(t_eclass* c, t_typ_method m, const char* name, t_atomtype type, long dummy);
88 
101 void eclass_new_attr_typed(t_eclass* c, const char* attrname, const char* type, long size, long maxsize, long flags, long offset);
102 
104 
112 void eclass_attr_setter(t_object* x, t_symbol *s, int argc, t_atom *argv);
113 
122 void eclass_attr_getter(t_object* x, t_symbol *s, int* argc, t_atom** argv);
123 
125 
135 void eclass_attr_category(t_eclass* c, const char* attrname, long flags, const char* category);
136 
146 void eclass_attr_order(t_eclass* c, const char* attrname, long flags, const char* order);
147 
157 void eclass_attr_label(t_eclass* c, const char* attrname, long flags, const char* label);
158 
168 void eclass_attr_style(t_eclass* c, const char* attrname, long flags, const char* style);
169 
179 void eclass_attr_default(t_eclass* c, const char* attrname, long flags, const char* value);
180 
189 void eclass_attr_filter_min(t_eclass* c, const char* attrname, float value);
190 
199 void eclass_attr_filter_max(t_eclass* c, const char* attrname, float value);
200 
209 void eclass_attr_step(t_eclass* c, const char* attrname, float value);
210 
219 void eclass_attr_save(t_eclass* c, const char* attrname, long flags);
220 
229 void eclass_attr_paint(t_eclass* c, const char* attrname, long flags);
230 
239 void eclass_attr_invisible(t_eclass* c, const char* attrname, long flags);
240 
250 void eclass_attr_accessor(t_eclass* c, const char* attrname, t_err_method getter, t_err_method setter);
251 
261 void eclass_attr_itemlist(t_eclass* c, const char* attrname, long flags, const char* list);
262 
264 #define calcoffset(x,y) ((long)(&(((x *)0L)->y)))
265 
268 #define CLASS_ATTR_INT(c,name,flags,struct,member) \
269 eclass_new_attr_typed(c,name, "int", 1, 0, flags, calcoffset(struct,member))
270 #define CLASS_ATTR_LONG(c,name,flags,struct,member) \
272 eclass_new_attr_typed(c,name, "long", 1, 0, flags, calcoffset(struct,member))
273 #define CLASS_ATTR_FLOAT(c,name,flags,struct,member) \
275 eclass_new_attr_typed(c,name, "float", 1, 0, flags, calcoffset(struct,member))
276 #define CLASS_ATTR_DOUBLE(c,name,flags,struct,member) \
278 eclass_new_attr_typed(c,name, "double", 1, 0, flags, calcoffset(struct,member))
279 #define CLASS_ATTR_RGB(c,name,flags,struct,member) \
281 eclass_new_attr_typed(c,name, "float", 3, 0, flags, calcoffset(struct,member))
282 #define CLASS_ATTR_RGBA(c,name,flags,struct,member) \
284 eclass_new_attr_typed(c,name, "float", 4, 0, flags, calcoffset(struct,member))
285 #define CLASS_ATTR_SYMBOL(c,name,flags,struct,member) \
287 eclass_new_attr_typed(c,name, "symbol", 1, 0, flags, calcoffset(struct,member))
288 #define CLASS_ATTR_ATOM(c,name,flags,struct,member) \
290 eclass_new_attr_typed(c,name, "atom", 1, 0, flags, calcoffset(struct,member))
291 #define CLASS_ATTR_INT_ARRAY(c,name,flags,struct,member,size) \
293 eclass_new_attr_typed(c,name, "int", size, 0, flags, calcoffset(struct,member))
294 #define CLASS_ATTR_LONG_ARRAY(c,name,flags,struct,member,size) \
296 eclass_new_attr_typed(c,name, "long", size, 0, flags, calcoffset(struct,member))
297 #define CLASS_ATTR_FLOAT_ARRAY(c,name,flags,struct,member,size) \
299 eclass_new_attr_typed(c,name, "float", size, 0, flags, calcoffset(struct,member))
300 #define CLASS_ATTR_DOUBLE_ARRAY(c,name,flags,struct,member,size) \
302 eclass_new_attr_typed(c,name, "double", size, 0, flags, calcoffset(struct,member))
303 #define CLASS_ATTR_SYMBOL_ARRAY(c,name,flags,struct,member, size) \
305 eclass_new_attr_typed(c,name, "symbol", size, 0, flags, calcoffset(struct,member))
306 #define CLASS_ATTR_ATOM_ARRAY(c,name,flags,struct,member, size) \
308 eclass_new_attr_typed(c,name, "atom", size, 0, flags, calcoffset(struct,member))
309 #define CLASS_ATTR_INT_VARSIZE(c,name,flags,struct,member, size, maxsize) \
311 eclass_new_attr_typed(c,name, "int", calcoffset(struct,size), maxsize, flags, calcoffset(struct,member))
312 #define CLASS_ATTR_LONG_VARSIZE(c,name,flags,struct,member, size, maxsize) \
314 eclass_new_attr_typed(c,name, "long", calcoffset(struct,size), maxsize, flags, calcoffset(struct,member))
315 #define CLASS_ATTR_FLOAT_VARSIZE(c,name,flags,struct,member, size, maxsize) \
317 eclass_new_attr_typed(c,name, "float", calcoffset(struct,size), maxsize, flags, calcoffset(struct,member))
318 #define CLASS_ATTR_DOUBLE_VARSIZE(c,name,flags,struct, member, size, maxsize) \
320 eclass_new_attr_typed(c,name, "double", calcoffset(struct,size), maxsize, flags, calcoffset(struct,member))
321 #define CLASS_ATTR_SYMBOL_VARSIZE(c,name,flags,struct, member, size, maxsize) \
323 eclass_new_attr_typed(c,name, "symbol", calcoffset(struct,size), maxsize, flags, calcoffset(struct,member))
324 #define CLASS_ATTR_ATOM_VARSIZE(c,name,flags,struct, member, size, maxsize) \
326 eclass_new_attr_typed(c,name, "atom", calcoffset(struct,size), maxsize, flags, calcoffset(struct,member))
327 
329 #define CLASS_ATTR_CATEGORY(c,name,flags,categoryname) eclass_attr_category(c,name,flags,categoryname)
330 #define CLASS_ATTR_ORDER(c,name,flags,order) eclass_attr_order(c,name,flags,order)
332 #define CLASS_ATTR_LABEL(c,name,flags,label) eclass_attr_label(c,name,flags,label)
334 #define CLASS_ATTR_STYLE(c,name,flags,style) eclass_attr_style(c,name,flags,style)
336 #define CLASS_ATTR_DEFAULT(c,name,flags,val) eclass_attr_default(c,name,flags,val)
338 #define CLASS_ATTR_FILTER_MIN(c, name, value) eclass_attr_filter_min(c, name, value)
340 #define CLASS_ATTR_FILTER_MAX(c, name, value) eclass_attr_filter_max(c, name, value)
342 #define CLASS_ATTR_FILTER_CLIP(c, name, minval, maxval) eclass_attr_filter_min(c, name, minval); eclass_attr_filter_max(c, name, maxval);
344 #define CLASS_ATTR_STEP(c, name, value) eclass_attr_step(c, name, value)
346 #define CLASS_ATTR_SAVE(c,name,flags) eclass_attr_save(c,name,flags)
348 #define CLASS_ATTR_PAINT(c,name,flags) eclass_attr_paint(c,name,flags)
350 #define CLASS_ATTR_INVISIBLE(c,name,flags) eclass_attr_invisible(c,name,flags)
352 #define CLASS_ATTR_ACCESSORS(c,name,getter,setter) eclass_attr_accessor(c,name,(t_err_method)getter,(t_err_method)setter)
354 #define CLASS_ATTR_ITEMS(c,name,flags, list) eclass_attr_itemlist(c,name,flags, list)
356 #define CLASS_ATTR_DEFAULT_SAVE_PAINT(c,attrname,flags,parsestr) \
358 { CLASS_ATTR_DEFAULT(c,attrname,flags,parsestr); CLASS_ATTR_SAVE(c,attrname,flags); CLASS_ATTR_PAINT(c,attrname,flags); }
359 
362 #endif
363 
364 
365 
void eclass_attr_paint(t_eclass *c, const char *attrname, long flags)
Sets if the attribute should call the ebox_redraw() function.
Definition: eclass.c:553
void eclass_addmethod(t_eclass *c, t_typ_method m, const char *name, t_atomtype type, long dummy)
Adds a method to the t_eclass.
Definition: eclass.c:162
void eclass_attr_order(t_eclass *c, const char *attrname, long flags, const char *order)
Sets the order of an attribute.
Definition: eclass.c:379
void eclass_attr_step(t_eclass *c, const char *attrname, float value)
Sets the step value of an attribute.
Definition: eclass.c:527
t_pd_err eclass_register(t_symbol *name, t_eclass *c)
Initialize the t_eclass in a namespace and preprare the t_eclass to be ready.
Definition: eclass.c:143
void eclass_new_attr_typed(t_eclass *c, const char *attrname, const char *type, long size, long maxsize, long flags, long offset)
Creates a new attribute.
Definition: eclass.c:284
void eclass_dspinit(t_eclass *c)
Initialize the t_eclass for the DSP behavior.
Definition: eclass.c:135
void eclass_init(t_eclass *c, long flags) _FUNCTION_DEPRECTAED_
Initialize the t_eclass for the GUI behavior (deprecated).
Definition: eclass.c:43
The class.
Definition: edefine.h:498
void eclass_attr_itemlist(t_eclass *c, const char *attrname, long flags, const char *list)
Sets the list available items of an attribute.
Definition: eclass.c:438
void eclass_guiinit(t_eclass *c, long flags)
Initialize the t_eclass for the GUI behavior.
Definition: eclass.c:48
t_pd_err(* t_err_method)(void *x,...)
The error method.
Definition: edefine.h:75
t_atomtype
The flags that discribes the type of an t_atom.
Definition: enative.h:84
void eclass_attr_accessor(t_eclass *c, const char *attrname, t_err_method getter, t_err_method setter)
Initialize new getter and setter methods for the attributes.
Definition: eclass.c:579
The t_atom struture.
Definition: enative.h:105
The t_symbol struture.
Definition: enative.h:46
The t_object struture.
Definition: enative.h:143
void eclass_attr_label(t_eclass *c, const char *attrname, long flags, const char *label)
Sets the label of an attribute.
Definition: eclass.c:393
void eclass_attr_category(t_eclass *c, const char *attrname, long flags, const char *category)
Sets the category of an attribute.
Definition: eclass.c:366
void eclass_attr_filter_min(t_eclass *c, const char *attrname, float value)
Sets the minimum value of an attribute.
Definition: eclass.c:491
void eclass_attr_save(t_eclass *c, const char *attrname, long flags)
Sets if the attribute should be saved with the object.
Definition: eclass.c:540
void eclass_attr_filter_max(t_eclass *c, const char *attrname, float value)
Sets the maximum value of an attribute for number attributes.
Definition: eclass.c:509
t_eclass * eclass_new(const char *name, t_typ_method newm, t_typ_method freem, size_t size, int flags, t_atomtype arg1, int arg2)
Allocates the memory and initialize a new t_eclass.
Definition: eclass.c:21
void(* t_typ_method)(void *x,...)
The standart method.
Definition: edefine.h:71
long t_pd_err
The error type.
Definition: edefine.h:69
void eclass_attr_invisible(t_eclass *c, const char *attrname, long flags)
Sets if the attribute should be displayed in the properties window.
Definition: eclass.c:566
void eclass_attr_default(t_eclass *c, const char *attrname, long flags, const char *value)
Sets the default value of an attribute.
Definition: eclass.c:353
void eclass_attr_style(t_eclass *c, const char *attrname, long flags, const char *style)
Sets the style of an attribute.
Definition: eclass.c:406