phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/inc/ccappstatuscontrol.h
changeset 0 e686773b3f54
child 3 04ab22b956c2
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2009-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: UI status control
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CCAPPSTATUSCONTROL_H_
       
    20 #define CCAPPSTATUSCONTROL_H_
       
    21 
       
    22 // INCLUDES
       
    23 #include <coecntrl.h>
       
    24 #include <spbcontentprovider.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class CEikImage;
       
    28 class CEikLabel;
       
    29 class CFbsBitmap;
       
    30 class CAknIcon;
       
    31 class MVPbkContactLink;
       
    32 class CAknsFrameBackgroundControlContext;
       
    33 class MTouchFeedback;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 /**
       
    37  * Class for observing click events to status control
       
    38  * 
       
    39  * since s60 9.2  
       
    40  **/
       
    41 class MCCAStatusControlObserver
       
    42 {
       
    43 public:	
       
    44 	virtual void StatusClickedL() = 0;
       
    45 
       
    46 protected:
       
    47     virtual ~MCCAStatusControlObserver() {}
       
    48 };
       
    49 
       
    50 /**
       
    51  * Class implements the status control
       
    52  *
       
    53  *  @lib ccapputil.dll
       
    54  *  @since S60 9.2
       
    55  */
       
    56 NONSHARABLE_CLASS( CCCAppStatusControl ) : 
       
    57     public CCoeControl, 
       
    58     public MSpbContentProviderObserver 
       
    59     {
       
    60 public: // Construction & destruction
       
    61     /**
       
    62      * Two-phased constructor.
       
    63      */
       
    64 	IMPORT_C static CCCAppStatusControl* NewL( CSpbContentProvider& aContentProvider, MCCAStatusControlObserver& aObserver );
       
    65 
       
    66     /**
       
    67      * Destructor.
       
    68      */
       
    69     ~CCCAppStatusControl();
       
    70 
       
    71 public: // New implementation
       
    72         
       
    73     /**
       
    74 	 * Sets the link object 
       
    75 	 * 
       
    76 	 * @aLink Link to current contact
       
    77 	 */
       
    78      IMPORT_C void SetContactLinkL( MVPbkContactLink& aLink );
       
    79 
       
    80     /**
       
    81      * Change buttons state between pressed and released.
       
    82      * 
       
    83      * @param aPressed ETrue to make the button pressed
       
    84      */
       
    85     void SetPressed( TBool aPressed );
       
    86     
       
    87     /**
       
    88      * Check if button is pressed down
       
    89      * 
       
    90      * @return ETrue if button is pressed
       
    91      */
       
    92     TBool IsPressed();
       
    93      
       
    94      /**
       
    95 	 * Sets the default status text and icon 
       
    96 	 * 
       
    97 	 * @aLink Link to current contact
       
    98 	 */
       
    99      IMPORT_C void SetDefaultStatusL( TInt aDefaultResource, CGulIcon* aDefaultStatusIcon );
       
   100              
       
   101 public: // From CCoeControl
       
   102      
       
   103     /**
       
   104      * From CCoeControl
       
   105      */
       
   106     TInt CountComponentControls() const;
       
   107 
       
   108     /**
       
   109      * From CCoeControl
       
   110      */
       
   111     CCoeControl* ComponentControl( TInt aIndex ) const;
       
   112 
       
   113     /**
       
   114      * From CoeControl
       
   115      */
       
   116     void SizeChanged();
       
   117 
       
   118     /**
       
   119      * From CoeControl
       
   120     */
       
   121     void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
   122 
       
   123     /**
       
   124      * From CoeControl
       
   125     */
       
   126     void SetContainerWindowL( const CCoeControl& aContainer );
       
   127     
       
   128     /**
       
   129      * From CoeControl
       
   130      */
       
   131     void Draw( const TRect& aRect ) const;
       
   132 
       
   133 public: // From MSpbContentProviderObserver
       
   134     
       
   135     /**
       
   136      * From MSpbContentProviderObserver
       
   137      */
       
   138     void ContentUpdated( 
       
   139         MVPbkContactLink& aLink, 
       
   140         MSpbContentProviderObserver::TSpbContentEvent aEvent );           
       
   141     
       
   142 private: // New functions    
       
   143 
       
   144     /**
       
   145      * Wraps the status text to fit into the space allocated for it.
       
   146      */
       
   147     TInt RewrapStatusTextL();
       
   148    
       
   149     /**
       
   150      * Set default status
       
   151      */
       
   152     void DefaultStatusL();
       
   153     
       
   154     /**
       
   155      * Handle status update event
       
   156      * 
       
   157      * @param aLink contact which has the status updated
       
   158      * @param aEvent 
       
   159      */
       
   160     void DoStatusUpdateL( 
       
   161         MVPbkContactLink& aLink, 
       
   162         MSpbContentProviderObserver::TSpbContentEvent aEvent );           
       
   163 
       
   164     void SetVariableLayouts( TInt aOption );
       
   165     
       
   166     inline void RewrapStatusTextToArrayL( 
       
   167             TDes& aStatusText, 
       
   168             CArrayFix<TPtrC>& aTxtArray );
       
   169     
       
   170 protected: // construction
       
   171 
       
   172     /**
       
   173      * Constructor for performing 1st stage construction
       
   174      */
       
   175     CCCAppStatusControl( 
       
   176         CSpbContentProvider& aContentProvider, 
       
   177         MCCAStatusControlObserver& aObserver );
       
   178 
       
   179     /**
       
   180      * Constructor for performing 2nd stage construction
       
   181      */
       
   182     void ConstructL();
       
   183 
       
   184 protected: // data
       
   185 
       
   186     /**
       
   187      * Own. Status service icon control
       
   188      */
       
   189     CEikImage* iStatusImage;
       
   190 
       
   191     /**
       
   192      * Own. Status text label control
       
   193      */
       
   194     CEikLabel* iStatusLabel1;
       
   195     CEikLabel* iStatusLabel2;
       
   196 
       
   197     /**
       
   198 	* Own. The status service bitmap
       
   199 	*/
       
   200     CGulIcon* iStatusIcon;
       
   201 
       
   202     /**
       
   203      * The status icon size on UI
       
   204      */
       
   205     TSize iStatusIconSize;
       
   206 
       
   207     /**
       
   208      * Own. Current status text
       
   209      */
       
   210     HBufC* iStatusText;
       
   211         
       
   212     /**
       
   213 	* Ref, Not owned. Status provider for updating the status and icon.
       
   214 	*/
       
   215 	CSpbContentProvider& iContentProvider;
       
   216     
       
   217     /**
       
   218 	* Observes clikcs to statustext
       
   219 	*/    
       
   220     MCCAStatusControlObserver& iObserver;
       
   221     
       
   222     /// Own.
       
   223     MVPbkContactLink* iLink;             
       
   224     
       
   225     // Own.
       
   226     CGulIcon* iDefaultIcon;              
       
   227         
       
   228     TInt iDefaultResource;
       
   229     /**
       
   230      * Own. Button background graphics context (button effect)
       
   231      */
       
   232     CAknsFrameBackgroundControlContext* iBgContext;
       
   233     
       
   234     /**
       
   235      * Flag for pressed down state
       
   236      */
       
   237     TBool iPressed;
       
   238     
       
   239     /**
       
   240      * Not own (singleton). Tactile feedback interface
       
   241      */
       
   242     MTouchFeedback* iTouchFeedBack;
       
   243     };
       
   244 
       
   245 #endif // CCAPPSTATUSCONTROL_H_