diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-05-21 23:53:27 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-05-22 00:51:53 +0300 |
commit | 1a8cf63488d8d6f4be297e753c31eea730ece226 (patch) | |
tree | 7e4050bdcd07e417d1c597c6c671c579c1d9256b /src/gui/widgets/button.cpp | |
parent | 3363acba6f1e8e51937ae2e354a8086c5c56b8cd (diff) | |
download | manaverse-1a8cf63488d8d6f4be297e753c31eea730ece226.tar.gz manaverse-1a8cf63488d8d6f4be297e753c31eea730ece226.tar.bz2 manaverse-1a8cf63488d8d6f4be297e753c31eea730ece226.tar.xz manaverse-1a8cf63488d8d6f4be297e753c31eea730ece226.zip |
Add option for show shortcuts buttons icons.
Icons by Guaritore.
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) |