sync gui examples with github 6cf0a8bc19c292ca810c917574895c8defa3922e
As always, full log is in GitHub. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2254 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
e6a9dd1922
commit
9a99573152
@ -13,6 +13,8 @@ demo_view_module.c
|
||||
|
||||
src = Split("""
|
||||
demo_application.c
|
||||
demo_listview.c
|
||||
demo_listview_icon.c
|
||||
demo_view.c
|
||||
demo_view_benchmark.c
|
||||
demo_view_dc.c
|
||||
@ -37,6 +39,7 @@ demo_view_slider.c
|
||||
demo_view_notebook.c
|
||||
demo_view_mywidget.c
|
||||
demo_view_box.c
|
||||
demo_view_edit.c
|
||||
mywidget.c
|
||||
""")
|
||||
|
||||
|
@ -61,7 +61,7 @@ static void application_entry(void* parameter)
|
||||
|
||||
rtgui_container_add_child(RTGUI_CONTAINER(main_win), RTGUI_WIDGET(the_notebook));
|
||||
|
||||
demo_view_box();
|
||||
//demo_view_box();
|
||||
|
||||
/* 初始化各个例子的视图 */
|
||||
demo_view_benchmark();
|
||||
@ -94,6 +94,7 @@ static void application_entry(void* parameter)
|
||||
demo_view_slider();
|
||||
demo_view_notebook();
|
||||
demo_view_mywidget();
|
||||
demo_view_edit();
|
||||
#if 0
|
||||
#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
|
||||
demo_view_image();
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <rtgui/widgets/window.h>
|
||||
#include <rtgui/widgets/list_view.h>
|
||||
|
||||
static struct rtgui_app *application = RT_NULL;
|
||||
static struct rtgui_application *application = RT_NULL;
|
||||
static rtgui_list_view_t *_view = RT_NULL;
|
||||
// static rtgui_image_t* return_image = RT_NULL;
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <rtgui/widgets/window.h>
|
||||
#include <rtgui/widgets/list_view.h>
|
||||
|
||||
static struct rtgui_app *application = RT_NULL;
|
||||
static struct rtgui_application *application = RT_NULL;
|
||||
static rtgui_list_view_t *_view = RT_NULL;
|
||||
|
||||
/* 列表项的动作函数 */
|
||||
@ -57,7 +57,8 @@ static struct rtgui_list_item *items = RT_NULL;
|
||||
static rtgui_image_t *item_icon = RT_NULL;
|
||||
static rtgui_image_t *exit_icon = RT_NULL;
|
||||
|
||||
static const char * image_xpm[] = {
|
||||
static const char *image_xpm[] =
|
||||
{
|
||||
"16 16 106 2",
|
||||
" c None",
|
||||
". c #D0C83F",
|
||||
@ -180,9 +181,11 @@ static const char * image_xpm[] = {
|
||||
" W @.l u I R #.Z Y U M ",
|
||||
" $.G I $.%.R &.Y *.& =. ",
|
||||
" -.;.>.,.L L ,.& M ",
|
||||
" "};
|
||||
" "
|
||||
};
|
||||
|
||||
static const char * exit_xpm[] = {
|
||||
static const char *exit_xpm[] =
|
||||
{
|
||||
"16 16 71 1",
|
||||
" c None",
|
||||
". c #CF673F",
|
||||
@ -270,7 +273,8 @@ static const char * exit_xpm[] = {
|
||||
" /DvvvvvvCE ",
|
||||
" [FeiiwAB ",
|
||||
" 6fjpxB ",
|
||||
" "};
|
||||
" "
|
||||
};
|
||||
|
||||
/* 打开列表视图用的按钮触发函数 */
|
||||
static void open_btn_onbutton(rtgui_widget_t *widget, struct rtgui_event *event)
|
||||
@ -316,7 +320,7 @@ static void open_btn_onbutton(rtgui_widget_t* widget, struct rtgui_event* event)
|
||||
}
|
||||
|
||||
/* 创建用于演示列表视图的视图 */
|
||||
rtgui_container_t* demo_listview_icon_view(struct rtgui_app *app)
|
||||
rtgui_container_t *demo_listview_icon_view(struct rtgui_application *app)
|
||||
{
|
||||
rtgui_rect_t rect;
|
||||
rtgui_container_t *view;
|
||||
|
@ -29,8 +29,10 @@ static void workbench_entry(void* parameter)
|
||||
|
||||
/* 添加一个label */
|
||||
label = rtgui_label_create("你好!RT-Thread!");
|
||||
rect.x1 = 10; rect.y1 = 10;
|
||||
rect.x2 = 210; rect.y2 = 30;
|
||||
rect.x1 = 10;
|
||||
rect.y1 = 10;
|
||||
rect.x2 = 210;
|
||||
rect.y2 = 30;
|
||||
/* 设置label的位置 */
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
|
||||
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
|
||||
|
@ -128,24 +128,3 @@ void demo_view_get_logic_rect(rtgui_container_t* container, rtgui_rect_t *rect)
|
||||
rect->y1 += 45;
|
||||
rect->y2 -= 35;
|
||||
}
|
||||
|
||||
/* 当是标准版本时,这个函数用于返回自动布局引擎box控件 */
|
||||
#ifndef RTGUI_USING_SMALL_SIZE
|
||||
struct rtgui_box* demo_view_create_box(struct rtgui_container *container, int orient)
|
||||
{
|
||||
rtgui_rect_t rect;
|
||||
struct rtgui_box* box;
|
||||
|
||||
/* 获得视图的位置信息 */
|
||||
rtgui_widget_get_rect(RTGUI_WIDGET(container), &rect);
|
||||
rect.y1 += 45;
|
||||
rect.y2 -= 25;
|
||||
|
||||
/* 创建一个自动布局引擎 */
|
||||
box = rtgui_box_create(orient, 5);
|
||||
/* 添加box控件到视图中 */
|
||||
rtgui_container_add_child(container, RTGUI_WIDGET(box));
|
||||
|
||||
return box;
|
||||
}
|
||||
#endif
|
||||
|
@ -30,10 +30,5 @@ void demo_view_get_rect(rtgui_container_t* view, rtgui_rect_t *rect);
|
||||
void demo_view_get_logic_rect(rtgui_container_t *view, rtgui_rect_t *rect);
|
||||
void demo_view_show(void);
|
||||
|
||||
/* 如果是标准版,可以调用这个函数获得一个自动布局引擎 */
|
||||
#ifndef RTGUI_USING_SMALL_SIZE
|
||||
rtgui_box_t* demo_view_create_box(rtgui_container_t* view, int orient);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -49,8 +49,10 @@ void timeout(struct rtgui_timer* timer, void* parameter)
|
||||
if (text_rect.y1 < rect.y1) dy = 1;
|
||||
|
||||
/* 移动文本框的位置 */
|
||||
text_rect.x1 += dx; text_rect.x2 += dx;
|
||||
text_rect.y1 += dy; text_rect.y2 += dy;
|
||||
text_rect.x1 += dx;
|
||||
text_rect.x2 += dx;
|
||||
text_rect.y1 += dy;
|
||||
text_rect.y2 += dy;
|
||||
|
||||
/* 绘图 */
|
||||
rtgui_dc_draw_text(dc, "飞线乱飞", &text_rect);
|
||||
@ -121,7 +123,7 @@ rtgui_container_t *demo_view_animation()
|
||||
if (container != RT_NULL)
|
||||
rtgui_object_set_event_handler(RTGUI_OBJECT(container), animation_event_handler);
|
||||
|
||||
rtgui_font_get_metrics(RTGUI_WIDGET_FONT(RTGUI_WIDGET(container)), "·ÉÏßÂÒ·É", &text_rect);
|
||||
rtgui_font_get_metrics(RTGUI_WIDGET_FONT(container), "·ÉÏßÂÒ·É", &text_rect);
|
||||
rtgui_rect_moveto(&text_rect, 0, 45);
|
||||
timer = rtgui_timer_create(2, RT_TIMER_FLAG_PERIODIC, timeout, (void *)container);
|
||||
|
||||
|
@ -28,7 +28,7 @@ void _onidle(struct rtgui_object *object, rtgui_event_t *event)
|
||||
draw_rect.y2 = RAND(draw_rect.y1, rect.y2);
|
||||
|
||||
color = RTGUI_RGB(rand() % 255, rand() % 255, rand() % 255);
|
||||
RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(container)) = color;
|
||||
RTGUI_WIDGET_BACKGROUND(container) = color;
|
||||
|
||||
rtgui_dc_fill_rect(dc, &draw_rect);
|
||||
|
||||
|
@ -44,12 +44,15 @@ static void timeout(struct rtgui_timer* timer, void* parameter)
|
||||
if (text_rect.y1 < rect.y1) dy = 1;
|
||||
|
||||
/* 移动文本框的位置 */
|
||||
text_rect.x1 += dx; text_rect.x2 += dx;
|
||||
text_rect.y1 += dy; text_rect.y2 += dy;
|
||||
text_rect.x1 += dx;
|
||||
text_rect.x2 += dx;
|
||||
text_rect.y1 += dy;
|
||||
text_rect.y2 += dy;
|
||||
|
||||
/* 绘图 */
|
||||
rect = text_rect;
|
||||
rect.x2 += 2; rect.y2 += 2;
|
||||
rect.x2 += 2;
|
||||
rect.y2 += 2;
|
||||
rtgui_dc_blit(dc_buffer, NULL, dc, &rect);
|
||||
|
||||
/* 绘图完成 */
|
||||
@ -117,20 +120,23 @@ struct rtgui_container *demo_view_buffer_animation(void)
|
||||
if (container != RT_NULL)
|
||||
rtgui_object_set_event_handler(RTGUI_OBJECT(container), animation_event_handler);
|
||||
|
||||
rtgui_font_get_metrics(RTGUI_WIDGET_FONT(RTGUI_WIDGET(container)), "»º³å¶¯»", &text_rect);
|
||||
rtgui_font_get_metrics(RTGUI_WIDGET_FONT(container), "»º³å¶¯»", &text_rect);
|
||||
if (dc_buffer == RT_NULL)
|
||||
{
|
||||
rtgui_rect_t rect;
|
||||
|
||||
rect.x1 = 0; rect.x2 = rtgui_rect_width(text_rect) + 2;
|
||||
rect.y1 = 0; rect.y2 = rtgui_rect_height(text_rect) + 2;
|
||||
rect.x1 = 0;
|
||||
rect.x2 = rtgui_rect_width(text_rect) + 2;
|
||||
rect.y1 = 0;
|
||||
rect.y2 = rtgui_rect_height(text_rect) + 2;
|
||||
|
||||
/* 创建 DC Buffer,长 50,宽 50 */
|
||||
dc_buffer = rtgui_dc_buffer_create(rtgui_rect_width(rect), rtgui_rect_height(rect));
|
||||
RTGUI_DC_FC(dc_buffer) = RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(container));
|
||||
RTGUI_DC_FC(dc_buffer) = RTGUI_WIDGET_BACKGROUND(container);
|
||||
rtgui_dc_fill_rect(dc_buffer, &rect);
|
||||
RTGUI_DC_FC(dc_buffer) = black;
|
||||
rect.x1 = 1; rect.y1 = 1;
|
||||
rect.x1 = 1;
|
||||
rect.y1 = 1;
|
||||
rtgui_dc_draw_text(dc_buffer, "缓冲动画", &rect);
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ rtgui_container_t* demo_view_button(void)
|
||||
/* 创建一个button控件 */
|
||||
button = rtgui_button_create("Red");
|
||||
/* 设置label控件的前景色为红色 */
|
||||
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(button)) = red;
|
||||
RTGUI_WIDGET_FOREGROUND(button) = red;
|
||||
/* 设置button的位置 */
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect);
|
||||
rtgui_container_add_child(container, RTGUI_WIDGET(button));
|
||||
@ -41,7 +41,7 @@ rtgui_container_t* demo_view_button(void)
|
||||
/* 创建一个button控件 */
|
||||
button = rtgui_button_create("Blue");
|
||||
/* 设置label控件的前景色为蓝色 */
|
||||
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(button)) = blue;
|
||||
RTGUI_WIDGET_FOREGROUND(button) = blue;
|
||||
/* 设置button的位置 */
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect);
|
||||
rtgui_container_add_child(container, RTGUI_WIDGET(button));
|
||||
@ -56,7 +56,7 @@ rtgui_container_t* demo_view_button(void)
|
||||
button = rtgui_button_create("12 font");
|
||||
/* 设置字体为12点阵的asc字体 */
|
||||
font = rtgui_font_refer("asc", 12);
|
||||
RTGUI_WIDGET_FONT(RTGUI_WIDGET(button)) = font;
|
||||
RTGUI_WIDGET_FONT(button) = font;
|
||||
/* 设置button的位置 */
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect);
|
||||
rtgui_container_add_child(container, RTGUI_WIDGET(button));
|
||||
@ -71,7 +71,7 @@ rtgui_container_t* demo_view_button(void)
|
||||
button = rtgui_button_create("16 font");
|
||||
/* 设置字体为16点阵的asc字体 */
|
||||
font = rtgui_font_refer("asc", 16);
|
||||
RTGUI_WIDGET_FONT(RTGUI_WIDGET(button)) = font;
|
||||
RTGUI_WIDGET_FONT(button) = font;
|
||||
/* 设置button的位置 */
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect);
|
||||
rtgui_container_add_child(container, RTGUI_WIDGET(button));
|
||||
|
@ -27,7 +27,7 @@ rtgui_container_t* demo_view_checkbox(void)
|
||||
/* 创建一个checkbox控件 */
|
||||
checkbox = rtgui_checkbox_create("Red", RT_TRUE);
|
||||
/* 设置前景色为红色 */
|
||||
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(checkbox)) = red;
|
||||
RTGUI_WIDGET_FOREGROUND(checkbox) = red;
|
||||
/* 设置checkbox的位置 */
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(checkbox), &rect);
|
||||
rtgui_container_add_child(container, RTGUI_WIDGET(checkbox));
|
||||
@ -41,7 +41,7 @@ rtgui_container_t* demo_view_checkbox(void)
|
||||
/* 创建一个checkbox控件 */
|
||||
checkbox = rtgui_checkbox_create("Blue", RT_TRUE);
|
||||
/* 设置前景色为蓝色 */
|
||||
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(checkbox)) = blue;
|
||||
RTGUI_WIDGET_FOREGROUND(checkbox) = blue;
|
||||
/* 设置checkbox的位置 */
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(checkbox), &rect);
|
||||
rtgui_container_add_child(container, RTGUI_WIDGET(checkbox));
|
||||
@ -56,7 +56,7 @@ rtgui_container_t* demo_view_checkbox(void)
|
||||
checkbox = rtgui_checkbox_create("12 font", RT_TRUE);
|
||||
/* 设置字体为12点阵 */
|
||||
font = rtgui_font_refer("asc", 12);
|
||||
RTGUI_WIDGET_FONT(RTGUI_WIDGET(checkbox)) = font;
|
||||
RTGUI_WIDGET_FONT(checkbox) = font;
|
||||
/* 设置checkbox的位置 */
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(checkbox), &rect);
|
||||
rtgui_container_add_child(container, RTGUI_WIDGET(checkbox));
|
||||
@ -71,7 +71,7 @@ rtgui_container_t* demo_view_checkbox(void)
|
||||
checkbox = rtgui_checkbox_create("16 font", RT_TRUE);
|
||||
/* 设置字体为16点阵 */
|
||||
font = rtgui_font_refer("asc", 16);
|
||||
RTGUI_WIDGET_FONT(RTGUI_WIDGET(checkbox)) = font;
|
||||
RTGUI_WIDGET_FONT(checkbox) = font;
|
||||
/* 设置checkbox的位置 */
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(checkbox), &rect);
|
||||
rtgui_container_add_child(container, RTGUI_WIDGET(checkbox));
|
||||
|
@ -63,8 +63,10 @@ rt_bool_t dc_event_handler(struct rtgui_object* object, rtgui_event_t *event)
|
||||
rtgui_rect_moveto(&rect, 80, 80);
|
||||
rtgui_image_blit((rtgui_image_t *)&play_image, dc, &rect);
|
||||
|
||||
rect.x1 = 0; rect.y1 = 0;
|
||||
rect.x2 = 0x1c; rect.y2 = 0x16;
|
||||
rect.x1 = 0;
|
||||
rect.y1 = 0;
|
||||
rect.x2 = 0x1c;
|
||||
rect.y2 = 0x16;
|
||||
rtgui_rect_moveto(&rect, 130, 80);
|
||||
rtgui_image_blit((rtgui_image_t *)&stop_image, dc, &rect);
|
||||
}
|
||||
|
120
examples/gui/demo_view_edit.c
Normal file
120
examples/gui/demo_view_edit.c
Normal file
@ -0,0 +1,120 @@
|
||||
/*
|
||||
* 程序清单:edit控件演示
|
||||
*
|
||||
* 这个例子会在conatiner上进行edit控件的演示
|
||||
*/
|
||||
|
||||
#include "demo_view.h"
|
||||
#include <rtgui/dc.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
#include <rtgui/widgets/edit.h>
|
||||
#include <rtgui/widgets/button.h>
|
||||
|
||||
void demo_edit_readin_file(struct rtgui_object *object, struct rtgui_event *event)
|
||||
{
|
||||
rtgui_button_t *button;
|
||||
struct rtgui_edit *edit;
|
||||
const char *filename = "/test_readin.txt";
|
||||
int fd;
|
||||
|
||||
RT_ASSERT(object != RT_NULL);
|
||||
button = RTGUI_BUTTON(object);
|
||||
/* 取得edit指针 */
|
||||
edit = RTGUI_EDIT(RTGUI_WIDGET(button)->user_data);
|
||||
|
||||
/* 判断文件是否存在 */
|
||||
fd = open(filename, O_RDONLY, 0);
|
||||
if (fd < 0)
|
||||
{
|
||||
/* 不存在存在,则创建它 */
|
||||
rt_kprintf("file:\"%s\" does not exist!\n", filename);
|
||||
|
||||
return;
|
||||
}
|
||||
close(fd);
|
||||
|
||||
rt_kprintf("read-in file:\"%s\"\n", filename);
|
||||
rtgui_edit_readin_file(edit, filename);
|
||||
}
|
||||
|
||||
void demo_edit_saveas_file(struct rtgui_object *object, struct rtgui_event *event)
|
||||
{
|
||||
rtgui_button_t *button;
|
||||
struct rtgui_edit *edit;
|
||||
const char* filename = "/test_saveas.txt";
|
||||
int fd;
|
||||
|
||||
RT_ASSERT(object != RT_NULL);
|
||||
button = RTGUI_BUTTON(object);
|
||||
/* 取得edit指针 */
|
||||
edit = RTGUI_EDIT(RTGUI_WIDGET(button)->user_data);
|
||||
|
||||
/* 判断文件是否存在, 如果存在则删除之 */
|
||||
fd = open(filename, O_RDONLY, 0);
|
||||
if (fd > 0)
|
||||
{
|
||||
close(fd);
|
||||
/* 如果是在win32中调试, 请手工删除该文件吧, NT中文件是只读的,unlink删除不掉 */
|
||||
if (unlink(filename) == -1)
|
||||
rt_kprintf("Could not delete %s\n", filename);
|
||||
}
|
||||
|
||||
rt_kprintf("save as file:\"%s\"\n", filename);
|
||||
rtgui_edit_saveas_file(edit, filename);
|
||||
}
|
||||
|
||||
/* 创建用于演示edit控件的视图 */
|
||||
rtgui_container_t *demo_view_edit(void)
|
||||
{
|
||||
rtgui_rect_t rect;
|
||||
rtgui_container_t *container;
|
||||
struct rtgui_edit *edit;
|
||||
struct rtgui_button *button;
|
||||
|
||||
/* 先创建一个演示用的视图 */
|
||||
container = demo_view("Edit View");
|
||||
|
||||
edit = rtgui_edit_create(container, 10, 35, 220, 200);
|
||||
rtgui_edit_set_text(edit,
|
||||
"Edit beta v0.1\n"
|
||||
"Hello RT-Thread\n"
|
||||
"this's edit demo\n"
|
||||
"rtgui_edit_create\n"
|
||||
"rtgui_edit_append_line\n"
|
||||
"rtgui_edit_insert_line\n"
|
||||
"rtgui_edit_delete_line\n"
|
||||
"rtgui_edit_connect_line\n"
|
||||
"a\n"
|
||||
"b\n"
|
||||
"c\n"
|
||||
"d\n"
|
||||
"1234567890\n");
|
||||
|
||||
/* 创建一个按钮, 读取某个文件 */
|
||||
demo_view_get_rect(container, &rect);
|
||||
rect.x1 += 10;
|
||||
rect.x2 = rect.x1 + 100;
|
||||
rect.y1 += 200;
|
||||
rect.y2 = rect.y1 + 22;
|
||||
button = rtgui_button_create("ReadIn File");
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect);
|
||||
rtgui_container_add_child(container, RTGUI_WIDGET(button));
|
||||
rtgui_button_set_onbutton(button, demo_edit_readin_file);
|
||||
/* 使用user_data传递edit指针 */
|
||||
RTGUI_WIDGET(button)->user_data = (rt_uint32_t)edit;
|
||||
|
||||
/* 创建一个按钮, 保存为某个文件 */
|
||||
demo_view_get_rect(container, &rect);
|
||||
rect.x1 += 130;
|
||||
rect.x2 = rect.x1 + 100;
|
||||
rect.y1 += 200;
|
||||
rect.y2 = rect.y1 + 22;
|
||||
button = rtgui_button_create("SaveAs File");
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect);
|
||||
rtgui_container_add_child(container, RTGUI_WIDGET(button));
|
||||
rtgui_button_set_onbutton(button, demo_edit_saveas_file);
|
||||
/* 使用user_data传递edit指针 */
|
||||
RTGUI_WIDGET(button)->user_data = (rt_uint32_t)edit;
|
||||
|
||||
return container;
|
||||
}
|
@ -87,7 +87,8 @@ static rt_bool_t demo_view_event_handler(rtgui_widget_t* widget, rtgui_event_t *
|
||||
demo_view_get_rect(RTGUI_CONTAINER(widget), &rect);
|
||||
|
||||
/* 获得图像显示区域 */
|
||||
rect.x1 += 5; rect.x2 -= 5;
|
||||
rect.x1 += 5;
|
||||
rect.x2 -= 5;
|
||||
rect.y1 += 30;
|
||||
|
||||
if (image != RT_NULL)
|
||||
@ -114,7 +115,8 @@ rtgui_container_t* demo_view_image(void)
|
||||
|
||||
/* 添加一个按钮 */
|
||||
demo_view_get_rect(_container, &rect);
|
||||
rect.x1 += 5; rect.x2 = rect.x1 + 120;
|
||||
rect.x1 += 5;
|
||||
rect.x2 = rect.x1 + 120;
|
||||
rect.y2 = rect.y1 + 20;
|
||||
open_btn = rtgui_button_create("打开图像文件");
|
||||
rtgui_container_add_child(RTGUI_CONTAINER(_container), RTGUI_WIDGET(open_btn));
|
||||
|
@ -26,9 +26,9 @@ rtgui_container_t* demo_view_label(void)
|
||||
/* 创建一个label控件 */
|
||||
label = rtgui_label_create("Red Left");
|
||||
/* 设置label控件上的文本对齐方式为:左对齐 */
|
||||
RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(label)) = RTGUI_ALIGN_LEFT;
|
||||
RTGUI_WIDGET_TEXTALIGN(label) = RTGUI_ALIGN_LEFT;
|
||||
/* 设置label控件的前景色为红色 */
|
||||
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(label)) = red;
|
||||
RTGUI_WIDGET_FOREGROUND(label) = red;
|
||||
/* 设置label的位置 */
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
|
||||
/* container是一个container控件,调用add_child方法添加这个label控件 */
|
||||
@ -43,9 +43,9 @@ rtgui_container_t* demo_view_label(void)
|
||||
/* 创建一个label控件 */
|
||||
label = rtgui_label_create("Blue Right");
|
||||
/* 设置label控件上的文本对齐方式为:右对齐 */
|
||||
RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(label)) = RTGUI_ALIGN_RIGHT;
|
||||
RTGUI_WIDGET_TEXTALIGN(label) = RTGUI_ALIGN_RIGHT;
|
||||
/* 设置label控件的前景色为蓝色 */
|
||||
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(label)) = blue;
|
||||
RTGUI_WIDGET_FOREGROUND(label) = blue;
|
||||
/* 设置label的位置 */
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
|
||||
/* container是一个container控件,调用add_child方法添加这个label控件 */
|
||||
@ -60,9 +60,9 @@ rtgui_container_t* demo_view_label(void)
|
||||
/* 创建一个label控件 */
|
||||
label = rtgui_label_create("Green Center");
|
||||
/* 设置label控件的前景色为绿色 */
|
||||
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(label)) = green;
|
||||
RTGUI_WIDGET_FOREGROUND(label) = green;
|
||||
/* 设置label控件上的文本对齐方式为:右对齐 */
|
||||
RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(label)) = RTGUI_ALIGN_CENTER_HORIZONTAL;
|
||||
RTGUI_WIDGET_TEXTALIGN(label) = RTGUI_ALIGN_CENTER_HORIZONTAL;
|
||||
/* 设置label的位置 */
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
|
||||
/* container是一个container控件,调用add_child方法添加这个label控件 */
|
||||
@ -78,7 +78,7 @@ rtgui_container_t* demo_view_label(void)
|
||||
label = rtgui_label_create("12 font");
|
||||
/* 设置字体为12点阵的asc字体 */
|
||||
font = rtgui_font_refer("asc", 12);
|
||||
RTGUI_WIDGET_FONT(RTGUI_WIDGET(label)) = font;
|
||||
RTGUI_WIDGET_FONT(label) = font;
|
||||
/* 设置label的位置 */
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
|
||||
/* container是一个container控件,调用add_child方法添加这个label控件 */
|
||||
@ -93,7 +93,7 @@ rtgui_container_t* demo_view_label(void)
|
||||
label = rtgui_label_create("16 font");
|
||||
/* 设置字体为16点阵的asc字体 */
|
||||
font = rtgui_font_refer("asc", 16);
|
||||
RTGUI_WIDGET_FONT(RTGUI_WIDGET(label)) = font;
|
||||
RTGUI_WIDGET_FONT(label) = font;
|
||||
/* 设置label的位置 */
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
|
||||
/* container是一个container控件,调用add_child方法添加这个label控件 */
|
||||
|
@ -8,7 +8,8 @@
|
||||
#include <rtgui/widgets/listbox.h>
|
||||
|
||||
static rtgui_image_t *item_icon = RT_NULL;
|
||||
static const char * image_xpm[] = {
|
||||
static const char *image_xpm[] =
|
||||
{
|
||||
"16 16 106 2",
|
||||
" c None",
|
||||
". c #D0C83F",
|
||||
@ -131,7 +132,8 @@ static const char * image_xpm[] = {
|
||||
" W @.l u I R #.Z Y U M ",
|
||||
" $.G I $.%.R &.Y *.& =. ",
|
||||
" -.;.>.,.L L ,.& M ",
|
||||
" "};
|
||||
" "
|
||||
};
|
||||
|
||||
static struct rtgui_listbox_item items[] =
|
||||
{
|
||||
|
@ -8,7 +8,8 @@
|
||||
#include <rtgui/widgets/listctrl.h>
|
||||
|
||||
static rtgui_image_t *item_icon = RT_NULL;
|
||||
static const char * image_xpm[] = {
|
||||
static const char *image_xpm[] =
|
||||
{
|
||||
"16 16 106 2",
|
||||
" c None",
|
||||
". c #D0C83F",
|
||||
@ -131,7 +132,8 @@ static const char * image_xpm[] = {
|
||||
" W @.l u I R #.Z Y U M ",
|
||||
" $.G I $.%.R &.Y *.& =. ",
|
||||
" -.;.>.,.L L ,.& M ",
|
||||
" "};
|
||||
" "
|
||||
};
|
||||
|
||||
static struct list_item
|
||||
{
|
||||
@ -178,16 +180,19 @@ void _rtgui_listctrl_item_draw(struct rtgui_listctrl *list,
|
||||
item = &items[index];
|
||||
|
||||
/* draw text */
|
||||
rtgui_dc_draw_text(dc, item->name, &item_rect); item_rect.x1 += 60;
|
||||
rtgui_dc_draw_text(dc, item->name, &item_rect);
|
||||
item_rect.x1 += 60;
|
||||
rtgui_dc_draw_vline(dc, item_rect.x1, item_rect.y1, item_rect.y2);
|
||||
|
||||
item_rect.x1 += 5;
|
||||
rtgui_dc_draw_text(dc, item->gender, &item_rect); item_rect.x1 += 60;
|
||||
rtgui_dc_draw_text(dc, item->gender, &item_rect);
|
||||
item_rect.x1 += 60;
|
||||
rtgui_dc_draw_vline(dc, item_rect.x1, item_rect.y1, item_rect.y2);
|
||||
|
||||
item_rect.x1 += 5;
|
||||
rt_snprintf(age_str, sizeof(age_str), "%d", item->age);
|
||||
rtgui_dc_draw_text(dc, age_str, &item_rect); item_rect.x1 += 40;
|
||||
rtgui_dc_draw_text(dc, age_str, &item_rect);
|
||||
item_rect.x1 += 40;
|
||||
rtgui_dc_draw_vline(dc, item_rect.x1, item_rect.y1, item_rect.y2);
|
||||
|
||||
item_rect.x1 += 5;
|
||||
@ -197,8 +202,10 @@ void _rtgui_listctrl_item_draw(struct rtgui_listctrl *list,
|
||||
{
|
||||
rtgui_rect_t image_rect;
|
||||
|
||||
image_rect.x1 = 0; image_rect.y1 = 0;
|
||||
image_rect.x2 = item->image->w; image_rect.y2 = item->image->h;
|
||||
image_rect.x1 = 0;
|
||||
image_rect.y1 = 0;
|
||||
image_rect.x2 = item->image->w;
|
||||
image_rect.y2 = item->image->h;
|
||||
rtgui_rect_moveto_align(&item_rect, &image_rect, RTGUI_ALIGN_CENTER_VERTICAL);
|
||||
rtgui_image_blit(item->image, dc, &image_rect);
|
||||
}
|
||||
|
@ -25,9 +25,11 @@ static const rtgui_menu_item_t items[] =
|
||||
{RTGUI_ITEM_NORMAL, "item #1", RT_NULL, RT_NULL, 0, RT_NULL},
|
||||
{RTGUI_ITEM_NORMAL, "item #2", RT_NULL, RT_NULL, 0, RT_NULL},
|
||||
{RTGUI_ITEM_SEPARATOR, RT_NULL, RT_NULL, RT_NULL, 0, RT_NULL},
|
||||
{RTGUI_ITEM_SUBMENU, "item #3", RT_NULL,
|
||||
{
|
||||
RTGUI_ITEM_SUBMENU, "item #3", RT_NULL,
|
||||
(struct rtgui_menu_item_t *)sub_items,
|
||||
sizeof(sub_items)/sizeof(sub_items[0]), RT_NULL},
|
||||
sizeof(sub_items) / sizeof(sub_items[0]), RT_NULL
|
||||
},
|
||||
};
|
||||
static rtgui_menu_t *menu;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* 程序清单:DC上显示图像演示
|
||||
* 3ìDò??μ¥£oDCé???ê?í????Yê?
|
||||
*
|
||||
* 这个例子会在创建出的view上显示图像
|
||||
* ?a??ày×ó?á?ú′′?¨3?μ?viewé???ê?í???
|
||||
*/
|
||||
|
||||
#include "demo_view.h"
|
||||
@ -13,59 +13,60 @@
|
||||
#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
|
||||
static rtgui_container_t *_view = RT_NULL;
|
||||
|
||||
/* 打开按钮的回调函数 */
|
||||
/* ′ò?a°′?¥μ???μ÷oˉêy */
|
||||
static void open_btn_onbutton(rtgui_widget_t *widget, struct rtgui_event *event)
|
||||
{
|
||||
rtgui_filelist_view_t *view;
|
||||
rtgui_workbench_t *workbench;
|
||||
rtgui_rect_t rect;
|
||||
|
||||
/* 获得顶层的workbench */
|
||||
/* ??μ??¥2?μ?workbench */
|
||||
workbench = RTGUI_WORKBENCH(rtgui_widget_get_toplevel(widget));
|
||||
rtgui_widget_get_rect(RTGUI_WIDGET(workbench), &rect);
|
||||
|
||||
/* WIN32平台上和真实设备上的初始路径处理 */
|
||||
/* WIN32??ì¨é?oí??êμéè±?é?μ?3?ê??·??′|àí */
|
||||
#ifdef _WIN32
|
||||
view = rtgui_filelist_view_create(workbench, "d:\\", "*.*", &rect);
|
||||
#else
|
||||
view = rtgui_filelist_view_create(workbench, "/", "*.*", &rect);
|
||||
#endif
|
||||
/* 模态显示一个文件列表视图,以提供给用户选择图像文件 */
|
||||
/* ?£ì???ê?ò??????táD±íêóí?£?ò?ìá1???ó??§????í??????t */
|
||||
if (rtgui_container_show(RTGUI_CONTAINER(view), RT_TRUE) == RTGUI_MODAL_OK)
|
||||
{
|
||||
char path[32], name[8];
|
||||
|
||||
/* 设置文件路径的标签 */
|
||||
/* éè?????t?·??μ?±ê?? */
|
||||
rtgui_filelist_view_get_fullpath(view, path, sizeof(path));
|
||||
|
||||
rt_memset(name, 0, sizeof(name));
|
||||
|
||||
/* 获得应用模块的类型 */
|
||||
/* ??μ?ó|ó??£?éμ?ààDí */
|
||||
if (rt_strstr(path, ".mo") != RT_NULL || rt_strstr(path, ".so") != RT_NULL)
|
||||
{
|
||||
rt_module_open(path);
|
||||
}
|
||||
}
|
||||
|
||||
/* 删除 文件列表 视图 */
|
||||
/* é?3y ???táD±í êóí? */
|
||||
rtgui_container_destroy(RTGUI_CONTAINER(view));
|
||||
rtgui_container_show(_view, RT_FALSE);
|
||||
}
|
||||
|
||||
/* 创建用于显示应用模块的演示视图 */
|
||||
/* ′′?¨ó?óú??ê?ó|ó??£?éμ??Yê?êóí? */
|
||||
rtgui_container_t *demo_view_module(rtgui_workbench_t *workbench)
|
||||
{
|
||||
rtgui_rect_t rect;
|
||||
rtgui_button_t *open_btn;
|
||||
|
||||
/* 先创建一个演示视图 */
|
||||
_view = demo_view(workbench, "应用模块演示");
|
||||
/* ?è′′?¨ò????Yê?êóí? */
|
||||
_view = demo_view(workbench, "ó|ó??£?é?Yê?");
|
||||
|
||||
/* 添加一个按钮 */
|
||||
/* ìí?óò???°′?¥ */
|
||||
demo_view_get_rect(_view, &rect);
|
||||
rect.x1 += 5; rect.x2 = rect.x1 + 120;
|
||||
rect.x1 += 5;
|
||||
rect.x2 = rect.x1 + 120;
|
||||
rect.y2 = rect.y1 + 20;
|
||||
open_btn = rtgui_button_create("打开应用模块");
|
||||
open_btn = rtgui_button_create("′ò?aó|ó??£?é");
|
||||
rtgui_container_add_child(RTGUI_CONTAINER(_view), RTGUI_WIDGET(open_btn));
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(open_btn), &rect);
|
||||
rtgui_button_set_onbutton(open_btn, open_btn_onbutton);
|
||||
|
@ -46,10 +46,13 @@ rtgui_container_t *demo_view_progressbar(void)
|
||||
demo_view_get_rect(container, &rect);
|
||||
label = rtgui_label_create("ˮƽ½ø¶ÈÌõ:");
|
||||
rtgui_container_add_child(container, RTGUI_WIDGET(label));
|
||||
rect.x1 += 5; rect.x2 -= 5;
|
||||
rect.y1 += 5; rect.y2 = rect.y1 + 18;
|
||||
rect.x1 += 5;
|
||||
rect.x2 -= 5;
|
||||
rect.y1 += 5;
|
||||
rect.y2 = rect.y1 + 18;
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
|
||||
rect.y1 += 20; rect.y2 = rect.y1 + 18;
|
||||
rect.y1 += 20;
|
||||
rect.y2 = rect.y1 + 18;
|
||||
hbar = rtgui_progressbar_create(RTGUI_HORIZONTAL, 100, &rect);
|
||||
rtgui_container_add_child(container, RTGUI_WIDGET(hbar));
|
||||
|
||||
@ -57,11 +60,15 @@ rtgui_container_t *demo_view_progressbar(void)
|
||||
demo_view_get_rect(container, &rect);
|
||||
label = rtgui_label_create("´¹Ö±½ø¶ÈÌõ:");
|
||||
rtgui_container_add_child(container, RTGUI_WIDGET(label));
|
||||
rect.x1 += 5; rect.x2 -= 5;
|
||||
rect.y1 += 45; rect.y2 = rect.y1 + 18;
|
||||
rect.x1 += 5;
|
||||
rect.x2 -= 5;
|
||||
rect.y1 += 45;
|
||||
rect.y2 = rect.y1 + 18;
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
|
||||
rect.x1 += 110; rect.x2 = rect.x1 + 20;
|
||||
rect.y1 += 18 + 5; rect.y2 = rect.y1 + 150;
|
||||
rect.x1 += 110;
|
||||
rect.x2 = rect.x1 + 20;
|
||||
rect.y1 += 18 + 5;
|
||||
rect.y2 = rect.y1 + 150;
|
||||
vbar = rtgui_progressbar_create(RTGUI_VERTICAL, 100, &rect);
|
||||
rtgui_container_add_child(container, RTGUI_WIDGET(vbar));
|
||||
|
||||
|
@ -18,10 +18,13 @@ rtgui_container_t *demo_view_scrollbar(void)
|
||||
demo_view_get_rect(container, &rect);
|
||||
label = rtgui_label_create("horizontal bar:");
|
||||
rtgui_container_add_child(container, RTGUI_WIDGET(label));
|
||||
rect.x1 += 5; rect.x2 -= 5;
|
||||
rect.y1 += 5; rect.y2 = rect.y1 + 18;
|
||||
rect.x1 += 5;
|
||||
rect.x2 -= 5;
|
||||
rect.y1 += 5;
|
||||
rect.y2 = rect.y1 + 18;
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
|
||||
rect.y1 += 20; rect.y2 = rect.y1 + 18;
|
||||
rect.y1 += 20;
|
||||
rect.y2 = rect.y1 + 18;
|
||||
hbar = rtgui_scrollbar_create(RTGUI_HORIZONTAL, &rect);
|
||||
rtgui_container_add_child(container, RTGUI_WIDGET(hbar));
|
||||
|
||||
@ -29,15 +32,19 @@ rtgui_container_t *demo_view_scrollbar(void)
|
||||
demo_view_get_rect(container, &rect);
|
||||
label = rtgui_label_create("vertical bar:");
|
||||
rtgui_container_add_child(container, RTGUI_WIDGET(label));
|
||||
rect.x1 += 5; rect.x2 -= 5;
|
||||
rect.y1 += 45; rect.y2 = rect.y1 + 18;
|
||||
rect.x1 += 5;
|
||||
rect.x2 -= 5;
|
||||
rect.y1 += 45;
|
||||
rect.y2 = rect.y1 + 18;
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
|
||||
rect.x1 += 110; rect.x2 = rect.x1 + 20;
|
||||
rect.y1 += 18 + 5; rect.y2 = rect.y1 + 150;
|
||||
rect.x1 += 110;
|
||||
rect.x2 = rect.x1 + 20;
|
||||
rect.y1 += 18 + 5;
|
||||
rect.y2 = rect.y1 + 150;
|
||||
vbar = rtgui_scrollbar_create(RTGUI_VERTICAL, &rect);
|
||||
rtgui_container_add_child(container, RTGUI_WIDGET(vbar));
|
||||
rtgui_scrollbar_set_line_step(vbar, 1);
|
||||
// RTGUI_WIDGET_DISABLE(RTGUI_WIDGET(vbar));
|
||||
// RTGUI_WIDGET_DISABLE(vbar);
|
||||
|
||||
return container;
|
||||
}
|
||||
|
@ -17,10 +17,13 @@ rtgui_container_t *demo_view_slider(void)
|
||||
demo_view_get_rect(container, &rect);
|
||||
label = rtgui_label_create("horizontal slider:");
|
||||
rtgui_container_add_child(container, RTGUI_WIDGET(label));
|
||||
rect.x1 += 5; rect.x2 -= 5;
|
||||
rect.y1 += 5; rect.y2 = rect.y1 + 18;
|
||||
rect.x1 += 5;
|
||||
rect.x2 -= 5;
|
||||
rect.y1 += 5;
|
||||
rect.y2 = rect.y1 + 18;
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
|
||||
rect.y1 += 20; rect.y2 = rect.y1 + 18;
|
||||
rect.y1 += 20;
|
||||
rect.y2 = rect.y1 + 18;
|
||||
slider = rtgui_slider_create(0, 100, RTGUI_HORIZONTAL);
|
||||
rtgui_container_add_child(container, RTGUI_WIDGET(slider));
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(slider), &rect);
|
||||
@ -29,11 +32,15 @@ rtgui_container_t *demo_view_slider(void)
|
||||
demo_view_get_rect(container, &rect);
|
||||
label = rtgui_label_create("vertical slider:");
|
||||
rtgui_container_add_child(container, RTGUI_WIDGET(label));
|
||||
rect.x1 += 5; rect.x2 -= 5;
|
||||
rect.y1 += 50; rect.y2 = rect.y1 + 18;
|
||||
rect.x1 += 5;
|
||||
rect.x2 -= 5;
|
||||
rect.y1 += 50;
|
||||
rect.y2 = rect.y1 + 18;
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
|
||||
rect.x1 += 110; rect.x2 = rect.x1 + 20;
|
||||
rect.y1 += 18 + 5; rect.y2 = rect.y1 + 150;
|
||||
rect.x1 += 110;
|
||||
rect.x2 = rect.x1 + 20;
|
||||
rect.y1 += 18 + 5;
|
||||
rect.y2 = rect.y1 + 150;
|
||||
slider = rtgui_slider_create(0, 100, RTGUI_VERTICAL);
|
||||
rtgui_container_add_child(container, RTGUI_WIDGET(slider));
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(slider), &rect);
|
||||
|
@ -88,7 +88,7 @@ rtgui_container_t *demo_view_ttf()
|
||||
container = demo_view("TTF 演示");
|
||||
if (container != RT_NULL)
|
||||
{
|
||||
RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(container)) = white;
|
||||
RTGUI_WIDGET_BACKGROUND(container) = white;
|
||||
/* 设置成自己的事件处理函数 */
|
||||
rtgui_object_set_event_handler(RTGUI_OBJECT(container), ttf_event_handler);
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ static void demo_normal_window_onbutton(struct rtgui_object* object, rtgui_event
|
||||
"第 %d 次显示", normal_window_show_count);
|
||||
rtgui_label_set_text(normal_window_label,
|
||||
normal_window_label_text);
|
||||
if (RTGUI_WIDGET_IS_HIDE(RTGUI_WIDGET(normal_window)))
|
||||
if (RTGUI_WIDGET_IS_HIDE(normal_window))
|
||||
rtgui_win_show(normal_window, RT_FALSE);
|
||||
else
|
||||
rtgui_win_activate(normal_window);
|
||||
@ -119,6 +119,10 @@ static void demo_autowin_onbutton(struct rtgui_object* object, rtgui_event_t* ev
|
||||
{
|
||||
struct rtgui_rect rect = {50, 50, 200, 200};
|
||||
|
||||
/* don't create the window twice */
|
||||
if (msgbox)
|
||||
return;
|
||||
|
||||
msgbox = rtgui_win_create(main_win, "Information",
|
||||
&rect, RTGUI_WIN_STYLE_DEFAULT | RTGUI_WIN_STYLE_DESTROY_ON_CLOSE);
|
||||
if (msgbox == RT_NULL)
|
||||
@ -203,17 +207,17 @@ static void demo_ntitlewin_onbutton(struct rtgui_object* object, rtgui_event_t*
|
||||
"no title", &rect, RTGUI_WIN_STYLE_NO_TITLE |
|
||||
RTGUI_WIN_STYLE_NO_BORDER |
|
||||
RTGUI_WIN_STYLE_DESTROY_ON_CLOSE);
|
||||
RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(win)) = white;
|
||||
RTGUI_WIDGET_BACKGROUND(win) = white;
|
||||
|
||||
/* 创建一个文本标签 */
|
||||
label = rtgui_label_create("无边框窗口");
|
||||
rtgui_font_get_metrics(RTGUI_WIDGET_FONT(RTGUI_WIDGET(label)), "Îޱ߿ò´°¿Ú", &widget_rect);
|
||||
rtgui_font_get_metrics(RTGUI_WIDGET_FONT(label), "Îޱ߿ò´°¿Ú", &widget_rect);
|
||||
rtgui_rect_moveto_align(&rect, &widget_rect, RTGUI_ALIGN_CENTER_HORIZONTAL);
|
||||
widget_rect.y1 += 20;
|
||||
widget_rect.y2 += 20;
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(label), &widget_rect);
|
||||
rtgui_container_add_child(RTGUI_CONTAINER(win), RTGUI_WIDGET(label));
|
||||
RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(label)) = white;
|
||||
RTGUI_WIDGET_BACKGROUND(label) = white;
|
||||
|
||||
/* 创建一个关闭按钮 */
|
||||
widget_rect.x1 = 0;
|
||||
|
@ -1,19 +0,0 @@
|
||||
#include <rtgui/rtgui.h>
|
||||
#include <rtgui/rtgui_server.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
|
||||
extern void workbench_init(void);
|
||||
extern void panel_init(void);
|
||||
|
||||
/* GUI相关演示入口,需放在线程中进行初始化 */
|
||||
void rtgui_startup()
|
||||
{
|
||||
/* GUI系统初始化 */
|
||||
rtgui_system_server_init();
|
||||
|
||||
/* 各个面板初始化 */
|
||||
panel_init();
|
||||
|
||||
/* 启动workbench */
|
||||
workbench_init();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user