gtkmm

gtkmm is a C++ wrapper for GTK, a library used to create graphical user interfaces. It is licensed using the LGPL license, so you can develop open software, free software, or even commercial non-free software using gtkmm without purchasing licenses.

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.

1.2.1. Why use gtkmm instead of GTK?

gtkmm permite escrever código usando as técnicas normais de C++ como encapsulamento, derivação e polimorfismo. Como um programador de C++, você já deve perceber que isso leva a um código mais limpo e melhor organizado.

O gtkmm tem melhor segurança quanto à tipagem, assim o compilador pode detectar erros que só seriam percebidos em tempo de execução ao usar C. Esse uso de tipos específicos também torna a API mais clara, porque você pode ver que tipos deveriam ser usados apenas olhando a declaração de um método.

Inheritance can be used to derive new widgets. The derivation of new widgets in GTK C code is so complicated and error prone that almost no C coders do it. As a C++ developer you know that derivation is an essential Object Orientated technique.

Member instances can be used, simplifying memory management. All GTK C widgets are dealt with by use of pointers. As a C++ coder you know that pointers should be avoided where possible.

gtkmm involves less code compared to GTK, which uses prefixed function names and lots of cast macros.

1.2.2. gtkmm comparado ao Qt

O Qt da Trolltech é o competidor mais próximo do gtkmm, então merece uma discussão.

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 standardised 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, Trolltech 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. See the FAQ for more detailed differences.

1.2.3. gtkmm é um wrapper

gtkmm is not a native C++ toolkit, but a C++ wrapper of a C toolkit. This separation of interface and implementation has advantages. The gtkmm developers spend most of their time talking about how gtkmm can present the clearest API, without awkward compromises due to obscure technical details. We contribute a little to the underlying GTK code base, but so do the C coders, and the Perl coders and the Python coders, etc. Therefore GTK benefits from a broader user base than language-specific toolkits - there are more implementers, more developers, more testers, and more users.