Re: [Vala] GObject Extensions



Hi Matias,

1. Gdk.Window isn't a GObject.
2. I think once the class definition is closed, you can't extend it, but
why not try something like this:

[CCode cname=GdkWindow new=gdk_window_new ....]
class DrawingArea:Gdk.Window {
   public void unset_gl_capability (); 
   ....

}


This is hackish and I am not sure if it is even possible.

Yu
On Thu, 2008-07-17 at 18:53 -0300, =?ISO-8859-1?Q? Mat=EDas_De_la_Puente
_ wrote:
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


_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list




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