Rubrikrad
Our application already uses a Gtk::HeaderBar instead of a 'normal' window titlebar. The header bar is a direct child of the window, and its type is titlebar. This is set in the window.ui file.
Here we'll just make two small changes to the header bar. The decoration-layout property is set in the window.ui file, to show only the close button, and hide the minimize and maximize buttons. We also include an icon in the resource file, and set up this icon as the window icon. In ExampleAppWindow's constructor:
Gtk::IconTheme::get_for_display(get_display())->add_resource_path("/org/gtkmm/exampleapp");
set_icon_name("exampleapp");
Här är hur programmet ser ut nu:
The window.ui file sets a header bar title, but this title is not shown. That's because the stack switcher is a child of type title. The stack switcher becomes a custom title that hides the title label.