From d99f864bf9b18c01d196426909af0ad10b631de9 Mon Sep 17 00:00:00 2001 From: Liu Chao Date: Wed, 14 Nov 2012 21:40:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E6=9C=AC=E6=A1=86?= =?UTF-8?q?=E9=83=A8=E4=BB=B6=E4=BB=A3=E7=A0=81=EF=BC=8C=E4=B8=BA=E4=BB=A5?= =?UTF-8?q?=E5=90=8E=E7=9A=84=E5=93=8D=E5=BA=94=E6=8C=89=E9=94=AE=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E5=81=9A=E5=87=86=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/LCUI_TextBox.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/widget/LCUI_TextBox.c b/src/widget/LCUI_TextBox.c index d328e24e1..191316334 100644 --- a/src/widget/LCUI_TextBox.c +++ b/src/widget/LCUI_TextBox.c @@ -14,6 +14,7 @@ #include LC_GRAPH_H #include LC_FONT_H #include LC_LABEL_H +#include LC_INPUT_H #include LC_ERROR_H typedef struct _LCUI_TextBox @@ -25,6 +26,11 @@ LCUI_TextBox; static LCUI_Widget *active_textbox = NULL; /************************* 基本的部件处理 ********************************/ +static void +_put_textbox_cursor( LCUI_Widget *widget, void *arg ) +{ + active_textbox = widget; +} static void set_textbox_cursor_despos( LCUI_Pos pos ) @@ -94,6 +100,23 @@ TextBox_TextLayer_Click( LCUI_Widget *widget, LCUI_DragEvent *event ) set_textbox_cursor_despos( pos ); } +static void +TextBox_Input( LCUI_Widget *widget, LCUI_Key *key ) +{ + printf("you input %d\n", key->code); + switch( key->code ) { + case KEY_LEFT: + break; + case KEY_RIGHT: + break; + case KEY_UP: + break; + case KEY_DOWN: + break; + default:break; + } +} + static void TextBox_Init( LCUI_Widget *widget ) /* 初始化文本框相关数据 */ @@ -118,6 +141,8 @@ TextBox_Init( LCUI_Widget *widget ) /* 设定定时器,每1秒闪烁一次 */ set_timer( 500, blink_cursor, TRUE ); Widget_Drag_Event_Connect( widget, TextBox_TextLayer_Click ); + Widget_FocusIn_Event_Connect( widget, _put_textbox_cursor, NULL ); + Widget_Keyboard_Event_Connect( widget, TextBox_Input ); } static LCUI_Widget*