diff options
Diffstat (limited to 'src/gui/widgets/button.cpp')
-rw-r--r-- | src/gui/widgets/button.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
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) |