Gtkmm
Encyclopedia
gtkmm is the official C++
interface for the popular GUI
library GTK+
. gtkmm is free software
distributed under the GNU Lesser General Public License
(LGPL).
gtkmm allows the creation of user interfaces either in code or with the Glade Interface Designer
, using the Gtk::Builder class. Other features include typesafe callbacks, a comprehensive set of widget
s, and the extensibility of widgets via inheritance
.
interface of the GUI
library GTK+
, C++
programmers can use the common OOP
techniques such as inheritance
, and C++
-specific facilities such as STL
(In fact, many of the gtkmm interfaces, especially those for widget
containers
, are designed to be similar to the Standard Template Library
(STL)).
Main features of gtkmm are listed as follows:
This program will create a window with a button labeled "Hello World". The button sends "Hello world" to standard output when clicked.
To run this program, just type the following command at your terminal:
or you can write a simple makefile.
To run gtkmm programs on Windows, see official manual.
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...
interface for the popular GUI
Gui
Gui or guee is a generic term to refer to grilled dishes in Korean cuisine. These most commonly have meat or fish as their primary ingredient, but may in some cases also comprise grilled vegetables or other vegetarian ingredients. The term derives from the verb, "gupda" in Korean, which literally...
library GTK+
GTK+
GTK+ is a cross-platform widget toolkit for creating graphical user interfaces. It is licensed under the terms of the GNU LGPL, allowing both free and proprietary software to use it. It is one of the most popular toolkits for the X Window System, along with Qt.The name GTK+ originates from GTK;...
. gtkmm is free software
Free software
Free software, software libre or libre software is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with restrictions that only ensure that further recipients can also do...
distributed under the GNU Lesser General Public License
GNU Lesser General Public License
The GNU Lesser General Public License or LGPL is a free software license published by the Free Software Foundation . It was designed as a compromise between the strong-copyleft GNU General Public License or GPL and permissive licenses such as the BSD licenses and the MIT License...
(LGPL).
gtkmm allows the creation of user interfaces either in code or with the Glade Interface Designer
Glade Interface Designer
Glade Interface Designer is a graphical user interface builder for GTK+, with additional components for GNOME. In its third version, Glade is programming language–independent, and does not produce code for events, but rather an XML file that is then used with an appropriate binding .Glade is...
, using the Gtk::Builder class. Other features include typesafe callbacks, a comprehensive set of widget
Widget (computing)
In computer programming, a widget is an element of a graphical user interface that displays an information arrangement changeable by the user, such as a window or a text box. The defining characteristic of a widget is to provide a single interaction point for the direct manipulation of a given...
s, and the extensibility of widgets via inheritance
Inheritance (computer science)
In object-oriented programming , inheritance is a way to reuse code of existing objects, establish a subtype from an existing object, or both, depending upon programming language support...
.
Features
Due to the fact that gtkmm is the official C++C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...
interface of the GUI
Gui
Gui or guee is a generic term to refer to grilled dishes in Korean cuisine. These most commonly have meat or fish as their primary ingredient, but may in some cases also comprise grilled vegetables or other vegetarian ingredients. The term derives from the verb, "gupda" in Korean, which literally...
library GTK+
GTK+
GTK+ is a cross-platform widget toolkit for creating graphical user interfaces. It is licensed under the terms of the GNU LGPL, allowing both free and proprietary software to use it. It is one of the most popular toolkits for the X Window System, along with Qt.The name GTK+ originates from GTK;...
, C++
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...
programmers can use the common OOP
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...
techniques such as inheritance
Inheritance (computer science)
In object-oriented programming , inheritance is a way to reuse code of existing objects, establish a subtype from an existing object, or both, depending upon programming language support...
, and C++
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...
-specific facilities such as STL
Standard Template Library
The Standard Template Library is a C++ software library which later evolved into the C++ Standard Library. It provides four components called algorithms, containers, functors, and iterators. More specifically, the C++ Standard Library is based on the STL published by SGI. Both include some...
(In fact, many of the gtkmm interfaces, especially those for widget
Widget (computing)
In computer programming, a widget is an element of a graphical user interface that displays an information arrangement changeable by the user, such as a window or a text box. The defining characteristic of a widget is to provide a single interaction point for the direct manipulation of a given...
containers
Container (data structure)
In computer science, a container is a class, a data structure, or an abstract data type whose instances are collections of other objects. In other words; they are used for storing objects in an organized way following specific access rules...
, are designed to be similar to the Standard Template Library
Standard Template Library
The Standard Template Library is a C++ software library which later evolved into the C++ Standard Library. It provides four components called algorithms, containers, functors, and iterators. More specifically, the C++ Standard Library is based on the STL published by SGI. Both include some...
(STL)).
Main features of gtkmm are listed as follows:
- Use inheritanceInheritance (computer science)In object-oriented programming , inheritance is a way to reuse code of existing objects, establish a subtype from an existing object, or both, depending upon programming language support...
to derive custom widgetsWidget (computing)In computer programming, a widget is an element of a graphical user interface that displays an information arrangement changeable by the user, such as a window or a text box. The defining characteristic of a widget is to provide a single interaction point for the direct manipulation of a given...
. - Type-safe signal handlersSignal programmingSignal programming is used in the same sense as dataflow programming, and is similar to event-driven programming.The word signal is used instead of the word dataflow in documentation of such libraries as Qt, GTK+ and libsigc++...
, in standard C++C++C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...
. - PolymorphismPolymorphism in object-oriented programmingSubtype polymorphism, almost universally called just polymorphism in the context of object-oriented programming, is the ability to create a variable, a function, or an object that has more than one form. The word derives from the Greek "πολυμορφισμός" meaning "having multiple forms"...
. - Use of Standard C++ Library, including stringsString (computer science)In formal languages, which are used in mathematical logic and theoretical computer science, a string is a finite sequence of symbols that are chosen from a set or alphabet....
, containersContainer (data structure)In computer science, a container is a class, a data structure, or an abstract data type whose instances are collections of other objects. In other words; they are used for storing objects in an organized way following specific access rules...
, and iterators. - Full internationalisation with UTF-8UTF-8UTF-8 is a multibyte character encoding for Unicode. Like UTF-16 and UTF-32, UTF-8 can represent every character in the Unicode character set. Unlike them, it is backward-compatible with ASCII and avoids the complications of endianness and byte order marks...
. - Complete C++C++C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...
memory management.- Object compositionObject compositionIn computer science, object composition is a way to combine simple objects or data types into more complex ones...
. - Automatic deallocation of dynamically allocated widgetsWidget (computing)In computer programming, a widget is an element of a graphical user interface that displays an information arrangement changeable by the user, such as a window or a text box. The defining characteristic of a widget is to provide a single interaction point for the direct manipulation of a given...
.
- Object composition
- Full use of C++ namespacesNamespace (computer science)A namespace is an abstract container or environment created to hold a logical grouping of unique identifiers or symbols . An identifier defined in a namespace is associated only with that namespace. The same identifier can be independently defined in multiple namespaces...
. - No macros.
- Cross-platform: LinuxLinuxLinux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...
(gccGNU Compiler CollectionThe GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain...
), FreeBSDFreeBSDFreeBSD is a free Unix-like operating system descended from AT&T UNIX via BSD UNIX. Although for legal reasons FreeBSD cannot be called “UNIX”, as the direct descendant of BSD UNIX , FreeBSD’s internals and system APIs are UNIX-compliant...
(gccGNU Compiler CollectionThe GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain...
), NetBSDNetBSDNetBSD is a freely available open source version of the Berkeley Software Distribution Unix operating system. It was the second open source BSD descendant to be formally released, after 386BSD, and continues to be actively developed. The NetBSD project is primarily focused on high quality design,...
(gccGNU Compiler CollectionThe GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain...
), Solaris (gccGNU Compiler CollectionThe GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain...
, Forte), Win32 (gccGNU Compiler CollectionThe GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain...
, MSVC++Visual C++Microsoft Visual C++ is a commercial , integrated development environment product from Microsoft for the C, C++, and C++/CLI programming languages...
, .Net 2003.NET FrameworkThe .NET Framework is a software framework that runs primarily on Microsoft Windows. It includes a large library and supports several programming languages which allows language interoperability...
), Mac OS XMac OS XMac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...
(gccGNU Compiler CollectionThe GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain...
), others.
Hello World in Gtkmm
This program will create a window with a button labeled "Hello World". The button sends "Hello world" to standard output when clicked.
To run this program, just type the following command at your terminal:
or you can write a simple makefile.
To run gtkmm programs on Windows, see official manual.
Applications
Some notable applications that use Gtkmm include:- InkscapeInkscapeInkscape is a free software vector graphics editor, licensed under the GNU General Public License. Its goal is to implement full support for the Scalable Vector Graphics 1.1 standard....
Vector graphics drawing. - K-3D 3D modelling and animation.
- WorkraveWorkraveWorkrave is a free software application intended to prevent computer users from developing or aggravating occupational diseases such as carpal tunnel syndrome, repetitive strain injuries, or myopia....
Assists in recovery and prevention of RSI. - GPartedGPartedGParted is a GTK+ front-end to GNU Parted and the official GNOME Partition Editor application.It is used for creating, deleting, resizing, moving, checking and copying partitions, and the file systems on them...
disk partitioning tool. - GobbyGobbyGobby is a free software collaborative real-time editor available on Windows and Unix-like platforms. It was initially released in June 2005 by the 0x539 dev group....
Collaborative text editor. - NemiverNemiverNemiver is a standalone graphical C and C++ debugger that integrates in the GNOME desktop environment.It currently features a backend which uses the well known GNU Debugger .The creator and the current lead developer is Dodji Seketeli.- General :...
GUI for the GNU debugger gdb. - ReferencerReferencerReferencer is a GNOME application to organize documents or references, and ultimately generate a BibTeX bibliography file. It is designed with the scientist/researcher in mind, and "document" may be taken to mean "paper" in general, although Referencer can deal with any kind of document that BibTeX...
document organiser and bibliography manager - MySQLMySQLMySQL officially, but also commonly "My Sequel") is a relational database management system that runs as a server providing multi-user access to a number of databases. It is named after developer Michael Widenius' daughter, My...
Administrator Database GUI. - Ardour Open Source digital audio workstation (DAW) for Linux and MacOS.
- GnoteGnoteGnote is a free and open-source desktop notetaking application written for Linux, cloned from Tomboy by Hubert Figuiere. It uses a Wiki-like linking system to connect notes together. Gnote is part of the GNOME desktop environment, often filling the need for personal information management. The main...
desktop notetaking application.
See also
- GTK+GTK+GTK+ is a cross-platform widget toolkit for creating graphical user interfaces. It is licensed under the terms of the GNU LGPL, allowing both free and proprietary software to use it. It is one of the most popular toolkits for the X Window System, along with Qt.The name GTK+ originates from GTK;...
- Widget toolkitWidget toolkitIn computing, a widget toolkit, widget library, or GUI toolkit is a set of widgets for use in designing applications with graphical user interfaces...
- QtQt (toolkit)Qt is a cross-platform application framework that is widely used for developing application software with a graphical user interface , and also used for developing non-GUI programs such as command-line tools and consoles for servers...
- wxWidgetsWxWidgetswxWidgets is a widget toolkit for creating graphical user interfaces for cross-platform applications. wxWidgets enables a program's GUI code to compile and run on several computer platforms with minimal or no code changes...
- FLTKFLTKFLTK is a cross-platform GUI library developed by Bill Spitzak and others. Made with 3D graphics programming in mind, it has an interface to OpenGL, but it is also suitable for general GUI programming....
- FOX toolkitFOX toolkitThe FOX toolkit is an open source, cross-platform widget toolkit, that is, a library of basic elements for building a graphical user interface...
- VCFVisual Component FrameworkThe Visual Component Framework is an open source project for development under Microsoft Windows and Apple Macintosh that is distributed under the BSD license. It is an advanced C++ application framework that makes it easier to produce GUI-based C++ applications. The framework is based on a...