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 EmbeddedArtists AB

Committer:
embeddedartists
Date:
Thu Jan 08 11:14:56 2015 +0100
Revision:
6:7917b0894655
Parent:
4:a73760d09423
Child:
10:651861441108
- Fixed bug in Image class
- Added option to draw() in Clickable to change frame buffer

Who changed what in which revision?

UserRevisionLine numberNew contents of line
embeddedartists 2:efae611de184 1 /*
embeddedartists 2:efae611de184 2 * Copyright 2014 Embedded Artists AB
embeddedartists 2:efae611de184 3 *
embeddedartists 2:efae611de184 4 * Licensed under the Apache License, Version 2.0 (the "License");
embeddedartists 2:efae611de184 5 * you may not use this file except in compliance with the License.
embeddedartists 2:efae611de184 6 * You may obtain a copy of the License at
embeddedartists 2:efae611de184 7 *
embeddedartists 2:efae611de184 8 * http://www.apache.org/licenses/LICENSE-2.0
embeddedartists 2:efae611de184 9 *
embeddedartists 2:efae611de184 10 * Unless required by applicable law or agreed to in writing, software
embeddedartists 2:efae611de184 11 * distributed under the License is distributed on an "AS IS" BASIS,
embeddedartists 2:efae611de184 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
embeddedartists 2:efae611de184 13 * See the License for the specific language governing permissions and
embeddedartists 2:efae611de184 14 * limitations under the License.
embeddedartists 2:efae611de184 15 */
embeddedartists 2:efae611de184 16
embeddedartists 3:3fabfe3339b8 17 #ifndef IMAGEBUTTON_H
embeddedartists 3:3fabfe3339b8 18 #define IMAGEBUTTON_H
embeddedartists 2:efae611de184 19
embeddedartists 2:efae611de184 20 #include "Clickable.h"
embeddedartists 2:efae611de184 21 #include "Image.h"
embeddedartists 2:efae611de184 22
embeddedartists 2:efae611de184 23 /**
embeddedartists 2:efae611de184 24 * The ImageButton is used in the same way as the Button so see it for an example
embeddedartists 2:efae611de184 25 */
embeddedartists 2:efae611de184 26 class ImageButton : public Clickable {
embeddedartists 2:efae611de184 27 public:
embeddedartists 2:efae611de184 28
embeddedartists 2:efae611de184 29 /** Creates a new button
embeddedartists 2:efae611de184 30 *
embeddedartists 2:efae611de184 31 * This button will use a SWIM window to draw on. That window will use
embeddedartists 2:efae611de184 32 * part of the full size frame buffer to draw on.
embeddedartists 2:efae611de184 33 *
embeddedartists 2:efae611de184 34 * @param fb the frame buffer
embeddedartists 2:efae611de184 35 * @param x the upper left corner of the button
embeddedartists 2:efae611de184 36 * @param y the upper left corner of the button
embeddedartists 2:efae611de184 37 * @param width the width of the button
embeddedartists 2:efae611de184 38 * @param height the height of the button
embeddedartists 3:3fabfe3339b8 39 */
embeddedartists 3:3fabfe3339b8 40 ImageButton(COLOR_T* fb, uint16_t x, uint16_t y, uint16_t width, uint16_t height);
embeddedartists 3:3fabfe3339b8 41 ~ImageButton();
embeddedartists 3:3fabfe3339b8 42
embeddedartists 3:3fabfe3339b8 43 /** Loads the mandatory "normal" state image and the optional "pressed" state image
embeddedartists 3:3fabfe3339b8 44 *
embeddedartists 4:a73760d09423 45 * @param imgUp the file with the image for the normal state
embeddedartists 4:a73760d09423 46 * @param imgDown the file with the image for the pressed state (or NULL to use the same)
embeddedartists 4:a73760d09423 47 *
embeddedartists 4:a73760d09423 48 * @returns
embeddedartists 4:a73760d09423 49 * true on success
embeddedartists 4:a73760d09423 50 * false on failure
embeddedartists 4:a73760d09423 51 */
embeddedartists 4:a73760d09423 52 bool loadImages(const char* imgUp, const char* imgDown = 0);
embeddedartists 4:a73760d09423 53
embeddedartists 4:a73760d09423 54 /** Loads the mandatory "normal" state image and the optional "pressed" state image
embeddedartists 4:a73760d09423 55 *
embeddedartists 2:efae611de184 56 * @param imgUp the image for the normal state
embeddedartists 2:efae611de184 57 * @param imgDown the image for the pressed state (or NULL to use the same)
embeddedartists 3:3fabfe3339b8 58 *
embeddedartists 3:3fabfe3339b8 59 * @returns
embeddedartists 3:3fabfe3339b8 60 * true on success
embeddedartists 3:3fabfe3339b8 61 * false on failure
embeddedartists 2:efae611de184 62 */
embeddedartists 4:a73760d09423 63 bool loadImages(const unsigned char* imgUp, unsigned int imgUpSize,
embeddedartists 4:a73760d09423 64 const unsigned char* imgDown = 0, unsigned int imgDownSize = 0);
embeddedartists 3:3fabfe3339b8 65
embeddedartists 6:7917b0894655 66 /** Draws the button (on a new framebuffer if one is specified)
embeddedartists 6:7917b0894655 67 * @param fb the frame buffer
embeddedartists 2:efae611de184 68 */
embeddedartists 6:7917b0894655 69 virtual void draw(COLOR_T* fb = 0);
embeddedartists 2:efae611de184 70
embeddedartists 2:efae611de184 71 private:
embeddedartists 2:efae611de184 72 Image::ImageData_t _imgUp;
embeddedartists 2:efae611de184 73 Image::ImageData_t _imgDown;
embeddedartists 2:efae611de184 74 };
embeddedartists 2:efae611de184 75
embeddedartists 3:3fabfe3339b8 76 #endif /* IMAGEBUTTON_H */