Re: 2. Re: General tips about GTK+ programming
I'm not a specialist, but ... I thing a good idea is the separate GUI code and functionaly code. Then I can easy move my functionaly code in another GUI toolkit and CLI. I mean two independent part for have interface to share data one another. GTK+ us only gets data for user and represent. I try do this :) -- Uzywane i nowe auta z Niemiec! Sprawdz http://link.interia.pl/f2113 ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: 2. Re: General tips about GTK+ programming
Ali Abdallah wrote: -- Message: 1 Date: Tue, 3 Mar 2009 09:39:51 -0300 From: Tomaz Canabrava tum...@gmail.com Subject: Re: General tips about GTK+ programming To: Vlad Volodin vest...@gmail.com Cc: gtk-app-devel-list@gnome.org Message-ID: 7ebbb4b50903030439k5e4bc73asff21305eefd84...@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
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 dhk...@optonline.net Ali Abdallah wrote: -- Message: 1 Date: Tue, 3 Mar 2009 09:39:51 -0300 From: Tomaz Canabrava tum...@gmail.com Subject: Re: General tips about GTK+ programming To: Vlad Volodin vest...@gmail.com Cc: gtk-app-devel-list@gnome.org Message-ID: 7ebbb4b50903030439k5e4bc73asff21305eefd84...@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
Re: 2. Re: General tips about GTK+ programming
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.grobg...@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 dhk...@optonline.net Ali Abdallah wrote: -- Message: 1 Date: Tue, 3 Mar 2009 09:39:51 -0300 From: Tomaz Canabrava tum...@gmail.com Subject: Re: General tips about GTK+ programming To: Vlad Volodin vest...@gmail.com Cc: gtk-app-devel-list@gnome.org Message-ID: 7ebbb4b50903030439k5e4bc73asff21305eefd84...@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 ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: 2. Re: General tips about GTK+ programming
Vlad Volodin wrote: 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. For me at least, speaking seriously and without being biased, i see that GObject classes are much more clean and understandable than the C++ ones. 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? It depends what you want to do here, in principle not, if you are writing a simple program, you souldn't do any inheritance at all, but in the other hand, if you are going to write something more complex, say a panel for example, yes probably you will have to inherit and overwrite the GtkWindow methods and probably others. - 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) To create th GUI you do it the way you like, it can be in a function that setup all the design and returns a pointer to the main window/dialog, GUI is just one piece of a software, the rest of the program functionalities usually ( in C/Gtk) are written in another independent files as GObjects, 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. it is a coding style, it is usually up to the programmer to separate things and make the program more clearer. Thank you all. Vlad Volodin Regards, Ali. 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.grobg...@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 dhk...@optonline.net Ali Abdallah wrote: -- Message: 1 Date: Tue, 3 Mar 2009 09:39:51 -0300 From: Tomaz Canabrava tum...@gmail.com Subject: Re: General tips about GTK+ programming To: Vlad Volodin vest...@gmail.com Cc: gtk-app-devel-list@gnome.org Message-ID: 7ebbb4b50903030439k5e4bc73asff21305eefd84...@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
2. Re: General tips about GTK+ programming
-- Message: 1 Date: Tue, 3 Mar 2009 09:39:51 -0300 From: Tomaz Canabrava tum...@gmail.com Subject: Re: General tips about GTK+ programming To: Vlad Volodin vest...@gmail.com Cc: gtk-app-devel-list@gnome.org Message-ID: 7ebbb4b50903030439k5e4bc73asff21305eefd84...@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