textinput/peninputcommonlayout/src/peninputcommonlayout.cpp
changeset 40 2cb9bae34d17
parent 31 f1bdd6b078d1
child 49 37f5d84451bd
equal deleted inserted replaced
31:f1bdd6b078d1 40:2cb9bae34d17
     1 /*
       
     2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  common layout framework
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // System includes
       
    20 #include <aknfeppeninputenums.h>    // Command from fep or IME to plugin
       
    21 #include <AknFepGlobalEnums.h>      // Define EPluginInputModeHwr
       
    22 #include <peninputcmd.h>            // Use global signal
       
    23 #include <peninputlayoutchoicelist.h>
       
    24 #include <peninputlayoutbutton.h>
       
    25 #include <peninputdragbutton.h>
       
    26 #include <coemain.h>
       
    27 
       
    28 // User includes
       
    29 #include "peninputuistatebase.h"
       
    30 #include "peninputdataconverter.h"
       
    31 #include "peninputcommonlayout.h"
       
    32 #include "peninputlayoutwindow.h"
       
    33 #include "peninputdatamgr.h"
       
    34 #include "peninputuistatemgr.h"
       
    35 #include "peninputrangebarinfo.h"	
       
    36 
       
    37 // Constants
       
    38 const TInt KPeninputCommonLayoutBufLen = 8;
       
    39 const TInt KIntSizeToInt16 = 2;
       
    40 
       
    41 // ======== MEMBER FUNCTIONS ========
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 // CPeninputCommonLayout::CPeninputCommonLayout
       
    45 // (other items were commented in a header)
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 EXPORT_C CPeninputCommonLayout::CPeninputCommonLayout( MLayoutOwner* aLayoutOwner )
       
    49     : CFepUiLayout( aLayoutOwner )
       
    50     {
       
    51     }
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // CPeninputCommonLayout::ConstructL
       
    55 // (other items were commented in a header)
       
    56 // ---------------------------------------------------------------------------
       
    57 //
       
    58 EXPORT_C void CPeninputCommonLayout::ConstructL( const TAny* aInitData )
       
    59     {
       
    60     BaseConstructL();
       
    61 
       
    62     TPixelsTwipsAndRotation ptSize;
       
    63     
       
    64     CCoeEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation( ptSize );
       
    65             
       
    66     SetScreenSize(ptSize.iPixelSize);    
       
    67     
       
    68     // This method must be called first, because it will initialize 
       
    69     // language from CenRep
       
    70     CreateDataMgrL(aInitData);
       
    71 
       
    72     TBool sizeChanging = ETrue;
       
    73     if ( iDataMgr )
       
    74         {
       
    75         // Store screen mode, and get new window position
       
    76         iDataMgr->SetData( EPeninputDataTypeScreenMode, ( TAny* ) &ptSize );
       
    77         
       
    78         // Store justify style
       
    79         iDataMgr->SetData(EAkninputDataTypeSizeChanging, &sizeChanging);
       
    80         }
       
    81 
       
    82     iUiStateMgr = CPeninputUiStateMgr::NewL( this );
       
    83 
       
    84     CreateLayoutWindowL();
       
    85 
       
    86     if ( iLayoutWindow )
       
    87         {
       
    88         iLayoutWindow->Hide(ETrue);
       
    89         AddControlL( iLayoutWindow );
       
    90         
       
    91         // Config layout self using the whole screen
       
    92         //SetRect(TRect(TPoint(0, 0), ptSize.iPixelSize ));
       
    93 
       
    94         // Call the function in window to read config info
       
    95         //ChangeInputLanguage( *( (TInt*)iDataMgr->RequestData(EPeninputDataTypeInputLanguage)));
       
    96 
       
    97         iLayoutWindow->SizeChanged( ETrue );
       
    98         EnableLayoutMoving( static_cast<CDragBar*>( iLayoutWindow->MoveButton() ) );
       
    99         }
       
   100     
       
   101     if (iDataMgr)
       
   102     	{
       
   103     	sizeChanging = EFalse;
       
   104     	iDataMgr->SetData(EAkninputDataTypeSizeChanging, &sizeChanging);
       
   105     	}
       
   106     }
       
   107 
       
   108 // ---------------------------------------------------------------------------
       
   109 // CPeninputCommonLayout::~CPeninputCommonLayout
       
   110 // (other items were commented in a header)
       
   111 // ---------------------------------------------------------------------------
       
   112 //
       
   113 EXPORT_C CPeninputCommonLayout::~CPeninputCommonLayout()
       
   114     {       
       
   115     delete iUiStateMgr;
       
   116     delete iDataMgr;
       
   117     
       
   118     }
       
   119 
       
   120 // ---------------------------------------------------------------------------
       
   121 // CPeninputCommonLayout::UiStateMgr
       
   122 // (other items were commented in a header)
       
   123 // ---------------------------------------------------------------------------
       
   124 //
       
   125 EXPORT_C MPeninputUiStateMgr* CPeninputCommonLayout::UiStateMgr() const
       
   126     {
       
   127     return iUiStateMgr;
       
   128     }
       
   129 
       
   130 // ---------------------------------------------------------------------------
       
   131 // CPeninputCommonLayout::LayoutWindow
       
   132 // (other items were commented in a header)
       
   133 // ---------------------------------------------------------------------------
       
   134 //
       
   135 EXPORT_C CPeninputLayoutWindow* CPeninputCommonLayout::LayoutWindow() const
       
   136     {
       
   137     return NULL;
       
   138     }
       
   139 
       
   140 // ---------------------------------------------------------------------------
       
   141 // CPeninputCommonLayout::HandleCommand
       
   142 // (other items were commented in a header)
       
   143 // ---------------------------------------------------------------------------
       
   144 //
       
   145 EXPORT_C TInt CPeninputCommonLayout::HandleCommand( TInt aCmd, 
       
   146                                                     TUint8* aData )
       
   147     {
       
   148     // Handle command from fep or IME to this layout
       
   149     TUint* data = ( TUint* ) aData;
       
   150     TBuf<KPeninputCommonLayoutBufLen> buf;
       
   151     TBuf<KIntSizeToInt16> bufStyle;
       
   152     TInt style;
       
   153     TInt ret = KErrNone;
       
   154     
       
   155     switch ( aCmd )
       
   156         {
       
   157         case ECmdPenInputPermittedRange:
       
   158             CPeninputDataConverter::IntToDesc( *data, buf );
       
   159             SendEventToWindow( EPeninputLayoutEventSetPermittedRange, NULL, 
       
   160                                buf );        
       
   161             break;
       
   162         case ECmdPenInputPermittedCase:
       
   163             {
       
   164             CPeninputDataConverter::IntToDesc( *data, buf );
       
   165             SendEventToWindow( EPeninputLayoutEventSetPermittedCase, NULL, 
       
   166                                buf );             
       
   167             }
       
   168             break;
       
   169         case ECmdPenInputEditorNumericKeyMap:
       
   170             {
       
   171             iDataMgr->SetData( EPeninputDataTypeNumericKeymap, data );
       
   172             }
       
   173             break;
       
   174         case ECmdPenInputCase:
       
   175             {
       
   176             CPeninputDataConverter::IntToDesc( *data, buf );
       
   177             SendEventToWindow( EPeninputLayoutEventSetCase, NULL, 
       
   178                                buf );
       
   179             }
       
   180             break;
       
   181         case ECmdPenInputLanguage:
       
   182             {
       
   183             ChangeInputLanguage(*data);
       
   184             }            
       
   185             break;
       
   186         case ECmdPenInputRange:
       
   187             {
       
   188             ChangeRange( TranslateRange(*data) );
       
   189             }
       
   190             break;
       
   191         case ECmdPenInputEnableSettingBtn:
       
   192             {
       
   193             SetEnableSettingBtn(*data);
       
   194             }
       
   195             break;
       
   196         case ECmdPenInputIsSecretText:
       
   197             {
       
   198             iLayoutWindow->SetTextIsSecret( *aData );
       
   199             }
       
   200             break;
       
   201         case ECmdPenInputIsNumberGrouping:
       
   202             {
       
   203             iLayoutWindow->SetNumberGrouping( *aData );
       
   204             }
       
   205             break;    
       
   206         case ECmdPenInputWindowOpen:
       
   207             {
       
   208             if ( *data == EPenInputOpenManually )
       
   209                 {
       
   210                 style = EPeninputPositionChangeBrJustify;
       
   211                 bufStyle = ( TUint16* )&style;
       
   212                 SendEventToWindow(EPeninputLayoutEventMovePosition, NULL, bufStyle );  
       
   213                 }
       
   214             iLayoutWindow->Hide(EFalse);
       
   215             LayoutOwner()->Hide( EFalse );
       
   216             }
       
   217             break;
       
   218         case ECmdPenInputWindowClose:
       
   219             {
       
   220             iLayoutWindow->Hide(ETrue);            
       
   221             LayoutOwner()->Hide( ETrue );
       
   222 
       
   223             SendEventToWindow( EPeninputLayoutEventCloseWindow, NULL );
       
   224             }
       
   225             break;
       
   226         case ECmdPenInputSetWindowPos:
       
   227             {
       
   228             // Only VKB need to move position automatically
       
   229             if ( LayoutType() == EPluginInputModeVkb )
       
   230                 {
       
   231                 // Data is a TRect
       
   232                 iDataMgr->SetData( EPeninputDataTypeDataQueryDlgRect, 
       
   233                                    (TRect*) aData );
       
   234                                    
       
   235                 // Store justify style
       
   236                 style = EPeninputPositionChangeDataQuery;
       
   237                 bufStyle = ( TUint16* )&style;
       
   238                 SendEventToWindow(EPeninputLayoutEventMovePosition, NULL, bufStyle);
       
   239                 }
       
   240             }
       
   241             break;
       
   242         case ECmdPenInputEditorCustomNumericKeyMap:
       
   243             {
       
   244             iDataMgr->SetData(EAknFepDataTypeUseDefinedResource, aData);
       
   245             }
       
   246             break;    
       
   247         case ECmdPenInputSetTextAlignment:
       
   248         	{
       
   249 		    TRAP_IGNORE(iLayoutWindow->SetTextAlignmentL( *data ));
       
   250         	}
       
   251         	break;
       
   252         default:
       
   253             {
       
   254             ret = CFepUiLayout::HandleCommand( aCmd, aData );
       
   255             }
       
   256             break;
       
   257         }
       
   258 
       
   259     return ret;
       
   260     }
       
   261 
       
   262 // ---------------------------------------------------------------------------
       
   263 // CPeninputCommonLayout::SizeChanged
       
   264 // (other items were commented in a header)
       
   265 // ---------------------------------------------------------------------------
       
   266 //
       
   267 EXPORT_C TInt CPeninputCommonLayout::SizeChanged( const TAny* /*aData*/ )
       
   268     {
       
   269     TBool sizeChanging = ETrue;
       
   270     iDataMgr->SetData(EAkninputDataTypeSizeChanging, &sizeChanging);
       
   271 
       
   272     // Handle size changed event
       
   273     TPixelsTwipsAndRotation ptSize;  
       
   274        
       
   275     CCoeEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation( ptSize );
       
   276     //SetScreenSize(ptSize.iPixelSize);
       
   277 
       
   278     // Store screen mode, and get new window position
       
   279     iDataMgr->SetData( EPeninputDataTypeScreenMode, ( TAny* )&ptSize );
       
   280 
       
   281      // The following need to implement
       
   282     iLayoutWindow->SizeChanged( ETrue );
       
   283 
       
   284     sizeChanging = EFalse;
       
   285     iDataMgr->SetData(EAkninputDataTypeSizeChanging, &sizeChanging);
       
   286 
       
   287     return KErrNone;
       
   288     }
       
   289 
       
   290 // ---------------------------------------------------------------------------
       
   291 // CPeninputCommonLayout::HandleControlEvent
       
   292 // (other items were commented in a header)
       
   293 // ---------------------------------------------------------------------------
       
   294 //
       
   295 EXPORT_C void CPeninputCommonLayout::HandleControlEvent(
       
   296     TInt aEventType, CFepUiBaseCtrl* aCtrl, const TDesC& aEventData )
       
   297     {
       
   298     // Handle event from control
       
   299     TInt* data = ( TInt* ) aEventData.Ptr();
       
   300 
       
   301     // Buffer for data conversion
       
   302     TBuf<KPeninputCommonLayoutBufLen> buf;
       
   303 
       
   304     switch ( aEventType )
       
   305         {
       
   306         case EPeninputLayoutEventClose:
       
   307             {
       
   308             SignalOwner( ESignalLayoutClosed );
       
   309             }
       
   310             break;
       
   311         case EPeninputLayoutEventOption:
       
   312             {
       
   313             SignalOwner( ESignalLaunchOptionMenu );
       
   314             }
       
   315             break;
       
   316         case EPeninputLayoutEventSwitchLanguage:
       
   317             {
       
   318             SignalOwner( ESignalLaunchLanguageMenu );
       
   319             }
       
   320             break;
       
   321         // When drag end, store the position data
       
   322         case EEventDraggingEnd:
       
   323             {
       
   324             TInt x = 0;
       
   325             TInt y = 0;
       
   326             x = 0x0000FFFF & ( Position().iX + Rect().Width() );
       
   327             y = 0xFFFF0000 & ( ( Position().iY + Rect().Height() ) << 16 );
       
   328             TInt position = x | y;
       
   329             if ( position )
       
   330                 {
       
   331                 iDataMgr->SetData( EPeninputDataTypeWindowPosition, &position );
       
   332                 }
       
   333             }
       
   334             break;
       
   335         default:
       
   336             {
       
   337             if ( iUiStateMgr->CurrentUiState() )
       
   338                 {
       
   339                 if ( !iUiStateMgr->CurrentUiState()->HandleControlEvent
       
   340                     ( aEventType, aEventData ) )
       
   341                     {
       
   342                     SendEventToWindow( aEventType, aCtrl, aEventData );
       
   343                     }                    
       
   344                 }
       
   345             }
       
   346             break;       
       
   347         }
       
   348     }
       
   349 
       
   350 // ---------------------------------------------------------------------------
       
   351 // CPeninputCommonLayout::OnAppEditorTextComing
       
   352 // (other items were commented in a header)
       
   353 // ---------------------------------------------------------------------------
       
   354 //
       
   355 EXPORT_C TInt CPeninputCommonLayout::OnAppEditorTextComing(
       
   356     const TFepInputContextFieldData& aData )
       
   357     {
       
   358     // Handle edit text coming
       
   359     if ( iLayoutWindow )
       
   360         {
       
   361         TRAPD( err, iLayoutWindow->SetEditorTextL( aData ) );
       
   362         return err;
       
   363         }
       
   364     
       
   365     return KErrNone;
       
   366     }
       
   367 
       
   368 // ---------------------------------------------------------------------------
       
   369 // CPeninputCommonLayout::HandleRawKeyEventL
       
   370 // (other items were commented in a header)
       
   371 // ---------------------------------------------------------------------------
       
   372 //
       
   373 EXPORT_C TBool CPeninputCommonLayout::HandleRawKeyEventL(
       
   374     const TRawEvent& aKeyEvent )
       
   375     { 
       
   376     return iUiStateMgr->CurrentUiState()->HandleKeyEventL( aKeyEvent );
       
   377     }
       
   378 
       
   379 // ---------------------------------------------------------------------------
       
   380 // CPeninputCommonLayout::SendEventToWindow
       
   381 // (other items were commented in a header)
       
   382 // ---------------------------------------------------------------------------
       
   383 //
       
   384 EXPORT_C void CPeninputCommonLayout::SendEventToWindow( 
       
   385     TInt aEventType, CFepUiBaseCtrl* aCtrl, const TDesC& aEventData )
       
   386     {
       
   387     iLayoutWindow->HandleControlEvent( aEventType, aCtrl, aEventData );
       
   388     }
       
   389 
       
   390 // ---------------------------------------------------------------------------
       
   391 // CPeninputCommonLayout::SendEventToLayout
       
   392 // (other items were commented in a header)
       
   393 // ---------------------------------------------------------------------------
       
   394 //
       
   395 EXPORT_C void CPeninputCommonLayout::SendEventToLayout( 
       
   396     TInt aEventType, CFepUiBaseCtrl* aCtrl, const TDesC& aEventData )
       
   397     {
       
   398     HandleControlEvent( aEventType, aCtrl, aEventData );
       
   399     }
       
   400 
       
   401 // ---------------------------------------------------------------------------
       
   402 // CPeninputCommonLayout::Sendkey
       
   403 // (other items were commented in a header)
       
   404 // ---------------------------------------------------------------------------
       
   405 //
       
   406 EXPORT_C void CPeninputCommonLayout::Sendkey( TInt aEventType, 
       
   407                                               const TDesC& aEventData )
       
   408     {
       
   409     SignalOwner( aEventType, aEventData ); 
       
   410     }
       
   411 
       
   412 // ---------------------------------------------------------------------------
       
   413 // CPeninputCommonLayout::IsShiftPermitted
       
   414 // (other items were commented in a header).
       
   415 // ---------------------------------------------------------------------------
       
   416 //           
       
   417 EXPORT_C TBool CPeninputCommonLayout::IsShiftPermitted()
       
   418     {
       
   419     return iDataMgr->IsShiftPermitted();
       
   420     }
       
   421     
       
   422 // ---------------------------------------------------------------------------
       
   423 // CPeninputCommonLayout::IsCapsLockPermitted
       
   424 // (other items were commented in a header).
       
   425 // ---------------------------------------------------------------------------
       
   426 //  
       
   427 EXPORT_C TBool CPeninputCommonLayout::IsCapsLockPermitted()
       
   428     {
       
   429     return iDataMgr->IsCapsLockPermitted();
       
   430     }
       
   431     
       
   432 // ---------------------------------------------------------------------------
       
   433 // CPeninputCommonLayout::RequestData
       
   434 // (other items were commented in a header)
       
   435 // ---------------------------------------------------------------------------
       
   436 //
       
   437 EXPORT_C TAny* CPeninputCommonLayout::RequestData( 
       
   438     TPeninputDataType aDataType )
       
   439     {
       
   440     return iDataMgr->RequestData( aDataType );
       
   441     }
       
   442 
       
   443 // ---------------------------------------------------------------------------
       
   444 // CPeninputCommonLayout::SetData
       
   445 // (other items were commented in a header)
       
   446 // ---------------------------------------------------------------------------
       
   447 //
       
   448 EXPORT_C void CPeninputCommonLayout::SetData( TPeninputDataType aDataType, 
       
   449                                               TAny* aData )
       
   450     {
       
   451     iDataMgr->SetData( aDataType, aData );
       
   452     }
       
   453                 
       
   454 // ---------------------------------------------------------------------------
       
   455 // CPeninputCommonLayout::SetData
       
   456 // (other items were commented in a header)
       
   457 // ---------------------------------------------------------------------------
       
   458 //
       
   459 EXPORT_C TBool CPeninputCommonLayout::IsValidDestination( const TRect& aRect,
       
   460                                                           CDragBar* aDragBar,
       
   461                                                           TBool& aVInfo,
       
   462                                                           TBool& aHInfo,
       
   463                                                           TBool aFlag )
       
   464     {
       
   465     // Validate move button destination 
       
   466     if ( !aDragBar )
       
   467         {
       
   468         return EFalse;
       
   469         }
       
   470         
       
   471     TRect rect = aRect;
       
   472     
       
   473     if ( aFlag )
       
   474         {
       
   475         // Layout is moving
       
   476         aHInfo = aVInfo = EFalse;
       
   477         TRect dragbarRect( aRect.iTl, aDragBar->Rect().Size() );
       
   478         
       
   479         if ( dragbarRect.iTl.iX >= 0 
       
   480              && dragbarRect.iBr.iX < ScreenSize().iWidth )
       
   481             {
       
   482             aHInfo = ETrue;
       
   483             }
       
   484             
       
   485         if ( dragbarRect.iTl.iY >= 0 
       
   486              && dragbarRect.iBr.iY < ScreenSize().iHeight )
       
   487             {
       
   488             aVInfo = ETrue;
       
   489             }
       
   490         
       
   491         return ( aHInfo && aVInfo );
       
   492         }
       
   493     else
       
   494         {
       
   495         if ( aDragBar )
       
   496             {
       
   497             rect.SetSize( aDragBar->Rect().Size() );
       
   498             }
       
   499             
       
   500         TBool tlInvalid = !Rect().Contains( rect.iTl );
       
   501         TBool brInvalid = !Rect().Contains( rect.iBr );
       
   502 
       
   503         if ( tlInvalid && !brInvalid )
       
   504             {
       
   505             if ( rect.iTl.iX >= Rect().iTl.iX 
       
   506                  && rect.iTl.iX <= Rect().iBr.iX )
       
   507                 {
       
   508                 aHInfo = ETrue;
       
   509                 }
       
   510             else if ( rect.iTl.iY >= Rect().iTl.iY 
       
   511                       && rect.iTl.iY <= Rect().iBr.iY )
       
   512                 {
       
   513                 aVInfo = ETrue;
       
   514                 }
       
   515             }
       
   516         else if ( !tlInvalid && brInvalid )
       
   517             {
       
   518             if ( rect.iBr.iX >= Rect().iTl.iX 
       
   519                  && rect.iBr.iX <= Rect().iBr.iX )
       
   520                 {
       
   521                 aHInfo = ETrue;
       
   522                 }
       
   523             else if ( rect.iBr.iY >= Rect().iTl.iY 
       
   524                       && rect.iBr.iY <= Rect().iBr.iY )
       
   525                 {
       
   526                 aVInfo = ETrue;
       
   527                 }
       
   528             }
       
   529 
       
   530         return !( tlInvalid || brInvalid );
       
   531         }
       
   532     }
       
   533 
       
   534 // ---------------------------------------------------------------------------
       
   535 // CPeninputCommonLayout::TranslateRange
       
   536 // (other items were commented in a header)
       
   537 // ---------------------------------------------------------------------------
       
   538 //
       
   539 TInt CPeninputCommonLayout::TranslateRange(TInt aRange)
       
   540     {
       
   541     TInt newRange = aRange;
       
   542     	     
       
   543     if ( aRange == ERangeNative)
       
   544         {
       
   545         if ( iLayoutWindow
       
   546              && iLayoutWindow->ConfigInfo()
       
   547              && iLayoutWindow->ConfigInfo()->RangeBarInfo()->FindRange( ERangeNative ) )
       
   548             {
       
   549             newRange = ERangeNative;    
       
   550             }
       
   551         else
       
   552             {
       
   553             newRange = ERangeEnglish;    
       
   554             }
       
   555         }
       
   556     else if ( aRange == ERangeEnglish)
       
   557         {
       
   558         if ( iLayoutWindow
       
   559              && iLayoutWindow->ConfigInfo()
       
   560              && iLayoutWindow->ConfigInfo()->RangeBarInfo()->FindRange( ERangeEnglish ) )
       
   561             {
       
   562             newRange = ERangeEnglish;    
       
   563             }
       
   564         else
       
   565             {
       
   566             newRange = ERangeNative;    
       
   567             }
       
   568         }
       
   569                 
       
   570     return newRange;    
       
   571     }
       
   572 
       
   573 // ---------------------------------------------------------------------------
       
   574 // CPeninputCommonLayout::Init
       
   575 // (other items were commented in a header)
       
   576 // ---------------------------------------------------------------------------
       
   577 //
       
   578 EXPORT_C TRect CPeninputCommonLayout::Init()
       
   579     {
       
   580     TRect r = CFepUiLayout::Init();
       
   581     //wxy -- No need to set position here
       
   582     //LayoutOwner()->SetPosition( Rect().iTl );
       
   583     //r = TRect( Position(), r.Size() );
       
   584 
       
   585     return r;
       
   586     }
       
   587 
       
   588 // ---------------------------------------------------------------------------
       
   589 // CPeninputCommonLayout::SaveKey
       
   590 // (other items were commented in a header)
       
   591 // ---------------------------------------------------------------------------
       
   592 //
       
   593 EXPORT_C void CPeninputCommonLayout::SaveKey( TInt aKey, TInt aValue )
       
   594     {
       
   595     iDataMgr->SaveKey( aKey, aValue );
       
   596     }
       
   597 
       
   598 // ---------------------------------------------------------------------------
       
   599 // CPeninputCommonLayout::ChangeInputLanguage
       
   600 // (other items were commented in a header)
       
   601 // ---------------------------------------------------------------------------
       
   602 //
       
   603 void CPeninputCommonLayout::ChangeInputLanguage( TInt aLangID )
       
   604     {
       
   605     // Call ChangeInputLanguage function in iLayoutWindow
       
   606     TRAP_IGNORE( iLayoutWindow->ChangeInputLanguageL( aLangID ) );
       
   607     }
       
   608 
       
   609 // ---------------------------------------------------------------------------
       
   610 // CPeninputCommonLayout::ChangeLanguage
       
   611 // (other items were commented in a header).
       
   612 // ---------------------------------------------------------------------------
       
   613 //
       
   614 void CPeninputCommonLayout::ChangeRange( TInt aRange )
       
   615     {
       
   616     iLayoutWindow->ChangeRange( aRange, 0 , EFalse);
       
   617     }
       
   618 
       
   619 // ---------------------------------------------------------------------------
       
   620 // CPeninputCommonLayout::SetEnableSwitchToHwr
       
   621 // (other items were commented in a header).
       
   622 // ---------------------------------------------------------------------------
       
   623 //
       
   624 void CPeninputCommonLayout::SetEnableSwitchToHwr( TBool aEnable )
       
   625     {
       
   626     iLayoutWindow->SetEnableSwitchToHwr( aEnable );
       
   627     }   
       
   628 
       
   629 // ---------------------------------------------------------------------------
       
   630 // CPeninputCommonLayout::SetEnableSettingBtn
       
   631 // (other items were commented in a header).
       
   632 // ---------------------------------------------------------------------------
       
   633 //
       
   634 void CPeninputCommonLayout::SetEnableSettingBtn( TBool aEnable )
       
   635     {
       
   636     iLayoutWindow->SetEnableSettingBtn( aEnable );
       
   637     }  
       
   638 
       
   639 EXPORT_C TInt CPeninputCommonLayout::PenInputType()
       
   640     {
       
   641     return LayoutType();
       
   642     }
       
   643 
       
   644 EXPORT_C void CPeninputCommonLayout::SetPositionFromOutside(const TPoint& aNewPos)
       
   645     {
       
   646     LayoutOwner()->SetPosition(aNewPos);
       
   647     TInt x = 0x0000FFFF & aNewPos.iX;
       
   648     TInt y = 0xFFFF0000 & ( aNewPos.iY << 16 );
       
   649     TInt position = x | y;
       
   650     
       
   651     SetData( EPeninputDataTypeWindowPosition, (TAny*)&position );
       
   652     }
       
   653