[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: 2. Re: General tips about GTK+ programming
- From: Vlad Volodin <vest 84 gmail com>
- To: Dov Grobgeld <dov grobgeld gmail com>
- Cc: gtk-app-devel-list gnome org, Ali Abdallah <aliov xfce org>
- Subject: Re: 2. Re: General tips about GTK+ programming
- Date: Thu, 5 Mar 2009 21:10:32 +0300
Especially for me, I decided to learn some basis of GObject. Believe
me, there isn't any impossible :) Yes, there might be some
misunderstanding, but it's only for a first time. I think, that if you
can't understand how GObject works, or implemented, there is less help
with gob2, and maybe Vala.
I decided to rewrite my c++ classes. I saw that people use c++ classes
as own wrappers to c-objects. But, I think in this key gtkmm is
better, because there is solid conceptions and hierarchy. And it takes
less time to understand what this class do, or draw, or can.
My previous question was aimed to ask how to write correct gui (or
software at whole) from scratch.
- Should I inherit my widows as classes form GtkWindow?
- Or I have to write functions: GtkWiget main_window_new(); (also
options_window_new, etc)
- use all the GUI initialization in main function (or box some of them
into separated: void create_gui();
- maybe use many global variables (tens pointers of GtkWindow,
twenties as GtkWidgets etc)
I've asked these questions, because even in tutorials and books all
examples are written in main function. but there are examples... some
of my favorite GnomeGames are written in main.c file (50-100-200 kb).
For me, as newbie, its hard to understand how it works.
Thank you all.
Vlad Volodin
ps. I didn't want to say any bad about GnomeGames. My skills are low
in such things, so that is why I show it as example. I prefer to break
sources into small files, to make them clearer.
2009/3/5 Dov Grobgeld <dov grobgeld gmail com>:
> 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
>>
> _______________________________________________
> 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]