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
Diff: Application/Button.h
- Revision:
- 2:efae611de184
- Parent:
- 1:46c8df4608c8
- Child:
- 3:3fabfe3339b8
--- a/Application/Button.h Thu Dec 11 18:15:52 2014 +0000 +++ b/Application/Button.h Fri Dec 19 07:37:24 2014 +0000 @@ -17,7 +17,7 @@ #ifndef BUTTON_H #define BUTTON_H -#include "lpc_swim.h" +#include "Clickable.h" /** * Button example @@ -62,7 +62,7 @@ * } * @endcode */ -class Button { +class Button : public Clickable { public: /** Creates a new button @@ -79,16 +79,6 @@ */ Button(const char* caption, COLOR_T* fb, uint16_t x, uint16_t y, uint16_t width, uint16_t height); - /** Set the function to call when the button is clicked - * - * Note that this function can be called with NULL as func to unregister the - * callback function. - * - * @param func the function to call - * @param arc the argument to pass to the function when calling - */ - void setAction(void (*func)(uint32_t arg), uint32_t arg) { _func = func; _funcArg = arg; } - /** Changes the caption * * @param caption the new text on the button @@ -104,37 +94,14 @@ */ void setColors(COLOR_T bg, COLOR_T fg, COLOR_T bgPressed, COLOR_T fgPressed); - /** Process the touch event - * - * This function will detect if and how the touch event affects it. - * If the event causes the button to be clicked then the registered - * callback function is called before handle() returns. - * - * The return value is to let the caller now if the button should be - * redrawn or not. - * - * @param x the touched x coordinate - * @param y the touched y coordinate - * @param pressed true if the user pressed the display - * - * @returns - * true if the button should be redrawn - * false if the event did not affect the button - */ - bool handle(uint16_t x, uint16_t y, bool pressed); - /** Draws the button */ - void draw(); + virtual void draw(); private: const char* _caption; int _capx, _capy; COLOR_T _bgCol, _fgCol, _bgColPressed, _fgColPressed; - bool _enabled, _pressed; - void (*_func)(uint32_t arg); - uint32_t _funcArg; - SWIM_WINDOW_T _win; }; #endif /* BUTTON_H */