pm_dotIndicator.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * File : pm_dotIndicator.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_widget.h>
  11. #include <pm_image.h>
  12. namespace Persimmon
  13. {
  14. class DotIndicator : public Widget
  15. {
  16. public:
  17. enum type
  18. {
  19. HORIZONTAL = 0,
  20. VERTICAL = 1,
  21. };
  22. DotIndicator(Image *norImg, Image *selImg, int num, int gap = 0);
  23. virtual ~DotIndicator();
  24. void setDirection(enum type t = HORIZONTAL)
  25. {
  26. direction = t;
  27. }
  28. void selectDotIndicator(int num)
  29. {
  30. if (num >= dotIndicatorNum || num < 0)
  31. return;
  32. dotIndicatorSelNum = num;
  33. }
  34. int getSelectNum(void)
  35. {
  36. return dotIndicatorSelNum;
  37. }
  38. void setDotIndicatorNum(int num)
  39. {
  40. dotIndicatorNum = num;
  41. }
  42. void setDotIndicatorGap(int gap)
  43. {
  44. dotIndicatorGap = gap;
  45. }
  46. virtual void render(struct rtgui_dc* dc, const Point &dcPoint = Point(),
  47. const Rect &srcRect = Rect(),
  48. RenderFlag flags = DrawNormal);
  49. private:
  50. enum type direction;
  51. Image *norImage, *selImage;
  52. int dotIndicatorNum, dotIndicatorSelNum, dotIndicatorGap;
  53. };
  54. }