gtkmm-3.0 is an old version of the gtkmm API that installs in parallel with the still older gtkmm-2.4 API and the new gtkmm-4.0 API. The last version of the gtkmm-2.4 API was gtkmm 2.24. gtkmm 3 has no major fundamental differences to gtkmm 2 but does make several small changes that were not possible while maintaining binary compatibility. If you never used the gtkmm-2.4 API then you can safely ignore this chapter.
gtkmm 3's library is called libgtkmm-3.0
rather than libgtkmm-2.4
and installs its headers in a similarly-versioned directory, so your pkg-config check should ask for gtkmm-3.0
rather than gtkmm-2.4
.
gtkmm 3 added some new classes:
Gtk::AppChooser
, Gtk::AppChooserButton
, Gtk::AppChooserDialog
allow the user to select an installed application to open a particular type of content.Gtk::Grid
is a new container widget that will eventually replace Gtk::Box
and Gtk::Table
. It arranges its children according to properties of those children rather than its own layout details.Gtk::Switch
displays On/Off states more explicitly than Gtk::CheckButton
. It may be useful, for instance, when allowing users to activate hardware.gtkmm 3 also made several small changes to the API, which you will probably encounter when porting code that used gtkmm-2.4. Here is a short list:
Gtk::CellLayout
, used by Gtk::IconView
, Gtk::TreeView::Column
and Gtk::ComboBox
, now has a Gtk::CellArea
which can be used to specify more details of how the CellRenderer
s are arranged and aligned.Gtk::CellRenderer
s.Gtk::Adjustment
and IconSet
and Gdk::Cursor
are now used via Glib::RefPtr
.Gtk::Box
, Gtk::ButtonBox
, Gtk::IconView
, Gtk::Paned
, Gtk::ProgressBar
, Gtk::ScaleButton
, Gtk::Scrollbar
and Gtk::Separator
now derive from Gtk::Orientable
, allowing their
orientation (vertical or horizontal) to be specified without requiring the use of a derived class such as Gtk::HBox
.Gtk::IconView
, Gtk::TextView
, Gtk::TreeView
and other widgets derive from Scrollable instead of having their own methods such as get_vadjustment()
and instead of having their own set_scroll_adjustments signal.Gtk::Style
and Gtk::Rc
were removed, replaced by Gtk::StyleContext
, and Gtk::StyleProvider
s, such as Gtk::CssProvider
.Cairo::Context
and does not require you to call Cairo::Context::clip()
.Gdk::RGBA
replaces Color
, adding an alpha component for opacity. Colormap
was removed, along with its awkward use to allocate colors.Gdk::Pixmap
and Gdk::Bitmap
were removed in favor of Gdk::Pixbuf
.Gdk::Drawable
was removed, with its methods moving into Gdk::Window
.
All deprecated API was removed in gtkmm 3.0, though there have been new deprecations in later gtkmm 3.x versions.
As a first step to porting your source code to gtkmm-3.0 you should probably ensure that your application builds with the deprecated gtkmm-2.4 API disabled, by defining macro such as GTKMM_DISABLE_DEPRECATED. There are some autotools macros that can help with this by defining them optionally at build time. See the gtkmm 3 porting wiki page for more details.