13
0

Canvas::Button improvements

This commit is contained in:
Paul Davis 2024-11-05 13:26:37 -07:00
parent c1ad49a411
commit d260b1d4c0

View File

@ -66,6 +66,12 @@ Button::Button (Canvas* canvas, std::string const & str, Pango::FontDescription
{ {
_label->set_font_description (font_description); _label->set_font_description (font_description);
_label->set (str); _label->set (str);
Rect r = _label->bounding_box();
width = r.width();
height = r.height();
init (); init ();
} }
@ -78,14 +84,18 @@ Button::Button (Item* parent, std::string const & str, Pango::FontDescription co
{ {
_label->set_font_description (font_description); _label->set_font_description (font_description);
_label->set (str); _label->set (str);
Rect r = _label->bounding_box();
width = r.width();
height = r.height();
init (); init ();
} }
void void
Button::init () Button::init ()
{ {
add (_label);
Event.connect (sigc::mem_fun (*this, &Button::event_handler)); Event.connect (sigc::mem_fun (*this, &Button::event_handler));
_label->Event.connect (sigc::mem_fun (*this, &Button::event_handler)); _label->Event.connect (sigc::mem_fun (*this, &Button::event_handler));