rt-thread/examples/gui/demo_view_radiobox.c

70 lines
1.8 KiB
C
Raw Normal View History

/*
2013-02-01 10:27:10 +08:00
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>radiobox<EFBFBD>ؼ<EFBFBD><EFBFBD><EFBFBD>ʾ
*
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>
*/
#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> */
static char *radio_item_v[5] =
{
"one",
"two",
"three",
"item 1",
"item 2"
};
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> */
static char *radio_item_h[3] =
{
"one", "two", "three"
};
2013-02-01 10:27:10 +08:00
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾradiobox<6F>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD>ͼ */
rtgui_container_t *demo_view_radiobox(void)
{
rtgui_rect_t rect;
rtgui_container_t *container;
rtgui_radiobox_t *radiobox;
2013-02-01 10:27:10 +08:00
/* <20>ȴ<EFBFBD><C8B4><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ʾ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ͼ */
container = demo_view("RadioBox View");
2013-02-01 10:27:10 +08:00
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϣ */
demo_view_get_rect(container, &rect);
rect.x1 += 5;
rect.x2 -= 5;
rect.y1 += 5;
rect.y2 = rect.y1 + 5 * 25;
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> */
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> */
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> */
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>Ϣ */
rtgui_widget_set_rect(RTGUI_WIDGET(radiobox), &rect);
2013-02-01 10:27:10 +08:00
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϣ */
demo_view_get_rect(container, &rect);
rect.x1 += 5;
rect.x2 -= 5;
rect.y1 += 5 + 5 * 25;
rect.y2 = rect.y1 + 60;
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> */
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> */
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> */
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>Ϣ */
rtgui_widget_set_rect(RTGUI_WIDGET(radiobox), &rect);
return container;
}