valac: make it compile with 0.7.2 (ugly workarounds)
[jackpanel.git] / gobject-2.0.vapi
blob8d3916b1d15ecee4ea1fd549d57e45b2f7e75f0b
1 /* gobject-2.0.vala
2  *
3  * Copyright (C) 2006-2009  Jürg Billeter
4  * Copyright (C) 2006-2008  Raffaele Sandrini
5  * Copyright (C) 2007  Mathias Hasselmann
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
20  *
21  * Author:
22  *      Jürg Billeter <j@bitron.ch>
23  *      Raffaele Sandrini <rasa@gmx.ch>
24  *      Mathias Hasselmann <mathias.hasselmann@gmx.de>
25  */
27 [CCode (cprefix = "G", lower_case_cprefix = "g_", cheader_filename = "glib.h")]
28 namespace GLib {
29         [CCode (type_id = "G_TYPE_GTYPE", marshaller_type_name = "GTYPE", get_value_function = "g_value_get_gtype", set_value_function = "g_value_set_gtype")]
30         public struct Type : ulong {
31                 [CCode (cname = "G_TYPE_IS_OBJECT")]
32                 public bool is_object ();
33                 [CCode (cname = "G_TYPE_IS_ABSTRACT")]
34                 public bool is_abstract ();
35                 [CCode (cname = "G_TYPE_IS_CLASSED")]
36                 public bool is_classed ();
37                 [CCode (cname = "G_TYPE_IS_DERIVABLE")]
38                 public bool is_derivable ();
39                 [CCode (cname = "G_TYPE_IS_DEEP_DERIVABLE")]
40                 public bool is_deep_derivable ();
41                 [CCode (cname = "G_TYPE_IS_DERIVED")]
42                 public bool is_derived ();
43                 [CCode (cname = "G_TYPE_IS_FUNDAMENTAL")]
44                 public bool is_fundamental ();
45                 [CCode (cname = "G_TYPE_IS_INSTANTIATABLE")]
46                 public bool is_instantiatable ();
47                 [CCode (cname = "G_TYPE_IS_INTERFACE")]
48                 public bool is_interface ();
49                 [CCode (cname = "G_TYPE_IS_VALUE_TYPE")]
50                 public bool is_value_type ();
52                 [CCode (cname = "G_TYPE_FROM_INSTANCE")]
53                 public static Type from_instance (void* instance);
55                 public Type[] children ();
56                 public uint depth ();
57                 public static Type from_name (string name);
58                 public Type[] interfaces ();
59                 public bool is_a (Type is_a_type);
60                 public weak string name ();
61                 public Quark qname ();
62                 public Type parent ();
64                 public void query (out TypeQuery query);
66                 public TypeClass class_ref ();
67                 public weak TypeClass class_peek ();
69                 [CCode (cname = "G_TYPE_INVALID")]
70                 public static Type INVALID;
71         }
73         public struct TypeQuery {
74                 public Type type;
75                 public weak string type_name;
76                 public uint class_size;
77                 public uint instance_size;
78         }
80         [Compact]
81         [CCode (ref_function = "g_type_class_ref", unref_function = "g_type_class_unref")]
82         public class TypeClass {
83                 [CCode (cname = "G_TYPE_FROM_CLASS")]
84                 public Type get_type ();
85         }
87         [CCode (cprefix = "G_TYPE_DEBUG_", has_type_id = false)]
88         public enum TypeDebugFlags {
89                 NONE,
90                 OBJECTS,
91                 SIGNALS,
92                 MASK
93         }
95         public interface TypePlugin {
96         }
98         [CCode (lower_case_csuffix = "type_module")]
99         public class TypeModule : Object, TypePlugin {
100                 public bool use ();
101                 public void unuse ();
102                 public void set_name (string name);
103                 [NoWrapper]
104                 public virtual bool load ();
105                 [NoWrapper]
106                 public virtual void unload ();
107         }
109         [CCode (ref_function = "g_param_spec_ref", unref_function = "g_param_spec_unref")]
110         public class ParamSpec {
111                 public string name;
112                 public ParamFlags flags;
113                 public Type value_type;
114                 public Type owner_type;
115                 public weak string get_blurb ();
116                 public weak string get_name ();
117                 public weak string get_nick ();
118         }
120         public class ParamSpecEnum : ParamSpec {
121                 [CCode (cname = "g_param_spec_enum")]
122                 public ParamSpecEnum (string name, string nick, string blurb, Type enum_type, int default_value, ParamFlags flags);
123         }
125         public class ParamSpecFloat : ParamSpec {
126                 [CCode (cname = "g_param_spec_float")]
127                 public ParamSpecFloat (string name, string nick, string blurb, float minimum, float maximum, float default_value, ParamFlags flags);
128         }
130         public class ParamSpecInt : ParamSpec {
131                 [CCode (cname = "g_param_spec_int")]
132                 public ParamSpecInt (string name, string nick, string blurb, int minimum, int maximum, int default_value, ParamFlags flags);
133         }
135         public class ParamSpecUInt : ParamSpec {
136                 [CCode (cname = "g_param_spec_uint")]
137                 public ParamSpecUInt (string name, string nick, string blurb, uint minimum, uint maximum, uint default_value, ParamFlags flags);
138         }
140         public class ParamSpecBoolean : ParamSpec {
141                 [CCode (cname = "g_param_spec_boolean")]
142                 public ParamSpecBoolean (string name, string nick, string blurb, bool defaultvalue, ParamFlags flags);
143         }
145         [CCode (cprefix = "G_PARAM_", has_type_id = false)]
146         public enum ParamFlags {
147                 READABLE,
148                 WRITABLE,
149                 CONSTRUCT,
150                 CONSTRUCT_ONLY,
151                 LAX_VALIDATION,
152                 STATIC_NAME,
153                 STATIC_NICK,
154                 STATIC_BLURB,
155                 READWRITE,
156                 STATIC_STRINGS
157         }
159         [CCode (lower_case_csuffix = "object_class")]
160         public class ObjectClass : TypeClass {
161                 public weak ParamSpec? find_property (string property_name);
162                 public weak ParamSpec[] list_properties ();
163                 public void install_property (uint property_id, ParamSpec pspec);
164         }
165         
166         public struct ObjectConstructParam {
167         }
169         public static delegate void ObjectGetPropertyFunc (Object object, uint property_id, Value value, ParamSpec pspec);
170         public static delegate void ObjectSetPropertyFunc (Object object, uint property_id, Value value, ParamSpec pspec);
171         public static delegate void WeakNotify (void *data, Object object);
173         [CCode (ref_function = "g_object_ref", unref_function = "g_object_unref", marshaller_type_name = "OBJECT", get_value_function = "g_value_get_object", set_value_function = "g_value_set_object", param_spec_function = "g_param_spec_object", cheader_filename = "glib-object.h")]
174         public class Object {
175                 public uint ref_count;
177                 public static Object @new (Type type, ...);
179                 [CCode (cname = "G_TYPE_FROM_INSTANCE")]
180                 public Type get_type ();
181                 public weak Object @ref ();
182                 public void unref ();
183                 public Object ref_sink ();
184                 public void weak_ref (WeakNotify notify, void *data);
185                 public void weak_unref (WeakNotify notify, void *data);
186                 public void add_weak_pointer (void **data);
187                 public void remove_weak_pointer (void **data);
188                 public void get (string first_property_name, ...);
189                 public void set (string first_property_name, ...);
190                 public void get_property (string property_name, ref Value value);
191                 public void set_property (string property_name, Value value);
192                 public void* get_data (string key);
193                 public void set_data (string key, void* data);
194                 public void set_data_full (string key, void* data, DestroyNotify? destroy);
195                 public void* steal_data (string key);
196                 public void* get_qdata (Quark quark);
197                 public void set_qdata (Quark quark, void* data);
198                 public void set_qdata_full (Quark quark, void* data, DestroyNotify? destroy);
199                 public void* steal_qdata (Quark quark);
200                 public void freeze_notify ();
201                 public void thaw_notify ();
202                 public virtual void dispose ();
203                 public virtual void finalize ();
204                 public virtual void constructed ();
206                 public signal void notify (ParamSpec pspec);
208                 public weak Object connect (string signal_spec, ...);
210                 public void add_toggle_ref (ToggleNotify notify);
211                 public void remove_toggle_ref (ToggleNotify notify);
212         }
214         [CCode (instance_pos = 0)]
215         public delegate void ToggleNotify (GLib.Object object, bool is_last_ref);
217         public struct Parameter {
218                 public string name;
219                 public Value value;
220         }
222         [CCode (ref_sink_function = "g_object_ref_sink")]
223         public class InitiallyUnowned : Object {
224         }
226         [CCode (lower_case_csuffix = "enum")]
227         public class EnumClass : TypeClass {
228                 public weak EnumValue? get_value (int value);
229                 public weak EnumValue? get_value_by_name (string name);
230                 public weak EnumValue? get_value_by_nick (string name);
231         }
233         [Compact]
234         public class EnumValue {
235                 public int value;
236                 public weak string value_name;
237                 public weak string value_nick;
238         }
240         [CCode (lower_case_csuffix = "flags")]
241         public class FlagsClass : TypeClass {
242                 public weak FlagsValue? get_first_value (uint value);
243                 public weak FlagsValue? get_value_by_name (string name);
244                 public weak FlagsValue? get_value_by_nick (string name);
245         }
247         [Compact]
248         public class FlagsValue {
249                 public int value;
250                 public weak string value_name;
251                 public weak string value_nick;
252         }
254         [Compact]
255         [CCode (cname = "gpointer", has_type_id = true, type_id = "G_TYPE_BOXED", marshaller_type_name = "BOXED", get_value_function = "g_value_get_boxed", set_value_function = "g_value_set_boxed")]
256         public abstract class Boxed {
257         }
259         public static delegate void ValueTransform (Value src_value, out Value dest_value);
261         [CCode (copy_function = "g_value_copy", destroy_function = "g_value_unset", type_id = "G_TYPE_VALUE", marshaller_type_name = "BOXED", get_value_function = "g_value_get_boxed", set_value_function = "g_value_set_boxed", type_signature = "v")]
262         public struct Value {
263                 [CCode (cname = "G_VALUE_HOLDS")]
264                 public bool holds (Type type);
265                 [CCode (cname = "G_VALUE_TYPE")]
266                 public Type type ();
267                 [CCode (cname = "G_VALUE_TYPE_NAME")]
268                 public weak string type_name ();
270                 public Value (Type g_type);
271                 public void copy (ref Value dest_value);
272                 public weak Value? reset ();
273                 public void init (Type g_type);
274                 public void unset ();
275                 public void set_instance (void* instance);
276                 public bool fits_pointer ();
277                 public void* peek_pointer ();
278                 public static bool type_compatible (Type src_type, Type dest_type);
279                 public static bool type_transformable (Type src_type, Type dest_type);
280                 public bool transform (ref Value dest_value);
281                 [CCode (cname = "g_strdup_value_contents")]
282                 public string strdup_contents ();
283                 public static void register_transform_func (Type src_type, Type dest_type, ValueTransform transform);
284                 public void set_boolean (bool v_boolean);
285                 public bool get_boolean ();
286                 public void set_char (char v_char);
287                 public char get_char ();
288                 public void set_uchar (uchar v_uchar);
289                 public uchar get_uchar ();
290                 public void set_int (int v_int);
291                 public int get_int ();
292                 public void set_uint (uint v_uint);
293                 public uint get_uint ();
294                 public void set_long (long v_long);
295                 public long get_long ();
296                 public void set_ulong (ulong v_ulong);
297                 public ulong get_ulong ();
298                 public void set_int64 (int64 v_int64);
299                 public int64 get_int64 ();
300                 public void set_uint64 (uint64 v_uint64);
301                 public uint64 get_uint64 ();
302                 public void set_float (float v_float);
303                 public float get_float ();
304                 public void set_double (double v_double);
305                 public double get_double ();
306                 public void set_enum (int v_enum);
307                 public int get_enum ();
308                 public void set_flags (uint v_flags);
309                 public uint get_flags ();
310                 public void set_string (string v_string);
311                 public void set_static_string (string v_string);
312                 public void take_string (string# v_string);
313                 public weak string get_string ();
314                 public string dup_string ();
315                 public void set_pointer (void* v_pointer);
316                 public void* get_pointer ();
317                 public void set_boxed (void* v_boxed);
318                 public weak Boxed get_boxed ();
319                 public Boxed dup_boxed ();
320                 public void set_object (Object v_object);
321                 public void take_object (Object# v_object);
322                 public weak Object get_object ();
323                 public Object dup_object ();
324                 public void set_gtype (Type v_gtype);
325                 public Type get_gtype ();
326         }
327         
328         public struct SignalInvocationHint {
329                 public uint signal_id;
330                 public Quark detail;
331                 public SignalFlags run_type;
332         }
334         public delegate bool SignalEmissionHook (SignalInvocationHint ihint, [CCode (array_length_pos = 1.9)] Value[] param_values);
336         [CCode (cprefix = "G_SIGNAL_", has_type_id = false)]
337         public enum SignalFlags {
338                 RUN_FIRST,
339                 RUN_LAST,
340                 RUN_CLEANUP,
341                 DETAILED,
342                 ACTION,
343                 NO_HOOKS
344         }
346         [CCode (cprefix = "G_CONNECT_", has_type_id = false)]
347         public enum ConnectFlags {
348                 AFTER,
349                 SWAPPED
350         }
352         public static delegate void Callback ();
354         [Compact]
355         public class Closure : Boxed {
356         }
358         public static delegate void ClosureNotify (void* data, Closure closure);
360         [Compact]
361         [CCode (type_id = "G_TYPE_VALUE_ARRAY")]
362         public class ValueArray : Boxed {
363                 public uint n_values;
364                 public Value[] values;
365                 public ValueArray (uint n_prealloced);
366                 public weak Value? get_nth (uint index_);
367                 public void append (Value value);
368                 public void prepend (Value value);
369                 public void insert (uint index_, Value value);
370                 public void remove (uint index_);
371                 public void sort (CompareFunc compare_func);
372                 public void sort_with_data (CompareDataFunc compare_func);
373         }
375         namespace Signal {
376                 public static void query (uint signal_id, out SignalQuery query);
377                 public static uint lookup (string name, Type itype);
378                 public static weak string name (uint signal_id);
379                 public static uint[] list_ids (Type itype);
380                 public static void emit (void* instance, uint signal_id, Quark detail, ...);
381                 public static void emit_by_name (void* instance, string detailed_signal, ...);
382                 public static ulong connect (void* instance, string detailed_signal, Callback handler, void* data);
383                 public static ulong connect_after (void* instance, string detailed_signal, Callback handler, void* data);
384                 public static ulong connect_swapped (void* instance, string detailed_signal, Callback handler, void* data);
385                 public static ulong connect_object (void* instance, string detailed_signal, Callback handler, Object gobject, ConnectFlags flags);
386                 public static ulong connect_data (void* instance, string detailed_signal, Callback handler, void* data, ClosureNotify destroy_data, ConnectFlags flags);
387                 public static ulong connect_closure (void* instance, string detailed_signal, Closure closure, bool after);
388                 public static ulong connect_closure_by_id (void* instance, uint signal_id, Quark detail, Closure closure, bool after);
389                 public static bool has_handler_pending (void* instance, uint signal_id, Quark detail, bool may_be_blocked);
390                 public static void stop_emission (void* instance, uint signal_id, Quark detail);
391                 public static void stop_emission_by_name (void* instance, string detailed_signal);
392                 public static void override_class_closure (uint signal_id, Type instance_type, Closure class_closure);
393                 public static void chain_from_overridden ([CCode (array_length = false)] Value[] instance_and_params, out Value return_value);
394                 public static ulong add_emission_hook (uint signal_id, Quark detail, SignalEmissionHook hook_func, DestroyNotify? data_destroy);
395                 public static void remove_emission_hook (uint signal_id, ulong hook_id);
396                 public static bool parse_name (string detailed_signal, Type itype, out uint signal_id, out Quark detail, bool force_detail_quark);
397         }
399         namespace SignalHandler {
400                 public static void block (void* instance, ulong handler_id);
401                 public static void unblock (void* instance, ulong handler_id);
402                 public static void disconnect (void* instance, ulong handler_id);
403                 public static ulong find (void* instance, SignalMatchType mask, uint signal_id, Quark detail, Closure? closure, void* func, void* data);
404                 public static bool is_connected (void* instance, ulong handler_id);
406                 [CCode (cname = "g_signal_handlers_block_matched")]
407                 public static uint block_matched (void* instance, SignalMatchType mask, uint signal_id, Quark detail, Closure? closure, void* func, void* data);
408                 [CCode (cname = "g_signal_handlers_unblock_matched")]
409                 public static uint unblock_matched (void* instance, SignalMatchType mask, uint signal_id, Quark detail, Closure? closure, void* func, void* data);
410                 [CCode (cname = "g_signal_handlers_disconnect_matched")]
411                 public static uint disconnect_matched (void* instance, SignalMatchType mask, uint signal_id, Quark detail, Closure? closure, void* func, void* data);
412                 [CCode (cname = "g_signal_handlers_block_by_func")]
413                 public static uint block_by_func (void* instance, void* func, void* data);
414                 [CCode (cname = "g_signal_handlers_unblock_by_func")]
415                 public static uint unblock_by_func (void* instance, void* func, void* data);
416                 [CCode (cname = "g_signal_handlers_disconnect_by_func")]
417                 public static uint disconnect_by_func (void* instance, void* func, void* data);
418         }
420         public struct SignalQuery {
421                 public uint signal_id;
422                 public weak string signal_name;
423                 public Type itype;
424                 public SignalFlags signal_flags;
425                 public Type return_type;
426                 public uint n_params;
427                 [CCode (array_length = false)]
428                 public weak Type[] param_types;
429         }
431         [CCode (cprefix = "G_SIGNAL_MATCH_", has_type_id = false)]
432         public enum SignalMatchType {
433                 ID,
434                 DETAIL,
435                 CLOSURE,
436                 FUNC,
437                 DATA,
438                 UNBLOCKED
439         }