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
Application/AppLauncher.cpp@3:3fabfe3339b8, 2014-12-19 (annotated)
- Committer:
- embeddedartists
- Date:
- Fri Dec 19 09:12:51 2014 +0100
- Revision:
- 3:3fabfe3339b8
- Parent:
- 0:4977187e90c7
- Child:
- 5:f4de114c31c3
- Fixed bug in Clickable
- Fixed missing include in Image
- Updated to match the new TouchPanel interface
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
embeddedartists | 0:4977187e90c7 | 1 | /* |
embeddedartists | 0:4977187e90c7 | 2 | * Copyright 2014 Embedded Artists AB |
embeddedartists | 0:4977187e90c7 | 3 | * |
embeddedartists | 0:4977187e90c7 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
embeddedartists | 0:4977187e90c7 | 5 | * you may not use this file except in compliance with the License. |
embeddedartists | 0:4977187e90c7 | 6 | * You may obtain a copy of the License at |
embeddedartists | 0:4977187e90c7 | 7 | * |
embeddedartists | 0:4977187e90c7 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
embeddedartists | 0:4977187e90c7 | 9 | * |
embeddedartists | 0:4977187e90c7 | 10 | * Unless required by applicable law or agreed to in writing, software |
embeddedartists | 0:4977187e90c7 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
embeddedartists | 0:4977187e90c7 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
embeddedartists | 0:4977187e90c7 | 13 | * See the License for the specific language governing permissions and |
embeddedartists | 0:4977187e90c7 | 14 | * limitations under the License. |
embeddedartists | 0:4977187e90c7 | 15 | */ |
embeddedartists | 0:4977187e90c7 | 16 | |
embeddedartists | 0:4977187e90c7 | 17 | |
embeddedartists | 0:4977187e90c7 | 18 | #include "mbed.h" |
embeddedartists | 0:4977187e90c7 | 19 | #include "AppLauncher.h" |
embeddedartists | 0:4977187e90c7 | 20 | #include "AppSettings.h" |
embeddedartists | 0:4977187e90c7 | 21 | #include "AppTouchCalibration.h" |
embeddedartists | 0:4977187e90c7 | 22 | #include "AppColorPicker.h" |
embeddedartists | 0:4977187e90c7 | 23 | #include "AppImageViewer.h" |
embeddedartists | 0:4977187e90c7 | 24 | #include "lpc_swim_font.h" |
embeddedartists | 0:4977187e90c7 | 25 | #include "Button.h" |
embeddedartists | 3:3fabfe3339b8 | 26 | #include "ImageButton.h" |
embeddedartists | 0:4977187e90c7 | 27 | |
embeddedartists | 0:4977187e90c7 | 28 | /****************************************************************************** |
embeddedartists | 0:4977187e90c7 | 29 | * Defines and typedefs |
embeddedartists | 0:4977187e90c7 | 30 | *****************************************************************************/ |
embeddedartists | 0:4977187e90c7 | 31 | |
embeddedartists | 0:4977187e90c7 | 32 | #define APP_PREFIX "[Launcher] " |
embeddedartists | 0:4977187e90c7 | 33 | |
embeddedartists | 0:4977187e90c7 | 34 | |
embeddedartists | 0:4977187e90c7 | 35 | typedef enum { |
embeddedartists | 0:4977187e90c7 | 36 | NoApplication = -1, |
embeddedartists | 0:4977187e90c7 | 37 | SettingsApp = 0, |
embeddedartists | 0:4977187e90c7 | 38 | ColorPicker, |
embeddedartists | 0:4977187e90c7 | 39 | TouchTestApp, |
embeddedartists | 0:4977187e90c7 | 40 | ImageViewerApp, |
embeddedartists | 0:4977187e90c7 | 41 | //SlideshowApp, |
embeddedartists | 0:4977187e90c7 | 42 | //TouchGFXApp, |
embeddedartists | 0:4977187e90c7 | 43 | //EmWinApp, |
embeddedartists | 3:3fabfe3339b8 | 44 | Placeholder = 99, |
embeddedartists | 0:4977187e90c7 | 45 | CalibrationApp = 100, |
embeddedartists | 0:4977187e90c7 | 46 | } AppID_t; |
embeddedartists | 0:4977187e90c7 | 47 | |
embeddedartists | 0:4977187e90c7 | 48 | /****************************************************************************** |
embeddedartists | 0:4977187e90c7 | 49 | * Private variables |
embeddedartists | 0:4977187e90c7 | 50 | *****************************************************************************/ |
embeddedartists | 0:4977187e90c7 | 51 | |
embeddedartists | 0:4977187e90c7 | 52 | static AppID_t appToLaunch = NoApplication; |
embeddedartists | 0:4977187e90c7 | 53 | |
embeddedartists | 0:4977187e90c7 | 54 | /****************************************************************************** |
embeddedartists | 0:4977187e90c7 | 55 | * Private functions |
embeddedartists | 0:4977187e90c7 | 56 | *****************************************************************************/ |
embeddedartists | 0:4977187e90c7 | 57 | |
embeddedartists | 0:4977187e90c7 | 58 | static void buttonClicked(uint32_t x) |
embeddedartists | 0:4977187e90c7 | 59 | { |
embeddedartists | 0:4977187e90c7 | 60 | if (appToLaunch == NoApplication) { |
embeddedartists | 0:4977187e90c7 | 61 | appToLaunch = (AppID_t)x; |
embeddedartists | 0:4977187e90c7 | 62 | } |
embeddedartists | 0:4977187e90c7 | 63 | } |
embeddedartists | 0:4977187e90c7 | 64 | |
embeddedartists | 0:4977187e90c7 | 65 | void AppLauncher::addButton(uint32_t buttonID, const char* caption) |
embeddedartists | 0:4977187e90c7 | 66 | { |
embeddedartists | 0:4977187e90c7 | 67 | int idx = _usedButtons++; |
embeddedartists | 0:4977187e90c7 | 68 | int xspace = ((_disp->width() - ButtonColumns * ButtonWidth) / (ButtonColumns + 1)); |
embeddedartists | 0:4977187e90c7 | 69 | int yspace = ((_disp->height() - TitleHeight - ButtonRows * ButtonHeight) / (ButtonRows + 1)); |
embeddedartists | 0:4977187e90c7 | 70 | |
embeddedartists | 0:4977187e90c7 | 71 | _buttons[idx] = new Button(caption, (COLOR_T*)_fb, |
embeddedartists | 0:4977187e90c7 | 72 | xspace + (ButtonWidth + xspace)*(idx%ButtonColumns), |
embeddedartists | 0:4977187e90c7 | 73 | TitleHeight + yspace + (ButtonHeight + yspace)*(idx/ButtonColumns), |
embeddedartists | 0:4977187e90c7 | 74 | ButtonWidth, ButtonHeight); |
embeddedartists | 0:4977187e90c7 | 75 | _buttons[idx]->setAction(buttonClicked, buttonID); |
embeddedartists | 0:4977187e90c7 | 76 | _buttons[idx]->draw(); |
embeddedartists | 0:4977187e90c7 | 77 | } |
embeddedartists | 0:4977187e90c7 | 78 | |
embeddedartists | 3:3fabfe3339b8 | 79 | void AppLauncher::addImageButton(uint32_t buttonID, const char* imgUp, const char* imgDown) |
embeddedartists | 3:3fabfe3339b8 | 80 | { |
embeddedartists | 3:3fabfe3339b8 | 81 | int idx = _usedButtons++; |
embeddedartists | 3:3fabfe3339b8 | 82 | int xspace = ((_disp->width() - ButtonColumns * 64) / (ButtonColumns + 1)); |
embeddedartists | 3:3fabfe3339b8 | 83 | int yspace = ((_disp->height() - TitleHeight - ButtonRows * 64) / (ButtonRows + 1)); |
embeddedartists | 3:3fabfe3339b8 | 84 | |
embeddedartists | 3:3fabfe3339b8 | 85 | ImageButton* img = new ImageButton((COLOR_T*)_fb, |
embeddedartists | 3:3fabfe3339b8 | 86 | xspace + (64 + xspace)*(idx%ButtonColumns), |
embeddedartists | 3:3fabfe3339b8 | 87 | TitleHeight + yspace + (64 + yspace)*(idx/ButtonColumns), |
embeddedartists | 3:3fabfe3339b8 | 88 | 64, 64); |
embeddedartists | 3:3fabfe3339b8 | 89 | if (!img->loadImages(imgUp, imgDown)) { |
embeddedartists | 3:3fabfe3339b8 | 90 | DMBoard::instance().logger()->printf("Failed to load image for buttonID %u, %s[%s]\n", buttonID, imgUp, imgDown==NULL?"":imgDown); |
embeddedartists | 3:3fabfe3339b8 | 91 | } |
embeddedartists | 3:3fabfe3339b8 | 92 | _buttons[idx] = img; |
embeddedartists | 3:3fabfe3339b8 | 93 | _buttons[idx]->setAction(buttonClicked, buttonID); |
embeddedartists | 3:3fabfe3339b8 | 94 | _buttons[idx]->draw(); |
embeddedartists | 3:3fabfe3339b8 | 95 | } |
embeddedartists | 3:3fabfe3339b8 | 96 | |
embeddedartists | 0:4977187e90c7 | 97 | void AppLauncher::draw() |
embeddedartists | 0:4977187e90c7 | 98 | { |
embeddedartists | 0:4977187e90c7 | 99 | // Prepare fullscreen |
embeddedartists | 0:4977187e90c7 | 100 | swim_window_open(_win, |
embeddedartists | 0:4977187e90c7 | 101 | _disp->width(), _disp->height(), // full size |
embeddedartists | 0:4977187e90c7 | 102 | (COLOR_T*)_fb, |
embeddedartists | 0:4977187e90c7 | 103 | 0,0,_disp->width()-1, _disp->height()-1, // window position and size |
embeddedartists | 0:4977187e90c7 | 104 | 1, // border |
embeddedartists | 3:3fabfe3339b8 | 105 | WHITE, BLACK, BLACK); // colors: pen, backgr, forgr |
embeddedartists | 0:4977187e90c7 | 106 | swim_set_title(_win, "Demo Program", BLACK); |
embeddedartists | 0:4977187e90c7 | 107 | |
embeddedartists | 0:4977187e90c7 | 108 | // Add many buttons |
embeddedartists | 3:3fabfe3339b8 | 109 | #if 0 |
embeddedartists | 0:4977187e90c7 | 110 | addButton(SettingsApp, "Settings"); |
embeddedartists | 0:4977187e90c7 | 111 | addButton(TouchTestApp, "Test Touch"); |
embeddedartists | 0:4977187e90c7 | 112 | //addButton(SlideshowApp, "Slideshow"); |
embeddedartists | 0:4977187e90c7 | 113 | //addButton(TouchGFXApp, "TouchGFX"); |
embeddedartists | 0:4977187e90c7 | 114 | //addButton(EmWinApp, "emWin"); |
embeddedartists | 0:4977187e90c7 | 115 | addButton(ColorPicker, "Color Picker"); |
embeddedartists | 0:4977187e90c7 | 116 | addButton(ImageViewerApp, "Image Viewer"); |
embeddedartists | 0:4977187e90c7 | 117 | //addButton(5, "Button 5"); |
embeddedartists | 0:4977187e90c7 | 118 | //addButton(6, "Button 6"); |
embeddedartists | 0:4977187e90c7 | 119 | //addButton(7, "Button 7"); |
embeddedartists | 0:4977187e90c7 | 120 | //addButton(8, "Button 8"); |
embeddedartists | 0:4977187e90c7 | 121 | //addButton(9, "Button 9"); |
embeddedartists | 3:3fabfe3339b8 | 122 | #else |
embeddedartists | 3:3fabfe3339b8 | 123 | addImageButton(SettingsApp, "/usb/preferences-desktop-applications.png"); |
embeddedartists | 3:3fabfe3339b8 | 124 | addImageButton(TouchTestApp, "/usb/bijiben.png"); |
embeddedartists | 3:3fabfe3339b8 | 125 | //addImageButton(SlideshowApp, "Slideshow"); |
embeddedartists | 3:3fabfe3339b8 | 126 | //addImageButton(TouchGFXApp, "TouchGFX"); |
embeddedartists | 3:3fabfe3339b8 | 127 | //addImageButton(EmWinApp, "emWin"); |
embeddedartists | 3:3fabfe3339b8 | 128 | addImageButton(ColorPicker, "/usb/preferences-color.png"); |
embeddedartists | 3:3fabfe3339b8 | 129 | addImageButton(ImageViewerApp, "/usb/multimedia-photo-manager.png"); |
embeddedartists | 3:3fabfe3339b8 | 130 | addImageButton(Placeholder, "/usb/help-info.png"); |
embeddedartists | 3:3fabfe3339b8 | 131 | addImageButton(Placeholder, "/usb/unetbootin.png"); |
embeddedartists | 3:3fabfe3339b8 | 132 | //addImageButton(5, "Button 5"); |
embeddedartists | 3:3fabfe3339b8 | 133 | //addImageButton(6, "Button 6"); |
embeddedartists | 3:3fabfe3339b8 | 134 | //addImageButton(7, "Button 7"); |
embeddedartists | 3:3fabfe3339b8 | 135 | //addImageButton(8, "Button 8"); |
embeddedartists | 3:3fabfe3339b8 | 136 | //addImageButton(9, "Button 9"); |
embeddedartists | 3:3fabfe3339b8 | 137 | #endif |
embeddedartists | 3:3fabfe3339b8 | 138 | |
embeddedartists | 0:4977187e90c7 | 139 | const char* msg = "(Press physical UserButton >2s to calibrate touch)"; |
embeddedartists | 0:4977187e90c7 | 140 | int w, h; |
embeddedartists | 0:4977187e90c7 | 141 | swim_get_string_bounds(_win, msg, &w, &h); |
embeddedartists | 0:4977187e90c7 | 142 | swim_put_text_xy(_win, msg, (_disp->width()-w)/2, _disp->height()-h*4); |
embeddedartists | 0:4977187e90c7 | 143 | } |
embeddedartists | 0:4977187e90c7 | 144 | |
embeddedartists | 0:4977187e90c7 | 145 | /****************************************************************************** |
embeddedartists | 0:4977187e90c7 | 146 | * Public functions |
embeddedartists | 0:4977187e90c7 | 147 | *****************************************************************************/ |
embeddedartists | 0:4977187e90c7 | 148 | |
embeddedartists | 0:4977187e90c7 | 149 | AppLauncher::AppLauncher() : _disp(NULL), _win(NULL), _fb(NULL), _usedButtons(0) |
embeddedartists | 0:4977187e90c7 | 150 | { |
embeddedartists | 0:4977187e90c7 | 151 | for (int i = 0; i < NumberOfButtons; i++) { |
embeddedartists | 0:4977187e90c7 | 152 | _buttons[i] = NULL; |
embeddedartists | 0:4977187e90c7 | 153 | } |
embeddedartists | 0:4977187e90c7 | 154 | } |
embeddedartists | 0:4977187e90c7 | 155 | |
embeddedartists | 0:4977187e90c7 | 156 | AppLauncher::~AppLauncher() |
embeddedartists | 0:4977187e90c7 | 157 | { |
embeddedartists | 0:4977187e90c7 | 158 | teardown(); |
embeddedartists | 0:4977187e90c7 | 159 | } |
embeddedartists | 0:4977187e90c7 | 160 | |
embeddedartists | 0:4977187e90c7 | 161 | bool AppLauncher::setup() |
embeddedartists | 0:4977187e90c7 | 162 | { |
embeddedartists | 0:4977187e90c7 | 163 | RtosLog* log = DMBoard::instance().logger(); |
embeddedartists | 0:4977187e90c7 | 164 | |
embeddedartists | 0:4977187e90c7 | 165 | _disp = DMBoard::instance().display(); |
embeddedartists | 0:4977187e90c7 | 166 | _win = (SWIM_WINDOW_T*)malloc(sizeof(SWIM_WINDOW_T)); |
embeddedartists | 0:4977187e90c7 | 167 | _fb = _disp->allocateFramebuffer(); |
embeddedartists | 0:4977187e90c7 | 168 | |
embeddedartists | 0:4977187e90c7 | 169 | if (_win == NULL || _fb == NULL) { |
embeddedartists | 0:4977187e90c7 | 170 | log->printf(APP_PREFIX"Failed to allocate memory for framebuffer\r\n"); |
embeddedartists | 0:4977187e90c7 | 171 | return false; |
embeddedartists | 0:4977187e90c7 | 172 | } |
embeddedartists | 0:4977187e90c7 | 173 | |
embeddedartists | 0:4977187e90c7 | 174 | return true; |
embeddedartists | 0:4977187e90c7 | 175 | } |
embeddedartists | 0:4977187e90c7 | 176 | |
embeddedartists | 0:4977187e90c7 | 177 | void AppLauncher::runToCompletion() |
embeddedartists | 0:4977187e90c7 | 178 | { |
embeddedartists | 0:4977187e90c7 | 179 | DMBoard* board = &DMBoard::instance(); |
embeddedartists | 0:4977187e90c7 | 180 | RtosLog* log = board->logger(); |
embeddedartists | 0:4977187e90c7 | 181 | |
embeddedartists | 0:4977187e90c7 | 182 | // Draw something on the framebuffer before using it so that it doesn't look garbled |
embeddedartists | 0:4977187e90c7 | 183 | draw(); |
embeddedartists | 0:4977187e90c7 | 184 | |
embeddedartists | 0:4977187e90c7 | 185 | // Start display in default mode (16-bit) |
embeddedartists | 0:4977187e90c7 | 186 | Display::DisplayError disperr = _disp->powerUp(_fb); |
embeddedartists | 3:3fabfe3339b8 | 187 | if (disperr != Display::DisplayError_Ok) { |
embeddedartists | 0:4977187e90c7 | 188 | log->printf(APP_PREFIX"Failed to initialize the display, got error %d\r\n", disperr); |
embeddedartists | 0:4977187e90c7 | 189 | return; |
embeddedartists | 0:4977187e90c7 | 190 | } |
embeddedartists | 0:4977187e90c7 | 191 | |
embeddedartists | 0:4977187e90c7 | 192 | // To keep track of the button pushes |
embeddedartists | 0:4977187e90c7 | 193 | Timer buttonTimer; |
embeddedartists | 0:4977187e90c7 | 194 | bool buttonPressed = false; |
embeddedartists | 0:4977187e90c7 | 195 | |
embeddedartists | 0:4977187e90c7 | 196 | // Wait for touches |
embeddedartists | 0:4977187e90c7 | 197 | TouchPanel* touch = board->touchPanel(); |
embeddedartists | 0:4977187e90c7 | 198 | TouchPanel::touchCoordinate_t coord; |
embeddedartists | 3:3fabfe3339b8 | 199 | while(touch->read(coord) == TouchPanel::TouchError_Ok) { |
embeddedartists | 0:4977187e90c7 | 200 | |
embeddedartists | 0:4977187e90c7 | 201 | // Process the touch coordinate for each button |
embeddedartists | 0:4977187e90c7 | 202 | for (int i = 0; i < NumberOfButtons; i++) { |
embeddedartists | 0:4977187e90c7 | 203 | if (_buttons[i] != NULL) { |
embeddedartists | 0:4977187e90c7 | 204 | if (_buttons[i]->handle(coord.x, coord.y, coord.z > 0)) { |
embeddedartists | 0:4977187e90c7 | 205 | _buttons[i]->draw(); |
embeddedartists | 0:4977187e90c7 | 206 | } |
embeddedartists | 0:4977187e90c7 | 207 | } |
embeddedartists | 0:4977187e90c7 | 208 | } |
embeddedartists | 0:4977187e90c7 | 209 | |
embeddedartists | 0:4977187e90c7 | 210 | // Check if the physical USER button on the board has been pressed |
embeddedartists | 0:4977187e90c7 | 211 | if (appToLaunch == NoApplication) { |
embeddedartists | 0:4977187e90c7 | 212 | if (board->buttonPressed()) { |
embeddedartists | 0:4977187e90c7 | 213 | if (buttonPressed) { |
embeddedartists | 0:4977187e90c7 | 214 | if (buttonTimer.read_ms() > 2000) { |
embeddedartists | 0:4977187e90c7 | 215 | // User has pressed the button more than two seconds. |
embeddedartists | 0:4977187e90c7 | 216 | // Start calibration application |
embeddedartists | 0:4977187e90c7 | 217 | appToLaunch = CalibrationApp; |
embeddedartists | 0:4977187e90c7 | 218 | buttonTimer.stop(); |
embeddedartists | 0:4977187e90c7 | 219 | buttonPressed = false; |
embeddedartists | 0:4977187e90c7 | 220 | } |
embeddedartists | 0:4977187e90c7 | 221 | } else { |
embeddedartists | 0:4977187e90c7 | 222 | buttonTimer.reset(); |
embeddedartists | 0:4977187e90c7 | 223 | buttonTimer.start(); |
embeddedartists | 0:4977187e90c7 | 224 | buttonPressed = true; |
embeddedartists | 0:4977187e90c7 | 225 | } |
embeddedartists | 0:4977187e90c7 | 226 | } else if (buttonPressed) { |
embeddedartists | 0:4977187e90c7 | 227 | buttonTimer.stop(); |
embeddedartists | 0:4977187e90c7 | 228 | buttonPressed = false; |
embeddedartists | 0:4977187e90c7 | 229 | } |
embeddedartists | 0:4977187e90c7 | 230 | } else { |
embeddedartists | 0:4977187e90c7 | 231 | // pressing the display buttons take precedence so disregard the |
embeddedartists | 0:4977187e90c7 | 232 | // USER button |
embeddedartists | 0:4977187e90c7 | 233 | buttonTimer.stop(); |
embeddedartists | 0:4977187e90c7 | 234 | buttonPressed = false; |
embeddedartists | 0:4977187e90c7 | 235 | } |
embeddedartists | 0:4977187e90c7 | 236 | |
embeddedartists | 0:4977187e90c7 | 237 | if (appToLaunch != NoApplication) { |
embeddedartists | 0:4977187e90c7 | 238 | App* a = NULL; |
embeddedartists | 0:4977187e90c7 | 239 | switch (appToLaunch) { |
embeddedartists | 0:4977187e90c7 | 240 | case SettingsApp: |
embeddedartists | 0:4977187e90c7 | 241 | a = new AppSettings(); |
embeddedartists | 0:4977187e90c7 | 242 | break; |
embeddedartists | 0:4977187e90c7 | 243 | case CalibrationApp: |
embeddedartists | 0:4977187e90c7 | 244 | a = new AppTouchCalibration(); |
embeddedartists | 0:4977187e90c7 | 245 | break; |
embeddedartists | 0:4977187e90c7 | 246 | case ColorPicker: |
embeddedartists | 0:4977187e90c7 | 247 | a = new AppColorPicker(); |
embeddedartists | 0:4977187e90c7 | 248 | break; |
embeddedartists | 0:4977187e90c7 | 249 | case ImageViewerApp: |
embeddedartists | 0:4977187e90c7 | 250 | a = new AppImageViewer(); |
embeddedartists | 0:4977187e90c7 | 251 | break; |
embeddedartists | 0:4977187e90c7 | 252 | default: |
embeddedartists | 0:4977187e90c7 | 253 | break; |
embeddedartists | 0:4977187e90c7 | 254 | } |
embeddedartists | 0:4977187e90c7 | 255 | if (a != NULL) { |
embeddedartists | 0:4977187e90c7 | 256 | if (a->setup()) { |
embeddedartists | 0:4977187e90c7 | 257 | a->runToCompletion(); |
embeddedartists | 0:4977187e90c7 | 258 | a->teardown(); |
embeddedartists | 0:4977187e90c7 | 259 | } |
embeddedartists | 0:4977187e90c7 | 260 | delete a; |
embeddedartists | 0:4977187e90c7 | 261 | } |
embeddedartists | 0:4977187e90c7 | 262 | appToLaunch = NoApplication; |
embeddedartists | 0:4977187e90c7 | 263 | } |
embeddedartists | 0:4977187e90c7 | 264 | } |
embeddedartists | 0:4977187e90c7 | 265 | } |
embeddedartists | 0:4977187e90c7 | 266 | |
embeddedartists | 0:4977187e90c7 | 267 | bool AppLauncher::teardown() |
embeddedartists | 0:4977187e90c7 | 268 | { |
embeddedartists | 0:4977187e90c7 | 269 | if (_win != NULL) { |
embeddedartists | 0:4977187e90c7 | 270 | free(_win); |
embeddedartists | 0:4977187e90c7 | 271 | _win = NULL; |
embeddedartists | 0:4977187e90c7 | 272 | } |
embeddedartists | 0:4977187e90c7 | 273 | if (_fb != NULL) { |
embeddedartists | 0:4977187e90c7 | 274 | free(_fb); |
embeddedartists | 0:4977187e90c7 | 275 | _fb = NULL; |
embeddedartists | 0:4977187e90c7 | 276 | } |
embeddedartists | 0:4977187e90c7 | 277 | for (int i = 0; i < NumberOfButtons; i++) { |
embeddedartists | 0:4977187e90c7 | 278 | _buttons[i] = NULL; |
embeddedartists | 0:4977187e90c7 | 279 | if (_buttons[i] != NULL) { |
embeddedartists | 0:4977187e90c7 | 280 | delete _buttons[i]; |
embeddedartists | 0:4977187e90c7 | 281 | _buttons[i] = NULL; |
embeddedartists | 0:4977187e90c7 | 282 | } |
embeddedartists | 0:4977187e90c7 | 283 | } |
embeddedartists | 0:4977187e90c7 | 284 | return true; |
embeddedartists | 0:4977187e90c7 | 285 | } |
embeddedartists | 0:4977187e90c7 | 286 | |
embeddedartists | 0:4977187e90c7 | 287 |