fixed RT-Thread/GUI building warning.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2080 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
e86f340521
commit
ffbbf82474
|
@ -15,7 +15,7 @@ static rtgui_list_view_t* _view = RT_NULL;
|
||||||
// static rtgui_image_t* return_image = RT_NULL;
|
// static rtgui_image_t* return_image = RT_NULL;
|
||||||
|
|
||||||
/* 列表项的动作函数 */
|
/* 列表项的动作函数 */
|
||||||
#if RT_VERSION == 4
|
#if RTTHREAD_VERSION >= 10000
|
||||||
static void listitem_action(rtgui_widget_t *widget, void* parameter)
|
static void listitem_action(rtgui_widget_t *widget, void* parameter)
|
||||||
#else
|
#else
|
||||||
static void listitem_action(void* parameter)
|
static void listitem_action(void* parameter)
|
||||||
|
@ -50,7 +50,7 @@ static void listitem_action(void* parameter)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 返回功能的动作函数 */
|
/* 返回功能的动作函数 */
|
||||||
#if RT_VERSION == 4
|
#if RTTHREAD_VERSION >= 10000
|
||||||
static void return_action(rtgui_widget_t* widget, void* parameter)
|
static void return_action(rtgui_widget_t* widget, void* parameter)
|
||||||
#else
|
#else
|
||||||
static void return_action(void* parameter)
|
static void return_action(void* parameter)
|
||||||
|
|
|
@ -14,7 +14,7 @@ static rtgui_workbench_t* workbench = RT_NULL;
|
||||||
static rtgui_list_view_t* _view = RT_NULL;
|
static rtgui_list_view_t* _view = RT_NULL;
|
||||||
|
|
||||||
/* 列表项的动作函数 */
|
/* 列表项的动作函数 */
|
||||||
#if RT_VERSION == 4
|
#if RTTHREAD_VERSION >= 10000
|
||||||
static void listitem_action(rtgui_widget_t* widget, void* parameter)
|
static void listitem_action(rtgui_widget_t* widget, void* parameter)
|
||||||
#else
|
#else
|
||||||
static void listitem_action(void* parameter)
|
static void listitem_action(void* parameter)
|
||||||
|
@ -49,7 +49,7 @@ static void listitem_action(void* parameter)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 返回功能的动作函数 */
|
/* 返回功能的动作函数 */
|
||||||
#if RT_VERSION == 4
|
#if RTTHREAD_VERSION >= 10000
|
||||||
static void return_action(rtgui_widget_t* widget, void* parameter)
|
static void return_action(rtgui_widget_t* widget, void* parameter)
|
||||||
#else
|
#else
|
||||||
static void return_action(void* parameter)
|
static void return_action(void* parameter)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <rtgui/widgets/view.h>
|
#include <rtgui/widgets/view.h>
|
||||||
#include "demo_view.h"
|
#include "demo_view.h"
|
||||||
|
|
||||||
#if RT_VERSION == 4
|
#if RTTHREAD_VERSION >= 10000
|
||||||
#define RAND(x1, x2) ((rand() % (x2 - x1)) + x1)
|
#define RAND(x1, x2) ((rand() % (x2 - x1)) + x1)
|
||||||
|
|
||||||
static rtgui_view_t* view = RT_NULL;
|
static rtgui_view_t* view = RT_NULL;
|
||||||
|
|
|
@ -26,8 +26,8 @@ rt_bool_t dc_event_handler(rtgui_widget_t* widget, rtgui_event_t *event)
|
||||||
{
|
{
|
||||||
struct rtgui_dc* dc;
|
struct rtgui_dc* dc;
|
||||||
rtgui_rect_t rect;
|
rtgui_rect_t rect;
|
||||||
const int vx[] = {20, 50, 60, 45, 60, 20};
|
// const int vx[] = {20, 50, 60, 45, 60, 20};
|
||||||
const int vy[] = {150, 50, 90, 60, 45, 50};
|
// const int vy[] = {150, 50, 90, 60, 45, 50};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 因为用的是demo view,上面本身有一部分控件,所以在绘图时先要让demo view
|
* 因为用的是demo view,上面本身有一部分控件,所以在绘图时先要让demo view
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include <rtgui/widgets/slider.h>
|
#include <rtgui/widgets/slider.h>
|
||||||
#include <rtgui/image.h>
|
#include <rtgui/image.h>
|
||||||
|
|
||||||
static rtgui_image_t *background;
|
// static rtgui_image_t *background;
|
||||||
static struct rtgui_dc *dc_buffer;
|
static struct rtgui_dc *dc_buffer;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
#include <rtgui/widgets/filelist_view.h>
|
#include <rtgui/widgets/filelist_view.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
static rtgui_image_t* image = RT_NULL;
|
// static rtgui_image_t* image = RT_NULL;
|
||||||
static rtgui_view_t* _view = RT_NULL;
|
// static rtgui_view_t* _view = RT_NULL;
|
||||||
|
|
||||||
#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
|
#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
|
||||||
/* 打开按钮的回调函数 */
|
/* 打开按钮的回调函数 */
|
||||||
|
|
|
@ -29,7 +29,7 @@ static const rtgui_menu_item_t items[] =
|
||||||
};
|
};
|
||||||
static rtgui_menu_t* menu;
|
static rtgui_menu_t* menu;
|
||||||
|
|
||||||
static _onmenu(struct rtgui_widget* widget, struct rtgui_event* event)
|
static void _onmenu(struct rtgui_widget* widget, struct rtgui_event* event)
|
||||||
{
|
{
|
||||||
rtgui_rect_t rect;
|
rtgui_rect_t rect;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
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;
|
||||||
|
@ -26,7 +26,7 @@ static rt_bool_t demo_workbench_event_handler(struct rtgui_widget* widget, struc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 如果不是绘制事件,使用view原来的事件处理函数处理 */
|
/* 如果不是绘制事件,使用view原来的事件处理函数处理 */
|
||||||
return rtgui_workbench_event_handler(widget, event);
|
return rtgui_workbench_event_handler(widget, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,28 +35,28 @@ static void workbench_entry(void* parameter)
|
||||||
rt_mq_t mq;
|
rt_mq_t mq;
|
||||||
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, 32, RT_IPC_FLAG_FIFO);
|
mq = rt_mq_create("workbench", 32, 32, RT_IPC_FLAG_FIFO);
|
||||||
#else
|
#else
|
||||||
mq = rt_mq_create("workbench", 256, 32, RT_IPC_FLAG_FIFO);
|
mq = rt_mq_create("workbench", 256, 32, 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);
|
||||||
|
|
||||||
/* 初始化各个例子的视图 */
|
/* 初始化各个例子的视图 */
|
||||||
#if RT_VERSION == 4
|
#if RTTHREAD_VERSION >= 10000
|
||||||
demo_view_benchmark(workbench);
|
demo_view_benchmark(workbench);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
demo_view_dc(workbench);
|
demo_view_dc(workbench);
|
||||||
#if RT_VERSION == 4
|
#if RTTHREAD_VERSION >= 10000
|
||||||
#ifdef RTGUI_USING_TTF
|
#ifdef RTGUI_USING_TTF
|
||||||
demo_view_ttf(workbench);
|
demo_view_ttf(workbench);
|
||||||
#endif
|
#endif
|
||||||
|
@ -68,7 +68,7 @@ static void workbench_entry(void* parameter)
|
||||||
demo_view_animation(workbench);
|
demo_view_animation(workbench);
|
||||||
#ifndef RTGUI_USING_SMALL_SIZE
|
#ifndef RTGUI_USING_SMALL_SIZE
|
||||||
demo_view_buffer_animation(workbench);
|
demo_view_buffer_animation(workbench);
|
||||||
// demo_view_instrument_panel(workbench);
|
demo_view_instrument_panel(workbench);
|
||||||
#endif
|
#endif
|
||||||
demo_view_window(workbench);
|
demo_view_window(workbench);
|
||||||
demo_view_label(workbench);
|
demo_view_label(workbench);
|
||||||
|
@ -83,7 +83,7 @@ static void workbench_entry(void* parameter)
|
||||||
demo_view_listctrl(workbench);
|
demo_view_listctrl(workbench);
|
||||||
demo_view_combobox(workbench);
|
demo_view_combobox(workbench);
|
||||||
demo_view_slider(workbench);
|
demo_view_slider(workbench);
|
||||||
demo_view_notebook(workbench);
|
// demo_view_notebook(workbench);
|
||||||
demo_view_mywidget(workbench);
|
demo_view_mywidget(workbench);
|
||||||
#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
|
#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
|
||||||
demo_view_image(workbench);
|
demo_view_image(workbench);
|
||||||
|
@ -99,13 +99,13 @@ static void workbench_entry(void* parameter)
|
||||||
demo_fn_view(workbench);
|
demo_fn_view(workbench);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* 显示视图 */
|
/* 显示视图 */
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ 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;
|
||||||
|
|
||||||
|
@ -134,6 +134,6 @@ void workbench()
|
||||||
{
|
{
|
||||||
workbench_init();
|
workbench_init();
|
||||||
}
|
}
|
||||||
/* finsh的命令输出,可以直接执行workbench()函数以执行上面的函数 */
|
/* finsh的命令输出,可以直接执行workbench()函数以执行上面的函数 */
|
||||||
FINSH_FUNCTION_EXPORT(workbench, workbench demo)
|
FINSH_FUNCTION_EXPORT(workbench, workbench demo)
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue