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