codhandler/codui/inc/CodView.h
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2004 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 the License "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:  Declaration of class CCodView.   
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef COD_VIEW_H
       
    20 #define COD_VIEW_H
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #include <coecntrl.h>
       
    25 
       
    26 // FORWARD DECLARATION
       
    27 
       
    28 class CCodData;
       
    29 class CEikRichTextEditor;
       
    30 class CEikScrollBarFrame;
       
    31 class MObjectProvider;
       
    32 class CStyleList;
       
    33 class CParagraphStyle;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38 * Control displaying COD details.
       
    39 */
       
    40 NONSHARABLE_CLASS( CCodView ): public CCoeControl
       
    41     {
       
    42 
       
    43     public:     // Constructors and destructor
       
    44 
       
    45         /**
       
    46         * Constructor.
       
    47         * @param aMopParent MOP Parent.
       
    48         */
       
    49         CCodView();
       
    50 
       
    51         /**
       
    52         * Second phase constructor. Leaves on failure.
       
    53         */
       
    54         void ConstructL();
       
    55 
       
    56         /**
       
    57         * Construct from resource. Uses resource STRUCT RTXTED.
       
    58         */
       
    59         virtual void ConstructFromResourceL( TResourceReader& aReader );
       
    60         
       
    61         /**
       
    62         * Destructor.
       
    63         */
       
    64         virtual ~CCodView();
       
    65 
       
    66     public:     // new methods
       
    67 
       
    68         /**
       
    69         * Display this data.
       
    70         * @param aCod COD flag (show Price).
       
    71         * @param aData COD data to display. Ownership not taken.
       
    72         */
       
    73         void SetDataL( const CCodData& iData, TBool aCod );
       
    74 
       
    75         /**
       
    76         * Clear view (display nothing).
       
    77         */
       
    78         void Clear();
       
    79 
       
    80     public:     // from CCoeControl
       
    81 
       
    82         /**
       
    83         * Return minimum size.
       
    84         * @return Minimum size.
       
    85         */
       
    86         TSize MinimumSize();
       
    87 
       
    88         /**
       
    89         * Size changed. Lay out and draw components.
       
    90         */
       
    91         void SizeChanged();
       
    92 
       
    93         /**
       
    94         * Count component controls.
       
    95         * @return Number of component controls.
       
    96         */
       
    97         TInt CountComponentControls() const;
       
    98 
       
    99         /**
       
   100         * Return component control.
       
   101         * @param aIndex Index of component control.
       
   102         * @param Component control.
       
   103         */
       
   104         CCoeControl* ComponentControl( TInt aIndex ) const;
       
   105 
       
   106         /**
       
   107         * Handle key event.
       
   108         * @param aKeyEvent Key event.
       
   109         * @param aType Event type.
       
   110         * @return Key response.
       
   111         */
       
   112         TKeyResponse OfferKeyEventL
       
   113             ( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   114 
       
   115         /**
       
   116         * Draw this control.
       
   117         * @param aRect Rectangle to draw.
       
   118         */
       
   119         void Draw( const TRect& aRect ) const;
       
   120 
       
   121         /**
       
   122         * Handle resource change.
       
   123         * @param aType Resource type.
       
   124         */
       
   125         void HandleResourceChange( TInt aType );
       
   126 
       
   127     private:    // new methods
       
   128 
       
   129         /**
       
   130         * Update styles (reload fontspecs).
       
   131         */
       
   132         void SetStylesL();
       
   133 
       
   134         /**
       
   135         * Add one item to the editor.
       
   136         * @param aNameResId Resource id of attribute name resource (TBUF).
       
   137         * @param aValue Attribute value.
       
   138         */
       
   139         void AddLineL( TInt aNameResId, const TDesC& aValue );
       
   140 
       
   141         /**
       
   142         * Update the scrollbar.
       
   143         * @param aTile If ETrue, scrollbar is tiled.
       
   144         */
       
   145         void UpdateScrollBarL( TBool aTile );
       
   146 
       
   147         /**
       
   148         * Allocate and return human-readable name for a MIME type.
       
   149         * @param MIME type.
       
   150         * @return Allocated human-readable name in a buffer. Ownership passed
       
   151         * to the caller.
       
   152         */
       
   153         HBufC* AllocTypeNameL( const TDesC8& aMimeType );
       
   154 
       
   155         /**
       
   156         * Scroll up.
       
   157         */
       
   158         void ScrollUpL();
       
   159 
       
   160         /**
       
   161         * Scroll down.
       
   162         */
       
   163         void ScrollDownL();
       
   164 
       
   165         /**
       
   166         * Get MIME type to be displayed. (First type which is 'meaningless'
       
   167         * to the user, e.g. leave out wrappers like DRM).
       
   168         * @param aData COD data.
       
   169         * @return MIME type.
       
   170         */
       
   171         TPtrC8 DisplayType( const CCodData& aData );
       
   172 
       
   173     private:    // data
       
   174 
       
   175         CEikRichTextEditor* iEditor;    ///< Editor. Owned.
       
   176         CEikScrollBarFrame* iSbFrame;   ///< Scrollbar frame. Owned.
       
   177         CStyleList* iStyles;            ///< Styles. Owned.
       
   178         CParagraphStyle* iNameStyle;    ///< Attribute name style. Owned.
       
   179         CParagraphStyle* iValueStyle;   ///< Attribute value style. Owned.
       
   180         HBufC* iUndefinedValue;         ///< "Undefined" value string. Owned.
       
   181 
       
   182     };
       
   183 
       
   184 #endif /* def COD_VIEW_H */