meetingrequest/mrgui/inc/cmrattachmentindicator.h
branchRCL_3
changeset 12 4ce476e64c59
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
       
     1 /*
       
     2 * Copyright (c) 2008 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: Attachment indicator class definition
       
    15 * 
       
    16 */ 
       
    17 
       
    18 #ifndef CMRATTACHMENTINDICATOR_H
       
    19 #define CMRATTACHMENTINDICATOR_H
       
    20 
       
    21 #include <coecntrl.h>
       
    22 
       
    23 /**
       
    24  * Attachment indicator
       
    25  */
       
    26 NONSHARABLE_CLASS( CMRAttachmentIndicator ) : 
       
    27         public CCoeControl                                            
       
    28     {
       
    29 public: // Construction and destruction
       
    30     
       
    31 	/**
       
    32 	 * Two-phased constructor.
       
    33 	 * Creates a new instance of class
       
    34 	 * 
       
    35 	 * @param aRect   rect for this control
       
    36 	 * @param aParent parent control
       
    37 	 * 
       
    38 	 * @return CMRAttachmentIndicator instance
       
    39 	 */
       
    40     static CMRAttachmentIndicator* NewL( 
       
    41             const TRect& aRect, 
       
    42             const CCoeControl* aParent );
       
    43     
       
    44     /**
       
    45      * C++ Destructor.
       
    46      */    
       
    47     ~CMRAttachmentIndicator();
       
    48 
       
    49 public: // new methods
       
    50     
       
    51     /**
       
    52      * Shows the indicator in UI. The ownships of aBitmap, aMaskBitmap and aText 
       
    53      * are transferred in. The status indicator is displayed for aDuration 
       
    54      * millisecond if aDuration is not negative; otherwise, it is diplayed forever 
       
    55      * until it is manually hidden.
       
    56      * 
       
    57      * @param aBitmap     Indicator image bitmap
       
    58      * @param aMaskBitmap Indicator image bitmap mask
       
    59      * @param aText       Indicator text
       
    60      * @param aDuration   Duration for the indicator to be shown
       
    61      */ 
       
    62     void ShowIndicatorL( 
       
    63             CFbsBitmap* aBitmap, 
       
    64             CFbsBitmap* aMaskBitmap,
       
    65             const TDesC& aText,
       
    66             TInt aDuration );
       
    67 
       
    68     /**
       
    69      * Hides the indicator from UI
       
    70      * 
       
    71      * @param aDelayBeforeHidingInMs Delay before the indicator is hidden
       
    72      *                               in milliseconds
       
    73      */
       
    74     void HideIndicator( 
       
    75             TInt aDelayBeforeHidingInMs );
       
    76     
       
    77     /**
       
    78      * Setter for indicator text. The ownship of aText is transferred in.
       
    79      * 
       
    80      * @param aText text for indicator
       
    81      */
       
    82     void SetTextL( 
       
    83             const TDesC& aText );
       
    84 
       
    85     /**
       
    86      * Setter for indicator image.
       
    87      * 
       
    88      * @param aBitmap     image bitmap for indicator
       
    89      * @param aMaskBitmap image bitmap mask for indicator
       
    90      */
       
    91     void SetImage( 
       
    92             CFbsBitmap* aBitmap, 
       
    93             CFbsBitmap* aMaskBitmap );
       
    94     
       
    95     /**
       
    96      * Getter for indicator image bitmap
       
    97      * 
       
    98      * @return the indicator image bitmap
       
    99      */
       
   100     const CFbsBitmap* Image() const;
       
   101     
       
   102     /**
       
   103      * Getter for indicator image bitmap mask
       
   104      * 
       
   105      * @return the indicator image bitmap mask
       
   106      */    
       
   107     const CFbsBitmap* ImageMask() const;    
       
   108     
       
   109     /**
       
   110      * Getter for indicator text
       
   111      * 
       
   112      * @return the indicator text
       
   113      */    
       
   114     const TDesC& Text() const;
       
   115     
       
   116 public:    // From CCoeControl
       
   117     CCoeControl* ComponentControl( 
       
   118             TInt aIndex ) const;
       
   119     TInt CountComponentControls() const;
       
   120     void Draw( 
       
   121             const TRect& aRect ) const;
       
   122     void SizeChanged();
       
   123     
       
   124 private:    
       
   125     
       
   126     CMRAttachmentIndicator();
       
   127     void ConstructL( 
       
   128             const TRect& aRect, 
       
   129             const CCoeControl* aParent );
       
   130     void CalculateLayout( 
       
   131             const TRect& aRect ) const;
       
   132     
       
   133     void SetTextFont() const;
       
   134     void CalculateVisualText() const;
       
   135 
       
   136     void DrawBoundary( const TRect& aRect ) const;
       
   137     void DrawImage( const TRect& aRect ) const;
       
   138     void DrawText( const TRect& aRect ) const;
       
   139     void ScaleImage() const;
       
   140     
       
   141     void ClearImage();
       
   142     void ClearText();
       
   143     
       
   144 private:
       
   145     /// own: Indicator image bitmap
       
   146     CFbsBitmap*                 iBitmap; 
       
   147     /// own: Indicator image bitmap mask
       
   148     CFbsBitmap*                 iMaskBitmap;
       
   149     /// own: Indicator text
       
   150     HBufC*                      iText;   
       
   151     // Rect for indicator image
       
   152     mutable TRect               iImageRect;
       
   153     // Rect for indicator text
       
   154     mutable TRect               iTextRect;
       
   155     /// own: Indicator visual text (final text shown in UI)
       
   156     mutable HBufC*              iVisualText;
       
   157     /// not owned: Indicator text font
       
   158     mutable CFont*              iTextFont;
       
   159     };
       
   160 
       
   161 #endif // CMRATTACHMENTINDICATOR_H