Relative Content

Tag Archive for c++gtkmm4

How to use Gtk::Viewport in GTKMM4?

I have a large widget that I would like to fit into a small place and make it scrollable.
For this, I have an example code as follows. It creates a Gtk::Window with default size 100×100, it has a Gtk::Box that contains a Gtk::Viewport and a Gtk::Scrollbar. The Gtk::Viewport widget contains a “large” widget with size 200×200. Unfortunately, the window grows to 200×200.

How to handle resize of Gtk::Window

Is there a way to handle Gtk::Window resize event? We don’t have an event controller for it, nor we can override Gtk::Widget::size_allocate function because it’s not virtual.