GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Oct 30, 2014 12:54 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: gtkmm... just getting started.
PostPosted: Mon Oct 03, 2005 3:06 am 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
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

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 03, 2005 3:20 am 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 3:07 am
Posts: 384
Location: Fairfax, Virginia
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. :)

_________________
Andrew Krause

Foundations of GTK+ Development: Buy now for only $31.49!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 03, 2005 3:34 am 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
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?

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 03, 2005 3:40 am 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 3:07 am
Posts: 384
Location: Fairfax, Virginia
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.

_________________
Andrew Krause

Foundations of GTK+ Development: Buy now for only $31.49!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 03, 2005 3:47 am 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
Cool. I'm glad I asked. That's a better approach for me right now. Thanks.

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group