1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 22:05:06 +00:00

LibGUI: Allow Button::set_icon to accept a bitmap without a move

Previously, Button::set_icon required moving the bitmap into the
button, preventing the same bitmap from being used by multiple
buttons at once. While this works for buttons that are created once,
any button that is dynamically added would require the same bitmap to
be loaded every single time. In addition to being ineffecient, this
also makes error checking more difficult.

With this change, a bitmap can be loaded once, and passed to multiple
buttons.
This commit is contained in:
Dylan Katz 2022-01-10 19:00:44 -08:00 committed by Andreas Kling
parent 12a6ec9292
commit a2a93727db
2 changed files with 2 additions and 2 deletions

View file

@ -134,7 +134,7 @@ void Button::set_action(Action& action)
set_checked(action.is_checked());
}
void Button::set_icon(RefPtr<Gfx::Bitmap>&& icon)
void Button::set_icon(RefPtr<Gfx::Bitmap> icon)
{
if (m_icon == icon)
return;