Re: Implementing GInterfaces purely from C++?



On Fri, 2008-02-01 at 18:14 -0800, Philip Langdale wrote:
> Philip Langdale wrote:
> > 
> > Is there a way I can make this work without doing my implementation in C
> > and then wrapping it - that would be pretty crummy as my underlying data
> > store is a C++ object.
> 
> Predictably, I found it right after sending the email.
> 
> As I understand it, it should be:
> 
> class Foo : virtual public Glib::ObjectBase,
>             public Glib::Object,
>             public Gtk::TreeModel
> {
>    Foo() : Glib::ObjectBase("FooType") {}
> };
> 
> This yields a custom type with the interface implemented.

I don't think you need to mention Glib::ObjectBase there because
Glib::Object has it already.

You can generally find this technique in custom CellRenderer and
TreeModel implementations.

-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com




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