remove dc_buffer example

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@589 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong 2010-04-07 06:19:09 +00:00
parent f727b165bc
commit 1e5fe1d7c1
1 changed files with 108 additions and 108 deletions

View File

@ -1,108 +1,108 @@
#include <rtgui/rtgui.h> #include <rtgui/rtgui.h>
#include <rtgui/rtgui_system.h> #include <rtgui/rtgui_system.h>
#include <rtgui/widgets/view.h> #include <rtgui/widgets/view.h>
#include <rtgui/widgets/workbench.h> #include <rtgui/widgets/workbench.h>
static rt_bool_t demo_workbench_event_handler(struct rtgui_widget* widget, struct rtgui_event* event) static rt_bool_t demo_workbench_event_handler(struct rtgui_widget* widget, struct rtgui_event* event)
{ {
/* 我们目前只对按键事件感兴趣。如果当前workbench处于模式显示状态忽略它 */ /* 我们目前只对按键事件感兴趣。如果当前workbench处于模式显示状态忽略它 */
if ((event->type == RTGUI_EVENT_KBD) && !RTGUI_WORKBENCH_IS_MODAL_MODE(RTGUI_WORKBENCH(widget))) if ((event->type == RTGUI_EVENT_KBD) && !RTGUI_WORKBENCH_IS_MODAL_MODE(RTGUI_WORKBENCH(widget)))
{ {
struct rtgui_event_kbd* ekbd = (struct rtgui_event_kbd*)event; struct rtgui_event_kbd* ekbd = (struct rtgui_event_kbd*)event;
if (ekbd->type == RTGUI_KEYDOWN) if (ekbd->type == RTGUI_KEYDOWN)
{ {
if (ekbd->key == RTGUIK_RIGHT) if (ekbd->key == RTGUIK_RIGHT)
{ {
demo_view_next(RT_NULL, RT_NULL); demo_view_next(RT_NULL, RT_NULL);
return RT_TRUE; return RT_TRUE;
} }
else if (ekbd->key == RTGUIK_LEFT) else if (ekbd->key == RTGUIK_LEFT)
{ {
demo_view_prev(RT_NULL, RT_NULL); demo_view_prev(RT_NULL, RT_NULL);
return RT_TRUE; return RT_TRUE;
} }
} }
} }
/* 如果不是绘制事件使用view原来的事件处理函数处理 */ /* 如果不是绘制事件使用view原来的事件处理函数处理 */
return rtgui_workbench_event_handler(widget, event); return rtgui_workbench_event_handler(widget, event);
} }
static void workbench_entry(void* parameter) static void workbench_entry(void* parameter)
{ {
rt_mq_t mq; rt_mq_t mq;
struct rtgui_view* view; struct rtgui_view* view;
struct rtgui_workbench* workbench; struct rtgui_workbench* workbench;
/* 创建GUI应用需要的消息队列 */ /* 创建GUI应用需要的消息队列 */
#ifdef RTGUI_USING_SMALL_SIZE #ifdef RTGUI_USING_SMALL_SIZE
mq = rt_mq_create("workbench", 32, 8, RT_IPC_FLAG_FIFO); mq = rt_mq_create("workbench", 32, 8, RT_IPC_FLAG_FIFO);
#else #else
mq = rt_mq_create("workbench", 256, 8, RT_IPC_FLAG_FIFO); mq = rt_mq_create("workbench", 256, 8, RT_IPC_FLAG_FIFO);
#endif #endif
/* 注册当前线程为GUI线程 */ /* 注册当前线程为GUI线程 */
rtgui_thread_register(rt_thread_self(), mq); rtgui_thread_register(rt_thread_self(), mq);
/* 创建一个工作台 */ /* 创建一个工作台 */
workbench = rtgui_workbench_create("main", "workbench"); workbench = rtgui_workbench_create("main", "workbench");
if (workbench == RT_NULL) return; if (workbench == RT_NULL) return;
rtgui_widget_set_event_handler(RTGUI_WIDGET(workbench), demo_workbench_event_handler); rtgui_widget_set_event_handler(RTGUI_WIDGET(workbench), demo_workbench_event_handler);
/* 初始化各个例子的视图 */ /* 初始化各个例子的视图 */
demo_view_dc(workbench); demo_view_dc(workbench);
demo_view_dc_buffer(workbench); /* demo_view_dc_buffer(workbench); */
demo_view_animation(workbench); demo_view_animation(workbench);
demo_view_window(workbench); demo_view_window(workbench);
demo_view_label(workbench); demo_view_label(workbench);
demo_view_button(workbench); demo_view_button(workbench);
demo_view_checkbox(workbench); demo_view_checkbox(workbench);
demo_view_progressbar(workbench); demo_view_progressbar(workbench);
demo_view_radiobox(workbench); demo_view_radiobox(workbench);
demo_view_textbox(workbench); demo_view_textbox(workbench);
demo_view_slider(workbench); demo_view_slider(workbench);
demo_view_mywidget(workbench); demo_view_mywidget(workbench);
demo_view_image(workbench); demo_view_image(workbench);
demo_listview_view(workbench); demo_listview_view(workbench);
demo_fn_view(workbench); demo_fn_view(workbench);
/* 显示视图 */ /* 显示视图 */
demo_view_show(); demo_view_show();
/* 执行工作台事件循环 */ /* 执行工作台事件循环 */
rtgui_workbench_event_loop(workbench); rtgui_workbench_event_loop(workbench);
/* 去注册GUI线程 */ /* 去注册GUI线程 */
rtgui_thread_deregister(rt_thread_self()); rtgui_thread_deregister(rt_thread_self());
rt_mq_delete(mq); rt_mq_delete(mq);
} }
void workbench_init() void workbench_init()
{ {
static rt_bool_t inited = RT_FALSE; static rt_bool_t inited = RT_FALSE;
if (inited == RT_FALSE) /* 避免重复初始化而做的保护 */ if (inited == RT_FALSE) /* 避免重复初始化而做的保护 */
{ {
rt_thread_t tid; rt_thread_t tid;
tid = rt_thread_create("wb", tid = rt_thread_create("wb",
workbench_entry, RT_NULL, workbench_entry, RT_NULL,
2048, 25, 10); 2048, 25, 10);
if (tid != RT_NULL) rt_thread_startup(tid); if (tid != RT_NULL) rt_thread_startup(tid);
inited = RT_TRUE; inited = RT_TRUE;
} }
} }
#ifdef RT_USING_RTGUI #ifdef RT_USING_RTGUI
#include <finsh.h> #include <finsh.h>
void workbench() void workbench()
{ {
workbench_init(); workbench_init();
} }
/* finsh的命令输出可以直接执行workbench()函数以执行上面的函数 */ /* finsh的命令输出可以直接执行workbench()函数以执行上面的函数 */
FINSH_FUNCTION_EXPORT(workbench, workbench demo) FINSH_FUNCTION_EXPORT(workbench, workbench demo)
#endif #endif