rtgui_system.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. struct rtgui_dc;
  22. struct rtgui_event;
  23. struct rtgui_widget;
  24. struct rtgui_timer;
  25. typedef void (*rtgui_timeout_func)(struct rtgui_timer *timer, void *parameter);
  26. enum rtgui_timer_state
  27. {
  28. RTGUI_TIMER_ST_INIT,
  29. RTGUI_TIMER_ST_RUNNING,
  30. RTGUI_TIMER_ST_DESTROY_PENDING,
  31. };
  32. struct rtgui_timer
  33. {
  34. /* the rtgui application it runs on */
  35. struct rtgui_app* app;
  36. /* rt timer */
  37. struct rt_timer timer;
  38. /* How many events are pending on the queue. */
  39. int pending_cnt;
  40. enum rtgui_timer_state state;
  41. /* timeout function and user data */
  42. rtgui_timeout_func timeout;
  43. void *user_data;
  44. };
  45. typedef struct rtgui_timer rtgui_timer_t;
  46. rtgui_timer_t *rtgui_timer_create(rt_int32_t time, rt_base_t flag, rtgui_timeout_func timeout, void *parameter);
  47. void rtgui_timer_destory(rtgui_timer_t *timer);
  48. void rtgui_timer_set_timeout(rtgui_timer_t *timer, rt_int32_t time);
  49. void rtgui_timer_start(rtgui_timer_t *timer);
  50. void rtgui_timer_stop(rtgui_timer_t *timer);
  51. /* rtgui system initialization function */
  52. int rtgui_system_server_init(void);
  53. void *rtgui_malloc(rt_size_t size);
  54. void rtgui_free(void *ptr);
  55. void *rtgui_realloc(void *ptr, rt_size_t size);
  56. #ifdef _WIN32_NATIVE
  57. #define rtgui_enter_critical()
  58. #define rtgui_exit_critical()
  59. #else
  60. #define rtgui_enter_critical rt_enter_critical
  61. #define rtgui_exit_critical rt_exit_critical
  62. #endif
  63. struct rtgui_app* rtgui_get_server(void);
  64. void rtgui_set_mainwin_rect(struct rtgui_rect *rect);
  65. void rtgui_get_mainwin_rect(struct rtgui_rect *rect);
  66. void rtgui_get_screen_rect(struct rtgui_rect *rect);
  67. void rtgui_screen_lock(rt_int32_t timeout);
  68. void rtgui_screen_unlock(void);
  69. int rtgui_screen_lock_freeze(void);
  70. void rtgui_screen_lock_thaw(int value);
  71. struct rtgui_event;
  72. rt_err_t rtgui_send(struct rtgui_app* app, struct rtgui_event *event, rt_size_t event_size);
  73. rt_err_t rtgui_send_urgent(struct rtgui_app* app, struct rtgui_event *event, rt_size_t event_size);
  74. rt_err_t rtgui_send_sync(struct rtgui_app* app, struct rtgui_event *event, rt_size_t event_size);
  75. rt_err_t rtgui_ack(struct rtgui_event *event, rt_int32_t status);
  76. rt_err_t rtgui_recv(struct rtgui_event *event, rt_size_t event_size, rt_int32_t timeout);
  77. rt_err_t rtgui_recv_filter(rt_uint32_t type, struct rtgui_event *event, rt_size_t event_size);
  78. #ifdef __cplusplus
  79. }
  80. #endif
  81. #endif