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.
#include <gtkmm.h>
class Window : public Gtk::Window {
public:
Window() {
// connecting on_resize to the window
};
void on_resize(int width, int height) {
};
};
int main(int argc, char **argv) {
auto app = Gtk::Application::create("hu.azsn.window");
return app->make_window_and_run<Window>(argc, argv);
}
size_allocate
is a signal. The corresponding handler is size_allocate_vfunc
.
class Window : public Gtk::Window {
public:
void on_resize(int width, int height) {
}
protected:
void size_allocate_vfunc(int width, int height, int baseline) override {
on_resize(width, height);
Gtk::Widget::size_allocate_vfunc(width, height, baseline);
}
};