guile_gi question: gtk+ interface object?

2022-06-14 Thread Andy Tai
question: how to create object representing Gtk+ (version 3)
interfaces? For example.

(let (model (make )))

would fail  because GtkTreeModel is an interface, not class derived
from GObject.

Thanks



Re: guile_gi question: gtk+ interface object?

2022-06-14 Thread Maxime Devos
Andy Tai schreef op di 14-06-2022 om 11:52 [-0700]:
> question: how to create object representing Gtk+ (version 3)
> interfaces? For example.
> 
> (let (model (make )))
> 
> would fail  because GtkTreeModel is an interface, not class derived
> from GObject.

By definition, you cannot instatiate interfaces, but you can
instantiate classes derived from GtkTreeModel?  Seems like you answered
the question yourself?
Maybe guile-gi even supports defining an implementation yourself in
Scheme with GOOPS ...

Greetings,
Maxime.


signature.asc
Description: This is a digitally signed message part


guile_gi question: gtk+ interface object?

2022-06-14 Thread Andy Tai
question: how to create object representing Gtk+ (version 3)
interfaces? For example.

(let (model (make )))

would fail  because GtkTreeModel is an interface, not class derived
from GObject.

Thanks



Re: guile_gi question: gtk+ interface object?

2022-06-14 Thread Andy Tai
Hi, thanks for the reply.   The interface in GObject level does not
necessarily translate as is to GOOPS at guile level...

the context of this question is

(let ((iter (make ))
 (model (make )))
(define selected (tree-selection:get-selected! selection model iter))

get_selected(GtkTreeModel out model, GtkTreeeIter out iter) has two
out parameters, model and iter, but I think GOOPS does type check on
arguments before invoking a method so  both parameters must be
initialized to the expected types.
The model parameter normally is instance of a GOBject class
"implementing" the GtkTreeModel interface (at the GOBject level), and
I cannot pass in a concrete GOBject class that implements GtkTreeModel
 as GOOPS will reject such calls--GOOPS does not understand "class
implementing an interface" at the GOBject level.  So I don't know how
to initialize the model parameter.

On Tue, Jun 14, 2022 at 12:42 PM Maxime Devos  wrote:
>
> Andy Tai schreef op di 14-06-2022 om 11:52 [-0700]:
> > question: how to create object representing Gtk+ (version 3)
> > interfaces? For example.
> >
> > (let (model (make )))
> >
> > would fail  because GtkTreeModel is an interface, not class derived
> > from GObject.
>
> By definition, you cannot instatiate interfaces, but you can
> instantiate classes derived from GtkTreeModel?
> Maybe guile-gi even supports defining an implementation yourself in
> Scheme with GOOPS ...
>



-- 
Andy Tai, a...@atai.org, Skype: licheng.tai, Line: andy_tai, WeChat: andytai1010
Year 2021 民國110年
自動的精神力是信仰與覺悟
自動的行為力是勞動與技能