rtgui_mv_model.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * File : rtgui_mv_model.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-15 Grissiom first version
  13. */
  14. #ifndef __RTGUI_MV_MODEL_H__
  15. #define __RTGUI_MV_MODEL_H__
  16. #include <rtgui/rtgui.h>
  17. #include <rtgui/widgets/mv_view.h>
  18. DECLARE_CLASS_TYPE(mv_model);
  19. /** Gets the type of a mv_model */
  20. #define RTGUI_MV_MODEL_TYPE (RTGUI_TYPE(mv_model))
  21. /** Casts the object to an mv_model */
  22. #define RTGUI_MV_MODEL(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_MV_MODEL_TYPE, struct rtgui_mv_model))
  23. /** Checks if the object is an mv_model */
  24. #define RTGUI_IS_MV_MODEL(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_MV_MODEL_TYPE))
  25. struct rtgui_mv_model
  26. {
  27. struct rtgui_object parent;
  28. rt_uint16_t dimension;
  29. rt_uint16_t view_number;
  30. /* the length of data */
  31. rt_uint16_t length;
  32. /* if the dimension is 1, the data is the pointer to the data. If the
  33. * dimension is more than 1, data is a pointer to a array of pointers to
  34. * data. */
  35. void *data;
  36. /* the content of view is like the content of data. If a model has more
  37. * then one view, view is pointed to an array of pointers to views. */
  38. void *view;
  39. };
  40. struct rtgui_mv_model *rtgui_mv_model_create(rt_uint16_t dimension);
  41. void rtgui_mv_model_destroy(struct rtgui_mv_model *model);
  42. rt_err_t rtgui_mv_model_set_dimension(struct rtgui_mv_model *model, rt_uint16_t dimension);
  43. rt_err_t rtgui_mv_model_add_view(struct rtgui_mv_model *, struct rtgui_mv_view *);
  44. void rtgui_mv_model_remove_view(struct rtgui_mv_model *, struct rtgui_mv_view *);
  45. rt_bool_t rtgui_mv_model_has_view(struct rtgui_mv_model *model, struct rtgui_mv_view *view);
  46. void rtgui_mv_model_set_data(struct rtgui_mv_model *model, rt_uint16_t dim, void *p);
  47. void *rtgui_mv_model_get_data(struct rtgui_mv_model *model, rt_uint16_t dim);
  48. void rtgui_mv_model_notify(struct rtgui_mv_model *model, struct rtgui_event_mv_model *em);
  49. #endif /* end of include guard: __RTGUI_MV_MODEL_H__ */