From e7fb7e6c1480c8e38f8fa0affbd874edc307527c Mon Sep 17 00:00:00 2001 From: "bernard.xiong" Date: Sat, 8 May 2010 15:50:45 +0000 Subject: update according 0.3.1 series and add XML parser. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@699 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- components/rtgui/include/rtgui/rtgui_xml.h | 34 +++++++++++++++++++++++++ components/rtgui/include/rtgui/widgets/widget.h | 1 - components/rtgui/include/rtgui/widgets/window.h | 2 ++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 components/rtgui/include/rtgui/rtgui_xml.h (limited to 'components/rtgui/include') diff --git a/components/rtgui/include/rtgui/rtgui_xml.h b/components/rtgui/include/rtgui/rtgui_xml.h new file mode 100644 index 0000000000..18bd1177ac --- /dev/null +++ b/components/rtgui/include/rtgui/rtgui_xml.h @@ -0,0 +1,34 @@ +#ifndef __RTGUI_XML_H__ +#define __RTGUI_XML_H__ + +#include + +/* Types of events: start element, end element, text, attr name, attr + val and start/end document. Other events can be ignored! */ +enum { + EVENT_START = 0, /* Start tag */ + EVENT_END, /* End tag */ + EVENT_TEXT, /* Text */ + EVENT_NAME, /* Attribute name */ + EVENT_VAL, /* Attribute value */ + EVENT_END_DOC, /* End of document */ + EVENT_COPY, /* Internal only; copies to internal buffer */ + EVENT_NONE /* Internal only; should never see this event */ +}; + +/* xml structure typedef */ +typedef struct rtgui_xml rtgui_xml_t; +typedef int (*rtgui_xml_event_handler_t)(rt_uint8_t event, const char* text, rt_size_t len, void* user); + +/* create a xml parser context */ +rtgui_xml_t* rtgui_xml_create(rt_size_t buffer_size, rtgui_xml_event_handler_t handler, void* user); +/* destroy a xml parser context */ +void rtgui_xml_destroy(rtgui_xml_t* rtgui_xml); + +/* parse xml buffer */ +int rtgui_xml_parse(rtgui_xml_t* rtgui_xml, const char* buf, rt_size_t len); + +/* event string */ +const char* rtgui_xml_event_str(rt_uint8_t event); + +#endif diff --git a/components/rtgui/include/rtgui/widgets/widget.h b/components/rtgui/include/rtgui/widgets/widget.h index 6c561a0051..5601c79a48 100644 --- a/components/rtgui/include/rtgui/widgets/widget.h +++ b/components/rtgui/include/rtgui/widgets/widget.h @@ -90,7 +90,6 @@ struct rtgui_widget /* the rect clip */ rtgui_region_t clip; - rt_uint16_t clip_sync; /* the event handler */ rt_bool_t (*event_handler) (struct rtgui_widget* widget, struct rtgui_event* event); diff --git a/components/rtgui/include/rtgui/widgets/window.h b/components/rtgui/include/rtgui/widgets/window.h index 1f63a666b6..43993dae67 100644 --- a/components/rtgui/include/rtgui/widgets/window.h +++ b/components/rtgui/include/rtgui/widgets/window.h @@ -10,6 +10,7 @@ * Change Logs: * Date Author Notes * 2009-10-04 Bernard first version + * 2010-05-03 Bernard add win close function */ #ifndef __RTGUI_WINDOW_H__ #define __RTGUI_WINDOW_H__ @@ -74,6 +75,7 @@ rtgui_type_t *rtgui_win_type_get(void); rtgui_win_t* rtgui_win_create(rtgui_toplevel_t* parent_toplevel, const char* title, rtgui_rect_t *rect, rt_uint8_t flag); void rtgui_win_destroy(rtgui_win_t* win); +void rtgui_win_close(struct rtgui_win* win); rtgui_modal_code_t rtgui_win_show(rtgui_win_t* win, rt_bool_t is_modal); void rtgui_win_hiden(rtgui_win_t* win); -- cgit v1.3.1