mouse.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * File : mouse.h
  3. * This file is part of RT-Thread GUI Engine
  4. * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, write to the Free Software Foundation, Inc.,
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19. *
  20. * Change Logs:
  21. * Date Author Notes
  22. * 2009-10-16 Bernard first version
  23. */
  24. #ifndef __RTGUI_MOUSE_H__
  25. #define __RTGUI_MOUSE_H__
  26. #include <rtgui/rtgui.h>
  27. #include <rtgui/image.h>
  28. #include <rtgui/widgets/window.h>
  29. struct rtgui_mouse_monitor
  30. {
  31. /* event rect */
  32. rtgui_rect_t rect;
  33. /* node list */
  34. rtgui_list_t list;
  35. };
  36. typedef struct rtgui_mouse_monitor rtgui_mouse_monitor_t;
  37. void rtgui_mouse_init(void);
  38. void rtgui_mouse_fini(void);
  39. void rtgui_mouse_moveto(int x, int y);
  40. /* set cursor position */
  41. void rtgui_mouse_set_position(int x, int y);
  42. void rtgui_mouse_set_cursor_enable(rt_bool_t enable);
  43. void rtgui_mouse_set_cursor(rtgui_image_t *cursor);
  44. void rtgui_mouse_get_cursor_rect(rtgui_rect_t *rect);
  45. void rtgui_mouse_show_cursor(void);
  46. void rtgui_mouse_hide_cursor(void);
  47. rt_bool_t rtgui_mouse_is_intersect(rtgui_rect_t *r);
  48. #ifdef RTGUI_USING_WINMOVE
  49. rt_bool_t rtgui_winrect_is_moved(void);
  50. void rtgui_winrect_set(struct rtgui_win *win);
  51. rt_bool_t rtgui_winrect_moved_done(rtgui_rect_t *winrect, struct rtgui_win **win);
  52. #endif
  53. void rtgui_mouse_monitor_append(rtgui_list_t *head, rtgui_rect_t *rect);
  54. void rtgui_mouse_monitor_remove(rtgui_list_t *head, rtgui_rect_t *rect);
  55. rt_bool_t rtgui_mouse_monitor_contains_point(rtgui_list_t *head, int x, int y);
  56. #endif