meetingrequest/mrgui/mrfieldbuilderpluginextension/inc/cesmrresponseitem.h
changeset 0 8466d47a6819
child 16 4ce476e64c59
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2007-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:  Contains the implementation of response area item
       
    15  *
       
    16 */
       
    17 
       
    18 #ifndef CESMRRESPONSEITEM_H
       
    19 #define CESMRRESPONSEITEM_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <coecntrl.h>
       
    23 #include "esmrcommands.h"
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CESMRLayoutManager;
       
    27 class CMRLabel;
       
    28 class CMRImage;
       
    29 
       
    30 // CLASS DECLARATIONS
       
    31 /**
       
    32  * Response area contains four response items. One item contains icon and text,
       
    33  * (e.g. unchecked icon and "Accept" as a text) except the first topic line that
       
    34  * doesn't have the icon. Topic item might have text in two lines depending on
       
    35  * the text length and screen orientation. Item is highlighted by drawing svg graphic
       
    36  * to the background. Only highlighted item can be selected by pressing "OK" key.
       
    37  */
       
    38 NONSHARABLE_CLASS( CESMRResponseItem ) : public CCoeControl
       
    39     {
       
    40     public:
       
    41         static CESMRResponseItem* NewL( TESMRCommand aCmd,
       
    42                                         const TDesC& aItemText,
       
    43                                         TBool aHasIcon );
       
    44         static CESMRResponseItem* NewLC( TESMRCommand aCmd,
       
    45                                          const TDesC& aItemText,
       
    46                                          TBool aHasIcon );
       
    47         ~CESMRResponseItem();
       
    48     
       
    49     public: // From CCoeControl
       
    50         TInt CountComponentControls() const;
       
    51         CCoeControl* ComponentControl( TInt aInd ) const;
       
    52         void SizeChanged();
       
    53     
       
    54     public: // New methods
       
    55         /**
       
    56          * Sets the highlight item on.
       
    57          */
       
    58         void SetHighlight();
       
    59     
       
    60         /**
       
    61          * Sets the highlight item off.
       
    62          */
       
    63         void RemoveHighlight();
       
    64         /**
       
    65          * Changes the icon from checked to unchecked or vice versa
       
    66          * depending on the parameter.
       
    67          *
       
    68          * @param aChecked - ETrue draws the checked icon
       
    69          *                   EFalse draws the unchecked icon
       
    70          */
       
    71     
       
    72         void ChangeIconL( TBool aChecked );
       
    73         /**
       
    74          * Sets font for the text in this item
       
    75          *
       
    76          * @param Font to be set
       
    77          */
       
    78         void SetFont( const CFont* aFont );
       
    79     
       
    80         /**
       
    81          * Sets text for this item. When called for the first time
       
    82          * text is captured and that text is always wrappen again when
       
    83          * calling this method. This is done because orientation of
       
    84          * the screen might change.
       
    85          *
       
    86          * @param Text for the item
       
    87          */
       
    88         void SetTextL( const TDesC& aItemText );
       
    89     
       
    90         /**
       
    91          * Gives pointer to layoutmanager for this class.
       
    92          *
       
    93          * @param aLayout- Layout manager
       
    94          */
       
    95         void SetLayoutManager( CESMRLayoutManager* aLayout );
       
    96     
       
    97         /**
       
    98          * Counts the number of lines that item needs for the text.
       
    99          * This is called to give enough space for the item.
       
   100          *
       
   101          * @return Number of text lines.
       
   102          */
       
   103         TInt ItemTextLineCount();
       
   104     
       
   105         /**
       
   106          * Returns the command id attached to this item.
       
   107          *
       
   108          * @return A command id
       
   109          */
       
   110         TESMRCommand CommandId() const;
       
   111     
       
   112     private: // Implementation
       
   113         CMRImage* IconL(TBool aChecked );
       
   114         void Draw( const TRect& aRect ) const;
       
   115     
       
   116     private: // private construction
       
   117         CESMRResponseItem(TESMRCommand aCmd);
       
   118         void ConstructL( const TDesC& aItemText, TBool aHasIcon );
       
   119         
       
   120     private: // data
       
   121         /// Own: Label for item's text
       
   122         CMRLabel* iSelectionLabel;
       
   123         /// Own: Checkbox icon
       
   124         CMRImage* iIcon;
       
   125         /// Own: Items text
       
   126         HBufC* iItemText;
       
   127         /// Item's command id
       
   128         TESMRCommand iCmd;
       
   129         /// Layout data
       
   130         CESMRLayoutManager* iLayout;
       
   131         /// Flag for the item highlight status
       
   132         TBool iHighlighted;
       
   133         /// Flag for telling whether the item needs the icon
       
   134         TBool iHasIcon;
       
   135         /// Original text length
       
   136         TInt iOriginalTextLength;
       
   137     };
       
   138 
       
   139 #endif // CESMRRESPONSEITEM_H
       
   140 
       
   141 // End of file