Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of DMBasicGUI by
Diff: Application/ImageButton.cpp
- Revision:
- 17:6e2abf107800
- Parent:
- 11:265884fa7fdd
- Child:
- 25:9528217a6c39
--- a/Application/ImageButton.cpp Mon Mar 09 14:24:54 2015 +0000
+++ b/Application/ImageButton.cpp Fri Mar 20 14:25:46 2015 +0100
@@ -105,6 +105,30 @@
return true;
}
+bool ImageButton::loadImages(Resource* resImgUp, Resource* resImgDown)
+{
+ if (_imgUp.pointerToFree != NULL) {
+ free(_imgUp.pointerToFree);
+ _imgUp.pointerToFree = NULL;
+ }
+ if (_imgDown.pointerToFree != NULL) {
+ free(_imgDown.pointerToFree);
+ _imgDown.pointerToFree = NULL;
+ }
+ if (Image::decode(resImgUp, Image::RES_16BIT, &_imgUp) != 0) {
+ DMBoard::instance().logger()->printf("Failed to load \"up\" image\n");
+ return false;
+ }
+ if (resImgDown != NULL) {
+ if (Image::decode(resImgDown, Image::RES_16BIT, &_imgDown) == 0) {
+ DMBoard::instance().logger()->printf("Failed to load \"down\" image\n");
+ return false;
+ }
+ }
+ return true;
+}
+
+
void ImageButton::setTransparency(COLOR_T tColor)
{
_transparent = true;
