A basic graphics package for the LPC4088 Display Module.
Dependents: lpc4088_displaymodule_demo_sphere sampleGUI sampleEmptyGUI lpc4088_displaymodule_fs_aid ... more
Fork of DMBasicGUI by
Diff: Application/AppLauncher.cpp
- Revision:
- 11:265884fa7fdd
- Parent:
- 8:19a6b70d42b1
- Child:
- 12:53601973f7eb
--- a/Application/AppLauncher.cpp Mon Jan 26 10:06:58 2015 +0100 +++ b/Application/AppLauncher.cpp Tue Feb 17 10:34:13 2015 +0100 @@ -84,7 +84,7 @@ osSignalSet(appThread, APP_SIGID_TOUCH); } -void onTimeoutEvent(void const* arg) +static void onTimeoutEvent(void const* arg) { *((bool*)arg) = true; osSignalSet(appThread, APP_SIGID_TOUCH); @@ -212,8 +212,8 @@ } // restore old touch listener (get our listener in return) - fpOld = touch->setListener(fpOld); - delete fpOld; + //fpOld = touch->setListener(fpOld); + //delete fpOld; } bool AppLauncher::teardown() @@ -258,14 +258,20 @@ bool AppLauncher::addImageButton(uint32_t buttonID, const char* imgUp, const char* imgDown) { + return addImageButton(buttonID, NULL, BLACK, imgUp, imgDown); +} + +bool AppLauncher::addImageButton(uint32_t buttonID, const char* caption, COLOR_T color, const char* imgUp, const char* imgDown) +{ int idx = _usedButtons++; int xspace = ((_disp->width() - ButtonColumns * 64) / (ButtonColumns + 1)); int yspace = ((_disp->height() - TitleHeight - ButtonRows * 64) / (ButtonRows + 1)); + int yoff = (caption == NULL) ? 0 : -15; // compensate for caption taking up space ImageButton* img = new ImageButton((COLOR_T*)_fb, xspace + (64 + xspace)*(idx%ButtonColumns), - TitleHeight + yspace + (64 + yspace)*(idx/ButtonColumns), - 64, 64); + TitleHeight + yspace + (64 + yspace)*(idx/ButtonColumns) + yoff, + 64, 64, caption, color); if (img->loadImages(imgUp, imgDown)) { _buttons[idx] = img; _buttons[idx]->setAction(buttonClicked, buttonID); @@ -279,14 +285,20 @@ bool AppLauncher::addImageButton(uint32_t buttonID, const unsigned char* imgUp, unsigned int imgUpSize, const unsigned char* imgDown, unsigned int imgDownSize) { + return addImageButton(buttonID, NULL, BLACK, imgUp, imgUpSize, imgDown, imgDownSize); +} + +bool AppLauncher::addImageButton(uint32_t buttonID, const char* caption, COLOR_T color, const unsigned char* imgUp, unsigned int imgUpSize, const unsigned char* imgDown, unsigned int imgDownSize) +{ int idx = _usedButtons++; int xspace = ((_disp->width() - ButtonColumns * 64) / (ButtonColumns + 1)); int yspace = ((_disp->height() - TitleHeight - ButtonRows * 64) / (ButtonRows + 1)); + int yoff = (caption == NULL) ? 0 : -15; // compensate for caption taking up space ImageButton* img = new ImageButton((COLOR_T*)_fb, xspace + (64 + xspace)*(idx%ButtonColumns), - TitleHeight + yspace + (64 + yspace)*(idx/ButtonColumns), - 64, 64); + TitleHeight + yspace + (64 + yspace)*(idx/ButtonColumns) + yoff, + 64, 64, caption, color); if (img->loadImages(imgUp, imgUpSize, imgDown, imgDownSize)) { _buttons[idx] = img; _buttons[idx]->setAction(buttonClicked, buttonID);