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

Re: 2. Re: General tips about GTK+ programming



First of all, since C++ is basically a superset of C, you can add as much or
little C++ as you want to your C-program. In another word, you can program
in C++, but use the C-api for widget creation, etc. That is what I have been
doing e.g. in my projects GemTCL and giv. In contrast to what was said in
this thread, I am subclassing GtkWindow and adding private members to it,
and am doing it in C. But, as I also find the C-syntax very tough and
verbose for object inheritance, I have been using gob2 for this. gob2 is a
preprocessor written for extending and dealing with GObjects.

It may be claimed that gob2 has become deprecated with the emergance of
Vala, which is a new language that compiles to C/H-code for GObjects. But
then you are no longer writing in C or C++ at all, for good and for bad.
It's pluses is that its syntax is much nicer for GObjects. Its minuses is
that you need to create extra glue interfaces in order to refer to other C
and C++ classes.

Hope this helps.

Regards,
Dov


2009/3/5 dhk <dhkuhl optonline net>

> Ali Abdallah wrote:
> >
> >>
> >>
> >> ----------------------------------------------------------------------
> >>
> >> Message: 1
> >> Date: Tue, 3 Mar 2009 09:39:51 -0300
> >> From: Tomaz Canabrava <tumaix gmail com>
> >> Subject: Re: General tips about GTK+ programming
> >> To: Vlad Volodin <vest 84 gmail com>
> >> Cc: gtk-app-devel-list gnome org
> >> Message-ID:
> >>     <7ebbb4b50903030439k5e4bc73asff21305eefd84f80 mail gmail com>
> >> Content-Type: text/plain; charset=ISO-8859-1
> >>
> >> from what I'v been into, it's better to write object oriented software
> >> using object oriented programming languages. I know some in this list
> >> dislikes c++ , but it's more sane than use pointers and simulations of
> >> classes.
> >> you will not learn how to program better by converting your gtkmm code
> >> to gtk, your code will be larger and will do the same thing.
> >>
> > I think what he was saying about "learning more when converting his
> > program to GTK" is valid,
> > since in C you deal with lower level programming than C++ , also you
> > know Gtk+ is written in C,
> > so when he gets used of C/Gtk/GObject programming he could easily
> > understand the way Gtk+ is done.
> >
> > My 2 cents.
> > _______________________________________________
> > gtk-app-devel-list mailing list
> > gtk-app-devel-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> >
>
> Is there a way to start adding C++ code to an existing C GTK program?
> How would you start to convert a GTK program written in C to a GTK
> program in C++?
>
> Thanks,
> dave
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>


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