From 297405c3c662c8b8f09c1abb9579f151c7128dfe Mon Sep 17 00:00:00 2001 From: "bernard.xiong@gmail.com" Date: Tue, 21 Dec 2010 23:50:25 +0000 Subject: update menu control and add notebook control. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1220 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- components/rtgui/widgets/notebook.c | 76 +++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 components/rtgui/widgets/notebook.c (limited to 'components/rtgui/widgets/notebook.c') diff --git a/components/rtgui/widgets/notebook.c b/components/rtgui/widgets/notebook.c new file mode 100644 index 0000000000..eed59c99d4 --- /dev/null +++ b/components/rtgui/widgets/notebook.c @@ -0,0 +1,76 @@ +#include +#include + +rtgui_type_t *rtgui_notebook_type_get(void) +{ +} + +rtgui_notebook_t* rtgui_notebook_create(const rtgui_rect_t* rect) +{ +} + +void rtgui_notebook_destroy(rtgui_notebook_t* notebook) +{ +} + +void rtgui_notebook_add(rtgui_notebook_t* notebook, const char* label, rtgui_widget_t* child) +{ +} + +int rtgui_notebook_get_count(rtgui_notebootk_t* notebook) +{ + return notebook->count; +} + +rtgui_widget_t* rtgui_notebook_get_current(rtgui_notebook_t* notebook) +{ + RT_ASSERT(notebook != RT_NULL); + if (notebook->current != RTGUI_NOT_FOUND) + return ¬ebook->childs[notebook->current]; + + return RT_NULL; +} +void rtgui_notebook_set_current(rtgui_notebook_t* notebook, rtgui_widget_t* widget) +{ + rt_int16_t index; + + RT_ASSERT(notebook != RT_NULL); + + for (index = 0; index < notebook->count; index ++) + { + if (widget == ¬ebook->childs[index]) + { + rtgui_notebook_set_current_by_index(notebook, index); + return; + } + } +} + +void rtgui_notebook_set_current_by_index(rtgui_notebook_t* notebook, rt_uint16_t index) +{ + RT_ASSERT(notebook != RT_NULL); + + if ((index < notebook->count) && (notebook->current != index)) + { + if (notebook->current != RTGUI_NOT_FOUND) + rtgui_widget_hide(¬ebook->childs[notebook->current]); + + notebook->current = index; + rtgui_widget_show(¬ebook->childs[notebook->current]); + rtgui_widget_update(¬ebook->childs[notebook->current]); + } +} + +rtgui_widget_t* rtgui_notebook_get_index(rtgui_notebook_t* notebook, rt_uint16_t index) +{ + RT_ASSERT(notebook != RT_NULL); + if (index < notebook->count) + return ¬ebook->childs[index]; + + return RT_NULL; +} + +rt_bool_t rtgui_notebook_event_handler(struct rtgui_widget* widget, struct rtgui_event* event) +{ + return RT_FALSE; +} -- cgit v1.3.1