update notebook example; fix listview_icon image size issue.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1227 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
97cc2b9e4c
commit
ae9cf0ea5c
|
@ -337,7 +337,7 @@ rtgui_view_t* demo_listview_icon_view(rtgui_workbench_t* workbench)
|
||||||
(const rt_uint8_t*)image_xpm, sizeof(image_xpm), RT_TRUE);
|
(const rt_uint8_t*)image_xpm, sizeof(image_xpm), RT_TRUE);
|
||||||
if (exit_icon == RT_NULL)
|
if (exit_icon == RT_NULL)
|
||||||
exit_icon = rtgui_image_create_from_mem("xpm",
|
exit_icon = rtgui_image_create_from_mem("xpm",
|
||||||
(const rt_uint8_t*)exit_xpm, sizeof(image_xpm), RT_TRUE);
|
(const rt_uint8_t*)exit_xpm, sizeof(exit_xpm), RT_TRUE);
|
||||||
|
|
||||||
/* 添加动作按钮 */
|
/* 添加动作按钮 */
|
||||||
demo_view_get_rect(view, &rect);
|
demo_view_get_rect(view, &rect);
|
||||||
|
|
|
@ -16,6 +16,15 @@ const static struct rtgui_listbox_item items[] =
|
||||||
{"list #3", RT_NULL},
|
{"list #3", RT_NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const static struct rtgui_listbox_item items2[] =
|
||||||
|
{
|
||||||
|
{"list #0", RT_NULL},
|
||||||
|
{"list #1", RT_NULL},
|
||||||
|
{"list #2", RT_NULL},
|
||||||
|
{"new list #1", RT_NULL},
|
||||||
|
{"new list #2", RT_NULL},
|
||||||
|
};
|
||||||
|
|
||||||
/* 创建用于演示notebook控件的视图 */
|
/* 创建用于演示notebook控件的视图 */
|
||||||
rtgui_view_t* demo_view_notebook(rtgui_workbench_t* workbench)
|
rtgui_view_t* demo_view_notebook(rtgui_workbench_t* workbench)
|
||||||
{
|
{
|
||||||
|
@ -30,12 +39,15 @@ rtgui_view_t* demo_view_notebook(rtgui_workbench_t* workbench)
|
||||||
/* 获得视图的位置信息 */
|
/* 获得视图的位置信息 */
|
||||||
demo_view_get_rect(view, &rect);
|
demo_view_get_rect(view, &rect);
|
||||||
|
|
||||||
notebook = rtgui_notebook_create(&rect);
|
notebook = rtgui_notebook_create(&rect, RTGUI_NOTEBOOK_BOTTOM);
|
||||||
/* view是一个container控件,调用add_child方法添加这个notebook控件 */
|
/* view是一个container控件,调用add_child方法添加这个notebook控件 */
|
||||||
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(notebook));
|
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(notebook));
|
||||||
|
|
||||||
box = rtgui_listbox_create(items, sizeof(items)/sizeof(struct rtgui_listbox_item), &rect);
|
box = rtgui_listbox_create(items, sizeof(items)/sizeof(struct rtgui_listbox_item), &rect);
|
||||||
rtgui_notebook_add(notebook, "Tab 1", RTGUI_WIDGET(box));
|
rtgui_notebook_add(notebook, "Tab 1", RTGUI_WIDGET(box));
|
||||||
|
|
||||||
|
box = rtgui_listbox_create(items2, sizeof(items2)/sizeof(struct rtgui_listbox_item), &rect);
|
||||||
|
rtgui_notebook_add(notebook, "Tab 2", RTGUI_WIDGET(box));
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue