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