remove examples depend.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1087 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
c7f8c325af
commit
f01f25b451
|
@ -31,6 +31,6 @@ gui_init.c
|
||||||
mywidget.c
|
mywidget.c
|
||||||
""")
|
""")
|
||||||
|
|
||||||
group = DefineGroup('gui_examples', src, depend = ['RTGUI_USING_EXAMPLES'])
|
group = DefineGroup('gui_examples', src, depend = ['RT_USING_RTGUI'])
|
||||||
|
|
||||||
Return('group')
|
Return('group')
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
#include <rtgui/widgets/workbench.h>
|
#include <rtgui/widgets/workbench.h>
|
||||||
#include <rtgui/widgets/staticline.h>
|
#include <rtgui/widgets/staticline.h>
|
||||||
|
|
||||||
/* 用于存放演示视图的数组,最多可创建32个演示视图 */
|
/* 用于存放演示视图的数组,最多可创建32个演示视图 */
|
||||||
static rtgui_view_t* demo_view_list[32];
|
static rtgui_view_t* demo_view_list[32];
|
||||||
/* 当前演示视图索引 */
|
/* 当前演示视图索引 */
|
||||||
static rt_uint16_t demo_view_current = 0;
|
static rt_uint16_t demo_view_current = 0;
|
||||||
/* 总共包括的演示视图数目 */
|
/* 总共包括的演示视图数目 */
|
||||||
static rt_uint16_t demo_view_number = 0;
|
static rt_uint16_t demo_view_number = 0;
|
||||||
|
|
||||||
/* 显示下一个演示视图 */
|
/* 显示下一个演示视图 */
|
||||||
void demo_view_next(struct rtgui_widget* widget, rtgui_event_t *event)
|
void demo_view_next(struct rtgui_widget* widget, rtgui_event_t *event)
|
||||||
{
|
{
|
||||||
if (demo_view_current + 1< demo_view_number)
|
if (demo_view_current + 1< demo_view_number)
|
||||||
|
@ -21,7 +21,7 @@ void demo_view_next(struct rtgui_widget* widget, rtgui_event_t *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 显示前一个演示视图 */
|
/* 显示前一个演示视图 */
|
||||||
void demo_view_prev(struct rtgui_widget* widget, rtgui_event_t *event)
|
void demo_view_prev(struct rtgui_widget* widget, rtgui_event_t *event)
|
||||||
{
|
{
|
||||||
if (demo_view_current != 0)
|
if (demo_view_current != 0)
|
||||||
|
@ -31,30 +31,30 @@ void demo_view_prev(struct rtgui_widget* widget, rtgui_event_t *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 创建一个演示视图,需提供父workbench和演示用的标题 */
|
/* 创建一个演示视图,需提供父workbench和演示用的标题 */
|
||||||
rtgui_view_t* demo_view(rtgui_workbench_t* workbench, const char* title)
|
rtgui_view_t* demo_view(rtgui_workbench_t* workbench, const char* title)
|
||||||
{
|
{
|
||||||
struct rtgui_view* view;
|
struct rtgui_view* view;
|
||||||
|
|
||||||
/* 设置视图的名称 */
|
/* 设置视图的名称 */
|
||||||
view = rtgui_view_create(title);
|
view = rtgui_view_create(title);
|
||||||
if (view == RT_NULL) return RT_NULL;
|
if (view == RT_NULL) return RT_NULL;
|
||||||
|
|
||||||
/* 创建成功后,添加到数组中 */
|
/* 创建成功后,添加到数组中 */
|
||||||
demo_view_list[demo_view_number] = view;
|
demo_view_list[demo_view_number] = view;
|
||||||
demo_view_number ++;
|
demo_view_number ++;
|
||||||
|
|
||||||
/* 添加到父workbench中 */
|
/* 添加到父workbench中 */
|
||||||
rtgui_workbench_add_view(workbench, view);
|
rtgui_workbench_add_view(workbench, view);
|
||||||
|
|
||||||
/* 添加下一个视图和前一个视图按钮 */
|
/* 添加下一个视图和前一个视图按钮 */
|
||||||
{
|
{
|
||||||
struct rtgui_rect rect;
|
struct rtgui_rect rect;
|
||||||
struct rtgui_button *next_btn, *prev_btn;
|
struct rtgui_button *next_btn, *prev_btn;
|
||||||
struct rtgui_label *label;
|
struct rtgui_label *label;
|
||||||
struct rtgui_staticline *line;
|
struct rtgui_staticline *line;
|
||||||
|
|
||||||
/* 获得视图的位置信息(在加入到workbench中时,workbench会自动调整视图的大小) */
|
/* 获得视图的位置信息(在加入到workbench中时,workbench会自动调整视图的大小) */
|
||||||
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
|
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
|
||||||
rtgui_widget_rect_to_device(RTGUI_WIDGET(view), &rect);
|
rtgui_widget_rect_to_device(RTGUI_WIDGET(view), &rect);
|
||||||
rect.x1 += 5;
|
rect.x1 += 5;
|
||||||
|
@ -62,23 +62,23 @@ rtgui_view_t* demo_view(rtgui_workbench_t* workbench, const char* title)
|
||||||
rect.x2 -= 5;
|
rect.x2 -= 5;
|
||||||
rect.y2 = rect.y1 + 20;
|
rect.y2 = rect.y1 + 20;
|
||||||
|
|
||||||
/* 创建标题用的标签 */
|
/* 创建标题用的标签 */
|
||||||
label = rtgui_label_create(title);
|
label = rtgui_label_create(title);
|
||||||
/* 设置标签位置信息 */
|
/* 设置标签位置信息 */
|
||||||
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
|
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
|
||||||
/* 添加标签到视图中 */
|
/* 添加标签到视图中 */
|
||||||
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
|
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
|
||||||
|
|
||||||
rect.y1 += 20;
|
rect.y1 += 20;
|
||||||
rect.y2 += 20;
|
rect.y2 += 20;
|
||||||
/* 创建一个水平的staticline线 */
|
/* 创建一个水平的staticline线 */
|
||||||
line = rtgui_staticline_create(RTGUI_HORIZONTAL);
|
line = rtgui_staticline_create(RTGUI_HORIZONTAL);
|
||||||
/* 设置静态线的位置信息 */
|
/* 设置静态线的位置信息 */
|
||||||
rtgui_widget_set_rect(RTGUI_WIDGET(line), &rect);
|
rtgui_widget_set_rect(RTGUI_WIDGET(line), &rect);
|
||||||
/* 添加静态线到视图中 */
|
/* 添加静态线到视图中 */
|
||||||
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(line));
|
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(line));
|
||||||
|
|
||||||
/* 获得视图的位置信息 */
|
/* 获得视图的位置信息 */
|
||||||
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
|
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
|
||||||
rtgui_widget_rect_to_device(RTGUI_WIDGET(view), &rect);
|
rtgui_widget_rect_to_device(RTGUI_WIDGET(view), &rect);
|
||||||
rect.x2 -= 5;
|
rect.x2 -= 5;
|
||||||
|
@ -86,16 +86,16 @@ rtgui_view_t* demo_view(rtgui_workbench_t* workbench, const char* title)
|
||||||
rect.x1 = rect.x2 - 100;
|
rect.x1 = rect.x2 - 100;
|
||||||
rect.y1 = rect.y2 - 25;
|
rect.y1 = rect.y2 - 25;
|
||||||
|
|
||||||
/* 创建"下一个"按钮 */
|
/* 创建"下一个"按钮 */
|
||||||
next_btn = rtgui_button_create("下一个");
|
next_btn = rtgui_button_create("下一个");
|
||||||
/* 设置onbutton动作到demo_view_next函数 */
|
/* 设置onbutton动作到demo_view_next函数 */
|
||||||
rtgui_button_set_onbutton(next_btn, demo_view_next);
|
rtgui_button_set_onbutton(next_btn, demo_view_next);
|
||||||
/* 设置按钮的位置信息 */
|
/* 设置按钮的位置信息 */
|
||||||
rtgui_widget_set_rect(RTGUI_WIDGET(next_btn), &rect);
|
rtgui_widget_set_rect(RTGUI_WIDGET(next_btn), &rect);
|
||||||
/* 添加按钮到视图中 */
|
/* 添加按钮到视图中 */
|
||||||
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(next_btn));
|
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(next_btn));
|
||||||
|
|
||||||
/* 获得视图的位置信息 */
|
/* 获得视图的位置信息 */
|
||||||
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
|
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
|
||||||
rtgui_widget_rect_to_device(RTGUI_WIDGET(view), &rect);
|
rtgui_widget_rect_to_device(RTGUI_WIDGET(view), &rect);
|
||||||
rect.x1 += 5;
|
rect.x1 += 5;
|
||||||
|
@ -103,21 +103,21 @@ rtgui_view_t* demo_view(rtgui_workbench_t* workbench, const char* title)
|
||||||
rect.x2 = rect.x1 + 100;
|
rect.x2 = rect.x1 + 100;
|
||||||
rect.y1 = rect.y2 - 25;
|
rect.y1 = rect.y2 - 25;
|
||||||
|
|
||||||
/* 创建"上一个"按钮 */
|
/* 创建"上一个"按钮 */
|
||||||
prev_btn = rtgui_button_create("上一个");
|
prev_btn = rtgui_button_create("上一个");
|
||||||
/* 设置onbutton动作到demo_view_prev函数 */
|
/* 设置onbutton动作到demo_view_prev函数 */
|
||||||
rtgui_button_set_onbutton(prev_btn, demo_view_prev);
|
rtgui_button_set_onbutton(prev_btn, demo_view_prev);
|
||||||
/* 设置按钮的位置信息 */
|
/* 设置按钮的位置信息 */
|
||||||
rtgui_widget_set_rect(RTGUI_WIDGET(prev_btn), &rect);
|
rtgui_widget_set_rect(RTGUI_WIDGET(prev_btn), &rect);
|
||||||
/* 添加按钮到视图中 */
|
/* 添加按钮到视图中 */
|
||||||
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(prev_btn));
|
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(prev_btn));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 返回创建的视图 */
|
/* 返回创建的视图 */
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 这个函数用于返回演示视图的对外可用区域 */
|
/* 这个函数用于返回演示视图的对外可用区域 */
|
||||||
void demo_view_get_rect(rtgui_view_t* view, rtgui_rect_t *rect)
|
void demo_view_get_rect(rtgui_view_t* view, rtgui_rect_t *rect)
|
||||||
{
|
{
|
||||||
RT_ASSERT(view != RT_NULL);
|
RT_ASSERT(view != RT_NULL);
|
||||||
|
@ -125,7 +125,7 @@ void demo_view_get_rect(rtgui_view_t* view, rtgui_rect_t *rect)
|
||||||
|
|
||||||
rtgui_widget_get_rect(RTGUI_WIDGET(view), rect);
|
rtgui_widget_get_rect(RTGUI_WIDGET(view), rect);
|
||||||
rtgui_widget_rect_to_device(RTGUI_WIDGET(view), rect);
|
rtgui_widget_rect_to_device(RTGUI_WIDGET(view), rect);
|
||||||
/* 去除演示标题和下方按钮的区域 */
|
/* 去除演示标题和下方按钮的区域 */
|
||||||
rect->y1 += 45;
|
rect->y1 += 45;
|
||||||
rect->y2 -= 35;
|
rect->y2 -= 35;
|
||||||
}
|
}
|
||||||
|
@ -136,33 +136,33 @@ void demo_view_get_logic_rect(rtgui_view_t* view, rtgui_rect_t *rect)
|
||||||
RT_ASSERT(rect != RT_NULL);
|
RT_ASSERT(rect != RT_NULL);
|
||||||
|
|
||||||
rtgui_widget_get_rect(RTGUI_WIDGET(view), rect);
|
rtgui_widget_get_rect(RTGUI_WIDGET(view), rect);
|
||||||
/* 去除演示标题和下方按钮的区域 */
|
/* 去除演示标题和下方按钮的区域 */
|
||||||
rect->y1 += 45;
|
rect->y1 += 45;
|
||||||
rect->y2 -= 35;
|
rect->y2 -= 35;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 当是标准版本时,这个函数用于返回自动布局引擎box控件 */
|
/* 当是标准版本时,这个函数用于返回自动布局引擎box控件 */
|
||||||
#ifndef RTGUI_USING_SMALL_SIZE
|
#ifndef RTGUI_USING_SMALL_SIZE
|
||||||
rtgui_box_t* demo_view_create_box(rtgui_view_t* view, int orient)
|
rtgui_box_t* demo_view_create_box(rtgui_view_t* view, int orient)
|
||||||
{
|
{
|
||||||
rtgui_rect_t rect;
|
rtgui_rect_t rect;
|
||||||
rtgui_box_t* box;
|
rtgui_box_t* box;
|
||||||
|
|
||||||
/* 获得视图的位置信息 */
|
/* 获得视图的位置信息 */
|
||||||
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
|
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
|
||||||
rect.y1 += 45;
|
rect.y1 += 45;
|
||||||
rect.y2 -= 25;
|
rect.y2 -= 25;
|
||||||
|
|
||||||
/* 创建一个自动布局引擎 */
|
/* 创建一个自动布局引擎 */
|
||||||
box = rtgui_box_create(orient, &rect);
|
box = rtgui_box_create(orient, &rect);
|
||||||
/* 添加box控件到视图中 */
|
/* 添加box控件到视图中 */
|
||||||
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(box));
|
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(box));
|
||||||
|
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* 这个函数用于显示当前的视图 */
|
/* 这个函数用于显示当前的视图 */
|
||||||
void demo_view_show()
|
void demo_view_show()
|
||||||
{
|
{
|
||||||
if (demo_view_number != 0)
|
if (demo_view_number != 0)
|
||||||
|
|
|
@ -32,6 +32,6 @@ heap_realloc.c
|
||||||
memp_simple.c
|
memp_simple.c
|
||||||
""")
|
""")
|
||||||
|
|
||||||
group = DefineGroup('examples', src, depend = ['RT_USING_TC'])
|
group = DefineGroup('examples', src, depend = [''])
|
||||||
|
|
||||||
Return('group')
|
Return('group')
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from building import *
|
from building import *
|
||||||
|
|
||||||
src = Glob('*.c')
|
src = Glob('*.c')
|
||||||
group = DefineGroup('libc_test', src, depend = ['RT_USING_NEWLIB', 'RT_USING_PTHREADS', 'RT_USING_LIBC_TEST'])
|
group = DefineGroup('libc_test', src, depend = ['RT_USING_NEWLIB', 'RT_USING_PTHREADS'])
|
||||||
|
|
||||||
Return('group')
|
Return('group')
|
||||||
|
|
Loading…
Reference in New Issue