From d260b1d4c07fb678801964fe5511ffeb748e3ff2 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 5 Nov 2024 13:26:37 -0700 Subject: [PATCH] Canvas::Button improvements --- libs/canvas/button.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/libs/canvas/button.cc b/libs/canvas/button.cc index 45a745474a..b9a4b212b9 100644 --- a/libs/canvas/button.cc +++ b/libs/canvas/button.cc @@ -66,6 +66,12 @@ Button::Button (Canvas* canvas, std::string const & str, Pango::FontDescription { _label->set_font_description (font_description); _label->set (str); + + Rect r = _label->bounding_box(); + + width = r.width(); + height = r.height(); + init (); } @@ -78,14 +84,18 @@ Button::Button (Item* parent, std::string const & str, Pango::FontDescription co { _label->set_font_description (font_description); _label->set (str); + + Rect r = _label->bounding_box(); + + width = r.width(); + height = r.height(); + init (); } void Button::init () { - add (_label); - Event.connect (sigc::mem_fun (*this, &Button::event_handler)); _label->Event.connect (sigc::mem_fun (*this, &Button::event_handler));