Пример #1
0
rtgui_view_t *demo_gui_slider(rtgui_view_t* parent_view)
{
	rtgui_view_t *view;

	/* create a demo view */
	view = demo_view_create(parent_view, "Slider View");

	rtgui_label_create(view, "horizontal slider:", 5, 40, 150, 20);
	rtgui_slider_create(view, 0, 100, 5, 60, 100, 16, RTGUI_HORIZONTAL);

	rtgui_label_create(view, "vertical slider:", 5, 80, 150, 20);
	rtgui_slider_create(view, 0, 100, 10, 100, 16, 80, RTGUI_VERTICAL);

	return view;
}
Пример #2
0
/* 触发模态窗口显示 */
static void demo_modalwin_onbutton(struct rtgui_object *object, rtgui_event_t *event)
{
    rtgui_win_t *win;
    rtgui_label_t *label;
    rtgui_rect_t rect = {0, 0, 150, 80};

    rtgui_rect_moveto(&rect, delta_x, delta_y);
    delta_x += 20;
    delta_y += 20;

    /* 创建一个窗口 */
    win = rtgui_win_create(main_win,
                           get_win_title(), &rect, RTGUI_WIN_STYLE_DEFAULT);

    rect.x1 += 20;
    rect.x2 -= 5;
    rect.y1 += 5;
    rect.y2 = rect.y1 + 20;

    label = rtgui_label_create("这是一个模式窗口");
    rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
    rtgui_container_add_child(RTGUI_CONTAINER(win), RTGUI_WIDGET(label));

    /* 模态显示窗口 */
    rtgui_win_show(win, RT_TRUE);

    /* 删除非自动删除窗口 */
    rtgui_win_destroy(win);
}
Пример #3
0
/* 触发自动窗口显示 */
static void demo_autowin_onbutton(struct rtgui_object *object, rtgui_event_t *event)
{
    struct rtgui_rect rect = {50, 50, 200, 200};

    /* don't create the window twice */
    if (autowin)
        return;

    autowin = rtgui_win_create(main_win, "Information",
                              &rect, RTGUI_WIN_STYLE_DEFAULT | RTGUI_WIN_STYLE_DESTROY_ON_CLOSE);
    if (autowin == RT_NULL)
        return;

    cnt = 5;
    rt_sprintf(label_text, "closed then %d second!", cnt);
    label = rtgui_label_create(label_text);
    rect.x1 += 5;
    rect.x2 -= 5;
    rect.y1 += 5;
    rect.y2 = rect.y1 + 20;
    rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
    rtgui_container_add_child(RTGUI_CONTAINER(autowin),
                              RTGUI_WIDGET(label));

    /* 设置关闭窗口时的动作 */
    rtgui_win_set_onclose(autowin, auto_window_close);

    rtgui_win_show(autowin, RT_FALSE);
    /* 创建一个定时器 */
    timer = rtgui_timer_create(100, RT_TIMER_FLAG_PERIODIC, diag_close, RT_NULL);
    rtgui_timer_start(timer);
}
Пример #4
0
/* 列表项的动作函数 */
static void listitem_action(rtgui_widget_t *widget, void *parameter)
{
    char label_text[32];
    rtgui_win_t *win;
    rtgui_label_t *label;
    rtgui_rect_t rect = {0, 0, 150, 80};
    int no = (int)parameter;

    rtgui_rect_moveto(&rect, 20, 50);

    /* 显示消息窗口 */
    win = rtgui_win_create(main_win,
                           "窗口", &rect, RTGUI_WIN_STYLE_DEFAULT);

    rect.x1 += 20;
    rect.x2 -= 5;
    rect.y1 += 5;
    rect.y2 = rect.y1 + 20;

    /* 添加相应的标签 */
    rt_sprintf(label_text, "动作 %d", no);
    label = rtgui_label_create(label_text);

    rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
    rtgui_container_add_child(win, RTGUI_WIDGET(label));

    /* 非模态显示窗口 */
    rtgui_win_show(win, RT_FALSE);
}
Пример #5
0
/* 触发正常窗口显示 */
static void demo_win_onbutton(struct rtgui_widget* widget, rtgui_event_t* event)
{
	rtgui_win_t *win;
	rtgui_label_t *label;
	rtgui_toplevel_t *parent;
	rtgui_rect_t rect = {0, 0, 150, 80};

	parent = RTGUI_TOPLEVEL(rtgui_widget_get_toplevel(widget));
	rtgui_rect_moveto(&rect, delta_x, delta_y);
	delta_x += 20;
	delta_y += 20;

	/* 创建一个窗口 */
	win = rtgui_win_create(parent,
		get_win_title(), &rect, RTGUI_WIN_STYLE_DEFAULT);

	rect.x1 += 20;
	rect.x2 -= 5;
	rect.y1 += 5;
	rect.y2 = rect.y1 + 20;

	/* 添加一个文本标签 */
	label = rtgui_label_create("这是一个普通窗口");
	rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
	rtgui_container_add_child(RTGUI_CONTAINER(win), RTGUI_WIDGET(label));

	/* 非模态显示窗口 */
	rtgui_win_show(win, RT_FALSE);
}
Пример #6
0
/* 触发自动窗口显示 */
static void demo_autowin_onbutton(struct rtgui_widget* widget, rtgui_event_t* event)
{
	rtgui_toplevel_t *parent;
	struct rtgui_rect rect ={50, 50, 200, 200};

	parent = RTGUI_TOPLEVEL(rtgui_widget_get_toplevel(widget));
	msgbox = rtgui_win_create(parent, "Information", &rect, RTGUI_WIN_STYLE_DEFAULT);
	if (msgbox != RT_NULL)
	{
		cnt = 5;
		rt_sprintf(label_text, "closed then %d second!", cnt);
		label = rtgui_label_create(label_text);
		rect.x1 += 5;
		rect.x2 -= 5;
		rect.y1 += 5;
		rect.y2 = rect.y1 + 20;
		rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
		rtgui_container_add_child(RTGUI_CONTAINER(msgbox), RTGUI_WIDGET(label));

		rtgui_win_show(msgbox, RT_FALSE);
	}

	/* 创建一个定时器 */
	timer = rtgui_timer_create(100, RT_TIMER_FLAG_PERIODIC, diag_close, RT_NULL);
	rtgui_timer_start(timer);
}
Пример #7
0
rt_bool_t show_modal_info(struct rtgui_widget *object, struct rtgui_event *event)
{
	rtgui_label_t *label;
	struct rtgui_win *win;
	rtgui_rect_t rect = {0, 60, 150, 100};
	win = rtgui_win_create(main_win,
						   "Info",
						   &rect,
						   RTGUI_WIN_STYLE_DEFAULT);

	rect.x1 += 20;
	rect.x2 -= 5;
	rect.y1 += 5;
	rect.y2 = rect.y1 + 20;

	label = rtgui_label_create("modal mode info");
	rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
	rtgui_container_add_child(RTGUI_CONTAINER(win), RTGUI_WIDGET(label));

	rtgui_win_show(win, RT_TRUE);

	rtgui_win_destroy(win);

	return RT_TRUE;
}
Пример #8
0
int creat_software_ver_not_match_win(struct rtgui_widget* widget)
{
	rtgui_rect_t rect = {60, 45, 260, 160};
	rtgui_label_t *label1;
	rtgui_label_t *label2;
	rtgui_toplevel_t *parent;

	if (RT_NULL != software_version_not_match_win)
		return FAIL;

	parent = RTGUI_TOPLEVEL(rtgui_widget_get_toplevel(widget));

	software_version_not_match_win = rtgui_win_create(parent,
		"致命错误", &rect, RTGUI_WIN_STYLE_MODAL);

	rtgui_widget_get_extent(RTGUI_WIDGET(software_version_not_match_win),&rect);
	rect.x1 += 20;
	rect.x2 -= 20;
	rect.y1 += 20;
	rect.y2 = rect.y1 + 30;
	label1 = rtgui_label_create("接收端与lcd软件版本");
	if (NULL != label1) {
		rtgui_widget_set_rect(RTGUI_WIDGET(label1), &rect);
		rtgui_container_add_child(RTGUI_CONTAINER(software_version_not_match_win), RTGUI_WIDGET(label1));
	}

	rtgui_widget_get_extent(RTGUI_WIDGET(software_version_not_match_win),&rect);
	rect.x1 += 70;
	rect.x2 -= 30;
	rect.y1 += 50;
	rect.y2 = rect.y1 + 30;
	label2 = rtgui_label_create("不匹配!");
	if (NULL != label2) {
		rtgui_widget_set_rect(RTGUI_WIDGET(label2), &rect);
		rtgui_container_add_child(RTGUI_CONTAINER(software_version_not_match_win), RTGUI_WIDGET(label2));
	}

	send_cmd_to_rxe(1, SWITCH2PT);

	rtgui_win_show(software_version_not_match_win, RT_TRUE);

	rtgui_win_destroy(software_version_not_match_win);
	software_version_not_match_win = RT_NULL;

	return SUCC;
}
rtgui_container_t *demo_view_scrollbar(void)
{
    rtgui_container_t *container;
    rtgui_rect_t rect;
    rtgui_label_t *label;
    rtgui_scrollbar_t *hbar;
    rtgui_scrollbar_t *vbar;

    /* create a demo container */
    container = demo_view("ScrollBar View");

    /* get demo container rect */
    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;
    rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
    rect.y1 += 20;
    rect.y2 = rect.y1 + 18;
    hbar = rtgui_scrollbar_create(RTGUI_HORIZONTAL, &rect);
    rtgui_container_add_child(container, RTGUI_WIDGET(hbar));

    /* get demo container rect */
    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;
    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;
    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(vbar);

    return container;
}
rtgui_view_t *demo_view_progressbar(rtgui_workbench_t* workbench)
{
	rtgui_view_t *view;
	rtgui_rect_t rect;
	rtgui_label_t *label;

	/* create a demo view */
	view = demo_view(workbench, "ProgressBar View");

	/* get demo view rect */
	demo_view_get_rect(view, &rect);
	label = rtgui_label_create("邦峠序業訳:");
	rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
	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;
	hbar = rtgui_progressbar_create(RTGUI_HORIZONTAL, 100, &rect);
	rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(hbar));

	/* get demo view rect */
	demo_view_get_rect(view, &rect);
	label = rtgui_label_create("換岷序業訳:");
	rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
	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;
	vbar = rtgui_progressbar_create(RTGUI_VERTICAL, 100, &rect);
	rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(vbar));

	bar_timer = rtgui_timer_create(50, RT_TIMER_FLAG_PERIODIC,
								   progressbar_timeout, RT_NULL);
	rtgui_timer_start(bar_timer);

	return view;
}
Пример #11
0
rtgui_view_t *demo_view_slider(rtgui_workbench_t* workbench)
{
	rtgui_view_t *view;
	rtgui_rect_t rect;
	rtgui_label_t *label;
	rtgui_slider_t *slider;

	/* create a demo view */
	view = demo_view(workbench, "Slider View");

	/* get demo view rect */
	demo_view_get_rect(view, &rect);
	label = rtgui_label_create("horizontal slider:");
	rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
	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;
	slider = rtgui_slider_create(0, 100, RTGUI_HORIZONTAL);
	rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(slider));
	rtgui_widget_set_rect(RTGUI_WIDGET(slider), &rect);

	/* get demo view rect */
	demo_view_get_rect(view, &rect);
	label = rtgui_label_create("vertical slider:");
	rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
	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;
	slider = rtgui_slider_create(0, 100, RTGUI_VERTICAL);
	rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(slider));
	rtgui_widget_set_rect(RTGUI_WIDGET(slider), &rect);

	return view;
}
Пример #12
0
/* 创建用于演示label控件的视图 */
rtgui_view_t* demo_gui_label(rtgui_view_t* parent_view)
{
	rtgui_view_t* view;
	rtgui_label_t* label;
	rtgui_font_t* font;

	/* 先创建一个演示用的视图 */
	view = demo_view_create(parent_view, "Label View");

	/* 创建一个label控件 */
	label = rtgui_label_create(view, "Red Left", 10, 40, 200, 20);
	/* 设置label控件上的文本对齐方式为:左对齐 */
	RTGUI_WIDGET_TEXTALIGN(label) = RTGUI_ALIGN_LEFT|RTGUI_ALIGN_CENTER_VERTICAL;
	/* 设置label控件的前景色为红色 */
	RTGUI_WIDGET_FOREGROUND(label) = red;
	RTGUI_WIDGET_BACKGROUND(label) = white;


	label = rtgui_label_create(view, "Blue Right", 10, 65, 200, 20);
	RTGUI_WIDGET_TEXTALIGN(label) = RTGUI_ALIGN_RIGHT|RTGUI_ALIGN_CENTER_VERTICAL;
	RTGUI_WIDGET_FOREGROUND(label) = blue;
	RTGUI_WIDGET_BACKGROUND(label) = white;

	label = rtgui_label_create(view, "Green Center", 10, 90, 200, 20);
	RTGUI_WIDGET_TEXTALIGN(label) = RTGUI_ALIGN_CENTER_HORIZONTAL|RTGUI_ALIGN_CENTER_VERTICAL;
	RTGUI_WIDGET_FOREGROUND(label) = green;
	RTGUI_WIDGET_BACKGROUND(label) = white;

	label = rtgui_label_create(view, "12 font",10, 115, 200, 20);
	/* 设置字体为12点阵的asc字体 */
	font = rtgui_font_refer("asc", 12);
	RTGUI_WIDGET_FONT(label) = font;
	RTGUI_WIDGET_BACKGROUND(label) = white;

	label = rtgui_label_create(view, "16 font", 10, 140, 200, 20);
	font = rtgui_font_refer("asc", 16);
	RTGUI_WIDGET_FONT(RTGUI_WIDGET(label)) = font;
	RTGUI_WIDGET_BACKGROUND(label) = white;

	return view;
}
Пример #13
0
/* 创建用于演示textbox控件的视图 */
rtgui_view_t* demo_gui_textbox(rtgui_view_t* parent_view)
{
	rtgui_view_t* view;
	
	/* 先创建一个演示用的视图 */
	view = demo_view_create(parent_view, "TextBox View");

	rtgui_label_create(view, "名字: ", 5, 40, 50, 20);
	rtgui_textbox_create(view, "bernard",5, 60, 200, 20, RTGUI_TEXTBOX_NONE);

	rtgui_label_create(view, "邮件: ", 5, 80, 50, 20);
	rtgui_textbox_create(view, "*****@*****.**", 5, 100, 200, 20, RTGUI_TEXTBOX_NONE);

	rtgui_label_create(view, "密码: ", 5, 120, 50, 20);
	rtgui_textbox_create(view, "rt-thread", 5, 140, 200, 20, RTGUI_TEXTBOX_MASK);

	rtgui_label_create(view, "主页: ", 5, 160, 50, 20);
	rtgui_textbox_create(view, "http://www.rt-thread.org", 5, 180, 200, 20, RTGUI_TEXTBOX_NONE);

	return view;
}
Пример #14
0
static void app_lcd(void *parameter)
{
    /* create application */
	struct rtgui_app *app;
    struct rtgui_rect rect1 = {0, 0, 240, 320};
    struct rtgui_button* btn;
    struct rtgui_label *lb;

	app = rtgui_app_create("lcd_app");

    if (!app)
    {
        rt_kprintf("Create application \"lcd_app\" failed!\n");
        return;
    }

    /* create main window */
    win_main = rtgui_win_create(RT_NULL, "main",
                    &rect1,
                    RTGUI_WIN_STYLE_NO_BORDER | RTGUI_WIN_STYLE_NO_TITLE);
    if (win_main == RT_NULL)
    {
        rt_kprintf("Create window \"main\" failed!\n");
        rtgui_app_destroy(app);
        return;
    }
    RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(win_main)) = green;

    rect1.x1 = rect1.y1 = 50;
    rect1.x2 -= 50;
    rect1.y2 -= 50;
    lb = rtgui_label_create("I am a transparent label!!!!!!!!!");
    rtgui_widget_set_rect(RTGUI_WIDGET(lb), &rect1);
    RTGUI_WIDGET_FLAG(RTGUI_WIDGET(lb)) |= RTGUI_WIDGET_FLAG_TRANSPARENT;

    rect1.x1 += 20;
    rect1.y1 += 20;
	notebook = rtgui_notebook_create(&rect1, 0);
    /* create lable in main container */
    btn = rtgui_button_create("Here I am.");
    rtgui_notebook_add(notebook, "btn A", RTGUI_WIDGET(btn));
    rtgui_button_set_onbutton(btn, remove_myself);
    btn = rtgui_button_create("There I am.");
    rtgui_notebook_add(notebook, "btn B", RTGUI_WIDGET(btn));

    rtgui_container_add_child(RTGUI_CONTAINER(win_main), RTGUI_WIDGET(lb));
	rtgui_container_add_child(RTGUI_CONTAINER(win_main), RTGUI_WIDGET(notebook));

    rtgui_win_show(win_main, RT_FALSE);

    rtgui_app_run(app);
    rtgui_app_destroy(app);
}
rtgui_container_t *demo_view_progressbar(void)
{
	rtgui_container_t *container;
	rtgui_rect_t rect;
	rtgui_label_t *label;

	/* create a demo container */
	container = demo_view("ProgressBar View");

	/* get demo container rect */
	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;
	rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
	rect.y1 += 20; rect.y2 = rect.y1 + 18;
	hbar = rtgui_progressbar_create(RTGUI_HORIZONTAL, 100, &rect);
	rtgui_container_add_child(container, RTGUI_WIDGET(hbar));

	/* get demo container rect */
	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;
	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;
	vbar = rtgui_progressbar_create(RTGUI_VERTICAL, 100, &rect);
	rtgui_container_add_child(container, RTGUI_WIDGET(vbar));

	bar_timer = rtgui_timer_create(50, RT_TIMER_FLAG_PERIODIC,
										progressbar_timeout, RT_NULL);

	rtgui_widget_set_onshow(RTGUI_WIDGET(container), start_timer);
	rtgui_widget_set_onhide(RTGUI_WIDGET(container), stop_timer);

	return container;
}
rtgui_view_t *demo_gui_scrollbar(rtgui_view_t* parent_view)
{
	rtgui_view_t *view;
	rtgui_scrollbar_t* hbar;
	rtgui_scrollbar_t* vbar;

	/* create a demo view */
	view = demo_view_create(parent_view, "ScrollBar View");
	
	rtgui_label_create(view, "horizontal bar:", 5, 40, 150, 20);
	hbar = rtgui_scrollbar_create(view, 5, 65, 20, 100, RTGUI_HORIZONTAL);
	rtgui_scrollbar_set_range(hbar, 10);
	rtgui_scrollbar_set_page_step(hbar, 5);
	rtgui_scrollbar_set_line_step(hbar, 1);

	rtgui_label_create(view, "vertical bar:", 5, 90, 150, 20);
	vbar = rtgui_scrollbar_create(view, 10, 115, 20, 80, RTGUI_VERTICAL);
	rtgui_scrollbar_set_range(vbar, 5);
	rtgui_scrollbar_set_page_step(vbar, 3);
	rtgui_scrollbar_set_line_step(vbar, 1);

	return view;
}
rtgui_view_t *demo_gui_progressbar(rtgui_view_t* parent_view)
{
	rtgui_view_t *view;
	rtgui_progressbar_t *hbar, *vbar;
	rtgui_timer_t *timer = RT_NULL;
	
	/* create a demo view */
	view = demo_view_create(parent_view, "ProgressBar View");
	
	rtgui_label_create(view, "邦峠序業訳:", 5, 40, 100, 20);
	hbar = rtgui_progressbar_create(view, RTGUI_HORIZONTAL, 100, 10, 70, 150, 15);

	rtgui_label_create(view, "換岷序業訳:", 5, 90, 100, 20);
	vbar = rtgui_progressbar_create(view, RTGUI_VERTICAL, 100, 10, 110, 15, 60);

	timer = rtgui_timer_create(20, RT_TIMER_FLAG_PERIODIC, hbar_timeout, hbar);
	rtgui_timer_start(timer);

	timer = rtgui_timer_create(20, RT_TIMER_FLAG_PERIODIC, vbar_timeout, vbar);
	rtgui_timer_start(timer);

	return view;
}
rtgui_container_t* demo_view_box(void)
{
    rtgui_rect_t  rect;
    rtgui_container_t* view;
	struct rtgui_panel *panel;
	struct rtgui_box *box;

	struct rtgui_label *label;
	struct rtgui_button *button;

    view = demo_view("Box View");
    demo_view_get_rect(view, &rect);

	panel = rtgui_panel_create(RTGUI_BORDER_NONE);
	rtgui_widget_set_rect(RTGUI_WIDGET(panel), &rect);
	rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(panel));

	box = rtgui_box_create(RTGUI_VERTICAL, 5);
	rtgui_container_set_box(RTGUI_CONTAINER(panel), box);

	label = rtgui_label_create("label 1");
	rtgui_container_add_child(RTGUI_CONTAINER(panel), RTGUI_WIDGET(label));
	label = rtgui_label_create("label 2");
	rtgui_container_add_child(RTGUI_CONTAINER(panel), RTGUI_WIDGET(label));

	button = rtgui_button_create("button 1");
	rtgui_container_add_child(RTGUI_CONTAINER(panel), RTGUI_WIDGET(button));

	button = rtgui_button_create("button 2");
	rtgui_container_add_child(RTGUI_CONTAINER(panel), RTGUI_WIDGET(button));
	rtgui_widget_set_miniheight(RTGUI_WIDGET(button), 25);
	RTGUI_WIDGET_ALIGN(button) = RTGUI_ALIGN_EXPAND;

	rtgui_container_layout(RTGUI_CONTAINER(panel));

    return view;
}
Пример #19
0
static void gui_win_entry(void* parameter)
{
	const struct rtgui_graphic_driver* gd = rtgui_graphic_driver_get_default();
	struct rt_messagequeue *mq;
	rtgui_win_t *win;
	rtgui_button_t *button;
	rtgui_point_t p;
	rtgui_rect_t rect = {0,0,200,180};
	rtgui_label_t *label;
	rtgui_font_t *font;
	
	/* 创建GUI应用需要的消息队列 */
	mq = rt_mq_create("demo_win", 256, 32, RT_IPC_FLAG_FIFO);
	/* 注册当前线程 */
	rtgui_thread_register(rt_thread_self(), mq);

	/* 窗口居中 */
	rtgui_rect_moveto(&rect, (gd->width - rtgui_rect_width(rect))/2, (gd->height - rtgui_rect_height(rect))/2);
	/* 创建窗口 */
	win = rtgui_win_create(RT_NULL,"demo_win",&rect,RTGUI_WIN_DEFAULT);
	if(win == RT_NULL) return;
 
	/* 取得客户区坐标零点 */
	p = rtgui_win_get_client_zero(win);
	label = rtgui_label_create(win, "hello world!", p.x+5, p.y+5, 100,25);
	font = rtgui_font_refer("asc", 12);	
	RTGUI_WIDGET_FONT(label) = font;

	button = rtgui_button_create(win, "Exit", (rtgui_rect_width(rect)-50)/2,
								rtgui_rect_height(rect)-40,50,25);
	rtgui_button_set_onbutton(button,rtgui_win_close);

	rtgui_widget_set_event_handler(win, demo_gui_win_event_handler);
	
	rtgui_win_show(win,RT_FALSE);
	
	/* 执行工作台事件循环 */
	rtgui_win_event_loop(win);

	demo_win_inited = RT_FALSE;
	
	/* 去注册GUI线程 */
	rtgui_thread_deregister(rt_thread_self());
	rt_mq_delete(mq);
}
Пример #20
0
void workbench_panel1(void* parameter)
{
	rt_mq_t mq;
	rtgui_view_t* view;
	rtgui_label_t* label;
	struct rtgui_workbench* workbench;
	rtgui_rect_t rect;

	mq = rt_mq_create("wmq", 256, 8, RT_IPC_FLAG_FIFO);
	/* 注册当前线程为GUI线程 */
	rtgui_thread_register(rt_thread_self(), mq);
	/* 创建一个工作台 */
	workbench = rtgui_workbench_create("main", "workbench #1");
	if (workbench == RT_NULL) return;

	view = rtgui_view_create("view");
	if (view == RT_NULL) return;
	/* 指定视图的背景色 */
	RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(view)) = white;

	/* 添加一个label */
	label = rtgui_label_create("hello RT-Thread!");
	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));

	/* 添加到父workbench中 */
	rtgui_workbench_add_view(workbench, view);
	/* 创建图片视图 */
	view = picture_view_create(workbench);
	
	/* 非模式方式显示视图 */
	rtgui_view_show(view, RT_FALSE);

	/* 执行工作台事件循环 */
	rtgui_workbench_event_loop(workbench);

	/* 去注册GUI线程 */
	rtgui_thread_deregister(rt_thread_self());

	/* delete message queue */
	rt_mq_delete(mq);
}
Пример #21
0
/* 触发无标题窗口显示 */
static void demo_ntitlewin_onbutton(struct rtgui_widget* widget, rtgui_event_t* event)
{
	rtgui_win_t *win;
	rtgui_label_t *label;
	rtgui_button_t *button;
	rtgui_toplevel_t *parent;
	rtgui_rect_t widget_rect, rect = {0, 0, 150, 80};

	parent = RTGUI_TOPLEVEL(rtgui_widget_get_toplevel(widget));
	rtgui_rect_moveto(&rect, delta_x, delta_y);
	delta_x += 20;
	delta_y += 20;

	/* 创建一个窗口,风格为无标题及无边框 */
	win = rtgui_win_create(parent,
		"no title", &rect, RTGUI_WIN_STYLE_NO_TITLE | RTGUI_WIN_STYLE_NO_BORDER);
	RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(win)) = white;

	/* 创建一个文本标签 */
	label = rtgui_label_create("无边框窗口");
	rtgui_font_get_metrics(RTGUI_WIDGET_FONT(RTGUI_WIDGET(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;

	/* 创建一个关闭按钮 */
	widget_rect.x1 = 0;
	widget_rect.y1 = 0;
	widget_rect.x2 = 40;
	widget_rect.y2 = 20;
	rtgui_rect_moveto_align(&rect, &widget_rect, RTGUI_ALIGN_CENTER_HORIZONTAL);
	widget_rect.y1 += 40;
	widget_rect.y2 += 40;
	button = rtgui_button_create("关闭");
	rtgui_widget_set_rect(RTGUI_WIDGET(button), &widget_rect);
	rtgui_container_add_child(RTGUI_CONTAINER(win), RTGUI_WIDGET(button));
	rtgui_button_set_onbutton(button, window_demo_close);

	/* 非模态显示窗口 */
	rtgui_win_show(win, RT_FALSE);
}
Пример #22
0
/* 创建用于演示文件列表视图的视图 */
rtgui_view_t* demo_fn_view(rtgui_workbench_t* workbench)
{
	rtgui_rect_t rect;
	rtgui_view_t* view;
	rtgui_button_t* open_btn;
	rtgui_font_t* font;

	/* 默认采用12字体的显示 */
	font = rtgui_font_refer("asc", 12);

	/* 创建演示用的视图 */
	view = demo_view(workbench, "FileList View");
	/* 获得演示视图的位置信息 */
	demo_view_get_rect(view, &rect);

	rect.x1 += 5;
	rect.x2 -= 5;
	rect.y1 += 5;
	rect.y2 = rect.y1 + 20;
	/* 创建显示文件路径用的文本标签 */
	label = rtgui_label_create("fn: ");
	rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
	rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
	RTGUI_WIDGET_FONT(RTGUI_WIDGET(label)) = font;

	/* 获得演示视图的位置信息 */
	demo_view_get_rect(view, &rect);
	rect.x1 += 5;
	rect.x2 = rect.x1 + 80;
	rect.y1 += 30;
	rect.y2 = rect.y1 + 20;
	/* 创建按钮以触发一个新的文件列表视图 */
	open_btn = rtgui_button_create("Open File");
	rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(open_btn));
	rtgui_widget_set_rect(RTGUI_WIDGET(open_btn), &rect);
	RTGUI_WIDGET_FONT(RTGUI_WIDGET(open_btn)) = font;
	rtgui_button_set_onbutton(open_btn, open_btn_onbutton);

	return view;
}
Пример #23
0
void main(void)
{
	struct rtgui_app* application;
	struct rtgui_win* win;	
	struct rtgui_label* label;

	application = rtgui_app_create(rt_thread_self(), "label");
	if (application != RT_NULL)
	{	
		rtgui_rect_t rect = {220, 250, 400, 450};
		win = rtgui_mainwin_create(RT_NULL, "Label", 
			RTGUI_WIN_STYLE_MAINWIN | RTGUI_WIN_STYLE_DESTROY_ON_CLOSE);

		/* create lable in app window */
		label = rtgui_label_create("This is a RTGUI label Demo");
		rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
		rtgui_container_add_child(RTGUI_CONTAINER(win), RTGUI_WIDGET(label));

		rtgui_win_show(win, RT_TRUE);
		rtgui_app_destroy(application);
	}
}
/* 创建用于演示label控件的视图 */
rtgui_container_t *demo_view_listctrl(void)
{
    rtgui_rect_t rect;
    rtgui_container_t *container;
    rtgui_label_t *label;
    rtgui_listctrl_t *box;

    /* 先创建一个演示用的视图 */
    container = demo_view("List Control Demo");

    if (item_icon == RT_NULL)
        item_icon = rtgui_image_create_from_mem("xpm",
                                                (const rt_uint8_t *)image_xpm, sizeof(image_xpm), RT_TRUE);
    items[1].image = item_icon;

    /* 获得视图的位置信息 */
    demo_view_get_rect(container, &rect);
    rect.x1 += 5;
    rect.x2 -= 5;
    rect.y1 += 5;
    rect.y2 = rect.y1 + 20;
    /* 创建一个label控件 */
    label = rtgui_label_create("List Control: ");
    /* 设置label的位置 */
    rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
    /* container是一个container控件,调用add_child方法添加这个label控件 */
    rtgui_container_add_child(container, RTGUI_WIDGET(label));

    rect.y1 = rect.y2 + 3;
    rect.y2 = 250;
    box = rtgui_listctrl_create(items, sizeof(items) / sizeof(items[0]), &rect,
                                _rtgui_listctrl_item_draw);
    rtgui_listctrl_set_onitem(box, on_items);
    /* container是一个container控件,调用add_child方法添加这个listctrl控件 */
    rtgui_container_add_child(container, RTGUI_WIDGET(box));

    return container;
}
Пример #25
0
void app1_entry(void* parameter)
{
    struct rtgui_app* application;
    struct rtgui_win* win;

    application = rtgui_app_create(rt_thread_self(), "ExApp1");
    if (application != RT_NULL)
    {
        struct rtgui_label *label;
        struct rtgui_box *box;

        box = rtgui_box_create(RTGUI_VERTICAL, 10);
        label = rtgui_label_create("Hello World");
        win = rtgui_mainwin_create(RT_NULL, "MainWin", RTGUI_WIN_STYLE_MAINWIN);
        rtgui_container_set_box(RTGUI_CONTAINER(win), box);
        rtgui_container_add_child(RTGUI_CONTAINER(win), RTGUI_WIDGET(label));
        rtgui_container_layout(RTGUI_CONTAINER(win));
        
        rtgui_win_show(win, RT_TRUE);

        rtgui_app_destroy(application);
    }
}
Пример #26
0
static void create_normal_win(void)
{
    rtgui_rect_t rect = {30, 40, 150, 80};

    normal_window = rtgui_win_create(RT_NULL, "普通窗口",
                                     &rect, RTGUI_WIN_STYLE_DEFAULT);

    rect.x1 += 20;
    rect.x2 -= 5;
    rect.y1 += 5;
    rect.y2 = rect.y1 + 20;

    /* 添加一个文本标签 */
    rt_sprintf(normal_window_label_text,
               "第 %d 次显示", normal_window_show_count);
    normal_window_label = rtgui_label_create(normal_window_label_text);
    rtgui_widget_set_rect(RTGUI_WIDGET(normal_window_label), &rect);
    rtgui_container_add_child(RTGUI_CONTAINER(normal_window),
                              RTGUI_WIDGET(normal_window_label));

    rtgui_win_set_onclose(normal_window,
                          normal_window_onclose);
}
Пример #27
0
void create_wins(struct rtgui_app *app, void *parameter)
{
	struct rtgui_win *win1, *win2, *win3, *win4;
	struct rtgui_label *label;
	struct rtgui_rect rect;

	if (parameter)
	{
        struct rtgui_win *dsk;
		rtgui_graphic_driver_get_rect(rtgui_graphic_driver_get_default(), &rect);
		dsk = rtgui_win_create(RT_NULL, "desktop", &rect, RTGUI_WIN_STYLE_ONBTM);
		rtgui_win_show(dsk, RT_FALSE);
	}

	rect.x1 = 40, rect.y1 = 40, rect.x2 = 200, rect.y2 = 80;

	win1 = rtgui_win_create(RT_NULL,
		"test window", &rect, RTGUI_WIN_STYLE_DEFAULT);

	rtgui_win_set_onclose(win1, on_window_close);

	rect.x1 += 20;
	rect.x2 -= 5;
	rect.y1 += 5;
	rect.y2 = rect.y1 + 20;

	label = rtgui_label_create("window in modal mode");
	rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
	rtgui_container_add_child(RTGUI_CONTAINER(win1), RTGUI_WIDGET(label));

	rtgui_win_show(win1, RT_TRUE);

	rt_kprintf("win1 terminated\n");
	/*rtgui_win_destroy(win1);*/

	rect.x1 = 20;
	rect.y1 = 80;
	rect.x2 = 180;
	rect.y2 = 90;
	win2 = rtgui_win_create(win1,
		"test window2", &rect, RTGUI_WIN_STYLE_DEFAULT);

	rtgui_win_set_onclose(win2, on_window_close);
	rtgui_win_show(win1, RT_FALSE);
	/*rtgui_win_show(win2, RT_TRUE);*/

	/* create second window tree */
	rect.y1 = 150;
	rect.y2 = rect.y1 + 50;
	win3 = rtgui_win_create(RT_NULL,
		"test tree2", &rect, RTGUI_WIN_STYLE_DEFAULT);

	rtgui_win_set_onclose(win3, on_window_close);

	rect.x1 += 20;
	rect.x2 -= 5;
	rect.y1 += 5;
	rect.y2 = rect.y1 + 20;

	label = rtgui_label_create("window in modal mode");
	rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
	rtgui_container_add_child(RTGUI_CONTAINER(win3), RTGUI_WIDGET(label));

	rect.x1 = 20;
	rect.y1 = 180;
	rect.x2 = 180;
	rect.y2 = 190;
	win4 = rtgui_win_create(win3,
		"test tree2.1", &rect, RTGUI_WIN_STYLE_DEFAULT);

	rtgui_win_set_onclose(win4, on_window_close);
	rtgui_win_show(win3, RT_FALSE);
	/*rtgui_win_show(win4, RT_TRUE);*/

	rtgui_app_run(app);

	rtgui_win_destroy(win1);
	rtgui_win_destroy(win2);
	rtgui_win_destroy(win3);
	rtgui_win_destroy(win4);
}
Пример #28
0
/* 创建一个演示视图,需提供父workbench和演示用的标题 */
rtgui_view_t* demo_view(rtgui_workbench_t* workbench, const char* title)
{
	struct rtgui_view* view;

	/* 设置视图的名称 */
	view = rtgui_view_create(title);
	if (view == RT_NULL) return RT_NULL;

	/* 创建成功后,添加到数组中 */
	demo_view_list[demo_view_number] = view;
	demo_view_number ++;

	/* 添加到父workbench中 */
	rtgui_workbench_add_view(workbench, view);

	/* 添加下一个视图和前一个视图按钮 */
	{
		struct rtgui_rect rect;
		struct rtgui_button *next_btn, *prev_btn;
		struct rtgui_label *label;
		struct rtgui_staticline *line;

		/* 获得视图的位置信息(在加入到workbench中时,workbench会自动调整视图的大小) */
		rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
		rtgui_widget_rect_to_device(RTGUI_WIDGET(view), &rect);
		rect.x1 += 5;
		rect.y1 += 5;
		rect.x2 -= 5;
		rect.y2 = rect.y1 + 20;

		/* 创建标题用的标签 */
		label = rtgui_label_create(title);
		/* 设置标签位置信息 */
		rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
		/* 添加标签到视图中 */
		rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));

		rect.y1 += 20;
		rect.y2 += 20;
		/* 创建一个水平的staticline线 */
		line = rtgui_staticline_create(RTGUI_HORIZONTAL);
		/* 设置静态线的位置信息 */
		rtgui_widget_set_rect(RTGUI_WIDGET(line), &rect);
		/* 添加静态线到视图中 */
		rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(line));

		/* 获得视图的位置信息 */
		rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
		rtgui_widget_rect_to_device(RTGUI_WIDGET(view), &rect);
		rect.x2 -= 5;
		rect.y2 -= 5;
		rect.x1 = rect.x2 - 100;
		rect.y1 = rect.y2 - 25;

		/* 创建"下一个"按钮 */
		next_btn = rtgui_button_create("下一个");
		/* 设置onbutton动作到demo_view_next函数 */
		rtgui_button_set_onbutton(next_btn, demo_view_next);
		/* 设置按钮的位置信息 */
		rtgui_widget_set_rect(RTGUI_WIDGET(next_btn), &rect);
		/* 添加按钮到视图中 */
		rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(next_btn));

		/* 获得视图的位置信息 */
		rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
		rtgui_widget_rect_to_device(RTGUI_WIDGET(view), &rect);
		rect.x1 += 5;
		rect.y2 -= 5;
		rect.x2 = rect.x1 + 100;
		rect.y1 = rect.y2 - 25;

		/* 创建"上一个"按钮 */
		prev_btn = rtgui_button_create("上一个");
		/* 设置onbutton动作到demo_view_prev函数 */
		rtgui_button_set_onbutton(prev_btn, demo_view_prev);
		/* 设置按钮的位置信息 */
		rtgui_widget_set_rect(RTGUI_WIDGET(prev_btn), &rect);
		/* 添加按钮到视图中 */
		rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(prev_btn));
	}

	/* 返回创建的视图 */
	return view;
}
Пример #29
0
static void creat_switch2pt_win(rtgui_widget_t* widget)
{
	rtgui_label_t *label;
	rtgui_button_t *cancel_button;
	rtgui_button_t *sure_button;
	rtgui_toplevel_t *parent;
	rtgui_rect_t rect = {60, 45, 260, 160};

	parent = RTGUI_TOPLEVEL(rtgui_widget_get_toplevel(widget));

	switch2pt_confirm_win = rtgui_win_create(parent, "警告", &rect, RTGUI_WIN_STYLE_MODAL);

	rtgui_widget_get_extent(RTGUI_WIDGET(switch2pt_confirm_win), &rect);
	rect.x1 += 30;
	rect.x2 -= 30;
	rect.y1 += 20;
	rect.y2 = rect.y1 + 30;
	label = rtgui_label_create("确定切换到PT侧?");
	if (NULL != label) {
		rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
		rtgui_container_add_child(RTGUI_CONTAINER(switch2pt_confirm_win), RTGUI_WIDGET(label));			
	}

	rtgui_widget_get_extent(RTGUI_WIDGET(switch2pt_confirm_win),&rect);
	rect.x1 += 20;
	rect.x2 -= 120;
	rect.y1 += 70;
	rect.y2 -= 20;
	sure_button = rtgui_button_create("确定");
	if (NULL != sure_button) {
		RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(sure_button)) = RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL;
		rtgui_widget_set_rect(RTGUI_WIDGET(sure_button), &rect);
		rtgui_container_add_child(RTGUI_CONTAINER(switch2pt_confirm_win), RTGUI_WIDGET(sure_button));
		rtgui_button_set_onbutton(sure_button, sure_btn_onbutton);
	} else {
		printf_syn("creat sure button fail\n");
	}
	
	rtgui_widget_get_extent(RTGUI_WIDGET(switch2pt_confirm_win),&rect);
	rect.x1 += 120;
	rect.x2 -= 20;
	rect.y1 += 70;
	rect.y2 -= 20;
	cancel_button = rtgui_button_create("取消");
	if (NULL != cancel_button) {
		RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(cancel_button)) = RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL;
		rtgui_widget_set_rect(RTGUI_WIDGET(cancel_button), &rect);
		rtgui_container_add_child(RTGUI_CONTAINER(switch2pt_confirm_win), RTGUI_WIDGET(cancel_button));
		rtgui_button_set_onbutton(cancel_button, cancel_btn_onbutton);
	} else {
		printf_syn("creat cancel button fail\n");
	}
	
	/* 模态显示窗口 */
	rtgui_win_show(switch2pt_confirm_win, RT_TRUE);

	/* 采用模态显示窗口,关闭时不会自行删除窗口,需要主动删除窗口 */
	rtgui_win_destroy(switch2pt_confirm_win);
	switch2pt_confirm_win = NULL;

	return;
}
Пример #30
0
/*
 * 构建应用视图
 */
int app_view_structure(struct rtgui_workbench *workbench, struct rtgui_view *view)
{
	int ret = SUCC;
	rtgui_rect_t rect, body_rect;
	rtgui_label_t* label;
	char str[48];
	//rtgui_radiobox_t *radiobox;
	//rtgui_button_t* button;
	struct tm *ptime;
#if 1==DISPLAY_OVERLOAD_INFO
	rtgui_label_t *rx_overload_label;
#endif

	app_view_get_can_use_rect(view, &rect);
	zvd_gui_debug(("fun:%s(), line:%d, (%d,%d) (%d,%d)!\n", __FUNCTION__, __LINE__,
				   rect.x1, rect.y1, rect.x2, rect.y2));

	body_rect.x1 = 0;
	body_rect.y1 = 0;
	body_rect.x2 = rect.x2;
	body_rect.y2 = TITLE_PANEL_HEIGHT;
	label = rtgui_label_create(DEVICE_NAME);
	if (NULL != label) {
		RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(label)) = RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL;
		RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(label)) = blue;
		rtgui_widget_set_rect(RTGUI_WIDGET(label), &body_rect);
		/* view是一个container控件,调用add_child方法添加这个label控件 */
		rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
	} else {
		printf_syn("creat title label fail\n");
	}

	body_rect.x1 = 0;
	body_rect.y1 = TITLE_PANEL_HEIGHT;
	body_rect.x2 = rect.x2;
	body_rect.y2 = rect.y2;
	zvd_gui_debug(("fun:%s(), line:%d, (%d,%d) (%d,%d)!\n", __FUNCTION__, __LINE__,
				   body_rect.x1, body_rect.y1, body_rect.x2, body_rect.y2));

	zvd_notebook = rtgui_notebook_create(&body_rect, RTGUI_NOTEBOOK_TOP);
	rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(zvd_notebook));

	re_form = rtgui_form_create(re_form_head, RE_FORM_ROWS, RE_FORM_COLS, &body_rect);
	rtgui_notebook_add(zvd_notebook, "接收端", RTGUI_WIDGET(re_form));
#if 1
	set_form_px_col(re_form);
	i2str(str, avg_val[AVI_RE_PA]);
	rtgui_form_set_item(re_form, str, RE_PA_AVG_VALUE_ROW, RE_PA_AVG_VALUE_COL, 0);
	rtgui_form_set_item(re_form, print_info_str[PIS_ID_ZHENGCHANG], RE_PA_OVER_RANGE_ROW, RE_PA_OVER_RANGE_COL, 0);

	i2str(str, avg_val[AVI_RE_PB]);
	rtgui_form_set_item(re_form, str, RE_PB_AVG_VALUE_ROW, RE_PB_AVG_VALUE_COL, 0);
	rtgui_form_set_item(re_form, print_info_str[PIS_ID_ZHENGCHANG], RE_PB_OVER_RANGE_ROW, RE_PB_OVER_RANGE_COL, 0);

	i2str(str, avg_val[AVI_RE_PC]);
	rtgui_form_set_item(re_form, str, RE_PC_AVG_VALUE_ROW, RE_PC_AVG_VALUE_COL, 0);
	rtgui_form_set_item(re_form, print_info_str[PIS_ID_ZHENGCHANG], RE_PC_OVER_RANGE_ROW, RE_PC_OVER_RANGE_COL, 0);
#endif

	se_form = rtgui_form_create(se_form_head, SE_FORM_ROWS, SE_FORM_COLS, &body_rect);
	rtgui_notebook_add(zvd_notebook, "发射端", RTGUI_WIDGET(se_form));
#if 1
	set_form_px_col(se_form);
	rtgui_form_set_item(se_form, print_info_str[PIS_ID_ZHENGCHANG], SE_PA_OVER_RANGE_ROW, SE_PA_OVER_RANGE_COL, 0);
	rtgui_form_set_item(se_form, print_info_str[PIS_ID_FOU], SE_PA_POWER_DOWN_ROW, SE_PA_POWER_DOWN_COL, 0);

	rtgui_form_set_item(se_form, print_info_str[PIS_ID_ZHENGCHANG], SE_PB_OVER_RANGE_ROW, SE_PB_OVER_RANGE_COL, 0);
	rtgui_form_set_item(se_form, print_info_str[PIS_ID_FOU], SE_PB_POWER_DOWN_ROW, SE_PB_POWER_DOWN_COL, 0);

	rtgui_form_set_item(se_form, print_info_str[PIS_ID_ZHENGCHANG], SE_PC_OVER_RANGE_ROW, SE_PC_OVER_RANGE_COL, 0);
	rtgui_form_set_item(se_form, print_info_str[PIS_ID_FOU], SE_PC_POWER_DOWN_ROW, SE_PC_POWER_DOWN_COL, 0);
#endif

	sys_form = rtgui_form_create(sys_form_head, SYS_FORM_ROWS, SYS_FORM_COLS, &body_rect);
	rtgui_notebook_add(zvd_notebook, "系统", RTGUI_WIDGET(sys_form));
#if 1
	rtgui_form_set_item(sys_form, "接收端", 1, 0, 0);
	i2str(str, sys_temper[STI_RE_CPU_T]);
	rtgui_form_set_item(sys_form, str, 		RE_RE_CPU_TEMP_ROW, RE_RE_CPU_TEMP_COL, 0);
	i2str(str, sys_temper[STI_RE_CTB_T]);
	rtgui_form_set_item(sys_form, str, 		RE_RE_BOX_TEMP_ROW, RE_RE_BOX_TEMP_COL, 0);
	convert_ver2str(re_version, str);
	rtgui_form_set_item(sys_form, str, 	RE_RE_SOFT_VER_ROW, RE_RE_SOFT_VER_COL, 0);

	rtgui_form_set_item(sys_form, "发射端", 2, 0, 0);
	i2str(str, sys_temper[STI_SE_CPU_T]);
	rtgui_form_set_item(sys_form, str, 		RE_SE_CPU_TEMP_ROW, RE_SE_CPU_TEMP_COL, 0);
	i2str(str, sys_temper[STI_SE_CTB_T]);
	rtgui_form_set_item(sys_form, str, 		RE_SE_BOX_TEMP_ROW, RE_SE_BOX_TEMP_COL, 0);
	convert_ver2str(se_version, str);
	rtgui_form_set_item(sys_form, str, 	RE_SE_SOFT_VER_ROW, RE_SE_SOFT_VER_COL, 0);

	creat_devsn(str, sizeof(str), 0);
	rtgui_form_set_row(sys_form, str, TE_SN_ROW);

	creat_devsn(str, sizeof(str), 1);
	rtgui_form_set_row(sys_form, str, RE_SN_ROW);
#endif


	other_form = rtgui_form_create(other_form_head, OTHER_FORM_ROWS, OTHER_FORM_COLS, &body_rect);
	rtgui_notebook_add(zvd_notebook, "掉电", RTGUI_WIDGET(other_form));
#if 1
	rtgui_form_set_item(other_form, "次数", 1, 0, 0);
	rtgui_form_set_item(other_form, "n", 2, 0, 0);
	rtgui_form_set_item(other_form, "n-1", 3, 0, 0);
	rtgui_form_set_item(other_form, "n-2", 4, 0, 0);
	update_tx_poweroff_info_of_otherform();
	update_rx_poweroff_info_of_otherform();
#endif

	body_rect.x1 = FRAME_GAP;
	body_rect.y1 = body_rect.y2 + WIDGET_ROW_GAP;
	body_rect.x2 = FRAME_GAP + 8 * rt_strlen(RE_IF_SWITCH2CABLE_STR);
	body_rect.y2 = body_rect.y1 + 16;
	zvd_gui_debug(("fun:%s(), line:%d, (%d,%d) (%d,%d)!\n", __FUNCTION__, __LINE__,
				   body_rect.x1, body_rect.y1, body_rect.x2, body_rect.y2));

	switch_cable_label = rtgui_label_create(RE_IF_SWITCH2CABLE_STR);
	if (NULL != switch_cable_label) {
		RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(switch_cable_label)) =  RTGUI_ALIGN_CENTER_VERTICAL;
		//RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(switch_cable_label)) = blue;
		rtgui_widget_set_rect(RTGUI_WIDGET(switch_cable_label), &body_rect);
		/* view是一个container控件,调用add_child方法添加这个label控件 */
		rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(switch_cable_label));
	} else {
		printf_syn("creat cable label fail\n");
	}

#if 1
	body_rect.x1 = body_rect.x2 + 2;
	body_rect.x2 = body_rect.x1 + 16 + 8;
	zvd_gui_debug(("fun:%s(), line:%d, (%d,%d) (%d,%d)!\n", __FUNCTION__, __LINE__,
				   body_rect.x1, body_rect.y1, body_rect.x2, body_rect.y2));

	switch_cable_yn_textview = rtgui_textview_create(print_info_str[PIS_ID_FOU], &body_rect);
	if (NULL != switch_cable_yn_textview) {
		RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(switch_cable_yn_textview)) = RTGUI_ALIGN_CENTER_HORIZONTAL
				| RTGUI_ALIGN_CENTER_VERTICAL;
		//RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(switch_cable_yn_textview)) = red;
		rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(switch_cable_yn_textview));
	} else {
		printf_syn("creat cable yn textview fail\n");
	}
#endif

#if 1
	body_rect.x1 = body_rect.x2 + 2 + 2*8;
	body_rect.x2 = body_rect.x1 + 8*rt_strlen(TE_HAD_POWEROFF_STR);
	zvd_gui_debug(("fun:%s(), line:%d, (%d,%d) (%d,%d)!\n", __FUNCTION__, __LINE__,
				   body_rect.x1, body_rect.y1, body_rect.x2, body_rect.y2));

	tx_poweroff_label = rtgui_label_create(TE_HAD_POWEROFF_STR);
	if (NULL != tx_poweroff_label) {
		RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(tx_poweroff_label)) =  RTGUI_ALIGN_CENTER_VERTICAL;
		rtgui_widget_set_rect(RTGUI_WIDGET(tx_poweroff_label), &body_rect);
		rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(tx_poweroff_label));
	} else {
		printf_syn("tx poweroff label fail\n");
	}

	body_rect.x1 = body_rect.x2 + 2;
	body_rect.x2 = body_rect.x1 + 16 + 8;
	zvd_gui_debug(("fun:%s(), line:%d, (%d,%d) (%d,%d)!\n", __FUNCTION__, __LINE__,
				   body_rect.x1, body_rect.y1, body_rect.x2, body_rect.y2));

	tx_poweroff_yn_textview = rtgui_textview_create(print_info_str[PIS_ID_FOU], &body_rect);
	if (NULL != tx_poweroff_yn_textview) {
		RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(tx_poweroff_yn_textview)) = RTGUI_ALIGN_CENTER_HORIZONTAL
				| RTGUI_ALIGN_CENTER_VERTICAL;
		rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(tx_poweroff_yn_textview));
	} else {
		printf_syn("creat cable yn textview fail\n");
	}
#endif


#if 1
	body_rect.x1 = FRAME_GAP;
	body_rect.y1 = body_rect.y2 + WIDGET_ROW_GAP;
	body_rect.x2 = FRAME_GAP + (8+1) * rt_strlen(RE_BUZZER_DISABLE_STR);
	body_rect.y2 = body_rect.y1 + 16 + 2*WIDGET_ROW_GAP;
	zvd_gui_debug(("fun:%s(), line:%d, (%d,%d) (%d,%d)!\n", __FUNCTION__, __LINE__,
				   body_rect.x1, body_rect.y1, body_rect.x2, body_rect.y2));

	buzzer_button = rtgui_pushbutton_create(RE_BUZZER_DISABLE_STR);
	if (NULL != buzzer_button) {
		RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(buzzer_button)) = RTGUI_ALIGN_CENTER_HORIZONTAL
				| RTGUI_ALIGN_CENTER_VERTICAL;
		//RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(buzzer_button)) = blue;
		rtgui_widget_set_rect(RTGUI_WIDGET(buzzer_button), &body_rect);
		rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(buzzer_button));

		rtgui_button_set_onbutton(buzzer_button, buzzer_btn_onbutton);
	} else {
		printf_syn("creat buzzer pushbutton fail\n");
	}

	body_rect.x1 = body_rect.x2 + FRAME_GAP;
	/* body_rect.y1 = body_rect.y1; */ /* 与前一个按钮在同一行, 所以, y1, y2保持不变 */
	body_rect.x2 = body_rect.x1 + (8+1) * rt_strlen(SWITCH_TO_PT_STR);;
	/* body_rect.y2 = body_rect.y2; */ /* 与前一个按钮在同一行, 所以, y1, y2保持不变 */
	
	switch2pt_button = rtgui_pushbutton_create(SWITCH_TO_PT_STR);
	if (NULL != switch2pt_button) {
		RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(switch2pt_button)) = RTGUI_ALIGN_CENTER_HORIZONTAL
				| RTGUI_ALIGN_CENTER_VERTICAL;
		//RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(switch2pt_button)) = blue;
		rtgui_widget_set_rect(RTGUI_WIDGET(switch2pt_button), &body_rect);
		rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(switch2pt_button));
		rtgui_button_set_onbutton(switch2pt_button, switch2pt_btn_onbutton);
	} else {
		printf_syn("creat switch button fail\n");
	}

#if USE_OPTICX_200S_VERSION
	body_rect.x1 = body_rect.x2 + FRAME_GAP;
	/* body_rect.y1 = body_rect.y1; */ /* 与前一个按钮在同一行, 所以, y1, y2保持不变 */
	body_rect.x2 = body_rect.x1 + (8) * rt_strlen(RE_CUR_CHANNEL_NO_STR) + 2;
	/* body_rect.y2 = body_rect.y2; */ /* 与前一个按钮在同一行, 所以, y1, y2保持不变 */
	zvd_gui_debug(("fun:%s(), line:%d, (%d,%d) (%d,%d)!\n", __FUNCTION__, __LINE__,
				   body_rect.x1, body_rect.y1, body_rect.x2, body_rect.y2));
	rxe_cur_channel_label = rtgui_label_create(RE_CUR_CHANNEL_NO_STR);
	if (NULL != rxe_cur_channel_label) {
		RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(rxe_cur_channel_label)) =  RTGUI_ALIGN_CENTER_VERTICAL;
		rtgui_widget_set_rect(RTGUI_WIDGET(rxe_cur_channel_label), &body_rect);
		rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(rxe_cur_channel_label));
	} else {
		printf_syn("rxe cru channel label fail\n");
	}

	body_rect.x1 = body_rect.x2 + 2;
	body_rect.x2 = body_rect.x1 + 8 + 8;
	zvd_gui_debug(("fun:%s(), line:%d, (%d,%d) (%d,%d)!\n", __FUNCTION__, __LINE__,
				   body_rect.x1, body_rect.y1, body_rect.x2, body_rect.y2));
	str[0] = convert_cur_channel_to_char();
	str[1] = '\0';
	rxe_cur_channel_no_textview = rtgui_textview_create(str, &body_rect);
	if (NULL != rxe_cur_channel_no_textview) {
		RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(rxe_cur_channel_no_textview)) = RTGUI_ALIGN_CENTER_HORIZONTAL
				| RTGUI_ALIGN_CENTER_VERTICAL;
		rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(rxe_cur_channel_no_textview));
	} else {
		printf_syn("creat cable yn textview fail\n");
	}
#endif
#endif

#if 1==DISPLAY_OVERLOAD_INFO
	body_rect.x1 = body_rect.x2 + 2 + 7*8;
	body_rect.x2 = body_rect.x1 + 8*rt_strlen(RE_OVERLOAD_CNT_STR);
	zvd_gui_debug(("fun:%s(), line:%d, (%d,%d) (%d,%d)!\n", __FUNCTION__, __LINE__,
				   body_rect.x1, body_rect.y1, body_rect.x2, body_rect.y2));

	rx_overload_label = rtgui_label_create(RE_OVERLOAD_CNT_STR);
	if (NULL != rx_overload_label) {
		RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(rx_overload_label)) =  RTGUI_ALIGN_CENTER_VERTICAL;
		rtgui_widget_set_rect(RTGUI_WIDGET(rx_overload_label), &body_rect);
		rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(rx_overload_label));
	} else {
		printf_syn("tx poweroff label fail\n");
	}

	body_rect.x1 = body_rect.x2 + 2;
	body_rect.x2 = body_rect.x1 + 16 + 8;
	zvd_gui_debug(("fun:%s(), line:%d, (%d,%d) (%d,%d)!\n", __FUNCTION__, __LINE__,
				   body_rect.x1, body_rect.y1, body_rect.x2, body_rect.y2));

	rx_overload_cnt_textview = rtgui_textview_create("0", &body_rect);
	if (NULL != rx_overload_cnt_textview) {
		RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(rx_overload_cnt_textview)) = RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL;
		rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(rx_overload_cnt_textview));
	} else {
		printf_syn("creat cable yn textview fail\n");
	}
#endif



#if 1
	/* 创建时间标签, 2013-03-18 09:20 */
	rtc_dev = rt_device_find("rtc");
	if (NULL != rtc_dev) {
		time_t time;
		rt_device_control(rtc_dev, RT_DEVICE_CTRL_RTC_GET_TIME, &time);
		ptime = localtime(&time);
		rt_sprintf(sys_time_str, "%4d-%02d-%02d %02d:%02d:%02d", (ptime->tm_year+1900), (ptime->tm_mon+1),
				   ptime->tm_mday,	ptime->tm_hour, ptime->tm_min, ptime->tm_sec);

		body_rect.x2 = rtgui_graphic_driver_get_default()->width;
		body_rect.y2 = rtgui_graphic_driver_get_default()->height;
		body_rect.x1 = body_rect.x2 - (8+1) * 19;
		body_rect.y1 = body_rect.y2 - 20;
#if SYS_TIME_USE_TEXTBOX
		sys_time_textbox = rtgui_textbox_create(sys_time_str, RTGUI_TEXTBOX_SINGLE | RTGUI_TEXTBOX_CARET_HIDE);
		if (NULL != sys_time_textbox) {
			RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(sys_time_textbox)) = RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL;
			//RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(sys_time_textbox)) = blue;
			RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(sys_time_textbox)) = blue; //default_background;
			//RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(view));
			rtgui_widget_set_rect(RTGUI_WIDGET(sys_time_textbox), &body_rect);
			rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(sys_time_textbox));

		} else {
			printf_syn("creat sys time textbox fail\n");
		}
#else
		sys_time_textview = rtgui_textview_create(sys_time_str, &body_rect);
		if (NULL != sys_time_textview) {
			RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(sys_time_textview)) = RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL;
			//RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(sys_time_textbox)) = blue;
			rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(sys_time_textview));
		} else {
			printf_syn("creat sys time textview fail\n");
		}
#endif

	} else {
		printf_syn("find rtc device fail\n");
	}

#endif
	rtgui_view_show(view, RT_FALSE); /* 显示视图 */

	return ret;
}