plot.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * File : plot.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2012, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2012-09-03 Grissiom first version
  13. */
  14. #ifndef __RTGUI_PLOT_H__
  15. #define __RTGUI_PLOT_H__
  16. #include <rtgui/rtgui.h>
  17. #include <rtgui/widgets/widget.h>
  18. #include <rtgui/widgets/mv_view.h>
  19. #include <rtgui/widgets/plot_curve.h>
  20. DECLARE_CLASS_TYPE(plot);
  21. /** Gets the type of a plot */
  22. #define RTGUI_PLOT_TYPE (RTGUI_TYPE(plot))
  23. /** Casts the object to an rtgui_plot */
  24. #define RTGUI_PLOT(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_PLOT_TYPE, struct rtgui_plot))
  25. /** Checks if the object is an rtgui_plot */
  26. #define RTGUI_IS_PLOT(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_PLOT_TYPE))
  27. enum rtgui_plot_type
  28. {
  29. RTGUI_PLOT_TYPE_SCAN,
  30. RTGUI_PLOT_TYPE_INCREMENTAL,
  31. };
  32. /*
  33. * the plot widget
  34. */
  35. struct rtgui_plot
  36. {
  37. struct rtgui_mv_view parent;
  38. enum rtgui_plot_type ptype;
  39. rt_uint16_t scale_x;
  40. rt_uint16_t scale_y;
  41. rtgui_plot_curve_dtype base_x;
  42. rtgui_plot_curve_dtype base_y;
  43. };
  44. struct rtgui_plot *rtgui_plot_create(void);
  45. void rtgui_plot_destroy(struct rtgui_plot *plot);
  46. void rtgui_plot_set_base(struct rtgui_plot *plot,
  47. rtgui_plot_curve_dtype x, rtgui_plot_curve_dtype y);
  48. rt_bool_t rtgui_plot_event_handler(struct rtgui_object *object, struct rtgui_event *event);
  49. #endif