Glade und Gtk::Builder
Although you can use C++ code to instantiate and arrange widgets, this can soon become tedious and repetitive. And it requires a recompilation to show changes. The Glade application allows you to layout widgets on screen and then save an XML description of the arrangement. Your application can then use the Gtk::Builder API to load that XML file at runtime and obtain a pointer to specifically named widget instances.
Dies hat folgende Vorteile:
Es wird weniger C++-Code benötigt.
UI changes can be seen more quickly, so UIs are able to improve.
Designer ohne Programmierkenntnisse können grafische Benutzeroberflächen entwerfen und bearbeiten.
You still need C++ code to deal with User Interface changes triggered by user actions, but using Gtk::Builder for the widget layout allows you to focus on implementing that functionality.
- 26.1. Laden der .glade-Datei
- 26.2. Zugriff auf Widgets
- 26.3. Verwenden abgeleiteter Widgets