mmsharing/mmshindicator/inc/musindicatordsa.h
branchRCL_3
changeset 33 bc78a40cd63c
parent 32 73a1feb507fb
child 35 6c57ef9392d2
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
     1 /*
       
     2 * Copyright (c) 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:  Draws availability indication to screen using direct screen
       
    15 *                access.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef C_MUSINDICATORDSA_H
       
    22 #define C_MUSINDICATORDSA_H
       
    23 
       
    24 
       
    25 #include "musunittesting.h"
       
    26 #include <e32base.h>
       
    27 #include <w32std.h>
       
    28 #include <coecntrl.h>
       
    29 
       
    30 const TInt KMusIndicatorDelay = 400000;
       
    31 const TInt KMusRedrawDelay = 25000;
       
    32 
       
    33 /**
       
    34  *  CMusIndicatorDsa provides multimedia sharing ready indicator "box" 
       
    35  *  indcating videosharing availability to user.
       
    36  *
       
    37  *  @code
       
    38  *   // Activates indication
       
    39  *  CMusIndicatorDsa* dsa = CMusIndicatorDsa::NewL();
       
    40  *
       
    41  *  // Deactivates indication
       
    42  *  delete dsa;
       
    43  *
       
    44  *  @endcode
       
    45  *
       
    46  *  @lib musindicator.lib
       
    47  */
       
    48 class CMusIndicatorDsa : public CCoeControl
       
    49     {
       
    50 public:
       
    51 
       
    52     MUS_UNITTEST( UT_CMusIndicatorDsa )
       
    53 
       
    54     static CMusIndicatorDsa* NewL();
       
    55 
       
    56     /**
       
    57      * Destructor.
       
    58      */
       
    59     ~CMusIndicatorDsa();
       
    60 
       
    61     
       
    62 public: //from CCoeControl
       
    63     
       
    64     
       
    65     /**
       
    66      * Draws video sharing ready box and text
       
    67      */
       
    68     void Draw( const TRect& aRect ) const;
       
    69     
       
    70     /**
       
    71      * Hanldes resource change i.e layout change
       
    72      * 
       
    73      */
       
    74     void HandleResourceChange( TInt aType);
       
    75     
       
    76 private:
       
    77 
       
    78     /**
       
    79      * Initializes
       
    80      */
       
    81      void Initialize();
       
    82 
       
    83     /**
       
    84      * Loads image.
       
    85      */
       
    86     void LoadImageL();
       
    87 
       
    88     /**
       
    89      * Loads resource string.
       
    90      */
       
    91     void LoadResourceStringL();
       
    92 
       
    93 
       
    94 private:
       
    95 
       
    96     CMusIndicatorDsa();
       
    97 
       
    98     void ConstructL();
       
    99 
       
   100     const CFont& Font() const;
       
   101 
       
   102     void TryActivateL();
       
   103 
       
   104     
       
   105     /**
       
   106     * Callback function to periodic timer.
       
   107     *
       
   108     * @param instanse of this.
       
   109     * @return TInt value indicating if function completed succesfully
       
   110     */
       
   111    static TInt TryActivate( TAny* aThis );
       
   112 
       
   113     /**
       
   114      * Callback function to periodic timer.
       
   115      *
       
   116      * @param instanse of this.
       
   117      * @return TInt value indicating if function completed succesfully
       
   118      */
       
   119     static TInt DoHandleResourceChange( TAny* aThis );
       
   120    
       
   121     void StartPeriodicTimer( const TCallBack& aCallBack) const;
       
   122     
       
   123     /**
       
   124      * Stops peridoic timer.
       
   125      */
       
   126     void StopPeriodicTimer();
       
   127     
       
   128     
       
   129 private: // data
       
   130 
       
   131 
       
   132     /**
       
   133      * Periodic timer.
       
   134      * Own.
       
   135      */
       
   136     CPeriodic* iPeriodic;
       
   137 
       
   138     /**
       
   139      * Used screen rectangle.
       
   140      */
       
   141     TRect iScreenRect;
       
   142 
       
   143     /**
       
   144      * Used client area size
       
   145      */
       
   146     TSize iScreenSize;
       
   147     
       
   148     /**
       
   149      * Calculated position of left-top point of text.
       
   150      */
       
   151     TPoint iTextpos;
       
   152 
       
   153     /**
       
   154      * Color of DSA boxes border.
       
   155      */
       
   156     TRgb iBorderColor;
       
   157 
       
   158     /**
       
   159      * DSA boxes background color.
       
   160      */
       
   161     TRgb iBorderBgColor;
       
   162 
       
   163     /**
       
   164      * Color of used font.
       
   165      */
       
   166     TRgb iFontColor;
       
   167 
       
   168     /**
       
   169      * Displayed text.
       
   170      * Own.
       
   171      */
       
   172     HBufC* iText;
       
   173     
       
   174     CFbsBitmap* iIcon;
       
   175     CFbsBitmap* iIconMask;
       
   176     
       
   177     TSize iImageSize;
       
   178     TPoint iImagepos;
       
   179     
       
   180     TCallBack iActivateCallBack;
       
   181     TCallBack iRedrawCallBack;
       
   182     
       
   183     
       
   184     };
       
   185 
       
   186 #endif // C_MUSINDICATORDSA_H