2012-04-18 23:06:12 +08:00
|
|
|
|
/*
|
2013-02-01 10:27:10 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>嵥<EFBFBD><EFBFBD>radiobox<EFBFBD>ؼ<EFBFBD><EFBFBD><EFBFBD>ʾ
|
2012-04-18 23:06:12 +08:00
|
|
|
|
*
|
2013-02-01 10:27:10 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӻ<EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>container<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>radiobox<EFBFBD>ؼ<EFBFBD>
|
2012-04-18 23:06:12 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "demo_view.h"
|
|
|
|
|
#include <rtgui/widgets/radiobox.h>
|
|
|
|
|
|
2013-02-01 10:27:10 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>radio<69>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
2012-08-13 16:32:01 +08:00
|
|
|
|
static char *radio_item_v[5] =
|
|
|
|
|
{
|
|
|
|
|
"one",
|
|
|
|
|
"two",
|
|
|
|
|
"three",
|
|
|
|
|
"item 1",
|
|
|
|
|
"item 2"
|
|
|
|
|
};
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2013-02-01 10:27:10 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾˮƽ<CBAE><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>radio<69>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
2012-08-13 16:32:01 +08:00
|
|
|
|
static char *radio_item_h[3] =
|
|
|
|
|
{
|
|
|
|
|
"one", "two", "three"
|
|
|
|
|
};
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2013-02-01 10:27:10 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾradiobox<6F>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD>ͼ */
|
2012-08-13 16:32:01 +08:00
|
|
|
|
rtgui_container_t *demo_view_radiobox(void)
|
2012-04-18 23:06:12 +08:00
|
|
|
|
{
|
2012-08-13 16:32:01 +08:00
|
|
|
|
rtgui_rect_t rect;
|
|
|
|
|
rtgui_container_t *container;
|
|
|
|
|
rtgui_radiobox_t *radiobox;
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2013-02-01 10:27:10 +08:00
|
|
|
|
/* <20>ȴ<EFBFBD><C8B4><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ʾ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ͼ */
|
2012-08-13 16:32:01 +08:00
|
|
|
|
container = demo_view("RadioBox View");
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2013-02-01 10:27:10 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϣ */
|
2012-08-13 16:32:01 +08:00
|
|
|
|
demo_view_get_rect(container, &rect);
|
|
|
|
|
rect.x1 += 5;
|
|
|
|
|
rect.x2 -= 5;
|
|
|
|
|
rect.y1 += 5;
|
|
|
|
|
rect.y2 = rect.y1 + 5 * 25;
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2013-02-01 10:27:10 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>radiobox<6F>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>radio_item_v<5F><76><EFBFBD>飬<EFBFBD><E9A3AC>5<EFBFBD><35><EFBFBD><EFBFBD> */
|
2012-08-13 16:32:01 +08:00
|
|
|
|
radiobox = rtgui_radiobox_create("Radio Box", RTGUI_VERTICAL, radio_item_v, 5);
|
2013-02-01 10:27:10 +08:00
|
|
|
|
/* <20><><EFBFBD>õ<EFBFBD>ǰѡ<C7B0><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǵ<EFBFBD>0<EFBFBD><30> */
|
2012-08-13 16:32:01 +08:00
|
|
|
|
rtgui_radiobox_set_selection(radiobox, 0);
|
2013-02-01 10:27:10 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD>radiobox<6F>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC> */
|
2012-08-13 16:32:01 +08:00
|
|
|
|
rtgui_container_add_child(container, RTGUI_WIDGET(radiobox));
|
2013-02-01 10:27:10 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD>radiobox<6F>ؼ<EFBFBD><D8BC><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϣ */
|
2012-08-13 16:32:01 +08:00
|
|
|
|
rtgui_widget_set_rect(RTGUI_WIDGET(radiobox), &rect);
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2013-02-01 10:27:10 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϣ */
|
2012-08-13 16:32:01 +08:00
|
|
|
|
demo_view_get_rect(container, &rect);
|
|
|
|
|
rect.x1 += 5;
|
|
|
|
|
rect.x2 -= 5;
|
|
|
|
|
rect.y1 += 5 + 5 * 25;
|
|
|
|
|
rect.y2 = rect.y1 + 60;
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2013-02-01 10:27:10 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>radiobox<6F>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>radio_item_h<5F><68><EFBFBD>飬<EFBFBD><E9A3AC>3<EFBFBD><33><EFBFBD><EFBFBD> */
|
2012-08-13 16:32:01 +08:00
|
|
|
|
radiobox = rtgui_radiobox_create("Radio Box", RTGUI_HORIZONTAL, radio_item_h, 3);
|
2013-02-01 10:27:10 +08:00
|
|
|
|
/* <20><><EFBFBD>õ<EFBFBD>ǰѡ<C7B0><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǵ<EFBFBD>0<EFBFBD><30> */
|
2012-08-13 16:32:01 +08:00
|
|
|
|
rtgui_radiobox_set_selection(radiobox, 0);
|
2013-02-01 10:27:10 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD>radiobox<6F>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC> */
|
2012-08-13 16:32:01 +08:00
|
|
|
|
rtgui_container_add_child(container, RTGUI_WIDGET(radiobox));
|
2013-02-01 10:27:10 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD>radiobox<6F>ؼ<EFBFBD><D8BC><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϣ */
|
2012-08-13 16:32:01 +08:00
|
|
|
|
rtgui_widget_set_rect(RTGUI_WIDGET(radiobox), &rect);
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
return container;
|
2012-04-18 23:06:12 +08:00
|
|
|
|
}
|