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

Application/ImageButton.h

Committer:
embeddedartists
Date:
2014-12-19
Revision:
3:3fabfe3339b8
Parent:
2:efae611de184
Child:
4:a73760d09423

File content as of revision 3:3fabfe3339b8:

/*
 *  Copyright 2014 Embedded Artists AB
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
 
#ifndef IMAGEBUTTON_H
#define IMAGEBUTTON_H

#include "Clickable.h"
#include "Image.h"

/**
 * The ImageButton is used in the same way as the Button so see it for an example
 */
class ImageButton : public Clickable {
public:

    /** Creates a new button
     *
     *  This button will use a SWIM window to draw on. That window will use
     *  part of the full size frame buffer to draw on.
     *
     *  @param fb      the frame buffer
     *  @param x       the upper left corner of the button
     *  @param y       the upper left corner of the button
     *  @param width   the width of the button
     *  @param height  the height of the button
     */
  ImageButton(COLOR_T* fb, uint16_t x, uint16_t y, uint16_t width, uint16_t height);
  ~ImageButton();

    /** Loads the mandatory "normal" state image and the optional "pressed" state image
     *
     *  @param imgUp   the image for the normal state
     *  @param imgDown the image for the pressed state (or NULL to use the same)
     *
     *  @returns
     *       true on success
     *       false on failure
     */
  bool loadImages(const char* imgUp, const char* imgDown = 0);

    /** Draws the button
     */
  virtual void draw();

private:
  Image::ImageData_t _imgUp;
  Image::ImageData_t _imgDown;
};

#endif /* IMAGEBUTTON_H */