GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

gtkmm... just getting started.

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
Micah Carrick
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 505
Location: Portland, OR USA

PostPosted: Mon Oct 03, 2005 3:06 am    Post subject: gtkmm... just getting started. Reply with quote

Hey y'all...

I've never dinked around with gtkmm, but since C++ is the dominant language being taught in schools, I'm considering perhaps switching over from C. The question that comes to mind, is what about all those libraries out there? They would need to have a wrapper in order to be used right? I'm specifically thinking about the GtkSourceView widget.

Micah
Back to top
openldev
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 387
Location: Fairfax, Virginia

PostPosted: Mon Oct 03, 2005 3:20 am    Post subject: Reply with quote

I used to use Gtkmm, but I realized something that should have been obvious in the first place. You can still use Gtk+ with C++, which is what I do. The only catch is that signals have to be friends if you want them to have access to private data members.

The only advantage of Gtkmm is that if gives you the same style of programming as c++ by using classes and namespaces that are wrappers of Gtk+. But, it not only doubled my executable size, but also required my users to install extra libraries. Also, Debian is always behind with the Gtkmm packages, so don't expect to have the most current, or even recently released Gtk+ versions at your disposal through the wrapper without requiring your users to compile Gtkmm directly from the sources.

Wrappers are great for some things, but not for most. And about the wrapper for GtkSourceView, it doesn't exist. There are some amateur projects for it that wrap some of the basic functions, but when I used it, I had to write my own wrapper for it. But then again, you can still use GtkSourceView with Gtkmm by using the Glib::wrap function provided. It will convert it from a GtkWidget* to a Gtk::Widget*.

Disclaimer: Just as a note, I don't mean to insult anyone with my bashing of Gtkmm. It really is a great set of libraries and has its uses. It is just not for me & I wanted to help people to learn from my mistakes so they can make an informed decision. :)
Back to top
Micah Carrick
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 505
Location: Portland, OR USA

PostPosted: Mon Oct 03, 2005 3:34 am    Post subject: Reply with quote

In addition to gtkmm, I'm seeing xfcd foundation classes, inti foundation classes and wxwidgets. Are these all just various wrappers and classes to make it "easier" to use C++ with GTK+?

I'd prefer to keep things simple. What does a basic code look like for a C++/GTK+ app which doesn't use gtkmm?
Back to top
openldev
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 387
Location: Fairfax, Virginia

PostPosted: Mon Oct 03, 2005 3:40 am    Post subject: Reply with quote

I've seen the xfcd foundation classes, but haven't ever worked with them. Gtkmm's only purpose is to make Gtk+ commands look like c++. Instead of using gtk_window_set_title (window, "title"), you would use window->set_title("title"). You just have to weigh whether the convenience outweighs the extra baggage. But yes, they are all just convenience wrappers.

As for code for a C++/Gtk+ app, just picture a normal c++ program that calls the Gtk+ library functions. It's just that simple. If you already know Gtk+, then all that's happening is that you're adding the ability to use things like strings, vectors, and other things available in c++. If you want to look at more, you can always go to SourceForge and view my project CVS, which is an example of this concept. The only extra things I have to do is the friend thing I mentioned before & .c_str()'s because Gtk+'s functions require gchar*'s.
Back to top
Micah Carrick
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 505
Location: Portland, OR USA

PostPosted: Mon Oct 03, 2005 3:47 am    Post subject: Reply with quote

Cool. I'm glad I asked. That's a better approach for me right now. Thanks.
Back to top
Amy606
Familiar Face


Joined: 23 Dec 2005
Posts: 5

PostPosted: Tue Dec 27, 2005 4:04 am    Post subject: Come on Reply with quote

V Oh please I do not think so.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP