2012-04-18 23:06:12 +08:00
|
|
|
|
/*
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>嵥<EFBFBD><EFBFBD>texbox<EFBFBD>ؼ<EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
*
|
|
|
|
|
* <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>textbox<EFBFBD>ؼ<EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
#include "demo_view.h"
|
|
|
|
|
#include <rtgui/widgets/label.h>
|
|
|
|
|
#include <rtgui/widgets/textbox.h>
|
|
|
|
|
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾtextbox<6F>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD>ͼ */
|
2012-08-13 16:32:01 +08:00
|
|
|
|
rtgui_container_t *demo_view_textbox(void)
|
2012-04-18 23:06:12 +08:00
|
|
|
|
{
|
2012-08-13 16:32:01 +08:00
|
|
|
|
rtgui_rect_t rect, textbox_rect;
|
|
|
|
|
rtgui_container_t *container;
|
|
|
|
|
rtgui_label_t *label;
|
|
|
|
|
rtgui_textbox_t *text;
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
/* <20>ȴ<EFBFBD><C8B4><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ʾ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ͼ */
|
|
|
|
|
container = demo_view("TextBox View");
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϣ */
|
|
|
|
|
demo_view_get_rect(container, &rect);
|
|
|
|
|
rect.x1 += 5;
|
|
|
|
|
rect.x2 = rect.x1 + 30;
|
|
|
|
|
rect.y1 += 5;
|
|
|
|
|
rect.y2 = rect.y1 + 20;
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>label<65>ؼ<EFBFBD> */
|
|
|
|
|
label = rtgui_label_create("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ");
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>label<65><6C>λ<EFBFBD><CEBB> */
|
|
|
|
|
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
|
|
|
|
|
rtgui_container_add_child(container, RTGUI_WIDGET(label));
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
/* <20><>textbox_rect<63><74>ֵ<EFBFBD><D6B5>rect<63><74><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD>textbox<6F>ؼ<EFBFBD><D8BC><EFBFBD>λ<EFBFBD><CEBB> */
|
|
|
|
|
textbox_rect = rect;
|
|
|
|
|
textbox_rect.x1 = textbox_rect.x2 + 5;
|
|
|
|
|
textbox_rect.x2 = textbox_rect.x1 + 160;
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>textbox<6F>ؼ<EFBFBD> */
|
|
|
|
|
text = rtgui_textbox_create("bernard", RTGUI_TEXTBOX_SINGLE);
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>textbox<6F>ؼ<EFBFBD><D8BC><EFBFBD>λ<EFBFBD><CEBB> */
|
|
|
|
|
rtgui_widget_set_rect(RTGUI_WIDGET(text), &textbox_rect);
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>textbox<6F>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC> */
|
|
|
|
|
rtgui_container_add_child(container, RTGUI_WIDGET(text));
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>label<65>ؼ<EFBFBD><D8BC><EFBFBD>λ<EFBFBD><CEBB> */
|
|
|
|
|
rect.y1 += 23;
|
|
|
|
|
rect.y2 = rect.y1 + 20;
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>label<65>ؼ<EFBFBD> */
|
|
|
|
|
label = rtgui_label_create("<EFBFBD>ʼ<EFBFBD>: ");
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>label<65><6C>λ<EFBFBD><CEBB> */
|
|
|
|
|
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>label<65>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC> */
|
|
|
|
|
rtgui_container_add_child(container, RTGUI_WIDGET(label));
|
|
|
|
|
textbox_rect = rect;
|
|
|
|
|
textbox_rect.x1 = textbox_rect.x2 + 5;
|
|
|
|
|
textbox_rect.x2 = textbox_rect.x1 + 160;
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>textbox<6F>ؼ<EFBFBD> */
|
|
|
|
|
text = rtgui_textbox_create("bernard.xiong@gmail.com", RTGUI_TEXTBOX_SINGLE);
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>textbox<6F>ؼ<EFBFBD><D8BC><EFBFBD>λ<EFBFBD><CEBB> */
|
|
|
|
|
rtgui_widget_set_rect(RTGUI_WIDGET(text), &textbox_rect);
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>textbox<6F>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC> */
|
|
|
|
|
rtgui_container_add_child(container, RTGUI_WIDGET(text));
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
rect.y1 += 23;
|
|
|
|
|
rect.y2 = rect.y1 + 20;
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>label<65>ؼ<EFBFBD> */
|
|
|
|
|
label = rtgui_label_create("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ");
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>label<65><6C>λ<EFBFBD><CEBB> */
|
|
|
|
|
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>label<65>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC> */
|
|
|
|
|
rtgui_container_add_child(container, RTGUI_WIDGET(label));
|
|
|
|
|
textbox_rect = rect;
|
|
|
|
|
textbox_rect.x1 = textbox_rect.x2 + 5;
|
|
|
|
|
textbox_rect.x2 = textbox_rect.x1 + 160;
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>textbox<6F>ؼ<EFBFBD> */
|
|
|
|
|
text = rtgui_textbox_create("rt-thread", RTGUI_TEXTBOX_SINGLE);
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>textbox<6F><78>ʾ<EFBFBD>ı<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ(<28><><EFBFBD><EFBFBD>ʾΪ*<2A>ţ<EFBFBD><C5A3>ʺ<EFBFBD><CABA><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) */
|
|
|
|
|
text->flag |= RTGUI_TEXTBOX_MASK;
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>textbox<6F>ؼ<EFBFBD><D8BC><EFBFBD>λ<EFBFBD><CEBB> */
|
|
|
|
|
rtgui_widget_set_rect(RTGUI_WIDGET(text), &textbox_rect);
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>textbox<6F>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC> */
|
|
|
|
|
rtgui_container_add_child(container, RTGUI_WIDGET(text));
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
rect.y1 += 23;
|
|
|
|
|
rect.y2 = rect.y1 + 20;
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>label<65>ؼ<EFBFBD> */
|
|
|
|
|
label = rtgui_label_create("<EFBFBD><EFBFBD>ҳ: ");
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>label<65><6C>λ<EFBFBD><CEBB> */
|
|
|
|
|
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>label<65>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC> */
|
|
|
|
|
rtgui_container_add_child(container, RTGUI_WIDGET(label));
|
|
|
|
|
textbox_rect = rect;
|
|
|
|
|
textbox_rect.x1 = textbox_rect.x2 + 5;
|
|
|
|
|
textbox_rect.x2 = textbox_rect.x1 + 160;
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>textbox<6F>ؼ<EFBFBD> */
|
|
|
|
|
text = rtgui_textbox_create("http://www.rt-thread.org", RTGUI_TEXTBOX_SINGLE);
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>textbox<6F>ؼ<EFBFBD><D8BC><EFBFBD>λ<EFBFBD><CEBB> */
|
|
|
|
|
rtgui_widget_set_rect(RTGUI_WIDGET(text), &textbox_rect);
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>textbox<6F>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC> */
|
|
|
|
|
rtgui_container_add_child(container, RTGUI_WIDGET(text));
|
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
|
|
|
|
}
|