From f06c70feed0941b5bceedcecf89e9aa22034aca8 Mon Sep 17 00:00:00 2001 From: Grissiom Date: Fri, 1 Feb 2013 10:27:10 +0800 Subject: sync with rtgui-0.6 --- examples/gui/SConscript | 1 + examples/gui/demo_application.c | 3 +- examples/gui/demo_plot.c | 13 +++++--- examples/gui/demo_view_benchmark.c | 4 +-- examples/gui/demo_view_box.c | 2 +- examples/gui/demo_view_button.c | 40 ++++++++++++------------ examples/gui/demo_view_checkbox.c | 40 ++++++++++++------------ examples/gui/demo_view_combobox.c | 14 ++++----- examples/gui/demo_view_digtube.c | 56 +++++++++++++++++++++++++++++++++ examples/gui/demo_view_edit.c | 34 ++++++++++---------- examples/gui/demo_view_label.c | 64 +++++++++++++++++++------------------- examples/gui/demo_view_listbox.c | 20 ++++++------ examples/gui/demo_view_menu.c | 16 +++++----- examples/gui/demo_view_mywidget.c | 20 ++++++------ examples/gui/demo_view_notebook.c | 12 +++---- examples/gui/demo_view_radiobox.c | 32 +++++++++---------- 16 files changed, 216 insertions(+), 155 deletions(-) create mode 100644 examples/gui/demo_view_digtube.c (limited to 'examples') diff --git a/examples/gui/SConscript b/examples/gui/SConscript index b4d2e952f8..1d82cccdb0 100644 --- a/examples/gui/SConscript +++ b/examples/gui/SConscript @@ -43,6 +43,7 @@ demo_view_edit.c demo_view_bmp.c demo_plot.c mywidget.c +demo_view_digtube.c """) if GetDepend('RTGUI_USING_FONT_COMPACT'): diff --git a/examples/gui/demo_application.c b/examples/gui/demo_application.c index d57987943b..45ce95251a 100644 --- a/examples/gui/demo_application.c +++ b/examples/gui/demo_application.c @@ -33,7 +33,7 @@ static void application_entry(void *parameter) struct rtgui_app *app; struct rtgui_rect rect; - app = rtgui_app_create(rt_thread_self(), "gui_demo"); + app = rtgui_app_create("gui_demo"); if (app == RT_NULL) return; @@ -95,6 +95,7 @@ static void application_entry(void *parameter) demo_view_notebook(); demo_view_mywidget(); demo_plot(); + demo_view_digtube(); #if defined(RTGUI_USING_DFS_FILERW) demo_view_edit(); diff --git a/examples/gui/demo_plot.c b/examples/gui/demo_plot.c index fa524aefa7..14595cb1e9 100644 --- a/examples/gui/demo_plot.c +++ b/examples/gui/demo_plot.c @@ -42,7 +42,7 @@ struct rtgui_container* demo_plot(void) curve1->min_x = 0; curve1->max_x = sizeof(sin_ydata)/sizeof(sin_ydata[0]); curve1->min_y = -100; - curve1->min_y = 100; + curve1->max_y = 100; curve1->color = red; rtgui_mv_model_add_view(RTGUI_MV_MODEL(curve1), RTGUI_MV_VIEW(plot)); @@ -51,22 +51,25 @@ struct rtgui_container* demo_plot(void) RTGUI_MV_MODEL(curve2)->length = sizeof(cos_ydata)/sizeof(cos_ydata[0]); curve2->min_x = 0; curve2->max_x = sizeof(cos_ydata)/sizeof(cos_ydata[0]); - curve1->min_y = -50; - curve1->min_y = 50; + curve2->min_y = -50; + curve2->max_y = 50; curve2->color = blue; rtgui_mv_model_add_view(RTGUI_MV_MODEL(curve2), RTGUI_MV_VIEW(plot)); curve3 = rtgui_plot_curve_create(); rtgui_plot_curve_set_x(curve3, cos_ydata); rtgui_plot_curve_set_y(curve3, sin_ydata); + curve3->min_x = -50; + curve3->max_x = 50; + curve3->min_y = -100; + curve3->max_y = 100; RTGUI_MV_MODEL(curve3)->length = sizeof(sin_ydata)/sizeof(sin_ydata[0]); curve3->color = black; rtgui_mv_model_add_view(RTGUI_MV_MODEL(curve3), RTGUI_MV_VIEW(plot)); rtgui_widget_get_rect(RTGUI_WIDGET(cnt), &rect); rtgui_widget_set_rect(RTGUI_WIDGET(plot), &rect); - rtgui_plot_set_base(plot, - -rtgui_rect_width(rect)/3, rtgui_rect_height(rect)/2); + rtgui_plot_set_base(plot, -100, -300); rtgui_container_add_child(cnt, RTGUI_WIDGET(plot)); diff --git a/examples/gui/demo_view_benchmark.c b/examples/gui/demo_view_benchmark.c index 005db4799f..8664759b5c 100644 --- a/examples/gui/demo_view_benchmark.c +++ b/examples/gui/demo_view_benchmark.c @@ -110,7 +110,7 @@ rt_bool_t benchmark_event_handler(struct rtgui_object *object, rtgui_event_t *ev if (running) { /* stop */ - rtgui_app_set_onidle(RT_NULL); + rtgui_app_set_onidle(rtgui_app_self(), RT_NULL); _draw_default(object, event); } else @@ -118,7 +118,7 @@ rt_bool_t benchmark_event_handler(struct rtgui_object *object, rtgui_event_t *ev /* run */ ticks = rt_tick_get(); area = 0; - rtgui_app_set_onidle(_onidle); + rtgui_app_set_onidle(rtgui_app_self(), _onidle); } running = !running; diff --git a/examples/gui/demo_view_box.c b/examples/gui/demo_view_box.c index f2ab96baa9..51e264aefe 100644 --- a/examples/gui/demo_view_box.c +++ b/examples/gui/demo_view_box.c @@ -34,7 +34,7 @@ rtgui_container_t *demo_view_box(void) 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_set_minheight(RTGUI_WIDGET(button), 25); RTGUI_WIDGET_ALIGN(button) = RTGUI_ALIGN_EXPAND; rtgui_container_layout(RTGUI_CONTAINER(panel)); diff --git a/examples/gui/demo_view_button.c b/examples/gui/demo_view_button.c index 45c688cfac..2fc73727bb 100644 --- a/examples/gui/demo_view_button.c +++ b/examples/gui/demo_view_button.c @@ -1,13 +1,13 @@ /* - * 程åº�清å�•:button控件演示 + * ³ÌÐòÇåµ¥£ºbutton¿Ø¼þÑÝʾ * - * 这个例å­�会在创建出的container上添加几个ä¸�å�Œç±»åž‹çš„button控件 + * Õâ¸öÀý×Ó»áÔÚ´´½¨³öµÄcontainerÉÏÌí¼Ó¼¸¸ö²»Í¬ÀàÐ͵Äbutton¿Ø¼þ */ #include "demo_view.h" #include -/* 创建用于演示button控件的视图 */ +/* ´´½¨ÓÃÓÚÑÝʾbutton¿Ø¼þµÄÊÓͼ */ rtgui_container_t *demo_view_button(void) { rtgui_rect_t rect; @@ -15,64 +15,64 @@ rtgui_container_t *demo_view_button(void) rtgui_button_t *button; rtgui_font_t *font; - /* 先创建一个演示用的视图 */ + /* ÏÈ´´½¨Ò»¸öÑÝʾÓõÄÊÓͼ */ container = demo_view("Button View"); - /* 获得视图的ä½�置信æ�¯ */ + /* »ñµÃÊÓͼµÄλÖÃÐÅÏ¢ */ demo_view_get_rect(container, &rect); rect.x1 += 5; rect.x2 = rect.x1 + 100; rect.y1 += 5; rect.y2 = rect.y1 + 20; - /* 创建一个button控件 */ + /* ´´½¨Ò»¸öbutton¿Ø¼þ */ button = rtgui_button_create("Red"); - /* 设置label控件的å‰�景色为红色 */ + /* ÉèÖÃlabel¿Ø¼þµÄǰ¾°É«ÎªºìÉ« */ RTGUI_WIDGET_FOREGROUND(button) = red; - /* 设置buttonçš„ä½�ç½® */ + /* ÉèÖÃbuttonµÄλÖà */ rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect); rtgui_container_add_child(container, RTGUI_WIDGET(button)); - /* 获得视图的ä½�置信æ�¯ */ + /* »ñµÃÊÓͼµÄλÖÃÐÅÏ¢ */ demo_view_get_rect(container, &rect); rect.x1 += 5; rect.x2 = rect.x1 + 100; rect.y1 += 5 + 25; rect.y2 = rect.y1 + 20; - /* 创建一个button控件 */ + /* ´´½¨Ò»¸öbutton¿Ø¼þ */ button = rtgui_button_create("Blue"); - /* 设置label控件的å‰�景色为è“�色 */ + /* ÉèÖÃlabel¿Ø¼þµÄǰ¾°É«ÎªÀ¶É« */ RTGUI_WIDGET_FOREGROUND(button) = blue; - /* 设置buttonçš„ä½�ç½® */ + /* ÉèÖÃbuttonµÄλÖà */ rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect); rtgui_container_add_child(container, RTGUI_WIDGET(button)); - /* 获得视图的ä½�置信æ�¯ */ + /* »ñµÃÊÓͼµÄλÖÃÐÅÏ¢ */ demo_view_get_rect(container, &rect); rect.x1 += 5; rect.x2 = rect.x1 + 100; rect.y1 += 5 + 25 + 25; rect.y2 = rect.y1 + 20; - /* 创建一个button控件 */ + /* ´´½¨Ò»¸öbutton¿Ø¼þ */ button = rtgui_button_create("12 font"); - /* 设置字体为12点阵的asc字体 */ + /* ÉèÖÃ×ÖÌåΪ12µãÕóµÄasc×ÖÌå */ font = rtgui_font_refer("asc", 12); RTGUI_WIDGET_FONT(button) = font; - /* 设置buttonçš„ä½�ç½® */ + /* ÉèÖÃbuttonµÄλÖà */ rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect); rtgui_container_add_child(container, RTGUI_WIDGET(button)); - /* 获得视图的ä½�置信æ�¯ */ + /* »ñµÃÊÓͼµÄλÖÃÐÅÏ¢ */ demo_view_get_rect(container, &rect); rect.x1 += 5; rect.x2 = rect.x1 + 100; rect.y1 += 5 + 25 + 25 + 25; rect.y2 = rect.y1 + 20; - /* 创建一个button控件 */ + /* ´´½¨Ò»¸öbutton¿Ø¼þ */ button = rtgui_button_create("16 font"); - /* 设置字体为16点阵的asc字体 */ + /* ÉèÖÃ×ÖÌåΪ16µãÕóµÄasc×ÖÌå */ font = rtgui_font_refer("asc", 16); RTGUI_WIDGET_FONT(button) = font; - /* 设置buttonçš„ä½�ç½® */ + /* ÉèÖÃbuttonµÄλÖà */ rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect); rtgui_container_add_child(container, RTGUI_WIDGET(button)); diff --git a/examples/gui/demo_view_checkbox.c b/examples/gui/demo_view_checkbox.c index 8e4e118681..0dc3c751dc 100644 --- a/examples/gui/demo_view_checkbox.c +++ b/examples/gui/demo_view_checkbox.c @@ -1,13 +1,13 @@ /* - * 程åº�清å�•:checkbox控件演示 + * ³ÌÐòÇåµ¥£ºcheckbox¿Ø¼þÑÝʾ * - * 这个例å­�会在创建出的container上添加几个checkbox控件 + * Õâ¸öÀý×Ó»áÔÚ´´½¨³öµÄcontainerÉÏÌí¼Ó¼¸¸öcheckbox¿Ø¼þ */ #include "demo_view.h" #include -/* 创建用于演示checkbox控件的视图 */ +/* ´´½¨ÓÃÓÚÑÝʾcheckbox¿Ø¼þµÄÊÓͼ */ rtgui_container_t *demo_view_checkbox(void) { rtgui_rect_t rect; @@ -15,64 +15,64 @@ rtgui_container_t *demo_view_checkbox(void) rtgui_checkbox_t *checkbox; rtgui_font_t *font; - /* 先创建一个演示用的视图 */ + /* ÏÈ´´½¨Ò»¸öÑÝʾÓõÄÊÓͼ */ container = demo_view("CheckBox View"); - /* 获得视图的ä½�置信æ�¯ */ + /* »ñµÃÊÓͼµÄλÖÃÐÅÏ¢ */ demo_view_get_rect(container, &rect); rect.x1 += 5; rect.x2 = rect.x1 + 100; rect.y1 += 5; rect.y2 = rect.y1 + 20; - /* 创建一个checkbox控件 */ + /* ´´½¨Ò»¸öcheckbox¿Ø¼þ */ checkbox = rtgui_checkbox_create("Red", RT_TRUE); - /* 设置å‰�景色为红色 */ + /* ÉèÖÃǰ¾°É«ÎªºìÉ« */ RTGUI_WIDGET_FOREGROUND(checkbox) = red; - /* 设置checkboxçš„ä½�ç½® */ + /* ÉèÖÃcheckboxµÄλÖà */ rtgui_widget_set_rect(RTGUI_WIDGET(checkbox), &rect); rtgui_container_add_child(container, RTGUI_WIDGET(checkbox)); - /* 获得视图的ä½�置信æ�¯ */ + /* »ñµÃÊÓͼµÄλÖÃÐÅÏ¢ */ demo_view_get_rect(container, &rect); rect.x1 += 5; rect.x2 = rect.x1 + 100; rect.y1 += 5 + 25; rect.y2 = rect.y1 + 20; - /* 创建一个checkbox控件 */ + /* ´´½¨Ò»¸öcheckbox¿Ø¼þ */ checkbox = rtgui_checkbox_create("Blue", RT_TRUE); - /* 设置å‰�景色为è“�色 */ + /* ÉèÖÃǰ¾°É«ÎªÀ¶É« */ RTGUI_WIDGET_FOREGROUND(checkbox) = blue; - /* 设置checkboxçš„ä½�ç½® */ + /* ÉèÖÃcheckboxµÄλÖà */ rtgui_widget_set_rect(RTGUI_WIDGET(checkbox), &rect); rtgui_container_add_child(container, RTGUI_WIDGET(checkbox)); - /* 获得视图的ä½�置信æ�¯ */ + /* »ñµÃÊÓͼµÄλÖÃÐÅÏ¢ */ demo_view_get_rect(container, &rect); rect.x1 += 5; rect.x2 = rect.x1 + 100; rect.y1 += 5 + 25 + 25; rect.y2 = rect.y1 + 20; - /* 创建一个checkbox控件 */ + /* ´´½¨Ò»¸öcheckbox¿Ø¼þ */ checkbox = rtgui_checkbox_create("12 font", RT_TRUE); - /* 设置字体为12点阵 */ + /* ÉèÖÃ×ÖÌåΪ12µãÕó */ font = rtgui_font_refer("asc", 12); RTGUI_WIDGET_FONT(checkbox) = font; - /* 设置checkboxçš„ä½�ç½® */ + /* ÉèÖÃcheckboxµÄλÖà */ rtgui_widget_set_rect(RTGUI_WIDGET(checkbox), &rect); rtgui_container_add_child(container, RTGUI_WIDGET(checkbox)); - /* 获得视图的ä½�置信æ�¯ */ + /* »ñµÃÊÓͼµÄλÖÃÐÅÏ¢ */ demo_view_get_rect(container, &rect); rect.x1 += 5; rect.x2 = rect.x1 + 100; rect.y1 += 5 + 25 + 25 + 25; rect.y2 = rect.y1 + 20; - /* 创建一个checkbox控件 */ + /* ´´½¨Ò»¸öcheckbox¿Ø¼þ */ checkbox = rtgui_checkbox_create("16 font", RT_TRUE); - /* 设置字体为16点阵 */ + /* ÉèÖÃ×ÖÌåΪ16µãÕó */ font = rtgui_font_refer("asc", 16); RTGUI_WIDGET_FONT(checkbox) = font; - /* 设置checkboxçš„ä½�ç½® */ + /* ÉèÖÃcheckboxµÄλÖà */ rtgui_widget_set_rect(RTGUI_WIDGET(checkbox), &rect); rtgui_container_add_child(container, RTGUI_WIDGET(checkbox)); diff --git a/examples/gui/demo_view_combobox.c b/examples/gui/demo_view_combobox.c index 7542131e7e..4d57a175e0 100644 --- a/examples/gui/demo_view_combobox.c +++ b/examples/gui/demo_view_combobox.c @@ -1,7 +1,7 @@ /* - * 程åº�清å�•:label控件演示 + * ³ÌÐòÇåµ¥£ºlabel¿Ø¼þÑÝʾ * - * 这个例å­�会在创建出的container上添加几个ä¸�å�Œç±»åž‹çš„label控件 + * Õâ¸öÀý×Ó»áÔÚ´´½¨³öµÄcontainerÉÏÌí¼Ó¼¸¸ö²»Í¬ÀàÐ͵Älabel¿Ø¼þ */ #include "demo_view.h" #include @@ -15,25 +15,25 @@ struct rtgui_listbox_item items[] = {"item 5", RT_NULL}, }; -/* 创建用于演示combobox控件的视图 */ +/* ´´½¨ÓÃÓÚÑÝʾcombobox¿Ø¼þµÄÊÓͼ */ rtgui_container_t *demo_view_combobox(void) { rtgui_rect_t rect; rtgui_container_t *container; rtgui_combobox_t *box; - /* 先创建一个演示用的视图 */ + /* ÏÈ´´½¨Ò»¸öÑÝʾÓõÄÊÓͼ */ container = demo_view("ComboBox View"); - /* 获得视图的ä½�置信æ�¯ */ + /* »ñµÃÊÓͼµÄλÖÃÐÅÏ¢ */ demo_view_get_rect(container, &rect); rect.x1 += 5; rect.x2 -= 5; rect.y1 += 5; rect.y2 = rect.y1 + 20; - /* 创建一个label控件 */ + /* ´´½¨Ò»¸ölabel¿Ø¼þ */ box = rtgui_combobox_create(items, sizeof(items) / sizeof(items[0]), &rect); - /* container是一个container控件,调用add_child方法添加这个box控件 */ + /* containerÊÇÒ»¸öcontainer¿Ø¼þ£¬µ÷ÓÃadd_child·½·¨Ìí¼ÓÕâ¸öbox¿Ø¼þ */ rtgui_container_add_child(container, RTGUI_WIDGET(box)); return container; diff --git a/examples/gui/demo_view_digtube.c b/examples/gui/demo_view_digtube.c new file mode 100644 index 0000000000..cff1d34f5e --- /dev/null +++ b/examples/gui/demo_view_digtube.c @@ -0,0 +1,56 @@ +#include "demo_view.h" +#include + +/* digit tube codes: "ERROR" */ +static char digitbuf[5] = {0x79, 0x77, 0x77, 0x3F, 0x77}; + +rtgui_container_t * demo_view_digtube(void) +{ + struct rtgui_rect rect; + rtgui_container_t *container; + struct rtgui_digtube * digtube; + struct rtgui_digitfont digitfont; + + container = demo_view("Digit Tube View"); + /* add digtube 1: use the default digit font */ + digtube = rtgui_digtube_create(RT_NULL, 5, (void *)4213, 0); + rtgui_container_add_child(container, RTGUI_WIDGET(digtube)); + + demo_view_get_rect(container, &rect); + rect.y2 = rect.y1 + 80; + rtgui_widget_set_rect(RTGUI_WIDGET(digtube), &rect); + + /* add digtube 2: show hex */ + digitfont.seg1_len = 20; + digitfont.seg1_hspace = 4; + digitfont.seg1_nr = 3; + digitfont.seg2_len = 20; + digitfont.seg3_len = 20; + digitfont.seg1_vspace = 1; + digitfont.data = RT_NULL; + + digtube = rtgui_digtube_create(&digitfont, 5, (void *)0xABC, RTGUI_DIGTUBE_STYLE_NOBACKFONT | RTGUI_DIGTUBE_STYLE_DISHEXNUM); + rtgui_container_add_child(container, RTGUI_WIDGET(digtube)); + rect.y1 = rect.y2 + 10;; + rect.y2 = rect.y1 + 60; + rtgui_widget_set_rect(RTGUI_WIDGET(digtube), &rect); + + /* add digtube 3: show custom codes table */ + digitfont.seg1_len = 25; + digitfont.seg1_hspace = 5; + digitfont.seg1_nr = 5; + digitfont.seg2_len = 25; + digitfont.seg3_len = 25; + digitfont.seg1_vspace = 1; + digitfont.data = RT_NULL; + digtube = rtgui_digtube_create(&digitfont, 5, (void *)digitbuf, RTGUI_DIGTUBE_STYLE_DISCODES); + rtgui_container_add_child(container, RTGUI_WIDGET(digtube)); + rect.y1 = rect.y2 + 5; + rect.y2 = rect.y1 + 80; + rtgui_widget_set_rect(RTGUI_WIDGET(digtube), &rect); + RTGUI_WIDGET_BACKGROUND(digtube) = RTGUI_RGB(0x00, 0x00, 0x00); + RTGUI_WIDGET_FOREGROUND(digtube) = RTGUI_RGB(0x00, 0xFF, 0x00); + digtube->digit_bc = RTGUI_RGB(0x00, 0xFF, 0xFF); + + return container; +} \ No newline at end of file diff --git a/examples/gui/demo_view_edit.c b/examples/gui/demo_view_edit.c index 3ee31b7994..fd3f81e949 100644 --- a/examples/gui/demo_view_edit.c +++ b/examples/gui/demo_view_edit.c @@ -1,7 +1,7 @@ /* - * 程åº�清å�•:edit控件演示 + * ³ÌÐòÇåµ¥£ºedit¿Ø¼þÑÝʾ * - * 这个例å­�会在conatiner上进行edit控件的演示 + * Õâ¸öÀý×Ó»áÔÚconatinerÉϽøÐÐedit¿Ø¼þµÄÑÝʾ */ #include "demo_view.h" @@ -22,14 +22,14 @@ void demo_edit_readin_file(struct rtgui_object *object, struct rtgui_event *even RT_ASSERT(object != RT_NULL); button = RTGUI_BUTTON(object); - /* å�–å¾—edit指针 */ + /* È¡µÃeditÖ¸Õë */ edit = RTGUI_EDIT(RTGUI_WIDGET(button)->user_data); - /* 判断文件是å�¦å­˜åœ¨ */ + /* ÅжÏÎļþÊÇ·ñ´æÔÚ */ file = rtgui_filerw_create_file(filename, "rb"); if (file == RT_NULL) { - /* ä¸�存在存在,则创建它 */ + /* ²»´æÔÚ´æÔÚ,Ôò´´½¨Ëü */ rt_kprintf("file:\"%s\" does not exist!\n", filename); return; @@ -49,15 +49,15 @@ void demo_edit_saveas_file(struct rtgui_object *object, struct rtgui_event *even RT_ASSERT(object != RT_NULL); button = RTGUI_BUTTON(object); - /* å�–å¾—edit指针 */ + /* È¡µÃeditÖ¸Õë */ edit = RTGUI_EDIT(RTGUI_WIDGET(button)->user_data); - /* 判断文件是å�¦å­˜åœ¨, 如果存在则删除之 */ + /* ÅжÏÎļþÊÇ·ñ´æÔÚ, Èç¹û´æÔÚÔòɾ³ýÖ® */ file = rtgui_filerw_create_file(filename, "rb"); if (file != RT_NULL) { rtgui_filerw_close(file); - /* 如果是在win32中调试, 请手工删除该文件å�§, NT中文件是å�ªè¯»çš„,unlink删除ä¸�掉 */ + /* Èç¹ûÊÇÔÚwin32Öе÷ÊÔ, ÇëÊÖ¹¤É¾³ý¸ÃÎļþ°É, NTÖÐÎļþÊÇÖ»¶ÁµÄ,unlinkɾ³ý²»µô */ if (rtgui_filerw_unlink(filename) == -1) rt_kprintf("Could not delete %s\n", filename); } @@ -95,7 +95,7 @@ rt_bool_t demo_edit_event_handler(struct rtgui_object* object, struct rtgui_even return result; } -/* 创建用于演示edit控件的视图 */ +/* ´´½¨ÓÃÓÚÑÝʾedit¿Ø¼þµÄÊÓͼ */ rtgui_container_t *demo_view_edit(void) { rtgui_rect_t rect; @@ -104,7 +104,7 @@ rtgui_container_t *demo_view_edit(void) struct rtgui_label *label; struct rtgui_button *button; - /* 先创建一个演示用的视图 */ + /* ÏÈ´´½¨Ò»¸öÑÝʾÓõÄÊÓͼ */ container = demo_view("Edit View"); edit = rtgui_edit_create(container, 10, 35, 220, 200); @@ -117,14 +117,14 @@ rtgui_container_t *demo_view_edit(void) "rtgui_edit_insert_line\n" "rtgui_edit_delete_line\n" "rtgui_edit_connect_line\n" - "å�Œå­—节测试\n" + "Ë«×Ö½Ú²âÊÔ\n" "a\n" "b\n" "c\n" "d\n" "1234567890\n"); - /* 创建一个按钮, 读å�–æŸ�个文件 */ + /* ´´½¨Ò»¸ö°´Å¥, ¶Áȡij¸öÎļþ */ demo_view_get_rect(container, &rect); rect.x1 += 10; rect.x2 = rect.x1 + 100; @@ -134,10 +134,10 @@ rtgui_container_t *demo_view_edit(void) 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指针 */ + /* ʹÓÃ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; @@ -147,10 +147,10 @@ rtgui_container_t *demo_view_edit(void) 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指针 */ + /* ʹÓÃuser_data´«µÝeditÖ¸Õë */ RTGUI_WIDGET(button)->user_data = (rt_uint32_t)edit; - /* 创建一个标签, 显示EDIT的主è¦�å�‚æ•° */ + /* ´´½¨Ò»¸ö±êÇ©, ÏÔʾEDITµÄÖ÷Òª²ÎÊý */ demo_view_get_rect(container, &rect); rect.x1 += 10; rect.x2 = rect.x1 + 220; @@ -165,7 +165,7 @@ rtgui_container_t *demo_view_edit(void) RTGUI_WIDGET(edit)->user_data = (rt_uint32_t)label; rtgui_object_set_event_handler(RTGUI_OBJECT(edit), demo_edit_event_handler); - /* 创建一个按钮, 读å�–EDIT的内存消耗 */ + /* ´´½¨Ò»¸ö°´Å¥, ¶ÁÈ¡EDITµÄÄÚ´æÏûºÄ */ demo_view_get_rect(container, &rect); rect.x1 += 150; rect.x2 = rect.x1 + 80; diff --git a/examples/gui/demo_view_label.c b/examples/gui/demo_view_label.c index a8e87142d6..7355cca648 100644 --- a/examples/gui/demo_view_label.c +++ b/examples/gui/demo_view_label.c @@ -1,12 +1,12 @@ /* - * 程åº�清å�•:label控件演示 + * ³ÌÐòÇåµ¥£ºlabel¿Ø¼þÑÝʾ * - * 这个例å­�会在创建出的container上添加几个ä¸�å�Œç±»åž‹çš„label控件 + * Õâ¸öÀý×Ó»áÔÚ´´½¨³öµÄcontainerÉÏÌí¼Ó¼¸¸ö²»Í¬ÀàÐ͵Älabel¿Ø¼þ */ #include "demo_view.h" #include -/* 创建用于演示label控件的视图 */ +/* ´´½¨ÓÃÓÚÑÝʾlabel¿Ø¼þµÄÊÓͼ */ rtgui_container_t *demo_view_label(void) { rtgui_rect_t rect; @@ -14,89 +14,89 @@ rtgui_container_t *demo_view_label(void) rtgui_label_t *label; rtgui_font_t *font; - /* 先创建一个演示用的视图 */ + /* ÏÈ´´½¨Ò»¸öÑÝʾÓõÄÊÓͼ */ container = demo_view("Label View"); - /* 获得视图的ä½�置信æ�¯ */ + /* »ñµÃÊÓͼµÄλÖÃÐÅÏ¢ */ demo_view_get_rect(container, &rect); rect.x1 += 5; rect.x2 -= 5; rect.y1 += 5; rect.y2 = rect.y1 + 20; - /* 创建一个label控件 */ + /* ´´½¨Ò»¸ölabel¿Ø¼þ */ label = rtgui_label_create("Red Left"); - /* 设置label控件上的文本对é½�æ–¹å¼�为:左对é½� */ + /* ÉèÖÃlabel¿Ø¼þÉϵÄÎı¾¶ÔÆë·½Ê½Îª£º×ó¶ÔÆë */ RTGUI_WIDGET_TEXTALIGN(label) = RTGUI_ALIGN_LEFT; - /* 设置label控件的å‰�景色为红色 */ + /* ÉèÖÃlabel¿Ø¼þµÄǰ¾°É«ÎªºìÉ« */ RTGUI_WIDGET_FOREGROUND(label) = red; - /* 设置labelçš„ä½�ç½® */ + /* ÉèÖÃlabelµÄλÖà */ rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - /* container是一个container控件,调用add_child方法添加这个label控件 */ + /* containerÊÇÒ»¸öcontainer¿Ø¼þ£¬µ÷ÓÃadd_child·½·¨Ìí¼ÓÕâ¸ölabel¿Ø¼þ */ rtgui_container_add_child(container, RTGUI_WIDGET(label)); - /* 获得视图的ä½�置信æ�¯ */ + /* »ñµÃÊÓͼµÄλÖÃÐÅÏ¢ */ demo_view_get_rect(container, &rect); rect.x1 += 5; rect.x2 -= 5; rect.y1 += 5 + 25; rect.y2 = rect.y1 + 20; - /* 创建一个label控件 */ + /* ´´½¨Ò»¸ölabel¿Ø¼þ */ label = rtgui_label_create("Blue Right"); - /* 设置label控件上的文本对é½�æ–¹å¼�为:å�³å¯¹é½� */ + /* ÉèÖÃlabel¿Ø¼þÉϵÄÎı¾¶ÔÆë·½Ê½Îª£ºÓÒ¶ÔÆë */ RTGUI_WIDGET_TEXTALIGN(label) = RTGUI_ALIGN_RIGHT; - /* 设置label控件的å‰�景色为è“�色 */ + /* ÉèÖÃlabel¿Ø¼þµÄǰ¾°É«ÎªÀ¶É« */ RTGUI_WIDGET_FOREGROUND(label) = blue; - /* 设置labelçš„ä½�ç½® */ + /* ÉèÖÃlabelµÄλÖà */ rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - /* container是一个container控件,调用add_child方法添加这个label控件 */ + /* containerÊÇÒ»¸öcontainer¿Ø¼þ£¬µ÷ÓÃadd_child·½·¨Ìí¼ÓÕâ¸ölabel¿Ø¼þ */ rtgui_container_add_child(container, RTGUI_WIDGET(label)); - /* 获得视图的ä½�置信æ�¯ */ + /* »ñµÃÊÓͼµÄλÖÃÐÅÏ¢ */ demo_view_get_rect(container, &rect); rect.x1 += 5; rect.x2 -= 5; rect.y1 += 5 + 25 + 25; rect.y2 = rect.y1 + 20; - /* 创建一个label控件 */ + /* ´´½¨Ò»¸ölabel¿Ø¼þ */ label = rtgui_label_create("Green Center"); - /* 设置label控件的å‰�景色为绿色 */ + /* ÉèÖÃlabel¿Ø¼þµÄǰ¾°É«ÎªÂÌÉ« */ RTGUI_WIDGET_FOREGROUND(label) = green; - /* 设置label控件上的文本对é½�æ–¹å¼�为:å�³å¯¹é½� */ + /* ÉèÖÃlabel¿Ø¼þÉϵÄÎı¾¶ÔÆë·½Ê½Îª£ºÓÒ¶ÔÆë */ RTGUI_WIDGET_TEXTALIGN(label) = RTGUI_ALIGN_CENTER_HORIZONTAL; - /* 设置labelçš„ä½�ç½® */ + /* ÉèÖÃlabelµÄλÖà */ rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - /* container是一个container控件,调用add_child方法添加这个label控件 */ + /* containerÊÇÒ»¸öcontainer¿Ø¼þ£¬µ÷ÓÃadd_child·½·¨Ìí¼ÓÕâ¸ölabel¿Ø¼þ */ rtgui_container_add_child(container, RTGUI_WIDGET(label)); - /* 获得视图的ä½�置信æ�¯ */ + /* »ñµÃÊÓͼµÄλÖÃÐÅÏ¢ */ demo_view_get_rect(container, &rect); rect.x1 += 5; rect.x2 -= 5; rect.y1 += 5 + 25 + 25 + 25; rect.y2 = rect.y1 + 20; - /* 创建一个label控件 */ + /* ´´½¨Ò»¸ölabel¿Ø¼þ */ label = rtgui_label_create("12 font"); - /* 设置字体为12点阵的asc字体 */ + /* ÉèÖÃ×ÖÌåΪ12µãÕóµÄasc×ÖÌå */ font = rtgui_font_refer("asc", 12); RTGUI_WIDGET_FONT(label) = font; - /* 设置labelçš„ä½�ç½® */ + /* ÉèÖÃlabelµÄλÖà */ rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - /* container是一个container控件,调用add_child方法添加这个label控件 */ + /* containerÊÇÒ»¸öcontainer¿Ø¼þ£¬µ÷ÓÃadd_child·½·¨Ìí¼ÓÕâ¸ölabel¿Ø¼þ */ rtgui_container_add_child(container, RTGUI_WIDGET(label)); - /* 获得视图的ä½�置信æ�¯ */ + /* »ñµÃÊÓͼµÄλÖÃÐÅÏ¢ */ demo_view_get_rect(container, &rect); rect.x1 += 5; rect.y1 += 5 + 25 + 25 + 25 + 25; rect.y2 = rect.y1 + 20; - /* 创建一个label控件 */ + /* ´´½¨Ò»¸ölabel¿Ø¼þ */ label = rtgui_label_create("16 font"); - /* 设置字体为16点阵的asc字体 */ + /* ÉèÖÃ×ÖÌåΪ16µãÕóµÄasc×ÖÌå */ font = rtgui_font_refer("asc", 16); RTGUI_WIDGET_FONT(label) = font; - /* 设置labelçš„ä½�ç½® */ + /* ÉèÖÃlabelµÄλÖà */ rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - /* container是一个container控件,调用add_child方法添加这个label控件 */ + /* containerÊÇÒ»¸öcontainer¿Ø¼þ£¬µ÷ÓÃadd_child·½·¨Ìí¼ÓÕâ¸ölabel¿Ø¼þ */ rtgui_container_add_child(container, RTGUI_WIDGET(label)); return container; diff --git a/examples/gui/demo_view_listbox.c b/examples/gui/demo_view_listbox.c index 1829c81fb0..9b7f4ed302 100644 --- a/examples/gui/demo_view_listbox.c +++ b/examples/gui/demo_view_listbox.c @@ -1,7 +1,7 @@ /* - * 程åº�清å�•:label控件演示 + * ³ÌÐòÇåµ¥£ºlabel¿Ø¼þÑÝʾ * - * 这个例å­�会在创建出的container上添加几个ä¸�å�Œç±»åž‹çš„label控件 + * Õâ¸öÀý×Ó»áÔÚ´´½¨³öµÄcontainerÉÏÌí¼Ó¼¸¸ö²»Í¬ÀàÐ͵Älabel¿Ø¼þ */ #include "demo_view.h" #include @@ -149,13 +149,13 @@ static rt_bool_t on_items(struct rtgui_object *object, struct rtgui_event *event /* get listbox */ box = RTGUI_LISTBOX(object); - /* 打å�°å½“å‰�的项 */ + /* ´òÓ¡µ±Ç°µÄÏî */ rt_kprintf("current item: %d\n", box->current_item); return RT_TRUE; } -/* 创建用于演示label控件的视图 */ +/* ´´½¨ÓÃÓÚÑÝʾlabel¿Ø¼þµÄÊÓͼ */ rtgui_container_t *demo_view_listbox(void) { rtgui_rect_t rect; @@ -163,7 +163,7 @@ rtgui_container_t *demo_view_listbox(void) rtgui_label_t *label; rtgui_listbox_t *box; - /* 先创建一个演示用的视图 */ + /* ÏÈ´´½¨Ò»¸öÑÝʾÓõÄÊÓͼ */ container = demo_view("ListBox Demo"); if (item_icon == RT_NULL) @@ -171,24 +171,24 @@ rtgui_container_t *demo_view_listbox(void) (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¿Ø¼þ */ label = rtgui_label_create("listbox: "); - /* 设置labelçš„ä½�ç½® */ + /* ÉèÖÃlabelµÄλÖà */ rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - /* container是一个container控件,调用add_child方法添加这个label控件 */ + /* containerÊÇÒ»¸öcontainer¿Ø¼þ£¬µ÷ÓÃadd_child·½·¨Ìí¼ÓÕâ¸ölabel¿Ø¼þ */ rtgui_container_add_child(container, RTGUI_WIDGET(label)); rect.y1 = rect.y2 + 3; rect.y2 = 250; box = rtgui_listbox_create(items, sizeof(items) / sizeof(struct rtgui_listbox_item), &rect); rtgui_listbox_set_onitem(box, on_items); - /* container是一个container控件,调用add_child方法添加这个listbox控件 */ + /* containerÊÇÒ»¸öcontainer¿Ø¼þ£¬µ÷ÓÃadd_child·½·¨Ìí¼ÓÕâ¸ölistbox¿Ø¼þ */ rtgui_container_add_child(container, RTGUI_WIDGET(box)); return container; diff --git a/examples/gui/demo_view_menu.c b/examples/gui/demo_view_menu.c index 45a170999f..e49ceca239 100644 --- a/examples/gui/demo_view_menu.c +++ b/examples/gui/demo_view_menu.c @@ -1,7 +1,7 @@ /* - * 程åº�清å�•:menu控件演示 + * ³ÌÐòÇåµ¥£ºmenu¿Ø¼þÑÝʾ * - * 这个例å­�会在创建出的container上添加几个ä¸�å�Œç±»åž‹çš„label控件 + * Õâ¸öÀý×Ó»áÔÚ´´½¨³öµÄcontainerÉÏÌí¼Ó¼¸¸ö²»Í¬ÀàÐ͵Älabel¿Ø¼þ */ #include "demo_view.h" #include @@ -46,27 +46,27 @@ static rt_bool_t _onmenu(struct rtgui_object *object, struct rtgui_event *event) return RT_TRUE; } -/* 创建用于演示menu控件的视图 */ +/* ´´½¨ÓÃÓÚÑÝʾmenu¿Ø¼þµÄÊÓͼ */ rtgui_container_t *demo_view_menu(void) { rtgui_rect_t rect; rtgui_container_t *container; rtgui_button_t *button; - /* 先创建一个演示用的视图 */ + /* ÏÈ´´½¨Ò»¸öÑÝʾÓõÄÊÓͼ */ container = demo_view("MENU View"); - /* 获得视图的ä½�置信æ�¯ */ + /* »ñµÃÊÓͼµÄλÖÃÐÅÏ¢ */ demo_view_get_rect(container, &rect); rect.x1 += 5; rect.x2 = rect.x1 + 100; rect.y1 += 5; rect.y2 = rect.y1 + 20; - /* 创建一个button控件 */ + /* ´´½¨Ò»¸öbutton¿Ø¼þ */ button = rtgui_button_create("Pop Menu"); - /* 设置buttonçš„ä½�ç½® */ + /* ÉèÖÃbuttonµÄλÖà */ rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect); - /* container是一个container控件,调用add_child方法添加这个button控件 */ + /* containerÊÇÒ»¸öcontainer¿Ø¼þ£¬µ÷ÓÃadd_child·½·¨Ìí¼ÓÕâ¸öbutton¿Ø¼þ */ rtgui_container_add_child(container, RTGUI_WIDGET(button)); rtgui_button_set_onbutton(button, _onmenu); diff --git a/examples/gui/demo_view_mywidget.c b/examples/gui/demo_view_mywidget.c index effe4d3507..622cc5a5bd 100644 --- a/examples/gui/demo_view_mywidget.c +++ b/examples/gui/demo_view_mywidget.c @@ -1,41 +1,41 @@ /* - * 程åº�清å�•:自定义控件演示 + * ³ÌÐòÇåµ¥£º×Ô¶¨Òå¿Ø¼þÑÝʾ * - * 这个例å­�会在创建出的container上添加两个自定义控件 + * Õâ¸öÀý×Ó»áÔÚ´´½¨³öµÄcontainerÉÏÌí¼ÓÁ½¸ö×Ô¶¨Òå¿Ø¼þ */ #include "demo_view.h" #include "mywidget.h" -/* 创建用于演示自定义控件的视图 */ +/* ´´½¨ÓÃÓÚÑÝʾ×Ô¶¨Òå¿Ø¼þµÄÊÓͼ */ rtgui_container_t *demo_view_mywidget(void) { rtgui_container_t *container; rtgui_rect_t rect; rtgui_mywidget_t *mywidget; - /* 先创建一个演示用的视图 */ + /* ÏÈ´´½¨Ò»¸öÑÝʾÓõÄÊÓͼ */ container = demo_view("MyWidget View"); - /* 获得视图的ä½�置信æ�¯ */ + /* »ñµÃÊÓͼµÄλÖÃÐÅÏ¢ */ demo_view_get_rect(container, &rect); rect.x1 += 5; rect.x2 = rect.y1 + 80; rect.y1 += 5; rect.y2 = rect.y1 + 80; - /* 创建一个自定义控件 */ + /* ´´½¨Ò»¸ö×Ô¶¨Òå¿Ø¼þ */ mywidget = rtgui_mywidget_create(&rect); - /* container是一个container控件,调用add_child方法添加这个自控件 */ + /* containerÊÇÒ»¸öcontainer¿Ø¼þ£¬µ÷ÓÃadd_child·½·¨Ìí¼ÓÕâ¸ö×Կؼþ */ rtgui_container_add_child(container, RTGUI_WIDGET(mywidget)); - /* 获得视图的ä½�置信æ�¯ */ + /* »ñµÃÊÓͼµÄλÖÃÐÅÏ¢ */ demo_view_get_rect(container, &rect); rect.x1 += 25; rect.x2 = rect.y1 + 40; rect.y1 += 5 + 100; rect.y2 = rect.y1 + 40; - /* 创建一个自定义控件 */ + /* ´´½¨Ò»¸ö×Ô¶¨Òå¿Ø¼þ */ mywidget = rtgui_mywidget_create(&rect); - /* container是一个container控件,调用add_child方法添加这个自控件 */ + /* containerÊÇÒ»¸öcontainer¿Ø¼þ£¬µ÷ÓÃadd_child·½·¨Ìí¼ÓÕâ¸ö×Կؼþ */ rtgui_container_add_child(container, RTGUI_WIDGET(mywidget)); return container; diff --git a/examples/gui/demo_view_notebook.c b/examples/gui/demo_view_notebook.c index 0573b3ac05..07bc84c966 100644 --- a/examples/gui/demo_view_notebook.c +++ b/examples/gui/demo_view_notebook.c @@ -1,7 +1,7 @@ /* - * 程åº�清å�•:notebook控件演示 + * ³ÌÐòÇåµ¥£ºnotebook¿Ø¼þÑÝʾ * - * 这个例å­�会在创建出的container上演示notebook控件 + * Õâ¸öÀý×Ó»áÔÚ´´½¨³öµÄcontainerÉÏÑÝʾnotebook¿Ø¼þ */ #include "demo_view.h" @@ -25,7 +25,7 @@ const static struct rtgui_listbox_item items2[] = {"new list #2", RT_NULL}, }; -/* 创建用于演示notebook控件的视图 */ +/* ´´½¨ÓÃÓÚÑÝʾnotebook¿Ø¼þµÄÊÓͼ */ rtgui_container_t *demo_view_notebook(void) { rtgui_rect_t rect; @@ -33,14 +33,14 @@ rtgui_container_t *demo_view_notebook(void) struct rtgui_notebook *notebook; rtgui_listbox_t *box; - /* 先创建一个演示用的视图 */ + /* ÏÈ´´½¨Ò»¸öÑÝʾÓõÄÊÓͼ */ container = demo_view("Notebook View"); - /* 获得视图的ä½�置信æ�¯ */ + /* »ñµÃÊÓͼµÄλÖÃÐÅÏ¢ */ demo_view_get_rect(container, &rect); notebook = rtgui_notebook_create(&rect, RTGUI_NOTEBOOK_BOTTOM); - /* container是一个container控件,调用add_child方法添加这个notebook控件 */ + /* containerÊÇÒ»¸öcontainer¿Ø¼þ£¬µ÷ÓÃadd_child·½·¨Ìí¼ÓÕâ¸önotebook¿Ø¼þ */ rtgui_container_add_child(container, RTGUI_WIDGET(notebook)); box = rtgui_listbox_create(items, sizeof(items) / sizeof(struct rtgui_listbox_item), &rect); diff --git a/examples/gui/demo_view_radiobox.c b/examples/gui/demo_view_radiobox.c index 45fe343a5a..7d72d550a6 100644 --- a/examples/gui/demo_view_radiobox.c +++ b/examples/gui/demo_view_radiobox.c @@ -1,13 +1,13 @@ /* - * 程åº�清å�•:radiobox控件演示 + * ³ÌÐòÇåµ¥£ºradiobox¿Ø¼þÑÝʾ * - * 这个例å­�会在创建出的container上添加两个ä¸�å�Œæ–¹å�‘çš„radiobox控件 + * Õâ¸öÀý×Ó»áÔÚ´´½¨³öµÄcontainerÉÏÌí¼ÓÁ½¸ö²»Í¬·½ÏòµÄradiobox¿Ø¼þ */ #include "demo_view.h" #include -/* 用于显示垂直方å�‘çš„radio文本项数组 */ +/* ÓÃÓÚÏÔʾ´¹Ö±·½ÏòµÄradioÎı¾ÏîÊý×é */ static char *radio_item_v[5] = { "one", @@ -17,52 +17,52 @@ static char *radio_item_v[5] = "item 2" }; -/* 用于显示水平方å�‘çš„radio文本项数组 */ +/* ÓÃÓÚÏÔʾˮƽ·½ÏòµÄradioÎı¾ÏîÊý×é */ static char *radio_item_h[3] = { "one", "two", "three" }; -/* 创建用于演示radiobox控件的视图 */ +/* ´´½¨ÓÃÓÚÑÝʾradiobox¿Ø¼þµÄÊÓͼ */ rtgui_container_t *demo_view_radiobox(void) { rtgui_rect_t rect; rtgui_container_t *container; rtgui_radiobox_t *radiobox; - /* 先创建一个演示用的视图 */ + /* ÏÈ´´½¨Ò»¸öÑÝʾÓõÄÊÓͼ */ container = demo_view("RadioBox View"); - /* 获得视图的ä½�置信æ�¯ */ + /* »ñµÃÊÓͼµÄλÖÃÐÅÏ¢ */ demo_view_get_rect(container, &rect); rect.x1 += 5; rect.x2 -= 5; rect.y1 += 5; rect.y2 = rect.y1 + 5 * 25; - /* 创建一个垂直方å�‘显示的radiobox控件,文本项是radio_item_v数组,共5个项 */ + /* ´´½¨Ò»¸ö´¹Ö±·½ÏòÏÔʾµÄradiobox¿Ø¼þ£¬Îı¾ÏîÊÇradio_item_vÊý×飬¹²5¸öÏî */ radiobox = rtgui_radiobox_create("Radio Box", RTGUI_VERTICAL, radio_item_v, 5); - /* 设置当å‰�选择的数组是第0项 */ + /* ÉèÖõ±Ç°Ñ¡ÔñµÄÊý×éÊǵÚ0Ïî */ rtgui_radiobox_set_selection(radiobox, 0); - /* 添加radiobox控件到视图中 */ + /* Ìí¼Óradiobox¿Ø¼þµ½ÊÓͼÖÐ */ rtgui_container_add_child(container, RTGUI_WIDGET(radiobox)); - /* 设置radiobox控件的ä½�置信æ�¯ */ + /* ÉèÖÃradiobox¿Ø¼þµÄλÖÃÐÅÏ¢ */ rtgui_widget_set_rect(RTGUI_WIDGET(radiobox), &rect); - /* 获得视图的ä½�置信æ�¯ */ + /* »ñµÃÊÓͼµÄλÖÃÐÅÏ¢ */ demo_view_get_rect(container, &rect); rect.x1 += 5; rect.x2 -= 5; rect.y1 += 5 + 5 * 25; rect.y2 = rect.y1 + 60; - /* 创建一个水平方å�‘显示的radiobox控件,文本项是radio_item_h数组,共3个项 */ + /* ´´½¨Ò»¸öˮƽ·½ÏòÏÔʾµÄradiobox¿Ø¼þ£¬Îı¾ÏîÊÇradio_item_hÊý×飬¹²3¸öÏî */ radiobox = rtgui_radiobox_create("Radio Box", RTGUI_HORIZONTAL, radio_item_h, 3); - /* 设置当å‰�选择的数组是第0项 */ + /* ÉèÖõ±Ç°Ñ¡ÔñµÄÊý×éÊǵÚ0Ïî */ rtgui_radiobox_set_selection(radiobox, 0); - /* 添加radiobox控件到视图中 */ + /* Ìí¼Óradiobox¿Ø¼þµ½ÊÓͼÖÐ */ rtgui_container_add_child(container, RTGUI_WIDGET(radiobox)); - /* 设置radiobox控件的ä½�置信æ�¯ */ + /* ÉèÖÃradiobox¿Ø¼þµÄλÖÃÐÅÏ¢ */ rtgui_widget_set_rect(RTGUI_WIDGET(radiobox), &rect); return container; -- cgit v1.3.1