gtkmm: gtkmm Reference Manual

gtkmm 4.13.2

gtkmm Reference Manual

# Description

gtkmm is the official C++ interface for the popular GUI library GTK. Highlights include typesafe callbacks, and a comprehensive set of widgets that are easily extensible via inheritance.

For instance, see Widgets, Dialogs, ListView and TextView.

See also the Programming with gtkmm book.

# Features

- GTK’s mature, capable set of widgets. See the GTK website for more information.
- Use inheritance to derive custom widgets.
- Type-safe signal handlers (slots), in standard C++, using libsigc++.
- Polymorphism.
- Use of the Standard C++ Library, including strings, containers and iterators.
- Full internationalisation with UTF8.
- Complete C++ memory management.
  - Member instances or dynamic new and delete.
  - Optional automatic deletion of child widgets.
  - No manual reference-counting.
- Full use of C++ namespaces.
- No macros.

# Basic Usage

Include the gtkmm header:

#include <gtkmm.h>

(You may include individual headers, such as `gtkmm/button.h` instead.)

If your source file is `program.cc`, you can compile it with:

g++ program.cc -o program `pkg-config --cflags --libs gtkmm-4.0`

If your version of g++ is not C++17-compliant by default, add the `-std=c++17` option.

If you use Meson, include the following in `meson.build:`

gtkmm_dep = dependency('gtkmm-4.0')
program_name = 'program'
cpp_sources = [ 'program.cc' ]
executable(program_name,
cpp_sources,
dependencies: gtkmm_dep
)

Alternatively, if using autoconf, use the following in `configure.ac:`

PKG_CHECK_MODULES([GTKMM], [gtkmm-4.0])

Then use the generated `GTKMM_CFLAGS` and `GTKMM_LIBS` variables in the project `Makefile.am` files. For example:

program_CPPFLAGS = $(GTKMM_CFLAGS)
program_LDADD = $(GTKMM_LIBS)