rtgui_system.h 3.4 KB

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