Basic swim GUI for LPC4088
Fork of DMBasicGUI by
Application/AppLauncher.h@38:1b7c79a10e14, 2016-03-14 (annotated)
- Committer:
- redbird
- Date:
- Mon Mar 14 20:14:06 2016 -0600
- Revision:
- 38:1b7c79a10e14
- Parent:
- 27:89ad51d98ed8
revert programming
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
embeddedartists | 1:46c8df4608c8 | 1 | /* |
embeddedartists | 1:46c8df4608c8 | 2 | * Copyright 2014 Embedded Artists AB |
embeddedartists | 1:46c8df4608c8 | 3 | * |
embeddedartists | 1:46c8df4608c8 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
embeddedartists | 1:46c8df4608c8 | 5 | * you may not use this file except in compliance with the License. |
embeddedartists | 1:46c8df4608c8 | 6 | * You may obtain a copy of the License at |
embeddedartists | 1:46c8df4608c8 | 7 | * |
embeddedartists | 1:46c8df4608c8 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
embeddedartists | 1:46c8df4608c8 | 9 | * |
embeddedartists | 1:46c8df4608c8 | 10 | * Unless required by applicable law or agreed to in writing, software |
embeddedartists | 1:46c8df4608c8 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
embeddedartists | 1:46c8df4608c8 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
embeddedartists | 1:46c8df4608c8 | 13 | * See the License for the specific language governing permissions and |
embeddedartists | 1:46c8df4608c8 | 14 | * limitations under the License. |
embeddedartists | 1:46c8df4608c8 | 15 | */ |
embeddedartists | 1:46c8df4608c8 | 16 | |
embeddedartists | 0:4977187e90c7 | 17 | #ifndef APP_LAUNCHER_H |
embeddedartists | 0:4977187e90c7 | 18 | #define APP_LAUNCHER_H |
embeddedartists | 0:4977187e90c7 | 19 | |
embeddedartists | 0:4977187e90c7 | 20 | #include "App.h" |
embeddedartists | 0:4977187e90c7 | 21 | #include "DMBoard.h" |
embeddedartists | 0:4977187e90c7 | 22 | #include "lpc_swim.h" |
embeddedartists | 3:3fabfe3339b8 | 23 | #include "Clickable.h" |
embeddedartists | 0:4977187e90c7 | 24 | |
embeddedartists | 0:4977187e90c7 | 25 | /** |
embeddedartists | 14:647b1896ed84 | 26 | * An App example using a number of buttons to launch different Apps. |
embeddedartists | 0:4977187e90c7 | 27 | * |
embeddedartists | 1:46c8df4608c8 | 28 | * The purpose of this example is to demonstrate how to manage a set of |
embeddedartists | 1:46c8df4608c8 | 29 | * Apps and launch them either as a result of clicked buttons or (in the |
embeddedartists | 1:46c8df4608c8 | 30 | * case of the TouchCalibrationApp) after an extended press of the USER |
embeddedartists | 1:46c8df4608c8 | 31 | * button on the back of the display module. |
embeddedartists | 0:4977187e90c7 | 32 | */ |
embeddedartists | 0:4977187e90c7 | 33 | class AppLauncher : public App { |
embeddedartists | 0:4977187e90c7 | 34 | public: |
embeddedartists | 0:4977187e90c7 | 35 | |
embeddedartists | 0:4977187e90c7 | 36 | AppLauncher(); |
embeddedartists | 10:651861441108 | 37 | virtual ~AppLauncher(); |
embeddedartists | 0:4977187e90c7 | 38 | |
embeddedartists | 5:f4de114c31c3 | 39 | enum CommonApplicationIDs { |
embeddedartists | 5:f4de114c31c3 | 40 | CalibrationApp = 0xffff, |
embeddedartists | 5:f4de114c31c3 | 41 | }; |
embeddedartists | 5:f4de114c31c3 | 42 | |
embeddedartists | 0:4977187e90c7 | 43 | virtual bool setup(); |
embeddedartists | 0:4977187e90c7 | 44 | virtual void runToCompletion(); |
embeddedartists | 0:4977187e90c7 | 45 | virtual bool teardown(); |
embeddedartists | 0:4977187e90c7 | 46 | |
embeddedartists | 5:f4de114c31c3 | 47 | void setAppCreatorFunc(App*(*callback)(uint32_t buttonID)); |
embeddedartists | 5:f4de114c31c3 | 48 | |
embeddedartists | 5:f4de114c31c3 | 49 | bool addButton(uint32_t buttonID, const char* caption); |
embeddedartists | 5:f4de114c31c3 | 50 | bool addImageButton(uint32_t buttonID, const char* imgUp, const char* imgDown = 0); |
embeddedartists | 5:f4de114c31c3 | 51 | bool addImageButton(uint32_t buttonID, const unsigned char* imgUp, unsigned int imgUpSize, const unsigned char* imgDown = 0, unsigned int imgDownSize = 0); |
embeddedartists | 11:265884fa7fdd | 52 | bool addImageButton(uint32_t buttonID, const char* caption, COLOR_T color, const char* imgUp, const char* imgDown = 0); |
embeddedartists | 11:265884fa7fdd | 53 | bool addImageButton(uint32_t buttonID, const char* caption, COLOR_T color, const unsigned char* imgUp, unsigned int imgUpSize, const unsigned char* imgDown = 0, unsigned int imgDownSize = 0); |
embeddedartists | 5:f4de114c31c3 | 54 | |
embeddedartists | 0:4977187e90c7 | 55 | private: |
embeddedartists | 0:4977187e90c7 | 56 | enum Constants { |
embeddedartists | 0:4977187e90c7 | 57 | TitleHeight = 20, |
embeddedartists | 0:4977187e90c7 | 58 | ButtonWidth = 75, |
embeddedartists | 0:4977187e90c7 | 59 | ButtonHeight = 75, |
redbird |
26:fb9902ddf294 | 60 | ButtonRows = 1, |
redbird |
27:89ad51d98ed8 | 61 | ButtonColumns = 3, |
embeddedartists | 0:4977187e90c7 | 62 | NumberOfButtons = ButtonRows*ButtonColumns, |
embeddedartists | 0:4977187e90c7 | 63 | }; |
embeddedartists | 0:4977187e90c7 | 64 | |
embeddedartists | 0:4977187e90c7 | 65 | Display* _disp; |
embeddedartists | 0:4977187e90c7 | 66 | SWIM_WINDOW_T* _win; |
embeddedartists | 0:4977187e90c7 | 67 | void* _fb; |
embeddedartists | 3:3fabfe3339b8 | 68 | Clickable* _buttons[NumberOfButtons]; |
embeddedartists | 0:4977187e90c7 | 69 | int _usedButtons; |
embeddedartists | 5:f4de114c31c3 | 70 | App*(*_callback)(uint32_t buttonID); |
embeddedartists | 8:19a6b70d42b1 | 71 | bool _supportsCalibration; |
embeddedartists | 8:19a6b70d42b1 | 72 | bool _newTouchEvent; |
embeddedartists | 8:19a6b70d42b1 | 73 | bool _newButtonEvent; |
embeddedartists | 0:4977187e90c7 | 74 | |
embeddedartists | 0:4977187e90c7 | 75 | void draw(); |
embeddedartists | 8:19a6b70d42b1 | 76 | void onTouchEvent(); |
embeddedartists | 8:19a6b70d42b1 | 77 | void onButtonEvent(); |
embeddedartists | 0:4977187e90c7 | 78 | }; |
embeddedartists | 0:4977187e90c7 | 79 | |
embeddedartists | 0:4977187e90c7 | 80 | #endif |