pm_meterbox.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * File : pm_meterbox.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_timer.h>
  12. #include <sigslot.h>
  13. namespace Persimmon
  14. {
  15. class MeterBox : public Widget
  16. {
  17. public:
  18. MeterBox(Image* img, int length);
  19. virtual ~MeterBox();
  20. Signal<void> finished;
  21. void setCenter(int x, int y);
  22. void setDegreeRange(double min, double max);
  23. void setValueRange(double min, double max);
  24. void setTimes(int times);
  25. void setValue(double value);
  26. virtual void render(struct rtgui_dc* dc, const Point &dcPoint = Point(),
  27. const Rect &srcRect = Rect(),
  28. RenderFlag flags = DrawNormal);
  29. private:
  30. void timeout(void);
  31. protected:
  32. struct rtgui_dc *pointer_dc;
  33. struct rtgui_point p_center, b_center;
  34. Timer *timer;
  35. int times;
  36. double min_degree, max_degree, min_value, max_value, pointer_degree, rota_degree, once_degree;
  37. };
  38. }