rt-thread/examples/gui/demo_view_notebook.c

54 lines
1.4 KiB
C
Raw Normal View History

/*
2013-02-01 10:27:10 +08:00
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>notebook<EFBFBD>ؼ<EFBFBD><EFBFBD><EFBFBD>ʾ
*
2013-02-01 10:27:10 +08:00
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӻ<EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>container<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾnotebook<EFBFBD>ؼ<EFBFBD>
*/
#include "demo_view.h"
#include <rtgui/widgets/notebook.h>
#include <rtgui/widgets/listbox.h>
const static struct rtgui_listbox_item items[] =
{
{"list #0", RT_NULL},
{"list #1", RT_NULL},
{"list #2", 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},
};
2013-02-01 10:27:10 +08:00
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾnotebook<6F>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD>ͼ */
rtgui_container_t *demo_view_notebook(void)
{
rtgui_rect_t rect;
rtgui_container_t *container;
struct rtgui_notebook *notebook;
rtgui_listbox_t *box;
2013-02-01 10:27:10 +08:00
/* <20>ȴ<EFBFBD><C8B4><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ʾ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ͼ */
container = demo_view("Notebook View");
2013-02-01 10:27:10 +08:00
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϣ */
demo_view_get_rect(container, &rect);
notebook = rtgui_notebook_create(&rect, RTGUI_NOTEBOOK_BOTTOM);
2013-02-01 10:27:10 +08:00
/* container<65><72>һ<EFBFBD><D2BB>container<65>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>add_child<6C><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>notebook<6F>ؼ<EFBFBD> */
rtgui_container_add_child(container, RTGUI_WIDGET(notebook));
box = rtgui_listbox_create(items, sizeof(items) / sizeof(struct rtgui_listbox_item), &rect);
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 container;
}