calendarui/controller/inc/calentoolbarimpl.h
changeset 0 f979ecb2b13e
child 14 21239b3bcd78
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  Calendar Toolbar Implementation
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CALENTOOLBARIMPL_H
       
    20 #define CALENTOOLBARIMPL_H
       
    21 
       
    22 #include <akntoolbarobserver.h>                 // MAknToolbarObserver
       
    23 #include <coecobs.h>                            // MCoeControlObserver
       
    24 #include <calentoolbar.h>                       // MCalenToolbarObserver
       
    25 
       
    26 //Forward declarations
       
    27 class CAknAppUi;
       
    28 class CAknButton;
       
    29 class CAknToolbar;
       
    30 class CCalenController;
       
    31 class CGulIcon;
       
    32 class CAknView;
       
    33 class CCalenViewInfo;
       
    34 
       
    35 NONSHARABLE_CLASS( CCalenToolbarImpl ) : public CBase, 
       
    36 public MCalenToolbar,
       
    37 public MAknToolbarObserver,
       
    38 public MCoeControlObserver
       
    39     {
       
    40     public:
       
    41 
       
    42         /**
       
    43          * First phase construction
       
    44          * Creates a new CCalenToolbarImpl instance
       
    45          * @param aController Reference to the Calendar Controller
       
    46          */
       
    47         static CCalenToolbarImpl* NewL( CCalenController& aController );
       
    48 
       
    49         /**
       
    50          * Destructor
       
    51          * Frees all resources used by this class
       
    52          */
       
    53         ~CCalenToolbarImpl();
       
    54 
       
    55         /**
       
    56          * From MCalenToolbar
       
    57          * Check if the toolbar is currently visible
       
    58          * @return ETrue if the toolbar is currently shown, EFalse otherwise
       
    59          */
       
    60         TBool IsVisible();
       
    61 
       
    62         /**
       
    63          * From MCalenToolbar
       
    64          * Show or hide the toolbar.  Has no effect if the toolbar is
       
    65          * disabled
       
    66          * @param aVisibility ETrue to set visible, EFalse to set invisible
       
    67          */
       
    68         void SetToolbarVisibilityL( TBool aMakeVisible );
       
    69 
       
    70         /**
       
    71          * From MCalenToolbar
       
    72          * Update the toolbar using Calendar layout information
       
    73          */
       
    74         void UpdateToolbar();
       
    75 
       
    76         /**
       
    77          * From MCalenToolbar
       
    78          * Accessor for the concrete toolbar
       
    79          * @return Reference to the concrete toolbar object
       
    80          */
       
    81         CAknToolbar& Toolbar();
       
    82 
       
    83         /**
       
    84          * From MCalenToolbar.
       
    85          * Allows extending this API without breaking BC.
       
    86          * 
       
    87          * @param aExtensionUid specifies
       
    88          * @return extension of the requested type
       
    89          */
       
    90         TAny* CalenToolbarExtensionL( TUid aExtensionUid );
       
    91 
       
    92         /**
       
    93          * From MAknToolbarObserver
       
    94          * Called before toolbar is drawn.  Allows modification of toolbar
       
    95          * components based on current context
       
    96          * @param aResourceId The resource ID for particular toolbar
       
    97          * @param aToolbar The toolbar object pointer
       
    98          */
       
    99         void DynInitToolbarL( TInt aResourceId, CAknToolbar* aToolbar );
       
   100 
       
   101         /**
       
   102          * From MAknToolbarObserver
       
   103          * Handles toolbar events for a toolbar item
       
   104          * @param aCommand The command ID of the toolbar item
       
   105          */
       
   106         void OfferToolbarEventL( TInt aCommand );
       
   107 
       
   108         /**
       
   109          * From MCoeControlObserver
       
   110          * Handles an event from an observed control
       
   111          * @param aControl The control that sent the event
       
   112          * @param aEventType The event type
       
   113          */
       
   114         void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
       
   115 
       
   116         /**
       
   117          * Update icon for "NextView" button
       
   118          * @param aIcon New icon for the nextview button
       
   119          */
       
   120         void SetNextViewIcon( CGulIcon* aIcon );
       
   121 
       
   122         /**
       
   123          * Populate the change view toolbar extension 
       
   124          * with available cycling views
       
   125          */
       
   126         void PopulateChangeViewToolbarExtensionL();
       
   127 
       
   128         /**
       
   129          * Resets calendar toolbar
       
   130          */
       
   131         void ResetCalendarToolbar();
       
   132 
       
   133         /**
       
   134          * For handling focus in toolbar extension
       
   135          */
       
   136         void SetToolbarExtensionFocus(TBool aFocus);
       
   137 
       
   138         /**
       
   139          * Reset toolbar extension commands 
       
   140          */
       
   141         void ResetToolbarExtensionCommandsL();
       
   142         
       
   143     private:
       
   144 
       
   145         /**
       
   146          * Private constructor
       
   147          * Creates a new CCalenToolbarImpl instance
       
   148          * @param aController Reference to the Calendar Controller
       
   149          */
       
   150         CCalenToolbarImpl( CCalenController& aController );
       
   151 
       
   152         /**
       
   153          * Second phase construction
       
   154          * Creates initial toolbar buttons
       
   155          */
       
   156         void ConstructL();
       
   157 
       
   158         /**
       
   159          * Create calendar toolbar buttons
       
   160          * @param aIcon Button Icon
       
   161          * @param aIconTextId Icon Text
       
   162          * @param aTooltipID Tooltip Text
       
   163          */ 
       
   164         CAknButton* CreateButtonL( CGulIcon* aIcon, 
       
   165                                    TInt aIconTextId,
       
   166                                    TInt aTooltipID );
       
   167         
       
   168         /**
       
   169          * Create calendar toolbar buttons
       
   170          * @param aIcon Button Icon
       
   171          * @param aIconTextId Icon Text
       
   172          * @param aTooltipID Tooltip Text
       
   173          */        
       
   174         CAknButton* CreateButtonForCustomViewsL(CGulIcon* aIcon,
       
   175                                                 TInt aIconTextId,
       
   176                                                 const TDesC &aIconText );
       
   177 
       
   178         /**
       
   179          * Add view toolbar items to the extendable toolbar as per 
       
   180          * view cycle positions
       
   181          * 
       
   182          * @param aIndex Index of the toolbar item
       
   183          * @aViewInformation reference to the CCalenViewInfo 
       
   184          */
       
   185         void AddItemsToExtendableToolbarL( TInt aIndex,
       
   186                                            CCalenViewInfo& aViewInformation);
       
   187         
       
   188         /**
       
   189          * Get view position list based on the cycling positions
       
   190          * 
       
   191          * @param aCurrentViewUid UID of the current view
       
   192          * @param aViewPositionArray array of view positions as per view cycle  
       
   193          */
       
   194         void GetViewPositionList( TUid aCurrentViewUid,
       
   195                                   RArray<TUid>& aViewPositionArray,
       
   196                                   RPointerArray<CCalenViewInfo>& aViewInfoArray);
       
   197         
       
   198         /**
       
   199          * Get IconText and tooltip text resource ids for extendable toolbar
       
   200          * items  
       
   201          * 
       
   202          * @param aViewUid view uid of the view
       
   203          * @param aIconTextId resource id of icon text
       
   204          * @param aToolTipTextId resource id of tooltip text
       
   205          */
       
   206         void GetResourceIdForToolTip( TUid aViewUid, TInt& aIconTextId,
       
   207                                       TInt& aToolTipTextId);
       
   208         
       
   209     private: // Data.
       
   210         
       
   211         CAknAppUi* iAppUi;                  // Application UI. Not owned by this class
       
   212         CCalenController& iController;      // Calendar Controller reference.
       
   213         CAknToolbar* iCalenToolbar;         // calendar toolbar. Owned by the CCalenToolbarImpl
       
   214         TBool iStartUpToolbar;
       
   215         RArray<TInt> iExtensionToolbarCommands;
       
   216         CAknToolbar* iAppToolbar;           // Concrete toolbar. Owned by the appui.
       
   217 
       
   218     };
       
   219 
       
   220 #endif // CALENTOOLBARIMPL_H
       
   221 
       
   222 // End of File