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  *
4  * A wrapper for Pure Data
5  *
6  * Copyright (C) 2013 Pierre Guillot, CICM - Université Paris 8
7  * All rights reserved.
8  *
9  * Website : http://www.mshparisnord.fr/HoaLibrary/
10  * Contacts : cicm.mshparisnord@gmail.com
11  *
12  * This library is free software; you can redistribute it and/or modify it
13  * under the terms of the GNU Library General Public License as published
14  * by the Free Software Foundation; either version 2 of the License.
15  *
16  * This library is distributed in the hope that it will be useful, but WITHOUT
17  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
19  * License for more details.
20  *
21  * You should have received a copy of the GNU Library General Public License
22  * along with this library; if not, write to the Free Software Foundation,
23  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24  *
25  */
26 
33 #ifndef DEF_ECLASS
34 #define DEF_ECLASS
35 
36 #include "edefine.h"
37 
55 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);
56 
64 void eclass_guiinit(t_eclass* c, long flags);
65 
74 void eclass_init(t_eclass* c, long flags) _FUNCTION_DEPRECTAED_;
75 
83 t_pd_err eclass_register(t_symbol *name, t_eclass *c);
84 
91 void eclass_dspinit(t_eclass* c);
92 
103 void eclass_addmethod(t_eclass* c, t_typ_method m, const char* name, t_atomtype type, long dummy);
104 
117 void eclass_new_attr_typed(t_eclass* c, const char* attrname, const char* type, long size, long maxsize, long flags, long offset);
118 
120 
128 void eclass_attr_setter(t_object* x, t_symbol *s, int argc, t_atom *argv);
129 
138 void eclass_attr_getter(t_object* x, t_symbol *s, int* argc, t_atom** argv);
139 
141 
151 void eclass_attr_category(t_eclass* c, const char* attrname, long flags, const char* category);
152 
162 void eclass_attr_order(t_eclass* c, const char* attrname, long flags, const char* order);
163 
173 void eclass_attr_label(t_eclass* c, const char* attrname, long flags, const char* label);
174 
184 void eclass_attr_style(t_eclass* c, const char* attrname, long flags, const char* style);
185 
195 void eclass_attr_default(t_eclass* c, const char* attrname, long flags, const char* value);
196 
205 void eclass_attr_filter_min(t_eclass* c, const char* attrname, float value);
206 
215 void eclass_attr_filter_max(t_eclass* c, const char* attrname, float value);
216 
225 void eclass_attr_step(t_eclass* c, const char* attrname, float value);
226 
235 void eclass_attr_save(t_eclass* c, const char* attrname, long flags);
236 
245 void eclass_attr_paint(t_eclass* c, const char* attrname, long flags);
246 
255 void eclass_attr_invisible(t_eclass* c, const char* attrname, long flags);
256 
266 void eclass_attr_accessor(t_eclass* c, const char* attrname, t_err_method getter, t_err_method setter);
267 
277 void eclass_attr_itemlist(t_eclass* c, const char* attrname, long flags, const char* list);
278 
280 #define calcoffset(x,y) ((long)(&(((x *)0L)->y)))
281 
284 #define CLASS_ATTR_INT(c,name,flags,struct,member) \
285 eclass_new_attr_typed(c,name, "int", 1, 0, flags, calcoffset(struct,member))
286 #define CLASS_ATTR_LONG(c,name,flags,struct,member) \
288 eclass_new_attr_typed(c,name, "long", 1, 0, flags, calcoffset(struct,member))
289 #define CLASS_ATTR_FLOAT(c,name,flags,struct,member) \
291 eclass_new_attr_typed(c,name, "float", 1, 0, flags, calcoffset(struct,member))
292 #define CLASS_ATTR_DOUBLE(c,name,flags,struct,member) \
294 eclass_new_attr_typed(c,name, "double", 1, 0, flags, calcoffset(struct,member))
295 #define CLASS_ATTR_RGB(c,name,flags,struct,member) \
297 eclass_new_attr_typed(c,name, "float", 3, 0, flags, calcoffset(struct,member))
298 #define CLASS_ATTR_RGBA(c,name,flags,struct,member) \
300 eclass_new_attr_typed(c,name, "float", 4, 0, flags, calcoffset(struct,member))
301 #define CLASS_ATTR_SYMBOL(c,name,flags,struct,member) \
303 eclass_new_attr_typed(c,name, "symbol", 1, 0, flags, calcoffset(struct,member))
304 #define CLASS_ATTR_ATOM(c,name,flags,struct,member) \
306 eclass_new_attr_typed(c,name, "atom", 1, 0, flags, calcoffset(struct,member))
307 #define CLASS_ATTR_INT_ARRAY(c,name,flags,struct,member,size) \
309 eclass_new_attr_typed(c,name, "int", size, 0, flags, calcoffset(struct,member))
310 #define CLASS_ATTR_LONG_ARRAY(c,name,flags,struct,member,size) \
312 eclass_new_attr_typed(c,name, "long", size, 0, flags, calcoffset(struct,member))
313 #define CLASS_ATTR_FLOAT_ARRAY(c,name,flags,struct,member,size) \
315 eclass_new_attr_typed(c,name, "float", size, 0, flags, calcoffset(struct,member))
316 #define CLASS_ATTR_DOUBLE_ARRAY(c,name,flags,struct,member,size) \
318 eclass_new_attr_typed(c,name, "double", size, 0, flags, calcoffset(struct,member))
319 #define CLASS_ATTR_SYMBOL_ARRAY(c,name,flags,struct,member, size) \
321 eclass_new_attr_typed(c,name, "symbol", size, 0, flags, calcoffset(struct,member))
322 #define CLASS_ATTR_ATOM_ARRAY(c,name,flags,struct,member, size) \
324 eclass_new_attr_typed(c,name, "atom", size, 0, flags, calcoffset(struct,member))
325 #define CLASS_ATTR_INT_VARSIZE(c,name,flags,struct,member, size, maxsize) \
327 eclass_new_attr_typed(c,name, "int", calcoffset(struct,size), maxsize, flags, calcoffset(struct,member))
328 #define CLASS_ATTR_LONG_VARSIZE(c,name,flags,struct,member, size, maxsize) \
330 eclass_new_attr_typed(c,name, "long", calcoffset(struct,size), maxsize, flags, calcoffset(struct,member))
331 #define CLASS_ATTR_FLOAT_VARSIZE(c,name,flags,struct,member, size, maxsize) \
333 eclass_new_attr_typed(c,name, "float", calcoffset(struct,size), maxsize, flags, calcoffset(struct,member))
334 #define CLASS_ATTR_DOUBLE_VARSIZE(c,name,flags,struct, member, size, maxsize) \
336 eclass_new_attr_typed(c,name, "double", calcoffset(struct,size), maxsize, flags, calcoffset(struct,member))
337 #define CLASS_ATTR_SYMBOL_VARSIZE(c,name,flags,struct, member, size, maxsize) \
339 eclass_new_attr_typed(c,name, "symbol", calcoffset(struct,size), maxsize, flags, calcoffset(struct,member))
340 #define CLASS_ATTR_ATOM_VARSIZE(c,name,flags,struct, member, size, maxsize) \
342 eclass_new_attr_typed(c,name, "atom", calcoffset(struct,size), maxsize, flags, calcoffset(struct,member))
343 
345 #define CLASS_ATTR_CATEGORY(c,name,flags,categoryname) eclass_attr_category(c,name,flags,categoryname)
346 #define CLASS_ATTR_ORDER(c,name,flags,order) eclass_attr_order(c,name,flags,order)
348 #define CLASS_ATTR_LABEL(c,name,flags,label) eclass_attr_label(c,name,flags,label)
350 #define CLASS_ATTR_STYLE(c,name,flags,style) eclass_attr_style(c,name,flags,style)
352 #define CLASS_ATTR_DEFAULT(c,name,flags,val) eclass_attr_default(c,name,flags,val)
354 #define CLASS_ATTR_FILTER_MIN(c, name, value) eclass_attr_filter_min(c, name, value)
356 #define CLASS_ATTR_FILTER_MAX(c, name, value) eclass_attr_filter_max(c, name, value)
358 #define CLASS_ATTR_FILTER_CLIP(c, name, minval, maxval) eclass_attr_filter_min(c, name, minval); eclass_attr_filter_max(c, name, maxval);
360 #define CLASS_ATTR_STEP(c, name, value) eclass_attr_step(c, name, value)
362 #define CLASS_ATTR_SAVE(c,name,flags) eclass_attr_save(c,name,flags)
364 #define CLASS_ATTR_PAINT(c,name,flags) eclass_attr_paint(c,name,flags)
366 #define CLASS_ATTR_INVISIBLE(c,name,flags) eclass_attr_invisible(c,name,flags)
368 #define CLASS_ATTR_ACCESSORS(c,name,getter,setter) eclass_attr_accessor(c,name,(t_err_method)getter,(t_err_method)setter)
370 #define CLASS_ATTR_ITEMS(c,name,flags, list) eclass_attr_itemlist(c,name,flags, list)
372 #define CLASS_ATTR_DEFAULT_SAVE_PAINT(c,attrname,flags,parsestr) \
374 { CLASS_ATTR_DEFAULT(c,attrname,flags,parsestr); CLASS_ATTR_SAVE(c,attrname,flags); CLASS_ATTR_PAINT(c,attrname,flags); }
375 
378 #endif
379 
380 
381 
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:178
t_pd_err(* t_err_method)(void *x,...)
The error method.
Definition: edefine.h:90
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:300
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:159
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:569
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:556
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:595
long t_pd_err
The error type.
Definition: edefine.h:84
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:369
void eclass_attr_step(t_eclass *c, const char *attrname, float value)
Sets the step value of an attribute.
Definition: eclass.c:543
void eclass_dspinit(t_eclass *c)
Initialize the t_eclass for the DSP behavior.
Definition: eclass.c:151
void eclass_init(t_eclass *c, long flags) _FUNCTION_DEPRECTAED_
Initialize the t_eclass for the GUI behavior (deprecated).
Definition: eclass.c:59
The class.
Definition: edefine.h:513
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:454
void eclass_attr_category(t_eclass *c, const char *attrname, long flags, const char *category)
Sets the category of an attribute.
Definition: eclass.c:382
void eclass_attr_filter_min(t_eclass *c, const char *attrname, float value)
Sets the minimum value of an attribute.
Definition: eclass.c:507
void eclass_attr_label(t_eclass *c, const char *attrname, long flags, const char *label)
Sets the label of an attribute.
Definition: eclass.c:409
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:37
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:582
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:525
void eclass_guiinit(t_eclass *c, long flags)
Initialize the t_eclass for the GUI behavior.
Definition: eclass.c:64
void eclass_attr_style(t_eclass *c, const char *attrname, long flags, const char *style)
Sets the style of an attribute.
Definition: eclass.c:422
void(* t_typ_method)(void *x,...)
The standart method.
Definition: edefine.h:86
void eclass_attr_order(t_eclass *c, const char *attrname, long flags, const char *order)
Sets the order of an attribute.
Definition: eclass.c:395