[Vala] GObject Extensions



Hi, all.

It is possible to add extension functions to some GObjects in the vapi files?
Here is a concrete sample.

In gtkglext-1.0 there's some functions that extend a Gdk.Window object. I create a vapi file with this:

        [CCode (lower_case_cprefix="gdk_window_")]
        namespace GdkWindowExtension
        {
            [NoArrayLength]
            public static weak Gdk.GL.Window set_gl_capability (Gdk.Window window, Gdk.GL.Config glconfig, int[] attrib_list);
            public static void unset_gl_capability (Gdk.Window window);
            public static bool is_gl_capable (Gdk.Window window);
            public static weak Gdk.GL.Window get_gl_window (Gdk.Window window);
            public static weak Gdk.GL.Drawable get_gl_drawable (Gdk.Window window);
        }


And a sample.vala code:
...
        DrawingArea drawing_area = new DrawingArea ();
        Gtk.GL.GtkWidgetExtension.set_gl_capability (drawing_area, glconfig, null, true, Gdk.GL.RenderType.RGBA_TYPE);
...

There is a possibility to implement something (in the vapi file) for use a code like this?:

        DrawingArea drawing_area = new DrawingArea ();
        drawing_area.set_gl_capability (glconfig, null, true, Gdk.GL.RenderType.RGBA_TYPE);

Im saying this because we only add functions to a Gdk.Window object (a GObject extension).


Matias



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]