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/include/rtgui/widgets/listctrl.h | 1 + components/rtgui/include/rtgui/widgets/menu.h | 1 + components/rtgui/include/rtgui/widgets/notebook.h | 39 +++++++++++++++++++++++ components/rtgui/include/rtgui/widgets/widget.h | 1 + 4 files changed, 42 insertions(+) create mode 100644 components/rtgui/include/rtgui/widgets/notebook.h (limited to 'components/rtgui/include') diff --git a/components/rtgui/include/rtgui/widgets/listctrl.h b/components/rtgui/include/rtgui/widgets/listctrl.h index 9ce3263d54..bd42dd12e7 100644 --- a/components/rtgui/include/rtgui/widgets/listctrl.h +++ b/components/rtgui/include/rtgui/widgets/listctrl.h @@ -60,5 +60,6 @@ void rtgui_listctrl_destroy(rtgui_listctrl_t* ctrl); rt_bool_t rtgui_listctrl_event_handler(struct rtgui_widget* widget, struct rtgui_event* event); void rtgui_listctrl_set_onitem(rtgui_listctrl_t* ctrl, rtgui_onitem_func_t func); void rtgui_listctrl_set_items(rtgui_listctrl_t* ctrl, rt_uint32_t items, rt_uint16_t count); +rt_bool_t rtgui_listctrl_get_item_rect(rtgui_listctrl_t* ctrl, rt_uint16_t item, rtgui_rect_t* item_rect); #endif diff --git a/components/rtgui/include/rtgui/widgets/menu.h b/components/rtgui/include/rtgui/widgets/menu.h index e573ad6a1e..f6c422bb19 100644 --- a/components/rtgui/include/rtgui/widgets/menu.h +++ b/components/rtgui/include/rtgui/widgets/menu.h @@ -73,6 +73,7 @@ void rtgui_menu_set_onmenupop(struct rtgui_menu* menu, rtgui_event_handler_ptr h void rtgui_menu_set_onmenuhide(struct rtgui_menu* menu, rtgui_event_handler_ptr handler); void rtgui_menu_pop(struct rtgui_menu* menu, int x, int y); +void rtgui_menu_hiden(struct rtgui_menu* menu); #endif diff --git a/components/rtgui/include/rtgui/widgets/notebook.h b/components/rtgui/include/rtgui/widgets/notebook.h new file mode 100644 index 0000000000..76e4298ec2 --- /dev/null +++ b/components/rtgui/include/rtgui/widgets/notebook.h @@ -0,0 +1,39 @@ +#ifndef __RTGUI_NOTEBOOK_H__ +#define __RTGUI_NOTEBOOK_H__ + +#include +#include + +/** Gets the type of a notebook */ +#define RTGUI_NOTEBOOK_TYPE (rtgui_notebook_type_get()) +/** Casts the object to a notebook control */ +#define RTGUI_NOTEBOOK(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_NOTEBOOK_TYPE, rtgui_notebook_t)) +/** Checks if the object is a notebook control */ +#define RTGUI_IS_NOTEBOOK(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_NOTEBOOK_TYPE)) + +struct rtgui_notebook +{ + struct rtgui_container parent; + + /* widget private data */ + struct rtgui_widget* childs; + rt_uint16_t count; + rt_int16_t current; +}; +typedef struct rtgui_notebook rtgui_notebook_t; + +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); +rtgui_widget_t* rtgui_notebook_get_current(rtgui_notebook_t* notebook); +void rtgui_notebook_set_current(rtgui_notebook_t* notebook, rtgui_widget_t* widget); +void rtgui_notebook_set_current_by_index(rtgui_notebook_t* notebook, rt_uint16_t index); +rtgui_widget_t* rtgui_notebook_get_index(rtgui_notebook_t* notebook, rt_uint16_t index); + +rt_bool_t rtgui_notebook_event_handler(struct rtgui_widget* widget, struct rtgui_event* event); + +#endif diff --git a/components/rtgui/include/rtgui/widgets/widget.h b/components/rtgui/include/rtgui/widgets/widget.h index 719272f272..1a58d6bead 100644 --- a/components/rtgui/include/rtgui/widgets/widget.h +++ b/components/rtgui/include/rtgui/widgets/widget.h @@ -150,6 +150,7 @@ void rtgui_widget_set_oncommand(rtgui_widget_t* widget, rtgui_event_handler_ptr /* get and set rect of widget */ void rtgui_widget_get_rect(rtgui_widget_t* widget, rtgui_rect_t *rect); void rtgui_widget_set_rect(rtgui_widget_t* widget, rtgui_rect_t* rect); +void rtgui_widget_get_extent(rtgui_widget_t* widget, rtgui_rect_t *rect); #ifndef RTGUI_USING_SMALL_SIZE void rtgui_widget_set_miniwidth(rtgui_widget_t* widget, int width); -- cgit v1.3.1