It's pretty easy. If you have the following GTK+ code
GtkWidget *w = gtk_widget_new (); |
gtk_widget_realize (w); |
gtk_widget_set_usize (w, width, height); |
gtk_widget_destroy (w); |
it becomes the following gtkmm code.
Gtk::Widget *w = manage(new Gtk::Widget()); |
w->realize (); |
w->set_usize (width, height); |
w->destroy (); |
You might want to take a look at some of examples that have also been translated into gtkmm and compare them to their GTK+ counterparts.
Derivation of widgets follows C++ rules and every signal has a _impl that you can overide as usual. Thus you always have the choice of deriving or connecting. Most programs use both. For a button to call something when pressed you will likely just use signals. For the main window most likely you will derive. As a general rule conversion from GTK+ to gtk-- uses
Gtk vs gtkmm resource consumption comparison
gtk+ | gtkmm |
---|---|
GtkFoo* | Gtk::Foo |
gtk_foo_method(GtkFoo* f,args) | f.method(args); |
GdkFoo* | Gdk_Foo |
gchar * | string& |
Things to note: Most gdkmm types are handles and not objects themselves. (Don't new them, use type.create();) They CAN point to a NULL object. These are properties inherited from X.)