pm_button.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * File : pm_button.h
  3. * COPYRIGHT (C) 2012-2017, Shanghai Real-Thread Technology Co., Ltd
  4. *
  5. * Change Logs:
  6. * Date Author Notes
  7. * 2017-11-05 realthread the first version
  8. */
  9. #pragma once
  10. #include <pm_image.h>
  11. #include <pm_widget.h>
  12. #include <sigslot.h>
  13. namespace Persimmon
  14. {
  15. class Button : public Widget
  16. {
  17. public:
  18. Button(const char *text, Image *imgNor, Image *imgDown);
  19. Button(Image *imgNor, Image *imgDown);
  20. virtual ~Button();
  21. void setId(int id);
  22. int getId(void);
  23. void setText(const char *text);
  24. const char* getText(void);
  25. void setNorImage(Image *imgNor);
  26. Image* getNorImage(void);
  27. void setDownImage(Image *imgDown);
  28. Image* getDownImage(void);
  29. void setShadowImage(Image *imgShadow);
  30. Image* getShadowImage(void);
  31. Signal<int> clicked;
  32. virtual bool handleGestureEvent(struct rtgui_event_gesture *, const struct rtgui_gesture *);
  33. virtual void render(struct rtgui_dc* dc, const Point &dcPoint = Point(),
  34. const Rect &srcRect = Rect(),
  35. RenderFlag flags = DrawNormal);
  36. private:
  37. int id;
  38. char *text;
  39. Image *imageNor, *imageDown, *imageShadow;
  40. bool down;
  41. };
  42. }