1 /*
2  * libInstPatch
3  * Copyright (C) 1999-2014 Element Green <element@elementsofsound.org>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public License
7  * as published by the Free Software Foundation; version 2.1
8  * of the License only.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18  * 02110-1301, USA or on the web at http://www.gnu.org.
19  */
20 #ifndef __IPATCH_TYPE_PROP_H__
21 #define __IPATCH_TYPE_PROP_H__
22 
23 #include <glib.h>
24 #include <glib-object.h>
25 
26 /* some built in type categories for "category" property */
27 enum
28 {
29     IPATCH_CATEGORY_NONE,			/* a NULL value */
30     IPATCH_CATEGORY_BASE,			/* patch file IpatchBase type */
31     IPATCH_CATEGORY_PROGRAM,		/* a MIDI program type (MIDI locale) */
32     IPATCH_CATEGORY_INSTRUMENT,		/* an instrument type (no MIDI locale) */
33     IPATCH_CATEGORY_INSTRUMENT_REF,	/* a type referencing an Instrument */
34     IPATCH_CATEGORY_SAMPLE,		/* sample type */
35     IPATCH_CATEGORY_SAMPLE_REF		/* a type referencing a sample */
36 };
37 
38 /* enum for "splits-type" to indicate that a type has
39    key-range or velocity-range parameters or its children do */
40 typedef enum
41 {
42     IPATCH_SPLITS_NONE,			/* type does not have splits */
43     IPATCH_SPLITS_NORMAL,			/* normal splits */
44     IPATCH_SPLITS_NO_OVERLAP		/* splits do not overlap */
45 } IpatchSplitsType;
46 
47 /**
48  * IpatchTypePropGetFunc:
49  * @type: The GType of the type property
50  * @spec: The parameter specification
51  * @value: Initialized value to store the type prop value in
52  * @object: Object instance (might be %NULL)
53  *
54  * A function type used for active type property callbacks.
55  * Allows for dynamic type properties that can return values depending
56  * on an object's state.
57  */
58 typedef void (*IpatchTypePropGetFunc)(GType type, GParamSpec *spec,
59                                       GValue *value, GObject *object);
60 
61 void ipatch_type_install_property(GParamSpec *prop_spec);
62 GParamSpec *ipatch_type_find_property(const char *name);
63 GParamSpec **ipatch_type_list_properties(guint *n_properties);
64 GType *ipatch_type_find_types_with_property(const char *name, const GValue *value,
65         guint *n_types);
66 void ipatch_type_set(GType type, const char *first_property_name, ...);
67 void ipatch_type_set_valist(GType type, const char *first_property_name,
68                             va_list args);
69 void ipatch_type_set_property(GType type, const char *property_name,
70                               const GValue *value);
71 void ipatch_type_unset_property(GType type, const char *property_name);
72 void ipatch_type_get(GType type, const char *first_property_name, ...);
73 void ipatch_type_get_valist(GType type, const char *first_property_name,
74                             va_list args);
75 void ipatch_type_get_property(GType type, const char *property_name,
76                               GValue *value);
77 void ipatch_type_object_get(GObject *object, const char *first_property_name,
78                             ...);
79 void ipatch_type_object_get_valist(GObject *object,
80                                    const char *first_property_name,
81                                    va_list args);
82 void ipatch_type_object_get_property(GObject *object,
83                                      const char *property_name, GValue *value);
84 void ipatch_type_set_dynamic_func(GType type, const char *property_name,
85                                   IpatchTypePropGetFunc func);
86 void ipatch_type_set_dynamic_func_full(GType type, const char *property_name,
87                                        IpatchTypePropGetFunc func,
88                                        GDestroyNotify notify_func, gpointer user_data);
89 IpatchTypePropGetFunc ipatch_type_get_dynamic_func(GType type,
90         const char *property_name);
91 #endif
92