From 1a8cf63488d8d6f4be297e753c31eea730ece226 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 21 May 2018 23:53:27 +0300 Subject: Add option for show shortcuts buttons icons. Icons by Guaritore. --- src/gui/widgets/button.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/gui/widgets/button.cpp') diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 7c4668126..34112e5a5 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -375,6 +375,22 @@ void Button::loadImage(const std::string &imageName) mImages[f] = image; } +void Button::setImage(Image *const image) +{ + if (image == nullptr) + return; + if (mImageSet != nullptr) + { + mImageSet->decRef(); + mImageSet = nullptr; + } + mImageWidth = image->getWidth(); + mImageHeight = image->getHeight(); + mImages = new Image*[BUTTON_COUNT]; + for (int f = 0; f < BUTTON_COUNT; f ++) + mImages[f] = image; +} + void Button::loadImageSet(const std::string &imageName) { if (mImageSet != nullptr) -- cgit v1.2.3-60-g2f50