121 lines
4.8 KiB
C
121 lines
4.8 KiB
C
/*
|
||
* 程序清单: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, 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, 0x00, 0x04,
|
||
0x00, 0x04, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x18, 0xC6,
|
||
0x00, 0x04, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x04,
|
||
0x00, 0x04, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x04,
|
||
0x18, 0xC6, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x04,
|
||
0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04,
|
||
0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04,
|
||
0x00, 0x04, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||
0x00, 0x04, 0x00, 0x04, 0x10, 0x04, 0x10, 0x04,
|
||
0x10, 0x04, 0x10, 0x04, 0x00, 0x04, 0x00, 0x04,
|
||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||
0x00, 0x04, 0x10, 0x04, 0xF3, 0x4C, 0xFF, 0x07,
|
||
0xFF, 0x07, 0xF3, 0x4C, 0x10, 0x04, 0x00, 0x04,
|
||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x04, 0x00, 0x04,
|
||
0x00, 0x04, 0x10, 0x04, 0xFF, 0x07, 0xFF, 0x07,
|
||
0xFF, 0x07, 0xFF, 0x07, 0x10, 0x04, 0x00, 0x04,
|
||
0x00, 0x04, 0x00, 0x04, 0xFF, 0xFF, 0xFF, 0xFF,
|
||
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x04, 0x00, 0x04,
|
||
0x00, 0x04, 0x10, 0x04, 0xFF, 0x07, 0xFF, 0x07,
|
||
0xFF, 0x07, 0xFF, 0x07, 0x10, 0x04,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F, 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;
|
||
}
|
||
|