Re: I want to use a Gtk+ widget...



On Thu, 2008-02-21 at 22:01 +0000, Robert Pearce wrote:
> On Thu, 21 Feb 2008, Rob Stoddard <rstoddard telanetix com> wrote :
> >
> >Is it possible for me to use a Gtk+ widget, perhaps wrapping it
> >(manually) in a class, rather than go through all the trouble of
> >creating a gtkmm library?
> 
> Yes, it is. I had a similar issue with a custom GTK widget (modified
> version of the "dial" example). I actually created a class derived from
> Gtk::Frame to embed it in, because that was convenient for the GUI I was
> creating, but the principle is similar.

There is an almost opposite approach too, which can work sometimes.

	Gtk::Widget* genericVersionOfSpecialWidget = 
                   Glib::wrap (gtk_special_widget_new());

         .... do stuff with the generic Gtk::Widget* ....
         .... such as packing it into containers etc ....

then when you need something other than the generic Widget API:

        GtkSpecialWidget* specialWidget = (GTK_SPECIAL_WIDGET*)
          (genericVersionOfSpecialWidget->gobj());

        gtk_special_widget_do_something_special (specialWidget);




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