+ }
+
+ void OnKeyEvent( const Event& event )
+ {
+ int keyCode = event.p1.mInt;
+
+ // Handle state changes
+ if( Dali::DALI_KEY_ESCAPE == keyCode )
+ {
+ ChangeState( INACTIVE ); // Escape key ends edit mode
+ }
+ else if ( event.p2.mString )
+ {
+ // Some text may be selected, hiding keyboard causes an empty keystring to be sent, we don't want to delete highlight in this case
+ ChangeState( EDITING );
+ }
+
+ // Handle the actual key event
+ if( Dali::DALI_KEY_BACKSPACE == keyCode )
+ {
+ HandleBackspaceKey();
+ }
+ else if( Dali::DALI_KEY_CURSOR_LEFT == keyCode ||
+ Dali::DALI_KEY_CURSOR_RIGHT == keyCode ||
+ Dali::DALI_KEY_CURSOR_UP == keyCode ||
+ Dali::DALI_KEY_CURSOR_DOWN == keyCode )
+ {
+ HandleCursorKey( keyCode );
+ }
+ else if ( event.p2.mString )
+ {
+ HandleKeyString( event.p2.mString );
+
+ delete [] event.p2.mString;
+ }
+ }
+
+ void HandleBackspaceKey()
+ {
+ // TODO
+ }
+
+ void HandleCursorKey( int keyCode )
+ {
+ // TODO
+ }
+
+ void HandleKeyString( const char* keyString )
+ {