[Glade-users] Recommended way to work with custom widget
Jaap A. Haitsma
jaap at haitsma.org
Sun Nov 4 16:46:14 EST 2007
On 9/28/07, Tristan Van Berkom <tvb at gnome.org> wrote:
> On Fri, 2007-09-28 at 11:16 +0200, Jaap Haitsma wrote:
> > Hi,
> >
> > I have custom widget (derived from GtkDrawingArea). What's the
> > recommended way to work with just a custom widget in glade?
> >
> > Should I just not put a widget and in the code add the widget to a
> > GtkBin that I put in the glade file?
>
> Hi, sorry there is no real documentation about this at the moment.
>
> please, the simplest way is to follow instructions in my blog post[1],
> that will get you the widget in the glade runtime (remember to set
> the parent attribute to GtkDrawingArea)... then in your libglade
> application you need to call:
>
> glade_provides ("name"); /* the name of the catalog in glade */
> glade_register_widget (FOO_TYPE_BAR, glade_standard_build_widget,
> NULL, NULL); /* FOO_TYPE_BAR is your real type */
>
>
Thanks, I've used the approach that I was suggesting as well. And that
works fine and is easier in my opinion. What I did is the following
My custom widget had to be placed into a GtkScrolledWindow. In glade I
simply did not put any widget. In the c code I created my custom
widget and simply called a gtk_container_add with the scrolled window
and my custom widget as parameters.
Any comments?
Jaap
More information about the Glade-users
mailing list