idlefw/plugins/wsplugin/src/aiwspluginanim.cpp
branchRCL_3
changeset 9 d0529222e3f0
parent 0 79c6a41cd166
equal deleted inserted replaced
4:1a2a00e78665 9:d0529222e3f0
    14 * Description:  Active Idle Window Server Plug-in implementation.
    14 * Description:  Active Idle Window Server Plug-in implementation.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
       
    19 // System includes
       
    20 #include <featmgr.h>
       
    21 
       
    22 // User includes
    19 #include "aiwspluginanim.h"
    23 #include "aiwspluginanim.h"
    20 #include "aiwspluginanimdef.h"
    24 #include "aiwspluginanimdef.h"
    21 #include "keylockhandler.h"
       
    22 #include "numerickeyhandler.h"
    25 #include "numerickeyhandler.h"
    23 #include "logslaunchhandler.h"
    26 
    24 #include "sindlaunchhandler.h"
       
    25 
       
    26 #include <featmgr.h>
       
    27 
    27 
    28 using namespace AiWsPlugin;
    28 using namespace AiWsPlugin;
    29 
    29 
       
    30 // ======== MEMBER FUNCTIONS ========
       
    31 
       
    32 // ---------------------------------------------------------------------------
       
    33 // CAiWsPluginAnim::CAiWsPluginAnim
       
    34 //
       
    35 // ---------------------------------------------------------------------------
       
    36 //
    30 CAiWsPluginAnim::CAiWsPluginAnim()
    37 CAiWsPluginAnim::CAiWsPluginAnim()
    31     {
    38     {
    32     }
    39     }
    33 
    40 
       
    41 // ---------------------------------------------------------------------------
       
    42 // CAiWsPluginAnim::~CAiWsPluginAnim
       
    43 //
       
    44 // ---------------------------------------------------------------------------
       
    45 //
    34 CAiWsPluginAnim::~CAiWsPluginAnim()
    46 CAiWsPluginAnim::~CAiWsPluginAnim()
    35     {
    47     {
    36     iEventHandlers.ResetAndDestroy();
    48     iEventHandlers.ResetAndDestroy();
       
    49     
    37     if ( iFunctions )
    50     if ( iFunctions )
    38         {
    51         {
    39         iFunctions->GetRawEvents( EFalse );
    52         iFunctions->GetRawEvents( EFalse );
    40         }
    53         }
       
    54     
    41     FeatureManager::UnInitializeLib();
    55     FeatureManager::UnInitializeLib();
    42     }
    56     }
    43 
    57 
       
    58 // ---------------------------------------------------------------------------
       
    59 // CAiWsPluginAnim::CommandReplyL
       
    60 //
       
    61 // ---------------------------------------------------------------------------
       
    62 //
    44 TInt CAiWsPluginAnim::CommandReplyL( TInt /*aOpcode*/, TAny* /*aArgs*/ )
    63 TInt CAiWsPluginAnim::CommandReplyL( TInt /*aOpcode*/, TAny* /*aArgs*/ )
    45     {
    64     {
    46     return KErrNone;
    65     return KErrNone;
    47     }
    66     }
    48 
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // CAiWsPluginAnim::Command
       
    70 //
       
    71 // ---------------------------------------------------------------------------
       
    72 //
    49 void CAiWsPluginAnim::Command( TInt /*aOpcode*/, TAny* /*aArgs*/ )
    73 void CAiWsPluginAnim::Command( TInt /*aOpcode*/, TAny* /*aArgs*/ )
    50     {
    74     {
    51     }
    75     }
    52 
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // CAiWsPluginAnim::Animate
       
    79 //
       
    80 // ---------------------------------------------------------------------------
       
    81 //
    53 void CAiWsPluginAnim::Animate( TDateTime* /*aDateTime*/ )
    82 void CAiWsPluginAnim::Animate( TDateTime* /*aDateTime*/ )
    54     {
    83     {
    55     }
    84     }
    56 
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // CAiWsPluginAnim::AddEventHandlerAndPopL
       
    88 //
       
    89 // ---------------------------------------------------------------------------
       
    90 //
    57 void CAiWsPluginAnim::AddEventHandlerAndPopL( CEventHandler* aEventHandler )
    91 void CAiWsPluginAnim::AddEventHandlerAndPopL( CEventHandler* aEventHandler )
    58     {
    92     {
    59     if( aEventHandler )
    93     if ( aEventHandler )
    60         {
    94         {
    61         aEventHandler->SetUiStateQuery( *this );
    95         aEventHandler->SetUiStateQuery( *this );
    62 	    iEventHandlers.AppendL( aEventHandler );
    96 	    iEventHandlers.AppendL( aEventHandler );
    63 	    CleanupStack::Pop( aEventHandler );
    97 	    CleanupStack::Pop( aEventHandler );
    64         }
    98         }
    65     }
    99     }
    66 
   100 
       
   101 // ---------------------------------------------------------------------------
       
   102 // CAiWsPluginAnim::ConstructL
       
   103 //
       
   104 // ---------------------------------------------------------------------------
       
   105 //
    67 void CAiWsPluginAnim::ConstructL( TAny* aArgs, TBool aHasFocus )
   106 void CAiWsPluginAnim::ConstructL( TAny* aArgs, TBool aHasFocus )
    68     {
   107     {
       
   108     if ( !aArgs )
       
   109         {
       
   110         User::Leave( KErrArgument );
       
   111         }
       
   112     
    69     FeatureManager::InitializeLibL();
   113     FeatureManager::InitializeLibL();
    70     
   114     
    71     iFunctions->GetRawEvents( ETrue );
   115     iFunctions->GetRawEvents( ETrue );
    72     if( !aArgs )
   116        
    73         {
   117     iWgInfo = *( static_cast< TAiWsPluginAnimInitData* >( aArgs ) );
    74         User::Leave( KErrArgument );
   118         
    75         }
   119     // AddEventHandlerAndPopL( CKeyLockHandler::NewLC() );
    76     iWgInfo = *( static_cast<TAiWsPluginAnimInitData*>(aArgs) );
   120     
    77     
   121     MAnimGeneralFunctionsWindowExtension* ext = 
    78     AddEventHandlerAndPopL( CKeyLockHandler::NewLC() );
   122         reinterpret_cast<MAnimGeneralFunctionsWindowExtension*>
    79 
   123             ( iFunctions->ExtendedInterface( 
    80     MAnimGeneralFunctionsWindowExtension* ext = reinterpret_cast<MAnimGeneralFunctionsWindowExtension*>
   124                 MAnimGeneralFunctions::EWindowExtensionInterface ) ); 
    81         ( iFunctions->ExtendedInterface( 
   125          
    82          MAnimGeneralFunctions::EWindowExtensionInterface ) );
   126     AddEventHandlerAndPopL( 
    83     AddEventHandlerAndPopL( CNumericKeyHandler::NewLC( iWgInfo.iTargetWgId, ext ) );
   127         CNumericKeyHandler::NewLC( iWgInfo.iTargetWgId, ext ) );
    84 	
   128 	
    85 	AddEventHandlerAndPopL( CLogsLaunchHandler::NewLC() );
       
    86 	
       
    87 /* Leave this commented code here for now.. 2.5.2007, unclear if needed still in some config.
       
    88 	if ( FeatureManager::FeatureSupported( KFeatureIdKeypadNoVoiceKey ) )
       
    89 	    {
       
    90 	    AddEventHandlerAndPopL( CSINDLaunchHandler::NewLC() );       
       
    91 	    }	
       
    92 */
       
    93     // Update initial focus status
   129     // Update initial focus status
    94     FocusChanged( aHasFocus );
   130     FocusChanged( aHasFocus );
    95     }
   131     }
    96 
   132 
       
   133 // ---------------------------------------------------------------------------
       
   134 // CAiWsPluginAnim::Redraw
       
   135 //
       
   136 // ---------------------------------------------------------------------------
       
   137 //
    97 void CAiWsPluginAnim::Redraw()
   138 void CAiWsPluginAnim::Redraw()
    98     {
   139     {
    99     }
   140     }
   100 
   141 
       
   142 // ---------------------------------------------------------------------------
       
   143 // CAiWsPluginAnim::FocusChanged
       
   144 //
       
   145 // ---------------------------------------------------------------------------
       
   146 //
   101 void CAiWsPluginAnim::FocusChanged( TBool aState )
   147 void CAiWsPluginAnim::FocusChanged( TBool aState )
   102     {
   148     {
   103     iAiFocused = aState;
   149     iAiFocused = aState;
   104     const TInt handlerCount = iEventHandlers.Count();
   150     
   105     for( TInt i = 0; i < handlerCount; ++i )
   151     const TInt count( iEventHandlers.Count() );
       
   152     
       
   153     for ( TInt i = 0; i < count; ++i )
   106         {
   154         {
   107         iEventHandlers[i]->FocusChanged( aState );
   155         iEventHandlers[i]->FocusChanged( aState );
   108         }
   156         }
   109     }
   157     }
   110 
   158 
       
   159 // ---------------------------------------------------------------------------
       
   160 // CAiWsPluginAnim::OfferRawEvent
       
   161 //
       
   162 // ---------------------------------------------------------------------------
       
   163 //
   111 TBool CAiWsPluginAnim::OfferRawEvent( const TRawEvent& aRawEvent )
   164 TBool CAiWsPluginAnim::OfferRawEvent( const TRawEvent& aRawEvent )
   112     {
   165     {
   113     // Forward event to all event handlers
   166     // Forward event to all event handlers
   114     const TInt handlerCount = iEventHandlers.Count();
   167     const TInt count( iEventHandlers.Count() );
   115     for( TInt i = 0; i < handlerCount; ++i )
   168     
       
   169     for ( TInt i = 0; i < count; ++i )
   116         {
   170         {
   117         // All other are made to return EFalse
   171         // All other are made to return EFalse
   118         // Except wait for 2ndkeyup and 2ndkeydown of keylock states.
   172         // Except wait for 2ndkeyup and 2ndkeydown of keylock states.
   119         if( iEventHandlers[i]->OfferRawEvent( aRawEvent ) )
   173         if( iEventHandlers[i]->OfferRawEvent( aRawEvent ) )
   120             {
   174             {
   125     // Update modifier key status
   179     // Update modifier key status
   126     iModifierTracker.Update( aRawEvent );
   180     iModifierTracker.Update( aRawEvent );
   127     
   181     
   128     return EFalse;
   182     return EFalse;
   129     }
   183     }
       
   184 
       
   185 // ---------------------------------------------------------------------------
       
   186 // CAiWsPluginAnim::Modifiers
       
   187 //
       
   188 // ---------------------------------------------------------------------------
       
   189 //
       
   190 TUint CAiWsPluginAnim::Modifiers() const
       
   191     {
       
   192     return iModifierTracker.Status();
       
   193     }
       
   194     
       
   195 // ---------------------------------------------------------------------------
       
   196 // CAiWsPluginAnim::HasFocus
       
   197 //
       
   198 // ---------------------------------------------------------------------------
       
   199 //
       
   200 TBool CAiWsPluginAnim::HasFocus() const
       
   201     {
       
   202     return iAiFocused;
       
   203     }
   130 	
   204 	
   131 TUint CAiWsPluginAnim::Modifiers() const
   205 // End of file
   132     {
       
   133     return iModifierTracker.Status();
       
   134     }
       
   135     
       
   136 TBool CAiWsPluginAnim::HasFocus() const
       
   137     {
       
   138     return iAiFocused;
       
   139     }
       
   140