guile-gtk-general
[Top][All Lists]
Advanced

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

Re: set-background / access to boxed types?


From: Andy Wingo
Subject: Re: set-background / access to boxed types?
Date: Sun, 30 May 2004 15:33:42 +0100

On Thu, 2004-05-27 at 19:50 +0200, Jan Nieuwenhuizen wrote:
> Title says it all, how can I
> 
>   (set-background <<widget>> <<boxed-type-gdk-color:: r g b>>
> 
> or is special glue code (similar to boxed type gdk-event) necessary?

Boxed types can only be accessed by the wrapped functions. I usually
press gdk-color-TAB to see ;).

So the code's not there yet. Here's what needs doing: you need to define
a function that can create a gdk-color from a tuple, and one that can
return a rgb tuple given a color. The functions can go in
gdk-support.[ch], and should be defined in the overrides file. You
should put (caller-owns-return #t) in the constructor function's defs
entry.

That will be sufficient for your purposes, but it's not a very nice API.
If you feel energetic, you should then wrap <gdk-color> so that you can
say (make <gdk-color> #:value (list r g b)), or (make <gdk-color>
#:value "white"). That will require some hooks within the gvalue
allocate-instance method, and an initialize method specialized to
<gdk-color>.

But if you just want functionality, simply wrapping routines to
construct and destructure (in the sense of CL's destructuring-bind) will
be sufficient.

Regards,
-- 
Andy Wingo <address@hidden>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]