add example: RTTAB

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1398 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
iamyhw@gmail.com 2011-05-07 10:17:01 +00:00
parent c98fd0226f
commit 8e5f428777
4 changed files with 130 additions and 1 deletions

View File

@ -4,8 +4,10 @@ Import('projects')
src = Split("""
gui_init.c
demo_gui_main.c
demo_gui_benchmark.c
demo_gui_button.c
demo_gui_dc_buffer.c
demo_gui_buffer_animation.c
demo_gui_label.c
demo_gui_radiobox.c
demo_gui_window.c
@ -15,6 +17,12 @@ demo_gui_scrollbar.c
demo_gui_textbox.c
demo_gui_listbox.c
demo_gui_combobox.c
demo_gui_menu.c
demo_gui_listctrl.c
demo_gui_slider.c
demo_gui_image.c
demo_gui_fnview.c
demo_gui_rttab.c
""")
group = {}

View File

@ -144,7 +144,7 @@ static void rtgui_panel_entry(void* parameter)
#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
demo_gui_fnview(view);
#endif
demo_gui_rttab(view);
rtgui_view_show(demo_list[demo_current]);
//}}} END ADD CODE.

View File

@ -0,0 +1,120 @@
/*
* rttab控件演示
*
* view上显示一个rttab控件
*/
#include "demo_view.h"
#include <rtgui/widgets/label.h>
#include <rtgui/widgets/button.h>
#include <rtgui/widgets/rttab.h>
#include <rtgui/widgets/propel.h>
const unsigned char image_tool[] = {
'H', 'D', 'C', 0x00,
0x10, 0x00, 0x10, 0x00,
0x10, 0x00, 0x10, 0x00,
0x00, 0x00, 0x10, 0x00,
0x00, 0x00, 0x10, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 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 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x04,
0x18, 0xC6, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x04,
0x00, 0x04, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
};
/* 创建用于演示rttab控件的视图 */
rtgui_view_t* demo_gui_rttab(rtgui_view_t* parent_view)
{
rtgui_view_t* view;
rtgui_image_t* image;
rtgui_rttab_t* tab;
rtgui_container_t* box;
/* 先创建一个演示用的视图 */
view = demo_view_create(parent_view, "RTTAB View");
image = rtgui_image_create_from_mem("hdc",image_tool,sizeof(image_tool),RT_TRUE);
/* 创建一个rttab控件 */
tab = rtgui_rttab_create(view, "TAB", 10, 40, 210, 160);
/* 添加标签页 */
rtgui_rttab_add_tag(tab, "Editor", image);
box = rtgui_rttab_get_container_by_index(tab, 0);
rtgui_label_create(box, "label1",5,5,100,20);
rtgui_rttab_add_tag(tab, "Other", RT_NULL);
box = rtgui_rttab_get_container_by_title(tab, "Other");
rtgui_label_create(box, "label3",5,5,100,20);
rtgui_rttab_add_tag(tab, "TAG1", image);
box = rtgui_rttab_get_container_by_title(tab, "TAG1");
rtgui_button_create(box, "button",5,5,80,25);
rtgui_rttab_add_tag(tab, "TAG2", RT_NULL);
rtgui_rttab_add_tag(tab, "TAG3", RT_NULL);
rtgui_rttab_add_tag(tab, "TAG4", RT_NULL);
rtgui_rttab_add_tag(tab, "TAG5", RT_NULL);
rtgui_rttab_add_tag(tab, "TAG6", RT_NULL);
rtgui_rttab_add_tag(tab, "TAG7", RT_NULL);
rtgui_rttab_add_tag(tab, "TAG8", RT_NULL);
return view;
}

View File

@ -25,6 +25,7 @@ rtgui_view_t* demo_gui_combobox(rtgui_view_t* parent_view);
rtgui_view_t* demo_gui_slider(rtgui_view_t* parent_view);
rtgui_view_t* demo_gui_image(rtgui_view_t* parent_view);
rtgui_view_t* demo_gui_fnview(rtgui_view_t* parent_view);
rtgui_view_t* demo_gui_rttab(rtgui_view_t* parent_view);
#endif