rtgui_system.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * File : rtgui_system.h
  3. * This file is part of RTGUI in RT-Thread RTOS
  4. * COPYRIGHT (C) 2006 - 2009, 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. * 2009-10-04 Bernard first version
  13. */
  14. #ifndef __RTGUI_SYSTEM_H__
  15. #define __RTGUI_SYSTEM_H__
  16. #include <rtthread.h>
  17. #include <rtgui/rtgui.h>
  18. struct rtgui_dc;
  19. struct rtgui_event;
  20. struct rtgui_widget;
  21. struct rtgui_thread
  22. {
  23. /* the thread id */
  24. rt_thread_t tid;
  25. /* the message queue of thread */
  26. rt_mq_t mq;
  27. /* the owner of thread */
  28. struct rtgui_widget* widget;
  29. };
  30. typedef struct rtgui_thread rtgui_thread_t;
  31. struct rtgui_timer;
  32. typedef void (*rtgui_timeout_func)(struct rtgui_timer* timer, void* parameter);
  33. struct rtgui_timer
  34. {
  35. /* context thread id */
  36. rt_thread_t tid;
  37. /* rt timer */
  38. struct rt_timer timer;
  39. /* timeout function and user data */
  40. rtgui_timeout_func timeout;
  41. void* user_data;
  42. };
  43. typedef struct rtgui_timer rtgui_timer_t;
  44. rtgui_timer_t* rtgui_timer_create(rt_int32_t time, rt_base_t flag, rtgui_timeout_func timeout, void* parameter);
  45. void rtgui_timer_destory(rtgui_timer_t* timer);
  46. void rtgui_timer_start(rtgui_timer_t* timer);
  47. void rtgui_timer_stop (rtgui_timer_t* timer);
  48. void rtgui_thread_system_init(void);
  49. rtgui_thread_t* rtgui_thread_register(rt_thread_t tid, rt_mq_t mq);
  50. void rtgui_thread_deregister(rt_thread_t tid);
  51. rt_thread_t rtgui_thread_get_server(void);
  52. void rtgui_thread_set_widget(struct rtgui_widget* widget);
  53. struct rtgui_widget* rtgui_thread_get_widget(void);
  54. rt_err_t rtgui_thread_send(rt_thread_t tid, struct rtgui_event* event, rt_size_t event_size);
  55. rt_err_t rtgui_thread_send_urgent(rt_thread_t tid, struct rtgui_event* event, rt_size_t event_size);
  56. rt_err_t rtgui_thread_send_sync(rt_thread_t tid, struct rtgui_event* event, rt_size_t event_size);
  57. rt_err_t rtgui_thread_recv(struct rtgui_event* event, rt_size_t event_size);
  58. rt_err_t rtgui_thread_recv_filter(rt_uint32_t type, struct rtgui_event* event, rt_size_t event_size);
  59. rt_err_t rtgui_thread_ack(struct rtgui_event* event, rt_int32_t status);
  60. /* rtgui system initialization function */
  61. void rtgui_system_server_init(void);
  62. void* rtgui_malloc(rt_size_t size);
  63. void rtgui_free(void* ptr);
  64. #endif