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.h@5:f4de114c31c3, 2014-12-21 (annotated)
- Committer:
- embeddedartists
- Date:
- Sun Dec 21 13:53:07 2014 +0100
- Revision:
- 5:f4de114c31c3
- Parent:
- 3:3fabfe3339b8
- Child:
- 8:19a6b70d42b1
- Added support for RAW images
- Added SlideShow + App for it
- Moved App-specific stuff out from the AppLauncher and into main
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 | 1:46c8df4608c8 | 26 | * An App example. This uses 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 | 0:4977187e90c7 | 37 | ~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 | 5:f4de114c31c3 | 52 | |
embeddedartists | 0:4977187e90c7 | 53 | private: |
embeddedartists | 0:4977187e90c7 | 54 | enum Constants { |
embeddedartists | 0:4977187e90c7 | 55 | TitleHeight = 20, |
embeddedartists | 0:4977187e90c7 | 56 | ButtonWidth = 75, |
embeddedartists | 0:4977187e90c7 | 57 | ButtonHeight = 75, |
embeddedartists | 0:4977187e90c7 | 58 | ButtonRows = 2, |
embeddedartists | 0:4977187e90c7 | 59 | ButtonColumns = 5, |
embeddedartists | 0:4977187e90c7 | 60 | NumberOfButtons = ButtonRows*ButtonColumns, |
embeddedartists | 0:4977187e90c7 | 61 | }; |
embeddedartists | 0:4977187e90c7 | 62 | |
embeddedartists | 0:4977187e90c7 | 63 | Display* _disp; |
embeddedartists | 0:4977187e90c7 | 64 | SWIM_WINDOW_T* _win; |
embeddedartists | 0:4977187e90c7 | 65 | void* _fb; |
embeddedartists | 3:3fabfe3339b8 | 66 | Clickable* _buttons[NumberOfButtons]; |
embeddedartists | 0:4977187e90c7 | 67 | int _usedButtons; |
embeddedartists | 5:f4de114c31c3 | 68 | App*(*_callback)(uint32_t buttonID); |
embeddedartists | 0:4977187e90c7 | 69 | |
embeddedartists | 0:4977187e90c7 | 70 | void draw(); |
embeddedartists | 0:4977187e90c7 | 71 | }; |
embeddedartists | 0:4977187e90c7 | 72 | |
embeddedartists | 0:4977187e90c7 | 73 | #endif |