uiacceltk/hitchcock/backgroundanim/inc/bganimhost.h
author hgs
Wed, 03 Nov 2010 19:29:22 +0200
changeset 64 9f8c0686fb49
permissions -rw-r--r--
201044
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
64
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description: 
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
#include <e32base.h>
hgs
parents:
diff changeset
    18
#include <w32std.h>
hgs
parents:
diff changeset
    19
#include <apgwgnam.h> 
hgs
parents:
diff changeset
    20
#include <sensrvdatalistener.h>
hgs
parents:
diff changeset
    21
#include <AknsSrvClient.h>
hgs
parents:
diff changeset
    22
hgs
parents:
diff changeset
    23
#include <EGL/egl.h>
hgs
parents:
diff changeset
    24
hgs
parents:
diff changeset
    25
#include "highrestimer.h"
hgs
parents:
diff changeset
    26
#include "plugininterface.h"
hgs
parents:
diff changeset
    27
#include "themerepositorylistener.h"
hgs
parents:
diff changeset
    28
#include "screensaverpropertylistener.h"
hgs
parents:
diff changeset
    29
#include "fgapppropertylistener.h"
hgs
parents:
diff changeset
    30
#include "sensor.h"
hgs
parents:
diff changeset
    31
hgs
parents:
diff changeset
    32
#include "../../../../uiaccelerator_plat/alf_visual_api/inc/alf/alfcompositionutility.h"
hgs
parents:
diff changeset
    33
hgs
parents:
diff changeset
    34
class CBgAnimHost : public CBase, public MAlfCompositionObserver, public MSensrvDataListener, public MAknsSkinChangeObserver
hgs
parents:
diff changeset
    35
    {
hgs
parents:
diff changeset
    36
    public:
hgs
parents:
diff changeset
    37
        void ConstructL();
hgs
parents:
diff changeset
    38
        CBgAnimHost();
hgs
parents:
diff changeset
    39
        ~CBgAnimHost();
hgs
parents:
diff changeset
    40
        void ExecuteL();
hgs
parents:
diff changeset
    41
        
hgs
parents:
diff changeset
    42
        static TInt TimerFunc(TAny* aPtr);
hgs
parents:
diff changeset
    43
        static TInt ReaperFunc(TAny* aPtr);
hgs
parents:
diff changeset
    44
        static TInt DoomBringerFunc(TAny* aPtr);
hgs
parents:
diff changeset
    45
        
hgs
parents:
diff changeset
    46
        // from MAlfCompositionObserver
hgs
parents:
diff changeset
    47
        void FrameReady(TInt aScreenNumber);
hgs
parents:
diff changeset
    48
        void RunningLowOnGraphicsMemory();
hgs
parents:
diff changeset
    49
        void GraphicsMemoryGood(); 
hgs
parents:
diff changeset
    50
        void CompositionTargetHidden();
hgs
parents:
diff changeset
    51
        void CompositionTargetVisible();
hgs
parents:
diff changeset
    52
        
hgs
parents:
diff changeset
    53
        // from MSensrvDataListener
hgs
parents:
diff changeset
    54
        void DataReceived( CSensrvChannel& aChannel, TInt aCount, TInt aDataLost );
hgs
parents:
diff changeset
    55
        void DataError( CSensrvChannel& aChannel, TSensrvErrorSeverity aError );
hgs
parents:
diff changeset
    56
        void GetDataListenerInterfaceL( TUid aInterfaceUid, TAny*& aInterface);
hgs
parents:
diff changeset
    57
        
hgs
parents:
diff changeset
    58
        // from MAknsSkinChangeObserver
hgs
parents:
diff changeset
    59
        void SkinContentChanged();
hgs
parents:
diff changeset
    60
        void SkinConfigurationChanged( const TAknsSkinStatusConfigurationChangeReason aReason );
hgs
parents:
diff changeset
    61
        void SkinPackageChanged( const TAknsSkinStatusPackageChangeReason aReason );
hgs
parents:
diff changeset
    62
hgs
parents:
diff changeset
    63
    protected:
hgs
parents:
diff changeset
    64
        void CreateWindowL();
hgs
parents:
diff changeset
    65
        void DestroyWindow();
hgs
parents:
diff changeset
    66
        void InitEGLL();
hgs
parents:
diff changeset
    67
        void ReleaseEGL();
hgs
parents:
diff changeset
    68
        void CreateWindowSurfaceL();
hgs
parents:
diff changeset
    69
        void ReleaseWindowSurface(TBool aReleaseObserver = ETrue);
hgs
parents:
diff changeset
    70
        void LoadPluginL();
hgs
parents:
diff changeset
    71
        void ReleasePlugin();
hgs
parents:
diff changeset
    72
        void NewFrame();
hgs
parents:
diff changeset
    73
        void Kill();
hgs
parents:
diff changeset
    74
        void HandleScreenSaverEvent();
hgs
parents:
diff changeset
    75
        void HandleFGAppEvent();
hgs
parents:
diff changeset
    76
        TBool GetPluginConfigurationL();
hgs
parents:
diff changeset
    77
        void StartSensorsL();
hgs
parents:
diff changeset
    78
        void StopSensors();
hgs
parents:
diff changeset
    79
        static TInt ScreenSaverCallback(TAny* aPtr);
hgs
parents:
diff changeset
    80
        static TInt FgAppCallback(TAny* aPtr);
hgs
parents:
diff changeset
    81
        
hgs
parents:
diff changeset
    82
    private:
hgs
parents:
diff changeset
    83
        // windowing stuff
hgs
parents:
diff changeset
    84
        RWsSession iWsSession;
hgs
parents:
diff changeset
    85
        RWindowGroup iWindowGroup;
hgs
parents:
diff changeset
    86
        RWindow iWindow;
hgs
parents:
diff changeset
    87
        CApaWindowGroupName* iWindGroupName;
hgs
parents:
diff changeset
    88
        CWsScreenDevice* iScreenDevice;
hgs
parents:
diff changeset
    89
        TSize iDisplaySize;
hgs
parents:
diff changeset
    90
        TSize iRealDisplaySize;
hgs
parents:
diff changeset
    91
        
hgs
parents:
diff changeset
    92
        // EGL stuff
hgs
parents:
diff changeset
    93
        EGLDisplay iEGLDisplay;
hgs
parents:
diff changeset
    94
        EGLConfig  iEGLConfig;
hgs
parents:
diff changeset
    95
        EGLContext iEGLContext;
hgs
parents:
diff changeset
    96
        EGLSurface iEGLSurface;
hgs
parents:
diff changeset
    97
        
hgs
parents:
diff changeset
    98
        // plugin
hgs
parents:
diff changeset
    99
        RLibrary iPluginLibrary;
hgs
parents:
diff changeset
   100
        plugin_export_v1_t* iPlugin;
hgs
parents:
diff changeset
   101
hgs
parents:
diff changeset
   102
        // timer
hgs
parents:
diff changeset
   103
        CHighResTimer* iTimer;
hgs
parents:
diff changeset
   104
        TBool iTimerRunning;
hgs
parents:
diff changeset
   105
        CHighResTimer* iTheReaper;
hgs
parents:
diff changeset
   106
        CHighResTimer* iDoomBringer;
hgs
parents:
diff changeset
   107
        
hgs
parents:
diff changeset
   108
        TBool iEGLInitialized;
hgs
parents:
diff changeset
   109
        TBool iSurfaceInitialized;
hgs
parents:
diff changeset
   110
        TBool iHiddenDueSC;
hgs
parents:
diff changeset
   111
        
hgs
parents:
diff changeset
   112
        // composition API
hgs
parents:
diff changeset
   113
        CAlfCompositionSource* iCompSource;
hgs
parents:
diff changeset
   114
        
hgs
parents:
diff changeset
   115
        TBool iRunning;
hgs
parents:
diff changeset
   116
    
hgs
parents:
diff changeset
   117
        CThemeRepositoryListener* iThemeRepositoryListener;
hgs
parents:
diff changeset
   118
        CScreenSaverPropertyListener* iSCPropertyListener;
hgs
parents:
diff changeset
   119
        CFGAppPropertyListener *iHSFgStatusPropertyListener;
hgs
parents:
diff changeset
   120
hgs
parents:
diff changeset
   121
        RPointerArray<CSensorListener> iSensorListeners;
hgs
parents:
diff changeset
   122
        TBool iSensorsStopped;
hgs
parents:
diff changeset
   123
hgs
parents:
diff changeset
   124
        RAknsSrvSession iSkinSrv;
hgs
parents:
diff changeset
   125
        HBufC* iCurrentPluginDllName;
hgs
parents:
diff changeset
   126
        HBufC* iCurrentPluginAssetDir;
hgs
parents:
diff changeset
   127
        TBool iIsUIReady;
hgs
parents:
diff changeset
   128
    
hgs
parents:
diff changeset
   129
        TBool iReaped;
hgs
parents:
diff changeset
   130
        
hgs
parents:
diff changeset
   131
        TBool iWindowVisible;
hgs
parents:
diff changeset
   132
    };