meetingrequest/mrgui/inc/cesmrview.h
branchRCL_3
changeset 64 3533d4323edc
child 80 726fba06891a
equal deleted inserted replaced
63:d189ee25cf9d 64:3533d4323edc
       
     1 /*
       
     2 * Copyright (c) 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:  ESMR container for the title label and list component
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CESMRVIEW_H
       
    19 #define CESMRVIEW_H
       
    20 
       
    21 #include <coecntrl.h>
       
    22 #include <eiksbobs.h>
       
    23 #include <eikscrlb.h>
       
    24 
       
    25 #include "cmrlistpane.h"
       
    26 #include "mesmrtitlepaneobserver.h"
       
    27 #include "mmrscrollbarobserver.h"
       
    28 #include "tnavipaneclearer.h"
       
    29 #include "esmrgui.hrh"
       
    30 
       
    31 class CESMRTitlePane;
       
    32 class MESMRFieldStorage;
       
    33 class MAgnEntryUiCallback;
       
    34 class CAknsBasicBackgroundControlContext;
       
    35 class CESMRPolicy;
       
    36 class CEikMenuPane;
       
    37 class MMRFocusStrategy;
       
    38 class MTouchFeedback;
       
    39 class CMRNaviArrow;
       
    40 class MESMRNaviArrowEventObserver;
       
    41 class CMRToolbar;
       
    42 class MESMRFieldEvent;
       
    43 class CMRAttachmentIndicator;
       
    44 
       
    45 /**
       
    46  *  Container for the meeting request title and list control.
       
    47  * This class is deleted by framework
       
    48  */
       
    49 NONSHARABLE_CLASS( CESMRView ):
       
    50     public CCoeControl,
       
    51     public MCoeControlBackground,
       
    52     public MESMRTitlePaneObserver,
       
    53     public MEikScrollBarObserver,
       
    54     public MMRScrollBarObserver
       
    55     {
       
    56     public:
       
    57         /**
       
    58          * Two-phased constructor.
       
    59          *
       
    60          * @param aStorage - interface to storage that has all the fileds
       
    61          * @param aEntry - interface to entry information.
       
    62          * @param aRect - rect for this view
       
    63          * @param aFocusStrategy - interface to focus strategy
       
    64          * @param aToolbar - Reference to MR toolbar
       
    65          * @param aObserver - navi arrow observer
       
    66          * @return Pointer to created and initialized esmr view object.
       
    67          */
       
    68          static CESMRView* NewL(
       
    69                  MESMRFieldStorage* aStorage,
       
    70                  MESMRCalEntry& aEntry,
       
    71                  const TRect& aRect,
       
    72                  MMRFocusStrategy& aFocusStrategy,
       
    73                  CMRToolbar& aToolbar,
       
    74                  MESMRNaviArrowEventObserver* aObserver = NULL );
       
    75 
       
    76         /**
       
    77          * Destructor.
       
    78          */
       
    79         ~CESMRView();
       
    80 
       
    81     public:
       
    82 
       
    83         /**
       
    84         * Externalize the list component items. Data in list items
       
    85         * is stored to iEntry member variable.
       
    86         *
       
    87         * @param TBool ETrue if force validation should be used
       
    88         */
       
    89         void ExternalizeL( TBool aForceValidation = EFalse );
       
    90 
       
    91         /**
       
    92         * Internalize the list component items. Data from iEntry is updated
       
    93         * to all fields.
       
    94         */
       
    95         void InternalizeL();
       
    96 
       
    97         /**
       
    98         * Process commands. Dialog forwards the commands that must
       
    99         * be handled by CESMRView.
       
   100         *
       
   101         * @param aCommand
       
   102         */
       
   103         void ProcessEditorCommandL( TInt aCommand );
       
   104 
       
   105         /**
       
   106         * Query if a component with given id is currently visible
       
   107         *
       
   108         * @param aField Field Id which visibility we are interested in.
       
   109         * @return True if component is currently visible
       
   110         */
       
   111         TBool IsControlVisible( TESMREntryFieldId aField ) const;
       
   112 
       
   113         /**
       
   114         * Title can be changed by calling this method
       
   115         *
       
   116         * @param aTitle New title for the view
       
   117         * @param aDefault
       
   118         */
       
   119         void SetTitleL( const TDesC& aTitle, TBool aDefault = EFalse );
       
   120 
       
   121         /**
       
   122         * Focused field in the list can be changed by calling this method
       
   123         *
       
   124         * @param aField Field id of the field that needs to be focused
       
   125         */
       
   126         void SetControlFocusedL( TESMREntryFieldId aField );
       
   127 
       
   128         /**
       
   129          * Launches editor help
       
   130          */
       
   131         void LaunchEditorHelpL();
       
   132 
       
   133         /**
       
   134          * Launches viewer help
       
   135          */
       
   136         void LaunchViewerHelpL();
       
   137 
       
   138         /**
       
   139         * Query if a component with given id is currently focused
       
   140         *
       
   141         * @param aField Field Id which focus we are interested in.
       
   142         * @return True if component is currently focused
       
   143         */
       
   144         TBool IsComponentFocused( TESMREntryFieldId aField ) const;
       
   145 
       
   146         /**
       
   147          * Returns the the currently focused field id.
       
   148          */
       
   149         TESMREntryFieldId FocusedField() const;
       
   150         
       
   151         /**
       
   152          * Returns the the currently clicked (if exists) or focused field id.
       
   153          */
       
   154         TESMREntryFieldId ClickedOrFocusedField() const;
       
   155         
       
   156         /**
       
   157          * Set the navi arrows' visibility.
       
   158          * @param aLeftArrowVisible  Indicate if the left arrow visible
       
   159          * @param aRightArrowVisible Indicate if the right arrow visible
       
   160          */
       
   161         void SetNaviArrowStatus(TBool aLeftArrowVisible, TBool aRightArrowVisible);
       
   162 
       
   163         /**
       
   164          * Adjusts view for a new entry and a new policy
       
   165          */
       
   166         void AdjustViewL(
       
   167                 MESMRCalEntry* aNewEntry,
       
   168                 const CESMRPolicy& aNewPolicy );
       
   169 
       
   170         /**
       
   171          * Scroll the list to put the responeArea at the top and
       
   172          * set the focus on it
       
   173          */
       
   174         void InitialScrollL();
       
   175 
       
   176         /**
       
   177          * Provides possibility to initialize current menu pane.
       
   178          * @param aMenuStyle style of the provided menu pane
       
   179          * @param aResourceId Context menu resource ID
       
   180          * @param aMenuPane Pointer to menu pane
       
   181          */
       
   182         void DynInitMenuPaneL(
       
   183                 TMRMenuStyle aMenuStyle,
       
   184                 TInt aResourceId,
       
   185                 CEikMenuPane* aMenuPane );
       
   186         
       
   187         /**
       
   188          * Processes event.
       
   189          * @param aEvent Reference to event to be processed
       
   190          */
       
   191         void ProcessEventL( const MESMRFieldEvent& aEvent );
       
   192         
       
   193         
       
   194     public: // From CCoeControl
       
   195         TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType);
       
   196 
       
   197     public:
       
   198     	/*
       
   199         * Set MRUI MR view mode for judge editor mode or viewer mode is using.
       
   200         * @param aMode MRUI MR view mode
       
   201         */    	
       
   202     	void SetViewMode(TESMRViewMode aMode);
       
   203     	TESMRViewMode GetViewMode();
       
   204     	
       
   205     private: // MESMRTitlePaneObserver
       
   206         void UpdateTitlePaneTextL( const TDesC& aText );
       
   207 
       
   208     private: // From MMRScrollBarObserver
       
   209         void ScrollBarPositionChanged( TInt aThumbPosition );
       
   210 
       
   211     private: // From MEikScrollBarObserver
       
   212         void HandleScrollEventL( CEikScrollBar* aScrollBar,
       
   213                                  TEikScrollEvent aEventType );
       
   214         
       
   215     private: // From MESMRToolbarVisibilityObserver
       
   216     	void MRToolbarVisibilityChanged( 
       
   217     	        TBool aVisible, 
       
   218     	        TRect aToolbarRect );
       
   219     	
       
   220 
       
   221     private: // From MCoeControlBackground
       
   222         void Draw(CWindowGc& aGc,
       
   223                   const CCoeControl& aControl,
       
   224                   const TRect& aRect) const;
       
   225         void GetTextDrawer(
       
   226                 CCoeTextDrawerBase*& aText,
       
   227                 const CCoeControl* aControl) const;
       
   228 
       
   229     private: // From CCoeControl 
       
   230         void SetContainerWindowL(const CCoeControl& aContainer);
       
   231         TInt CountComponentControls() const;
       
   232         CCoeControl* ComponentControl( TInt aInd ) const;
       
   233         void SizeChanged();
       
   234         TSize MinimumSize();
       
   235         void HandleResourceChange( TInt aType );
       
   236         TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
       
   237         void HandlePointerEventL(
       
   238             const TPointerEvent &aPointerEvent );
       
   239 
       
   240     private: // From CCoeControl
       
   241         void Draw( const TRect& aRect ) const;
       
   242 
       
   243     private: // implementation
       
   244         void ConstructL( const TRect& aRect );
       
   245         CESMRView(MESMRFieldStorage* aStorage,
       
   246                   MESMRCalEntry& aEntry,
       
   247                   MMRFocusStrategy& aFocusStrategy,
       
   248                   MESMRNaviArrowEventObserver* aObserver,
       
   249                   CMRToolbar& aToolbar );
       
   250         void LaunchHelpL( const TDesC& aContext );
       
   251         void SetTitlePaneObserver();
       
   252         TRect CalculateAttachmentIndicatorLayout();
       
   253         TRect ContainerRect() const;
       
   254         
       
   255     private: // data
       
   256         
       
   257         /**
       
   258          * Defines the component is clicked
       
   259          */
       
   260         enum TComponentPointed
       
   261             {
       
   262             // No component is clicked
       
   263             EComponentNone,
       
   264             // Scroll bar is clicked
       
   265             EComponentScrollBar,
       
   266             // List component is clicked
       
   267             EComponentListPane
       
   268             };
       
   269         
       
   270         /// Own: UI list pane in event editor and viewer
       
   271         CMRListPane* iListPane;
       
   272         /// Ref: List item storage
       
   273         MESMRFieldStorage* iStorage;
       
   274         /// Own: scrollbar
       
   275         CAknDoubleSpanScrollBar* iScrollBar;
       
   276         /// Ref: scrollbar model
       
   277         TAknDoubleSpanScrollBarModel iScrollBarModel;
       
   278         /// Own: current scroll bar thumb position
       
   279         TInt iScrollBarThumbPosition;
       
   280         /// Ref: Current MR entry
       
   281         MESMRCalEntry* iEntry;
       
   282         /// Own: To enable skin as background for the iTitle
       
   283         CAknsBasicBackgroundControlContext* iBgContext;
       
   284         /// Own: This clears the navipane for us.
       
   285         TNavipaneClearer iClearer;
       
   286         /// Ref: Focus strategy reference
       
   287         MMRFocusStrategy& iFocusStrategy;
       
   288         /// Own: Left navigation arrow component control.
       
   289         CMRNaviArrow* iNaviArrowLeft;
       
   290         /// Own: Right navigation arrow component control.
       
   291         CMRNaviArrow* iNaviArrowRight;
       
   292         /// Ref: Navigation arrow event observer.
       
   293         MESMRNaviArrowEventObserver* iObserver;
       
   294         /// Own: judge which view mode is using
       
   295         TESMRViewMode iViewMode;
       
   296         /// Ref: Reference to viewer dialog owned mr toolbar 
       
   297         CMRToolbar& iToolbar;
       
   298         /// Own: Record the rect of stripe.
       
   299         TRect iStripeRect;
       
   300         /// Own: Attachment download indicator
       
   301         CMRAttachmentIndicator* iAttachmentIndicator;
       
   302         /// Own: Control array
       
   303         RArray<CCoeControl*> iControls;
       
   304     };
       
   305 
       
   306 #endif //CESMRVIEW_H