Re: Dispatch of GObject virtual functions in GtkMM



Am Sonntag, den 28.01.2007, 13:53 -0600 schrieb Matt Hoosier:
> On 1/28/07, Daniel Elstner <daniel kitta googlemail com> wrote:
> >
> > Well, if you subclass the GObject as you would in plain C without gtkmm,
> > it's of course possible to wrap the result as a non-custom widget in
> > gtkmm.  Is that what you meant?
> 
> Not quite. I had something more like this in mind:
[snip]
>             CustomWidget ()
>             {
>                 static bool lazy_init_done = false;
> 
>                 if (!lazy_init_done)
>                 {
>                     GtkWidgetClass* klass = < macros to fetch class
> object for this new GType > ;
>                     klass->expose_event = CustomWidget::expose_event;
>                     lazy_init_done = true;
>                 }
>             }

That will probably work, though it's of course a hack.  I don't expect
any problems on the gtkmm side though, at least if Glib::ObjectBase(0)
is used.  Deriving a custom GObject class would be cleaner though.

--Daniel





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