guile-user
[Top][All Lists]
Advanced

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

Re: gw:wcp types in Guile-Gnome


From: David Pirotte
Subject: Re: gw:wcp types in Guile-Gnome
Date: Sun, 27 Aug 2017 01:01:28 -0300

Hello,

        Sorry for the late response, I was hoping someone else would answer 
before I
        could, we are not that many but there are still a few very good 
guile-gnome
        users out there ... :)

> Pango attributes are instances of class <gw:wcp> in Guile-Gnome but they 
> are not GOOPS instances (i.e. (instance? x) returns false). Class name 
> <pango-attribute> is not defined at all.

Indeed, pango attributes are opaque pointers, in the manual you see:

        Class: <pango-attribute>
        
        Opaque pointer.

        This class defines no direct slots.

Note that the manual is automatically generated, which is why you read 'Class:
<pango-attrobute>, but on the next entry you can also read 'Opaque pointer', 
which
is an indication for users that the class has not been 'optimally' wrapped:

        they are not goops classes - subclass of <gobject>, such as 
<gtk-window>,
        they are (G-Wrap) opaque pointers.

In the manual, references to <pango-attribute> means it wish to receive an 
opaque
pointer of the corresponding attribute  ... and these are returned by the 
interface
creating pango attributes:

        pango-attr-size-new, pango-attr-font-desc-new ...

Opaque pointers are low level G-Wrap beats, so you don't want to involve 
yourself
there :). Their printing representation miss leaded you to believe they are
instances of ... which is not the case. When you create an attribute:

        scheme@(guile-user)> (pango-attr-size-new 10)
        $3 = #<gw:wcp <pango-attribute> 0x562572ca8c40>

        in the above, gw:wcp stands for 'g-wrap:wrap C type', and what you read 
is
        just an opaque pointer printing representation for  
(pango-attr-size-new 10)

Just for info, below is a copy ot the automatically G-Wrap generated definition 
for
pango-attr-size-new [1]

> How can I test if an arbitrary  object belongs to some specific <gw:wcp> 
> class,
> e.g. if an object is a Pango attribute?

You can't, you have to use their creator interfaces and attribute list 
operators ...

        scheme@(guile-user)> (pango-attr-list-new)
        $2 = #<<pango-attr-list> 562572e2f260 [native]>
        scheme@(guile-user)> (pango-attr-size-new 10)
        $3 = #<gw:wcp <pango-attribute> 0x562572ca8c40>
        scheme@(guile-user)> (pango-attr-list-insert $2 $3)
        scheme@(guile-user)> 

HTH,
David

[1]

{
  const char *gw__tmp1217_arg_types[1];
  static GWTypeSpec gw__tmp1218_arg_typespecs[] = { GW_TYPESPEC_CALLER_OWNED,  
};
  gw__tmp1217_arg_types[0] = "int";
   gw_wrapset_add_function(gw__tmp0_c_info, pango_attr_size_new, 1, 0, 
"<pango-attribute>", GW_TYPESPEC_CALLER_OWNED, gw__tmp1217_arg_types, 
gw__tmp1218_arg_typespecs, "pango-attr-size-new", NULL, 
GW_FUNCTION_FLAG_LEAVE_RUNTIME);
}

Attachment: pgp_mZAPU4T09.pgp
Description: OpenPGP digital signature


reply via email to

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