mmsharing/mmshui/inc/musuigeneralview.h
changeset 15 ccd8e69b5392
parent 2 b31261fd4e04
child 20 e8be2c2e049d
child 22 496ad160a278
equal deleted inserted replaced
2:b31261fd4e04 15:ccd8e69b5392
     1 /*
       
     2 * Copyright (c) 2005 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:  Mus Applications Event Observer Interface
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef MUSUIGENERALVIEW_H
       
    21 #define MUSUIGENERALVIEW_H
       
    22 
       
    23 #include "musuisharingobserver.h"
       
    24 #include "musuiactivetimerobserver.h"
       
    25 
       
    26 #include <avkon.rsg>              // Avkon resource file
       
    27 #include <aknview.h>              // Avkon base view class
       
    28 #include <akntoolbarobserver.h>
       
    29 
       
    30 class CMusUiAppUi;
       
    31 class CMusUiEventController;
       
    32 class CMusUiActivityManager;
       
    33 class CMusUiViewContainer;
       
    34 class CAknIncallBubble;
       
    35 class CMusUiActiveTimer;
       
    36 class CMusUiBackgroundViewContainer;
       
    37 
       
    38 /**
       
    39  * The base class for the MUS application's view classes.
       
    40  * Encapsulates common methods for views.
       
    41  *
       
    42  * @lib musui.exe
       
    43  */
       
    44 class CMusUiGeneralView : public CAknView,
       
    45                           public MAknToolbarObserver,
       
    46                           public MMusUiSharingObserver,
       
    47                           public MMusUiActiveTimerObserver
       
    48     {
       
    49     
       
    50 public: // constructors and destructor
       
    51 
       
    52     enum TMusFgBgEventType
       
    53         {
       
    54         EMusFgBgEventNone,
       
    55         EMusFgEvent,
       
    56         EMusBgEvent
       
    57         };
       
    58 
       
    59     /**
       
    60     * EPOC default constructor.
       
    61     */
       
    62 	void ConstructL();
       
    63 
       
    64     /**
       
    65      * Destructor.
       
    66      */
       
    67     virtual ~CMusUiGeneralView();
       
    68 
       
    69 public: // new functions
       
    70 
       
    71     /**
       
    72      * @return the pointer to the application's AppUi (CMusUiAppUi).
       
    73      */
       
    74     CMusUiAppUi* MusAppUi() const;
       
    75     
       
    76     /**
       
    77      * Refreshes the view.  Called after the mode has been changed from portrait
       
    78      * to landscape or vice versa.  This is a virtual function that must be 
       
    79      * implemented by all concrete MUS UI views.
       
    80      */
       
    81     virtual void RefreshView() = 0;
       
    82     
       
    83     virtual void HandleToolbarCommandL( TInt aCommand ) = 0;
       
    84     
       
    85     virtual void HandleKeyUpEvent( TInt aKeyCode );
       
    86     
       
    87     virtual void SetToolbarVisibility( TBool aVisible );
       
    88 
       
    89     void AsyncQueryDialogAcceptedL( TBool aAccepted );
       
    90 
       
    91     TInt FocusedToolbarItem() const;
       
    92     
       
    93     virtual void LevelIndicatorDismissed() {};
       
    94     virtual void SetInitialFocusedItemL() = 0;
       
    95     
       
    96     TBool OperatorSpecificFunctionality() const;
       
    97     /**
       
    98     * Called when UI comes to foregound / goes to background.
       
    99     * CAknView version of HandleForegroundEventL is not used
       
   100     * at it generates lots of events. Instead, appui implements
       
   101     * foreground event callback funtion and forwards events to views
       
   102     * via this method.
       
   103     */
       
   104     virtual void DoHandleForegroundEventL( TBool aForeground ) = 0;  
       
   105 
       
   106 
       
   107 public: // from base class MAknToolbarObserver
       
   108     
       
   109     virtual void DynInitToolbarL( TInt aResourceId, CAknToolbar* aToolbar );
       
   110     
       
   111     virtual void OfferToolbarEventL( TInt aCommand );
       
   112     
       
   113 
       
   114 public: // from MMusUiSharingObserver
       
   115 
       
   116     /*
       
   117     * Shows sychronous wait dialog with softkey R_AVKON_SOFTKEYS_CANCEL.
       
   118     * @param aPrompt Prompt text shown in dialog
       
   119     * @param aTimerInSeconds Timer in seconds when dialog is dismissed
       
   120     *        automatically. Timer value 0 means that no timer is used.
       
   121     * @param aExpirationMessageResourceId is ID of resource indicating
       
   122     *        the message to be shown if timer expires. Value 0 means that
       
   123     *        no message is shown.
       
   124     * @return EFalse if dialog is dismissed by user pressing cancel
       
   125     *         or by expiration of timer. ETrue if DismissWaitDialogL
       
   126     *         is called with parameter ETrue;
       
   127     */
       
   128     virtual TBool ShowWaitDialogL( const TDesC& aPrompt, 
       
   129                                    TInt aTimerInSeconds = 0,
       
   130                                    TInt aExpirationMessageResourceId = 0 );
       
   131     
       
   132     /*
       
   133     * Dismisses sychronous wait dialog shown by calling ShowWaitDialogL.
       
   134     * @param aReturnValue determines return value of function 
       
   135     *        ShowWaitDialogL.
       
   136     */
       
   137     virtual void DismissWaitDialogL( TBool aReturnValue = ETrue );
       
   138     
       
   139     /*
       
   140     * Set call back service of wait dialog
       
   141     * @param aCallback A pointer of class MProgressDialogCallback
       
   142     *        which implemented DialogDismissedL 
       
   143     */
       
   144     virtual void SetWaitDialogCallbackL( MProgressDialogCallback* aCallback );
       
   145     
       
   146     virtual void ShowStatusPaneTitleL();
       
   147 
       
   148     virtual void EnableMiddleSoftkeyL( TInt aResourceId );
       
   149 
       
   150     virtual void ActivateVolumeControlL( TInt aValue );  
       
   151     
       
   152     virtual void HighlightSelectedToolbarItem( TInt aCommand );
       
   153     
       
   154     /**
       
   155     * General functionality for replacing a toolbar command
       
   156     * Function should be overridden for specific functionality
       
   157     */
       
   158     virtual void ReplaceToolbarCommand( TInt aOldCommand, 
       
   159                                         TInt aNewCommand,
       
   160                                         TBool aSetNewCommandFocused );
       
   161     
       
   162     /**
       
   163     * If toolbar is shown, audio routing button will be refreshed according to
       
   164     * current state of audio routing. 
       
   165     * In case there is no toolbar, middle softkey will be updated
       
   166     */
       
   167     virtual void RefreshAudioRoutingToolbarButton();
       
   168     
       
   169     virtual void UpdateSessionTime( const TDesC& aSessionTime );                                  
       
   170                                         
       
   171                                         
       
   172 public: // from base class CAknView
       
   173 
       
   174     /**
       
   175      * Takes care of command handling.
       
   176      *
       
   177      * @param aCommand  The command that was received.
       
   178      */
       
   179     virtual void HandleCommandL( TInt aCommand );
       
   180 
       
   181     /**
       
   182      * From MEikMenuObserver, called by framework before constructing menupane.
       
   183      * Initializes menu items common to all sharing types.
       
   184      */
       
   185     virtual void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
   186     
       
   187 public: // from MMusUiActiveTimerObserver    
       
   188     
       
   189     /**
       
   190      * Indicates that a certain amount of time elapsed
       
   191      */    
       
   192     virtual void TimerComplete( CMusUiActiveTimer* aTimer );
       
   193 
       
   194 
       
   195 protected: // New functions
       
   196 
       
   197     virtual CMusUiEventController* EventController() const = 0;
       
   198     
       
   199     virtual CMusUiViewContainer& SharingContainer() const = 0;
       
   200     
       
   201     /**
       
   202     * Leaves with KErrNotFound if eventcontroller is not available
       
   203     */
       
   204     CMusUiEventController& EventControllerL() const;
       
   205     
       
   206     /**
       
   207      * Called when event occurs of type EEventFocusLost or
       
   208      * EEventFocusGained.
       
   209      *
       
   210      * @param aForeground ETrue if the application is in the foreground,
       
   211      *                    otherwise EFalse.
       
   212      * @param aExit indicates if the application should exit 
       
   213      */
       
   214     void HandleForegroundEventL( TBool aForeground, TBool aExit );    
       
   215     
       
   216 
       
   217 protected:
       
   218 
       
   219     /**
       
   220      * Gets called by the framework when it's activating this view.
       
   221      *
       
   222      * @param aPrevViewId Previous view id
       
   223      * @param aCustomMessageId Custom message's id
       
   224      * @param aCustomMessage Custom message
       
   225      */
       
   226     void DoActivateL( const TVwsViewId& aPrevViewId,
       
   227                       TUid aCustomMessageId,
       
   228                       const TDesC8& aCustomMessage );
       
   229 
       
   230     /**
       
   231      * Gets called by the framework when it's deactivating this view.
       
   232      */
       
   233     void DoDeactivate();
       
   234 
       
   235 protected:
       
   236 
       
   237    
       
   238     void CompleteForegroundEventL();
       
   239     void DoForegroundEventL();
       
   240     void DoBackgroundEventL( TBool aExit );
       
   241     void SetCurrentFgBgEvent( TMusFgBgEventType aEventType );
       
   242     TInt ToolbarPlaceHolderHeight() const;
       
   243     void UpdateBackgroundOrdinalPosition( TBool aUp );  
       
   244 
       
   245 protected: // data
       
   246 
       
   247     /**
       
   248     * ETrue if operator specific functionality is needed 
       
   249     */
       
   250     TBool iOperatorSpecificFunctionality;
       
   251         
       
   252     TBool iToolbarItemSelected;
       
   253     
       
   254 private: // data
       
   255     
       
   256     CAknIncallBubble* iIncallBubble;
       
   257     
       
   258     CMusUiActiveTimer* iSessionEndTimer;
       
   259     
       
   260     CMusUiActiveTimer* iFgBgTimer;
       
   261     
       
   262     TMusFgBgEventType iCurrentFgBgEvent;
       
   263     
       
   264     TBool iCurrentExitSetting;
       
   265     
       
   266     CMusUiBackgroundViewContainer* iBackgroundContainer; // skin background drawer
       
   267     
       
   268     };
       
   269 
       
   270 // macro for NO_TOOLBAR case
       
   271 #define MUS_NO_TOOLBAR ( iOperatorSpecificFunctionality && !(AknLayoutUtils::PenEnabled()))
       
   272 
       
   273 #endif // MUSUIGENERALVIEW_H
       
   274 
       
   275 // end of file