test export

Dependencies:   DmTftLibrary mbed

Fork of dm_calc by Display Module

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Button.h Source File

Button.h

00001 #ifndef BUTTON_h
00002 #define BUTTON_h
00003 
00004 #include "DmTftBase.h"
00005 
00006 typedef void (*cbFunc)(uint32_t);
00007 
00008 class Button {
00009 public:
00010   Button(const char* caption, uint16_t x, uint16_t y, uint16_t width, uint16_t height);
00011   void setAction(cbFunc func, uint32_t arg) { _func = func; _funcArg = arg; }
00012   void setCaption(const char* caption) { _caption = caption; }
00013   void setColors(uint16_t bg, uint16_t fg, uint16_t bgPressed, uint16_t fgPressed);
00014   bool handle(uint16_t x, uint16_t y, bool pressed);
00015   void draw(DmTftBase* tft);
00016 
00017 private:
00018   const char* _caption;
00019   uint16_t _x0, _y0, _x1, _y1;
00020   uint16_t _bgCol, _fgCol, _bgColPressed, _fgColPressed;
00021   bool _enabled, _pressed;
00022   cbFunc _func;
00023   uint32_t _funcArg;
00024 };
00025 
00026 #endif /* BUTTON_h */
00027