2012-04-18 23:06:12 +08:00
|
|
|
|
#include <rtgui/rtgui.h>
|
|
|
|
|
#include <rtgui/rtgui_system.h>
|
2012-07-20 20:37:56 +08:00
|
|
|
|
#include <rtgui/rtgui_app.h>
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
|
|
|
|
#include <rtgui/widgets/window.h>
|
|
|
|
|
#include <rtgui/widgets/notebook.h>
|
|
|
|
|
|
|
|
|
|
struct rtgui_notebook *the_notebook;
|
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
static rt_bool_t demo_handle_key(struct rtgui_object *object, struct rtgui_event *event)
|
2012-04-18 23:06:12 +08:00
|
|
|
|
{
|
2012-08-13 16:32:01 +08:00
|
|
|
|
struct rtgui_event_kbd *ekbd = (struct rtgui_event_kbd *)event;
|
|
|
|
|
|
|
|
|
|
if (ekbd->type == RTGUI_KEYUP)
|
|
|
|
|
{
|
|
|
|
|
if (ekbd->key == RTGUIK_RIGHT)
|
|
|
|
|
{
|
|
|
|
|
demo_view_next(RT_NULL, RT_NULL);
|
|
|
|
|
return RT_TRUE;
|
|
|
|
|
}
|
|
|
|
|
else if (ekbd->key == RTGUIK_LEFT)
|
|
|
|
|
{
|
|
|
|
|
demo_view_prev(RT_NULL, RT_NULL);
|
|
|
|
|
return RT_TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return RT_TRUE;
|
2012-04-18 23:06:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct rtgui_win *main_win;
|
2012-08-13 16:32:01 +08:00
|
|
|
|
static void application_entry(void *parameter)
|
2012-04-18 23:06:12 +08:00
|
|
|
|
{
|
2012-08-13 16:32:01 +08:00
|
|
|
|
struct rtgui_app *app;
|
|
|
|
|
struct rtgui_rect rect;
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
app = rtgui_app_create(rt_thread_self(), "gui_demo");
|
|
|
|
|
if (app == RT_NULL)
|
|
|
|
|
return;
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
/* create a full screen window */
|
|
|
|
|
rtgui_graphic_driver_get_rect(rtgui_graphic_driver_get_default(), &rect);
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
main_win = rtgui_win_create(RT_NULL, "demo_win", &rect,
|
|
|
|
|
RTGUI_WIN_STYLE_NO_BORDER | RTGUI_WIN_STYLE_NO_TITLE);
|
|
|
|
|
if (main_win == RT_NULL)
|
|
|
|
|
{
|
|
|
|
|
rtgui_app_destroy(app);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
rtgui_win_set_onkey(main_win, demo_handle_key);
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
/* create a no title notebook that we can switch demo on it easily. */
|
|
|
|
|
the_notebook = rtgui_notebook_create(&rect, RTGUI_NOTEBOOK_NOTAB);
|
|
|
|
|
if (the_notebook == RT_NULL)
|
|
|
|
|
{
|
|
|
|
|
rtgui_win_destroy(main_win);
|
|
|
|
|
rtgui_app_destroy(app);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
rtgui_container_add_child(RTGUI_CONTAINER(main_win), RTGUI_WIDGET(the_notebook));
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
//demo_view_box();
|
2012-07-20 20:37:56 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
/* <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD>ͼ */
|
|
|
|
|
demo_view_benchmark();
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
demo_view_dc();
|
2012-04-18 23:06:12 +08:00
|
|
|
|
#ifdef RTGUI_USING_TTF
|
2012-08-13 16:32:01 +08:00
|
|
|
|
demo_view_ttf();
|
2012-04-18 23:06:12 +08:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef RTGUI_USING_SMALL_SIZE
|
2012-08-13 16:32:01 +08:00
|
|
|
|
demo_view_dc_buffer();
|
2012-04-18 23:06:12 +08:00
|
|
|
|
#endif
|
2012-08-13 16:32:01 +08:00
|
|
|
|
demo_view_animation();
|
2012-04-18 23:06:12 +08:00
|
|
|
|
#ifndef RTGUI_USING_SMALL_SIZE
|
2012-08-13 16:32:01 +08:00
|
|
|
|
demo_view_buffer_animation();
|
|
|
|
|
demo_view_instrument_panel();
|
2012-04-18 23:06:12 +08:00
|
|
|
|
#endif
|
2012-08-13 16:32:01 +08:00
|
|
|
|
demo_view_window();
|
|
|
|
|
demo_view_label();
|
|
|
|
|
demo_view_button();
|
|
|
|
|
demo_view_checkbox();
|
|
|
|
|
demo_view_progressbar();
|
|
|
|
|
demo_view_scrollbar();
|
|
|
|
|
demo_view_radiobox();
|
|
|
|
|
demo_view_textbox();
|
|
|
|
|
demo_view_listbox();
|
|
|
|
|
demo_view_menu();
|
|
|
|
|
demo_view_listctrl();
|
|
|
|
|
demo_view_combobox();
|
|
|
|
|
demo_view_slider();
|
|
|
|
|
demo_view_notebook();
|
|
|
|
|
demo_view_mywidget();
|
2012-09-07 09:50:13 +08:00
|
|
|
|
demo_plot();
|
|
|
|
|
|
|
|
|
|
#if defined(RTGUI_USING_DFS_FILERW)
|
|
|
|
|
demo_view_edit();
|
|
|
|
|
demo_view_bmp();
|
|
|
|
|
#endif
|
|
|
|
|
|
2012-04-18 23:06:12 +08:00
|
|
|
|
#if 0
|
2012-09-07 09:50:13 +08:00
|
|
|
|
#if defined(RTGUI_USING_DFS_FILERW)
|
2012-08-13 16:32:01 +08:00
|
|
|
|
demo_view_image();
|
2012-04-18 23:06:12 +08:00
|
|
|
|
#endif
|
2012-08-13 16:32:01 +08:00
|
|
|
|
#ifdef RT_USING_MODULE
|
2012-09-07 09:50:13 +08:00
|
|
|
|
#if defined(RTGUI_USING_DFS_FILERW)
|
2012-08-13 16:32:01 +08:00
|
|
|
|
demo_view_module();
|
2012-04-18 23:06:12 +08:00
|
|
|
|
#endif
|
|
|
|
|
#endif
|
2012-08-13 16:32:01 +08:00
|
|
|
|
demo_listview_view();
|
|
|
|
|
demo_listview_icon_view();
|
2012-09-07 09:50:13 +08:00
|
|
|
|
#if defined(RTGUI_USING_DFS_FILERW)
|
2012-08-13 16:32:01 +08:00
|
|
|
|
demo_fn_view();
|
2012-04-18 23:06:12 +08:00
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
rtgui_win_show(main_win, RT_FALSE);
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
/* ִ<>й<EFBFBD><D0B9><EFBFBD>̨<EFBFBD>¼<EFBFBD>ѭ<EFBFBD><D1AD> */
|
|
|
|
|
rtgui_app_run(app);
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
rtgui_app_destroy(app);
|
2012-04-18 23:06:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
2012-07-20 20:37:56 +08:00
|
|
|
|
void application_init()
|
2012-04-18 23:06:12 +08:00
|
|
|
|
{
|
2012-08-13 16:32:01 +08:00
|
|
|
|
static rt_bool_t inited = RT_FALSE;
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
if (inited == RT_FALSE) /* <20><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD> */
|
|
|
|
|
{
|
|
|
|
|
rt_thread_t tid;
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
tid = rt_thread_create("wb",
|
|
|
|
|
application_entry, RT_NULL,
|
|
|
|
|
2048 * 2, 25, 10);
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
if (tid != RT_NULL)
|
|
|
|
|
rt_thread_startup(tid);
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
inited = RT_TRUE;
|
|
|
|
|
}
|
2012-04-18 23:06:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef RT_USING_FINSH
|
|
|
|
|
#include <finsh.h>
|
2012-07-20 20:37:56 +08:00
|
|
|
|
void application()
|
2012-04-18 23:06:12 +08:00
|
|
|
|
{
|
2012-08-13 16:32:01 +08:00
|
|
|
|
application_init();
|
2012-04-18 23:06:12 +08:00
|
|
|
|
}
|
|
|
|
|
/* finsh<73><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1>ִ<EFBFBD><D6B4>application()<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD> */
|
|
|
|
|
FINSH_FUNCTION_EXPORT(application, application demo)
|
|
|
|
|
#endif
|