gtkmm
C++ Interfaces for GTK and GNOME
C++ Interfaces for GTK and GNOME
1. gtkmm's place in the world |
|
What is GTK? |
|
GTK is the GUI widget toolkit, written in C, which serves as the foundation for the GNOME project as well as many stand-alone applications. GTK is the foundation on which gtkmm is built. See https://www.gtk.org. |
|
Why is it named gtkmm? |
|
gtkmm was originally named gtk-- because GTK was originally named GTK+ and had a + in the name. However, as -- is not easily indexed by search engines, the package generally went by the name gtkmm, and that's what we stuck with. |
|
Why use gtkmm instead of GTK? |
|
|
|
Why use libsigc++? Why not use the GTK signal functions? |
|
|
|
Why isn't GTK/GNOME itself written in C++? |
|
|
|
Why not use Qt if you like C++ so much? |
|
gtkmm developers tend to prefer gtkmm to Qt because gtkmm does things in a more C++ way. Qt originates from a time when C++ and the standard library were not standardized or well supported by compilers. It therefore duplicates a lot of stuff that is now in the standard library, such as containers and type information. Most significantly, they modified the C++ language to provide signals, so that Qt classes cannot be used easily with non-Qt classes. gtkmm was able to use standard C++ to provide signals without changing the C++ language. Also, gtkmm and the other *mm modules allow you to build software which works more closely with the GNOME desktop. |
|
2. How good is gtkmm? |
|
What systems does it run under? |
|
gtkmm should run under any UNIX-type system with the proper compilers and libraries installed. The GNU C++ compiler (g++, part of gcc) together with the GNU toolset (such as found on Linux and *BSD systems) comprise its default build environment. It can also be built and used on Windows with the mingw build tools or MSVC. |
|
How complete is it? |
|
gtkmm tries to offer all of the functionality offered by GTK. This means that you should be able to do anything with gtkmm that's supported by GTK, and do it more easily. If something isn't covered then we want to know about it. GLib contains classes with similar functionality as standard C++
classes, for instance |
|
Does gtkmm use Standard C++ containers such as |
|
Yes, we believe in reusing standard C++ code wherever possible.
This might not be obvious at first because gtkmm has |
|
How does gtkmm compare to Qt? |
|
|
|
3. Further information |
|
Where can gtkmm be discussed? |
|
See the Discussion page. |
|
What documentation is there for gtkmm? |
|
See the Documentation page. |
|
Where can I find some example code? |
|
See the examples directory in the gtkmm-documentation module. Most of these appear in the gtkmm book. |
|
4. Using gtkmm |
|
What compiler arguments should I use to compile a gtkmm program? |
|
See the reference documentation. |
|
How can I get the GTK object from a gtkmm object? |
|
If you need some GTK functionality which is not supported through gtkmm,
you can call the |
|
How can I wrap a GTK widget in a gtkmm instance? |
|
|
|
Can I use C++ exceptions with gtkmm? |
|
Yes, but there are restrictions. Since plain C doesn't know what a C++ exception is, you can use exceptions in your gtkmm code as long as there are no C functions in your call stack between the thrower and the catcher. This means that you have to catch your exception locally. You will be warned at runtime about uncaught exceptions, and you can specify a different handler for uncaught exceptions. Some gtkmm methods use exceptions to report errors. The exception types that might be thrown are listed in the reference documentation of these methods. |
|
How can I use Cambalache or Glade with gtkmm? |
|
See the Gtk::Builder chapter in the gtkmm book. Cambalache replaces the Glade application. Glade can't be used with GTK4/gtkmm4. |
|
What does |
|
This means “The container widget will delete this child widget.” Use it if you don't want to worry about when to delete dynamically allocated widgets. |
|
How can I learn about arranging widgets? I am confused by the packing options. |
|
Cambalache is a great way to see what can be done with GTK and GNOME widgets. Use Cambalache to explore the choice of widgets and to see how they can be put together. |
|
I'm used to MFC (Microsoft Foundation Class Library). Where is the Document and the View? |
|
Document/View (which is a version of the Model–View–Controller
(MVC) software design pattern) is not supported directly by GTK. However, the
|
|
How do I load pictures for use with gtkmm? |
|
Use |
|
Is gtkmm thread-safe? |
|
Neither GTK nor gtkmm are thread-safe. All GUI code must run in the same thread. If your program might benefit from using multiple threads, have a look at the Multi-threaded programs chapter in the gtkmm book. |