meetingrequest/mrgui/inc/cesmrview.h
branchRCL_3
changeset 33 da5135c61bad
parent 0 8466d47a6819
child 24 b5fbb9b25d57
--- a/meetingrequest/mrgui/inc/cesmrview.h	Mon Mar 15 12:39:10 2010 +0200
+++ b/meetingrequest/mrgui/inc/cesmrview.h	Wed Mar 31 21:08:33 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -19,18 +19,28 @@
 #define CESMRVIEW_H
 
 #include <coecntrl.h>
-#include <eikmenup.h>
+#include <eiksbobs.h>
+#include <eikscrlb.h>
 
-#include "cesmrlistcomponent.h"
+#include "cmrlistpane.h"
 #include "mesmrtitlepaneobserver.h"
-#include "mesmrfontsizeobserver.h"
+#include "mmrscrollbarobserver.h"
+#include "tnavipaneclearer.h"
+#include "esmrgui.hrh"
 
 class CESMRTitlePane;
-class MESMRCalEntry;
 class MESMRFieldStorage;
 class MAgnEntryUiCallback;
-class CESMRLayoutManager;
 class CAknsBasicBackgroundControlContext;
+class CESMRPolicy;
+class CEikMenuPane;
+class MMRFocusStrategy;
+class MTouchFeedback;
+class CMRNaviArrow;
+class MESMRNaviArrowEventObserver;
+class CMRToolbar;
+class MESMRFieldEvent;
+class CMRAttachmentIndicator;
 
 /**
  *  Container for the meeting request title and list control.
@@ -39,163 +49,262 @@
 NONSHARABLE_CLASS( CESMRView ):
     public CCoeControl,
     public MCoeControlBackground,
-    public MESMRFontSizeObserver,
-    public MESMRTitlePaneObserver
+    public MESMRTitlePaneObserver,
+    public MEikScrollBarObserver,
+    public MMRScrollBarObserver
     {
-public:
-    /**
-     * Two-phased constructor.
-     *
-     * @param aStorage - interface to storage that has all the fileds
-     * @param aEntry - interface to entry information.
-     * @param aRect - rect for this view
-     * @return Pointer to created and initialized esmr view object.
-     */
-     static CESMRView* NewL( 
-    		 MESMRFieldStorage* aStorage, 
-    		 MESMRCalEntry& aEntry, 
-    		 const TRect& aRect );
+    public:
+        /**
+         * Two-phased constructor.
+         *
+         * @param aStorage - interface to storage that has all the fileds
+         * @param aEntry - interface to entry information.
+         * @param aRect - rect for this view
+         * @param aFocusStrategy - interface to focus strategy
+         * @param aToolbar - Reference to MR toolbar
+         * @param aObserver - navi arrow observer
+         * @return Pointer to created and initialized esmr view object.
+         */
+         static CESMRView* NewL(
+                 MESMRFieldStorage* aStorage,
+                 MESMRCalEntry& aEntry,
+                 const TRect& aRect,
+                 MMRFocusStrategy& aFocusStrategy,
+                 CMRToolbar& aToolbar,
+                 MESMRNaviArrowEventObserver* aObserver = NULL );
+
+        /**
+         * Destructor.
+         */
+        ~CESMRView();
 
-    /**
-     * Destructor.
-     */
-    ~CESMRView();
+    public:
 
-public:
+        /**
+        * Externalize the list component items. Data in list items
+        * is stored to iEntry member variable.
+        *
+        * @param TBool ETrue if force validation should be used
+        */
+        void ExternalizeL( TBool aForceValidation = EFalse );
+
+        /**
+        * Internalize the list component items. Data from iEntry is updated
+        * to all fields.
+        */
+        void InternalizeL();
 
-    /**
-    * Externalize the list component items. Data in list items
-    * is stored to iEntry member variable.
-    *
-    * @param TBool ETrue if force validation should be used
-    */
-    void ExternalizeL( TBool aForceValidation = EFalse );
+        /**
+        * Process commands. Dialog forwards the commands that must
+        * be handled by CESMRView.
+        *
+        * @param aCommand
+        */
+        void ProcessEditorCommandL( TInt aCommand );
 
-    /**
-    * Internalize the list component items. Data from iEntry is updated
-    * to all fields.
-    */
-    void InternalizeL();
+        /**
+        * Query if a component with given id is currently visible
+        *
+        * @param aField Field Id which visibility we are interested in.
+        * @return True if component is currently visible
+        */
+        TBool IsControlVisible( TESMREntryFieldId aField ) const;
 
-    /**
-    * Checks if the command can be processed
-    * be handled by CESMRView.
-    *
-    * @param aCommand
-    * @return ETrue if command can be processed
-    */
-    TBool CanProcessEditorCommandL( TInt aCommand );
+        /**
+        * Title can be changed by calling this method
+        *
+        * @param aTitle New title for the view
+        * @param aDefault
+        */
+        void SetTitleL( const TDesC& aTitle, TBool aDefault = EFalse );
 
-    /**
-    * Process commands. Dialog forwards the commands that must
-    * be handled by CESMRView.
-    *
-    * @param aCommand
-    */
-    void ProcessEditorCommandL( TInt aCommand );
+        /**
+        * Focused field in the list can be changed by calling this method
+        *
+        * @param aField Field id of the field that needs to be focused
+        */
+        void SetControlFocusedL( TESMREntryFieldId aField );
+
+        /**
+         * Launches editor help
+         */
+        void LaunchEditorHelpL();
+
+        /**
+         * Launches viewer help
+         */
+        void LaunchViewerHelpL();
 
-    /**
-    * Query if a component with given id is currently visible
-    *
-    * @param aField Field Id which visibility we are interested in.
-    * @return True if component is currently visible
-    */
-    TBool IsComponentVisible( TESMREntryFieldId aField ) const;
+        /**
+        * Query if a component with given id is currently focused
+        *
+        * @param aField Field Id which focus we are interested in.
+        * @return True if component is currently focused
+        */
+        TBool IsComponentFocused( TESMREntryFieldId aField ) const;
 
-    /**
-    * Title can be changed by calling this method
-    *
-    * @param aTitle New title for the view
-    * @param aDefault
-    */
-    void SetTitleL( const TDesC& aTitle, TBool aDefault = EFalse );
+        /**
+         * Returns the the currently focused field id.
+         */
+        TESMREntryFieldId FocusedField() const;
+        
+        /**
+         * Returns the the currently clicked (if exists) or focused field id.
+         */
+        TESMREntryFieldId ClickedOrFocusedField() const;
+        
+        /**
+         * Set the navi arrows' visibility.
+         * @param aLeftArrowVisible  Indicate if the left arrow visible
+         * @param aRightArrowVisible Indicate if the right arrow visible
+         */
+        void SetNaviArrowStatus(TBool aLeftArrowVisible, TBool aRightArrowVisible);
 
-    /**
-    * Focused field in the list can be changed by calling this method
-    *
-    * @param aField Field id of the field that needs to be focused
-    */
-    void SetControlFocusedL( TESMREntryFieldId aField );
+        /**
+         * Adjusts view for a new entry and a new policy
+         */
+        void AdjustViewL(
+                MESMRCalEntry* aNewEntry,
+                const CESMRPolicy& aNewPolicy );
+
+        /**
+         * Scroll the list to put the responeArea at the top and
+         * set the focus on it
+         */
+        void InitialScrollL();
 
-    /**
-     * Launches editor help
-     */
-    void LaunchEditorHelpL();
-
-    /**
-     * Launches viewer help
-     */
-    void LaunchViewerHelpL();
+        /**
+         * Provides possibility to initialize current menu pane.
+         * @param aMenuStyle style of the provided menu pane
+         * @param aResourceId Context menu resource ID
+         * @param aMenuPane Pointer to menu pane
+         */
+        void DynInitMenuPaneL(
+                TMRMenuStyle aMenuStyle,
+                TInt aResourceId,
+                CEikMenuPane* aMenuPane );
+        
+        /*
+         * Relayouts view by calling size changed.
+         */
+        void ReLayout();
     
-    /**
-	* Query if a component with given id is currently focused
-	*
-	* @param aField Field Id which focus we are interested in.
-	* @return True if component is currently focused
-	*/
-	TBool IsComponentFocused( TESMREntryFieldId aField ) const;
+        /**
+         * Processes event.
+         * @param aEvent Reference to event to be processed
+         */
+        void ProcessEventL( const MESMRFieldEvent& aEvent );
+        
+        
+    public: // From CCoeControl
+        TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType);
 
-	/**
-	 * Returns the the currently focused field id. 
-	 */
-	TESMREntryFieldId FocusedField() const; 
-	
-public: // From CAknDialog
-    void DynInitMenuPaneL( /*TInt aResourceId,*/ 
-    		CEikMenuPane* aMenuPane );	
+    public:
+    	/*
+        * Set MRUI MR view mode for judge editor mode or viewer mode is using.
+        * @param aMode MRUI MR view mode
+        */    	
+    	void SetViewMode(TESMRViewMode aMode);
+    	TESMRViewMode GetViewMode();
+    	
+    private: // MESMRTitlePaneObserver
+        void UpdateTitlePaneTextL( const TDesC& aText );
+
+    private: // From MMRScrollBarObserver
+        void ScrollBarPositionChanged( TInt aThumbPosition );
 
-public: // MESMRTitlePaneObserver
-    void UpdateTitlePaneTextL( const TDesC& aText );
-    void UpdateTitlePanePriorityIconL( TUint aPriority );
+    private: // From MEikScrollBarObserver
+        void HandleScrollEventL( CEikScrollBar* aScrollBar,
+                                 TEikScrollEvent aEventType );
+        
+    private: // From MESMRToolbarVisibilityObserver
+    	void MRToolbarVisibilityChanged( 
+    	        TBool aVisible, 
+    	        TRect aToolbarRect );
+    	
 
-private: // implementation
-    void ConstructL( const TRect& aRect );
-    CESMRView( MESMRFieldStorage* aStorage, MESMRCalEntry& aEntry );
-
-private:
-    void LaunchHelpL( const TDesC& aContext );
+    private: // From MCoeControlBackground
+        void Draw(CWindowGc& aGc,
+                  const CCoeControl& aControl,
+                  const TRect& aRect) const;
+        void GetTextDrawer(
+                CCoeTextDrawerBase*& aText,
+                const CCoeControl* aControl) const;
 
-public: // From CCoeControl
-    void SetContainerWindowL(const CCoeControl& aContainer);
-    TInt CountComponentControls() const;
-    CCoeControl* ComponentControl( TInt aInd ) const;
-    void SizeChanged();
-    TSize MinimumSize();
-    TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType);
-    void HandleResourceChange( TInt aType );
-    TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
+    private: // From CCoeControl 
+        void SetContainerWindowL(const CCoeControl& aContainer);
+        TInt CountComponentControls() const;
+        CCoeControl* ComponentControl( TInt aInd ) const;
+        void SizeChanged();
+        TSize MinimumSize();
+        void HandleResourceChange( TInt aType );
+        TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
+        void HandlePointerEventL(
+            const TPointerEvent &aPointerEvent );
 
-    // <cmail>
-    void FocusChanged(TDrawNow aDrawNow); 
-    // </cmail>
-
-private: // From CCoeControl
-    void Draw( const TRect& aRect ) const;
-
-protected: // FromMESMRFontSizeObserver
-    void FontSizeSettingsChanged();
+    private: // From CCoeControl
+        void Draw( const TRect& aRect ) const;
 
-public: // From MCoeControlBackground
-    void Draw(CWindowGc& aGc, 
-    		  const CCoeControl& aControl, 
-    		  const TRect& aRect) const;
-    void GetTextDrawer(
-    		CCoeTextDrawerBase*& aText, 
-    		const CCoeControl* aControl) const;
-
-private:
-    /// Own: Priority icon
-    CESMRTitlePane* iTitle;
-    /// Own: Meeting Requst list component
-    CESMRListComponent* iList;
-    /// Ref: List item storage
-    MESMRFieldStorage* iStorage;
-    /// Ref: Current MR entry
-    MESMRCalEntry& iEntry;
-    /// Own: Pointer to layout manager
-    CESMRLayoutManager* iLayout;
-    /// Own: To enable skin as background for the iTitle   
-    CAknsBasicBackgroundControlContext* iBgContext;
+    private: // implementation
+        void ConstructL( const TRect& aRect );
+        CESMRView(MESMRFieldStorage* aStorage,
+                  MESMRCalEntry& aEntry,
+                  MMRFocusStrategy& aFocusStrategy,
+                  MESMRNaviArrowEventObserver* aObserver,
+                  CMRToolbar& aToolbar );
+        void LaunchHelpL( const TDesC& aContext );
+        void SetTitlePaneObserver();
+        TRect CalculateAttachmentIndicatorLayout();
+        
+    private: // data
+        
+        /**
+         * Defines the component is clicked
+         */
+        enum TComponentPointed
+            {
+            // No component is clicked
+            EComponentNone,
+            // Scroll bar is clicked
+            EComponentScrollBar,
+            // List component is clicked
+            EComponentListPane
+            };
+        
+        /// Own: UI list pane in event editor and viewer
+        CMRListPane* iListPane;
+        /// Ref: List item storage
+        MESMRFieldStorage* iStorage;
+        /// Own: scrollbar
+        CAknDoubleSpanScrollBar* iScrollBar;
+        /// Ref: scrollbar model
+        TAknDoubleSpanScrollBarModel iScrollBarModel;
+        /// Own: current scroll bar thumb position
+        TInt iScrollBarThumbPosition;
+        /// Ref: Current MR entry
+        MESMRCalEntry* iEntry;
+        /// Own: To enable skin as background for the iTitle
+        CAknsBasicBackgroundControlContext* iBgContext;
+        /// Own: This clears the navipane for us.
+        TNavipaneClearer iClearer;
+        /// Ref: Focus strategy reference
+        MMRFocusStrategy& iFocusStrategy;
+        /// Own: Left navigation arrow component control.
+        CMRNaviArrow* iNaviArrowLeft;
+        /// Own: Right navigation arrow component control.
+        CMRNaviArrow* iNaviArrowRight;
+        /// Ref: Navigation arrow event observer.
+        MESMRNaviArrowEventObserver* iObserver;
+        /// Own: judge which view mode is using
+        TESMRViewMode iViewMode;
+        /// Ref: Reference to viewer dialog owned mr toolbar 
+        CMRToolbar& iToolbar;
+        /// Own: Record the rect of stripe.
+        TRect iStripeRect;
+        /// Own: Attachment download indicator
+        CMRAttachmentIndicator* iAttachmentIndicator;
+        /// Own: Control array
+        RArray<CCoeControl*> iControls;
     };
 
 #endif //CESMRVIEW_H