25 #include <libvisual/lvconfig.h>
26 #include <libvisual/lv_defines.h>
27 #include <libvisual/lv_color.h>
28 #include <libvisual/lv_palette.h>
29 #include <libvisual/lv_event.h>
30 #include <libvisual/lv_param_value.h>
31 #include <libvisual/lv_param_validators.h>
40 #include <initializer_list>
59 ParamList (std::initializer_list<Param*> params);
74 void add (Param&& param);
83 void add (Param* param);
90 template <
class Container>
91 void add (Container
const& params)
93 for (
auto const& param : params) {
105 bool remove (std::string
const& name);
115 Param*
get (std::string
const& name)
const;
122 void set_event_queue (
EventQueue& event_queue);
136 std::unique_ptr<Impl> m_impl;
141 typedef LV::Param VisParam;
146 typedef struct _VisParam VisParam;
151 #define VISUAL_PARAM(obj) ((VisParam *) (obj))
152 #define VISUAL_PARAM_LIST(obj) ((VisParamList *) (obj))
154 typedef int (*VisParamValidateFunc) (VisParamValue *value,
void *priv);
155 typedef void (*VisParamChangedFunc) (VisParam *param,
void *priv);
156 typedef void (*VisDestroyFunc) (
void *data);
162 LV_API VisClosure *visual_closure_new (
void *func,
void *data, VisDestroyFunc destroy_func);
163 LV_API
void visual_closure_free (VisClosure *
self);
168 LV_API
void visual_param_list_free (
VisParamList *
self);
170 LV_API
void visual_param_list_add (
VisParamList *list, VisParam *param);
171 LV_API
void visual_param_list_add_array (
VisParamList *list, VisParam **params,
unsigned int nparams);
172 LV_API
void visual_param_list_add_many (
VisParamList *list, ...);
173 LV_API VisParam ** visual_param_list_get_entries (
VisParamList *list);
174 LV_API
int visual_param_list_remove (
VisParamList *list,
const char *name);
175 LV_API VisParam * visual_param_list_get (
VisParamList *list,
const char *name);
194 const char * description,
196 void * default_value,
197 VisClosure * validator);
215 VisParamChangedFunc func,
217 VisDestroyFunc destroy_func);
253 LV_API
const char * visual_param_get_name (VisParam *param);
254 LV_API VisParamType visual_param_get_type (VisParam *param);
255 LV_API
const char * visual_param_get_description (VisParam *param);
257 LV_API
void visual_param_set_value (VisParam *param, VisParamValue *value);
258 LV_API
void visual_param_set_value_bool (VisParam *param,
int boolean);
259 LV_API
void visual_param_set_value_integer (VisParam *param,
int integer);
260 LV_API
void visual_param_set_value_float (VisParam *param,
float flt);
261 LV_API
void visual_param_set_value_double (VisParam *param,
double dbl);
262 LV_API
void visual_param_set_value_string (VisParam *param,
const char *
string);
263 LV_API
void visual_param_set_value_color (VisParam *param,
VisColor *color);
264 LV_API
void visual_param_set_value_palette (VisParam *param,
VisPalette *pal);
266 LV_API
int visual_param_get_value_bool (VisParam *param);
267 LV_API
int visual_param_get_value_integer (VisParam *param);
268 LV_API
float visual_param_get_value_float (VisParam *param);
269 LV_API
double visual_param_get_value_double (VisParam *param);
270 LV_API
const char *visual_param_get_value_string (VisParam *param);
271 LV_API
VisColor * visual_param_get_value_color (VisParam *param);
272 LV_API
VisPalette *visual_param_get_value_palette (VisParam *param);
276 #define _LV_DEFINE_PARAM_NEW(func,ctype,type,marshal) \
277 static inline VisParam *visual_param_new_##func (const char *name, \
278 const char *description, \
279 ctype default_value, \
280 VisClosure *validator) \
281 { return visual_param_new (name, description, VISUAL_PARAM_TYPE_##type, _LV_PARAM_MARSHAL_##marshal (default_value), validator); }
283 _LV_DEFINE_PARAM_NEW (
bool ,
int , BOOL , INTEGER)
284 _LV_DEFINE_PARAM_NEW (integer,
int , INTEGER, INTEGER)
285 _LV_DEFINE_PARAM_NEW (
float ,
float , FLOAT , FLOAT)
286 _LV_DEFINE_PARAM_NEW (
double ,
double , DOUBLE , DOUBLE)
287 _LV_DEFINE_PARAM_NEW (
string , const
char * , STRING , POINTER)
288 _LV_DEFINE_PARAM_NEW (color , const
VisColor * , COLOR , POINTER)
289 _LV_DEFINE_PARAM_NEW (palette, const
VisPalette *, PALETTE, POINTER)
291 static inline VisParam *visual_param_new_color_rgb (const
char *name,
292 const
char *description,
296 VisClosure *validator)
298 VisColor color = { red, green, blue, 255 };
299 return visual_param_new_color (name, description, &color, validator);