gtkgtkmm

gtkmm how to use header bar instead of titlebar if I'm not using .ui file


I wanna replace Notebook bar with Gtk::HeaderBar in one of my projects, and since I'm not using .ui file, but I'm directly programming everything I wonder how can I hide title bar and use header bar.


Solution

  • Firstly, we need to create new header bar which will replace our titlebar and then simply providing window.set_titlebar() with Gtk::Header widget solved it.

    Definition:

    void Gtk::Window::set_titlebar  (Widget& titlebar)