summaryrefslogtreecommitdiff
path: root/components/rtgui/include
diff options
context:
space:
mode:
authorbernard.xiong <[email protected]>2010-05-05 14:26:53 +0000
committerbernard.xiong <[email protected]>2010-05-05 14:26:53 +0000
commit13c797f616b8547dbc3567264b9ed61eb83a6a81 (patch)
tree0dbd21c3bb6f642c515a01da64956eaf87fd9303 /components/rtgui/include
parent157bc5f26325603008c30f8d37c29558cb9389b7 (diff)
add listbox widget.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@694 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/rtgui/include')
-rw-r--r--components/rtgui/include/rtgui/widgets/listbox.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/components/rtgui/include/rtgui/widgets/listbox.h b/components/rtgui/include/rtgui/widgets/listbox.h
new file mode 100644
index 0000000000..3d05e70e28
--- /dev/null
+++ b/components/rtgui/include/rtgui/widgets/listbox.h
@@ -0,0 +1,66 @@
+/*
+ * File : listbox.h
+ * This file is part of RTGUI in RT-Thread RTOS
+ * COPYRIGHT (C) 2010, RT-Thread Development Team
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rt-thread.org/license/LICENSE
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2010-01-06 Bernard first version
+ */
+
+#ifndef __RTGUI_LISTBOX_H__
+#define __RTGUI_LISTBOX_H__
+
+#include <rtgui/rtgui.h>
+#include <rtgui/image.h>
+#include <rtgui/rtgui_system.h>
+#include <rtgui/widgets/widget.h>
+
+struct rtgui_listbox_item
+{
+ char* name;
+ rtgui_image_t *image;
+};
+
+/** Gets the type of a list box */
+#define RTGUI_LISTBOX_TYPE (rtgui_listbox_type_get())
+/** Casts the object to a filelist */
+#define RTGUI_LISTBOX(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_LISTBOX_TYPE, rtgui_listbox_t))
+/** Checks if the object is a filelist box */
+#define RTGUI_IS_LISTBOX(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_LISTBOX_TYPE))
+
+struct rtgui_listbox
+{
+ struct rtgui_widget parent;
+
+ /* widget private data */
+ /* listbox item */
+ const struct rtgui_listbox_item* items;
+
+ /* item event handler */
+ void (*on_item)(rtgui_widget_t *widgets, struct rtgui_event* event);
+
+ /* total number of items */
+ rt_uint16_t items_count;
+ /* the number of item in a page */
+ rt_uint16_t page_items;
+ /* current item */
+ rt_uint16_t current_item;
+};
+typedef struct rtgui_listbox rtgui_listbox_t;
+typedef void (*rtgui_onitem_func_t)(struct rtgui_widget* widget, rtgui_event_t *event);
+
+rtgui_type_t *rtgui_listbox_type_get(void);
+
+rtgui_listbox_t* rtgui_listbox_create(const struct rtgui_listbox_item* items, rt_uint16_t count,
+ rtgui_rect_t *rect);
+void rtgui_listbox_destroy(rtgui_listbox_t* box);
+
+rt_bool_t rtgui_listbox_event_handler(struct rtgui_widget* widget, struct rtgui_event* event);
+
+#endif
+