inc/screensaverctrlplugin.h
changeset 14 8a173132b0aa
parent 2 058b1fc1663a
equal deleted inserted replaced
2:058b1fc1663a 14:8a173132b0aa
     1 /*
       
     2 * Copyright (c) 2009 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:   Definitions for the display object of plugin type
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_SCREENSAVERCTRLPLUGIN_H
       
    21 #define C_SCREENSAVERCTRLPLUGIN_H
       
    22 
       
    23 #include <babitflags.h>
       
    24 
       
    25 #include "screensaverbase.h"
       
    26 
       
    27 /**
       
    28  * The plugin type of display object which is derived from the 
       
    29  * CScreensaverBase class
       
    30  */
       
    31 class CScreensaverCtrlPlugin : public CScreensaverBase,
       
    32     public MScreensaverPluginHost
       
    33     {
       
    34 public:
       
    35     enum TScreensaverPluginFlag
       
    36         {
       
    37         // Indicates that plugin module wants to draw indicators
       
    38         EPluginFlagOverrideIndicators = 0,
       
    39         // Indicates that plugin does not use refresh timer and should not get
       
    40         // Draw() calls
       
    41         EPluginFlagTimerNotUsed,
       
    42         EPluginFlagSuspend
       
    43         };
       
    44 public:
       
    45     /**
       
    46     * Two-phased constructor.  
       
    47     */
       
    48     static CScreensaverCtrlPlugin* NewL();
       
    49 
       
    50     /**
       
    51     * Destructor  
       
    52     */
       
    53     ~CScreensaverCtrlPlugin();
       
    54 
       
    55     /**
       
    56     * Start the control needed timer
       
    57     */
       
    58     void StartTimer();
       
    59     
       
    60     /**
       
    61     * Cancels the timer
       
    62     */
       
    63     void CancelTimer();
       
    64     
       
    65     
       
    66     /**
       
    67     * Show the control
       
    68     */
       
    69     void DrawObject();
       
    70     
       
    71     /**
       
    72     * Clear the screen
       
    73     */
       
    74     void ClearScreen();
       
    75     
       
    76     /*
       
    77     * Refresh the display 
       
    78     */
       
    79     void Refresh();
       
    80     
       
    81     /**
       
    82     * Send the event to plugin to deal with
       
    83     * 
       
    84     * @param aEvent the event send to plugin
       
    85     * @return TInt  
       
    86     */
       
    87     TInt SendPluginEvent( TScreensaverEvent aEvent );
       
    88 
       
    89 public:
       
    90     // From MScreensaverPluginHost
       
    91     void UseStandardIndicators();
       
    92     void OverrideStandardIndicators();
       
    93     TBool StandardIndicatorsUsed() const;
       
    94     void SetRefreshTimerValue( TInt aValue );
       
    95     TInt RefreshTimerValue() const;
       
    96     TInt GetIndicatorPayload( TScreensaverIndicatorIndex aIndex,
       
    97         TIndicatorPayload& aResult ) const;
       
    98     TInt SetActiveDisplayArea( TRect& aRect,
       
    99         const TScreensaverPartialMode& aMode );
       
   100     TInt SetActiveDisplayArea( TInt aStartRow, TInt aEndRow,
       
   101         const TScreensaverPartialMode& aMode );
       
   102     void ExitPartialMode();
       
   103     const TScreensaverColorModel& GetColorModel() const;
       
   104     void Suspend( TInt aTime );
       
   105     void RequestLights( TInt aSecs );
       
   106     TInt DisplayInfo( TScreensaverDisplayInfo* aDisplayInfo );
       
   107     void UseRefreshTimer( TBool aOn = ETrue );
       
   108     void RequestTimeout( TInt aSecs );
       
   109     void RevertToDefaultSaver();
       
   110     // End MScreensaverPluginHost
       
   111 
       
   112 protected:
       
   113     /**
       
   114     * The default C++ constuctor
       
   115     * 
       
   116     * @param aType the type of the display object.
       
   117     * @param aPlugin the plugin which the screensaver is setted.  
       
   118     */
       
   119     CScreensaverCtrlPlugin();
       
   120 
       
   121     /**
       
   122     * Symbian default constructor.
       
   123     */
       
   124     void ConstructL();
       
   125 
       
   126 protected:
       
   127     // From CCoeControl
       
   128     
       
   129     /** 
       
   130     * Resource change handling  
       
   131     */
       
   132     virtual void HandleResourceChange( TInt aType );
       
   133     
       
   134     /**
       
   135     * Responds to changes to the size and position of the contents 
       
   136     * of this control.  
       
   137     */
       
   138     virtual void SizeChanged();
       
   139     
       
   140     /**
       
   141     * Drawing (override this to draw)
       
   142     */
       
   143     virtual void Draw( const TRect& aRect ) const;
       
   144     
       
   145 private:
       
   146     /*
       
   147     * LoadPluginL()
       
   148     */
       
   149     void LoadPluginL( MScreensaverPluginHost* aPluginHost );
       
   150     
       
   151     /*
       
   152     * Get the poiter of the plugin
       
   153     */
       
   154     void LoadPluginModuleL();
       
   155     
       
   156     /*
       
   157     * Delete the plugin
       
   158     */
       
   159     void DeletePlugin();
       
   160     
       
   161     /**
       
   162     * Starts the plugin refresh timer
       
   163     */
       
   164     void StartPluginRefreshTimer();
       
   165 
       
   166     /**
       
   167     * Starts the plugin time out timer
       
   168     */
       
   169     void StartPluginTimeoutTimer( TInt aSecs );
       
   170 
       
   171     
       
   172     /**
       
   173     * Callback fuction. Called when the Plugin tiemr time out
       
   174     */
       
   175     static TInt HandlePluginTimeoutTimerExpiry( TAny* aPtr );
       
   176 
       
   177 
       
   178 private://data
       
   179     /**
       
   180     * Plugin interface.
       
   181     */
       
   182     MScreensaverPlugin* iPlugin;
       
   183     
       
   184     /**
       
   185     * The plugin refresh timer
       
   186     */
       
   187     CPeriodic* iPluginRefreshTimer;
       
   188     
       
   189     /**
       
   190     * The plugin timeout timer
       
   191     */
       
   192     CPeriodic* iPluginTimeoutTimer;
       
   193 
       
   194     
       
   195     /**
       
   196     * The plugin flag
       
   197     */
       
   198     mutable TBitFlagsT<TUint32> iPluginFlag;
       
   199     
       
   200     /**
       
   201     * The refresh rate of plugin
       
   202     */
       
   203     TInt iPluginRefreshRate;
       
   204     };
       
   205 #endif // C_SCREENSAVERCTRLPLUGIN_H