Re: [gtk-list] C++ and Gtk



> However, the development for Lilypond has all been in C++, and i plan on
> continuing that tradition in the front end.  I have Gtk+-1.0.3 but can't
> seem to find any real information on Gtk--.  Is it in production?  Is
> there something available to me?  What is it that makes Gtk-- better than
> Gtk for C++ coding?  Is there a site that someone can point me at for my
> answers?  All i found in the tutorial (which is pretty good by the way)
> was a reference to the fact that Gtk-- may exist.

Basically, as you seem to have figured out, you have two choices.  You can
either use gtk--, which has the nice type-safe callbacks, an (arguably)
more elegant style, C++ style inheritance based customization, etc. or the
straight gtk+ interface.  There's no real crime with using gtk+ in C++, the
only real minus (which IMHO isn't really that big of a deal) is the small
amount of casting to get from a generic callback pointer to, say, your object
instance.  To be honest, I haven't done that much with gtk, but I have done
plenty with C++ and Motif, and for the purposes of discussion in this
context, the problems with C++/Motif vs. C++/gtk+ are the same, and I've
gotten along just fine with some fairly big projects using C++/Motif.

I have some things planned soon with gtk+, (using C++) and although I haven't
made up my mind for sure, I'm definitely slanting towards using the straight
gtk+ interface, for a few reasons (some have more merit than others).
First, I like looking at, say, the gimp code, and seeing exactly how something
was done, and being able to use that directly (or indirectly) in my code.
Second, I really *don't* like seeing how something was done in, say, the
gimp code, but then finding out that it's not quite possible yet to do it
in a different binding, because of reason X, or something.  Mostly, though,
I don't like the added level of indirection of using an API that sits on top
of the C API, when I could just as easily use the C API.  These are not 
intensely critical reasons, and as I've said, I still haven't totally made up
my mind, because Tero et al. are doing some pretty cool things with gtk--, but
these are just my feelings at present.

Apologies for the length, and hopefully this is at least slightly helpful.

						Brian



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