epoc32/include/mw/akntoolbar.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 /*
     2 * Copyright (c) 2005-2007 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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:  Popup toolbar component
    15 *
    16 */
    17 
    18 
    19 
    20 #ifndef __AKNTOOLBAR_H__
    21 #define __AKNTOOLBAR_H__
    22 
    23 //  INCLUDES
    24 #include <avkon.hrh> // TAknOrientation
    25 #include <akncontrol.h> // CCoeControl
    26 #include <coecobs.h>    // MCoeControlObserver
    27 #include <eikcmobs.h>   // MEikCommandObserver
    28 #include <aknpopupfader.h>
    29 #include <babitflags.h>
    30 
    31 // FORWARD DECLARATIONS
    32 class CAknButton;
    33 class CAknToolbarItem;
    34 class CAknToolbarExtension;
    35 class MAknToolbarObserver;
    36 class CEikButtonGroupContainer;
    37 class TAknWindowComponentLayout;
    38 class CAknsFrameBackgroundControlContext;
    39 class CAknsBasicBackgroundControlContext;
    40 
    41 
    42 // DisableToolbarL leaves with this value if toolbar is shown, since toolbar
    43 // should not be shown when disabling/enabling toolbar. 
    44 const TInt KErrToolbarShown = -101;   
    45 
    46 // CLASS DECLARATION
    47 
    48 /**
    49 *  The class to provide toolbar for the application
    50 *
    51 *  @lib eikcoctl.lib
    52 *  @since Series 60 3.1
    53 */
    54 class CAknToolbar : public CAknControl, public MCoeControlObserver, 
    55     public MCoeControlBackground, public MEikCommandObserver, 
    56     public MAknFadedComponent
    57     {
    58     public: //Enumerations: 
    59 
    60     enum TEventModifiers {
    61         ELongPress = 1,
    62         ELongPressEnded = 2,
    63     };
    64 
    65     public: // Constructors and destructor
    66 
    67         /**
    68          * Two-phased constructor.
    69          *
    70          * @param aResourceId The ID for this component's resource
    71          * @return Pointer to the created toolbar object
    72          */
    73         IMPORT_C static CAknToolbar* NewL( const TInt aResourceId );
    74 
    75         /**
    76          * Two-phased constructor.
    77          *
    78          * @param aResourceId The ID for this component's resource
    79          * @return Pointer to the created toolbar object
    80          */
    81         IMPORT_C static CAknToolbar* NewLC( const TInt aResourceId );
    82 
    83         /**
    84          * Destructor
    85          */
    86         ~CAknToolbar();
    87 
    88     public: // From base class
    89 
    90         /**
    91          * From CCoeControl.
    92          * Gets the number of controls contained in a compound control.
    93          *
    94          * @return The number of component controls contained by this control.
    95          */
    96          IMPORT_C TInt CountComponentControls() const;
    97 
    98          /**
    99          * From CCoeControl.
   100          * Gets the specified component of a compound control.
   101          *
   102          * @param aIndex The index of the control to get
   103          * @return The component control with an index of aIndex.
   104          */
   105         IMPORT_C CCoeControl* ComponentControl( TInt aIndex ) const ;
   106 
   107         /**
   108          * From CCoeControl.
   109          * Handles pointer events.
   110          *
   111          * @param aPointerEvent The pointer event. 
   112          */
   113         IMPORT_C void HandlePointerEventL( const TPointerEvent& aPointerEvent );
   114 
   115         /**
   116          * From CCoeControl.
   117          * Handles a change to the control's resources.
   118          *
   119          * @param aType A message UID value.
   120          */
   121         IMPORT_C void HandleResourceChange( TInt aType );
   122 
   123         /**
   124          * From MCoeControlObserver.
   125          * Handles an event from an observed toolbar item.
   126          *
   127          * @param aControl The control which sent the event
   128          * @param aEventType The event type
   129          */
   130         IMPORT_C void HandleControlEventL( CCoeControl* aControl, 
   131                                            TCoeEvent aEventType );
   132 
   133         /**
   134          * From CCoeControl.
   135          * Responds to changes in the position of a toolbar.
   136          */
   137         IMPORT_C void PositionChanged();
   138 
   139         /**
   140          * From MEikCommandObserver.
   141          * Processes user commands.
   142          *
   143          * @param TInt aCommandId  ID of the command to respond to.
   144          */
   145         IMPORT_C void ProcessCommandL( TInt aCommandId );
   146 
   147         /**
   148          * From CCoeControl.
   149          * Sets toolbar dimmed. Doesn't redraw.
   150          *
   151          * @param aDimmed is ETrue to dim the toolbar, 
   152          *      EFalse to set the toolbar as not dimmed
   153          */
   154         IMPORT_C void SetDimmed( TBool aDimmed );
   155 
   156         /**
   157          * From CCoeControl.
   158          * Handles key events.
   159          *
   160          * @param aKeyEvent The key event
   161          * @param aType The type of key event: EEventKey, EEventKeyUp
   162          *      or EEventKeyDown.
   163          * @return TKeyResponse Indicates whether or not the key event was used
   164          *      by this control.
   165          */
   166         IMPORT_C TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
   167                                               TEventCode aType );
   168 
   169         /**
   170          * From CCoeControl.
   171          * Gets the control's input capabilities.
   172          *
   173          * @return The control's input capabilities.
   174          */
   175         IMPORT_C TCoeInputCapabilities InputCapabilities() const;
   176 
   177         /**
   178          * From MCoeControlBackground.
   179          * Draw the background for a given control.
   180          * The text drawer that shall be used to draw text on the specific
   181          * background can be fetched through the GetTextDrawer() method.
   182          *
   183          * @param aGc Graphics context used for drawing.
   184          * @param aControl The control being drawn (may be a child of the drawer).
   185          * @param aRect The area to be redrawn.
   186          */
   187         IMPORT_C void Draw( CWindowGc& aGc,
   188                             const CCoeControl& aControl,
   189                             const TRect& aRect ) const;
   190 
   191     public: // New functions
   192 
   193         /**
   194          * Gets a pointer to the specified control.
   195          *
   196          * @param aControlId The ID of the control for which a pointer is
   197          *      required.
   198          * @return Pointer to the control with the specified ID.
   199          */
   200         IMPORT_C CCoeControl* ControlOrNull( const TInt aControlId ) const;
   201 
   202         /**
   203          * Shows or hides toolbar. Position of the top left corner should be set
   204          * in advance. Toolbar set visible with this method is by default focusing.
   205          * Does nothing if toolbar is disabled.
   206          * @param aVisible ETrue to show it, EFalse to hide it.
   207          */
   208         IMPORT_C void SetToolbarVisibility( const TBool aVisible );
   209 
   210         /**
   211         * Shows or hides toolbar. Position of the top left corner should be set
   212         * in advance. This overload of the method allows toolbar to be set
   213         * non-focusing. Does nothing if toolbar is disabled. 
   214         * @param aVisible ETrue to show it, EFalse to hide it.
   215         * @param aFocusing ETrue to set toolbar focusing, otherwise EFalse.
   216         */
   217         IMPORT_C void SetToolbarVisibility( const TBool aVisible, 
   218                                             const TBool aFocusing );
   219 
   220         /**
   221          * Dims (greys out) or undims a toolbar item.
   222          *
   223          * @param aCommandId The command (as defined in an .hrh file)
   224          *      associated with this toolbar item. This identifies the toolbar
   225          *      item, whose text is to be dimmed or un-dimmed.
   226          * @param aDimmed Use ETrue to dim this toolbar item or EFalse to
   227          *      un-dim this toolbar item.
   228          * @param aDrawNow Should be ETrue for the item to be redrawn.
   229          */
   230         IMPORT_C void SetItemDimmed( const TInt aCommandId,
   231                                      const TBool aDimmed,
   232                                      const TBool aDrawNow );
   233 
   234         /**
   235          * Hides or unhides a toolbar item.
   236          *
   237          * @param aCommandId The command (as defined in an .hrh file)
   238          *      associated with this toolbar item. This identifies the toolbar
   239          *      item, which will be set to hidden or unhidden.
   240          * @param aHide Use ETrue to hide this toolbar item or EFalse to
   241          *      unhide this toolbar item.
   242          * @param aDrawNow Should be ETrue for the toolbar to be redrawn.
   243          */
   244         IMPORT_C void HideItem( const TInt aCommandId,
   245                                 const TBool aHide,
   246                                 const TBool aDrawNow );
   247 
   248         /**
   249          * Sets the observer for the toolbar.
   250          *
   251          * @param aObserver A pointer to the observer. Ownership is not changed.
   252          */
   253         IMPORT_C void SetToolbarObserver( MAknToolbarObserver* aObserver );
   254 
   255         /**
   256          * Returns a pointer to the toolbar observer.
   257          *
   258          * @return Pointer to the toolbar observer.
   259          */
   260         IMPORT_C MAknToolbarObserver* ToolbarObserver();
   261 
   262         /**
   263          * Adds one item to the end of the toolbar. Takes ownership.
   264          * Leaves with value KErrNotSupported, if the control type is not
   265          * supported by toolbar (see CAknToolbar::IsSupportedItemType()).
   266          *
   267          * @param aItem The control.
   268          * @param aType The type of the new toolbar item.
   269          * @param aCommandId The command ID for this item.
   270          * @param aFlags The flags.
   271          */
   272         IMPORT_C void AddItemL( CCoeControl* aItem, 
   273                                 const TInt aType, 
   274                                 const TInt aCommandId, 
   275                                 const TInt aFlags );
   276 
   277         /**
   278          * Adds one item to the specified place. Takes ownership.
   279          * Leaves with value KErrNotSupported, if the control type is not
   280          * supported by toolbar (see CAknToolbar::IsSupportedItemType()).
   281          *
   282          * @param aItem The control.
   283          * @param aType The type of the new toolbar item.
   284          * @param aCommandId The command ID for this item.
   285          * @param aFlags The flags.
   286          * @param aIndex The index in array at which item should be added.
   287          */
   288         IMPORT_C void AddItemL( CCoeControl* aItem,
   289                                 const TInt aType,
   290                                 const TInt aCommandId,
   291                                 const TInt aFlags,
   292                                 const TInt aIndex );
   293 
   294         /**
   295          * Removes one item from the toolbar.
   296          *
   297          * @param aCommandId The ID of the item which should be removed.
   298          */
   299         IMPORT_C void RemoveItem( const TInt aCommandId );
   300 
   301         /**
   302          * Returns ETrue if the type of the item can be included in the
   303          * toolbar.
   304          *
   305          * @return ETrue for the supported type, otherwise EFalse.
   306          */
   307         IMPORT_C TBool IsSupportedItemType( const TInt aType ) const;
   308 
   309         /**
   310          * Changes the command ID for the initially focused item when toolbar is
   311          * shown or gain focus. Notice that, if this item is not visible, then
   312          * focus will be according default behaviour. Normally, focus will be on
   313          * the first item, if KAknToolbarMiddleItemFocused flag was not used.
   314          *
   315          * @param aCommandId The command ID for the item to get focus.
   316          */
   317         IMPORT_C void SetInitialFocusedItem( const TInt aCommandId );
   318 
   319         /**
   320          * Called by the framework to handle the emphasising or
   321          * de-emphasising of a toolbar window when it is needed. 
   322          * 
   323          * @param aEmphasis ETrue to emphasize the menu, EFalse otherwise.
   324          */
   325         IMPORT_C void SetEmphasis( const TBool aEmphasis );
   326 
   327         /**
   328          * Returns toolbar visibility at this moment
   329          *
   330          * @return ETrue, if toolbar is shown.
   331          */
   332         IMPORT_C TBool IsShown() const;
   333 
   334         /**
   335          * Specifies whether toolbar should be shown with sliding effect or not.
   336          * By default toolbar is shown with sliding.
   337          *
   338          * @param aSlide ETrue for sliding effect, EFalse without sliding.
   339          */
   340         IMPORT_C void SetWithSliding( const TBool aSlide );
   341 
   342         /**
   343          * Sets whether the toolbar should be closed or remain open after the
   344          * specified command is issued from the toolbar.
   345          *
   346          * @param aCommandId The command.
   347          * @param aClose ETrue, if toolbar should be close.
   348          */
   349         IMPORT_C void SetCloseOnCommand( const TInt aCommandId,
   350                                          const TBool aClose );
   351 
   352         /**
   353          * Sets whether the toolbar should be closed after a command is issued
   354          * from the toolbar. This method affects every command on the toolbar.
   355          *
   356          * @param aClose ETrue, if toolbar should be closed.
   357          */
   358         IMPORT_C void SetCloseOnAllCommands( const TBool aClose );
   359         
   360         /**
   361          * Sets toolbar orientation.
   362          * 
   363          * @param aOrientation Orientation that should be used for toolbar.
   364          * @since 3.2
   365          */
   366         IMPORT_C void SetOrientation( const TAknOrientation aOrientation );
   367         
   368         /**
   369          * Updates transparent toolbar's background. 
   370          * @since 3.2
   371          */
   372         IMPORT_C void UpdateBackground();
   373          
   374         /**
   375          * Shows toolbar again after it has been hidden for background changing 
   376          * purposes
   377          * 
   378          * @since 3.2
   379          */
   380         void ShowToolbarForBackgroundUpdate(); 
   381         
   382         /**
   383          * Disables/Enables toolbar so that it cannot/can be activated from e.g. 
   384          * touch pane. Needed especially if a dialog is on the screen and 
   385          * toolbar is not wished to be shown. Leaves with value KErrToolbarShown
   386          * if called when toolbar is shown. 
   387          * 
   388          * @param aDisable ETrue if toolbar should be disabled 
   389          * 
   390          * @since S60 3.2
   391          */
   392         IMPORT_C void DisableToolbarL( TBool aDisable ); 
   393 
   394         /**
   395          * Checks if toolbar is disabled. 
   396          * 
   397          * @return ETrue if toolbar is disabled, EFalse if not 
   398          * 
   399          * @since S60 3.2
   400          */
   401         IMPORT_C TBool IsToolbarDisabled() const; 
   402         
   403         /**
   404          * Moves highlight from one item to another. Leaves with 
   405          * value KErrNotFound if item not found. 
   406          * 
   407          * @param aCommandId command id of the item to be focused.           
   408          * 
   409          * @since S60 3.2
   410          */
   411         IMPORT_C void SetFocusedItemL( const TInt aCommandId ); 
   412 
   413         /**
   414          * Returns command id of focused item. 
   415          * 
   416          * @return command id of focused item. Returns KErrNotFound if 
   417          * no item is focused. 
   418          * 
   419          * @since S60 3.2
   420          */
   421         IMPORT_C TInt FocusedItem() const; 
   422 
   423         /**
   424          * Takes focus away from edwin or other controls if needed. Called by 
   425          * AknAppUi from HandleWsEventL when a pointer event is targeted to 
   426          * other control than toolbar. 
   427          * 
   428          * @since S60 3.2
   429          */
   430         void PrepareForFocusLossL(); 
   431 
   432         /**
   433          * Returns event modifiers defined in TEventModifiers in this header. 
   434          * This can be used by applications in OfferToolbarEventL to know if 
   435          * the event sent was for example a long press event. Information is
   436          * valid only during OfferToolbarEventL. 
   437          * 
   438          * @return event modifiers
   439          * @since S60 3.2
   440          */
   441         IMPORT_C TInt EventModifiers() const; 
   442 
   443         /**
   444          * Returns the flags of toolbar. Flags are defined in eikon.hrh.  
   445          * @return toolbar flags
   446          * @since S60 3.2
   447          */
   448         IMPORT_C TInt ToolbarFlags() const; 
   449 
   450         /*
   451          * Count faded components
   452          * @return then number of faded components
   453          */
   454         TInt CountFadedComponents(); 
   455 
   456         /*
   457          * Returns faded components by index
   458          * @return faded component
   459          */
   460         CCoeControl* FadedComponent( TInt aIndex ); 
   461 
   462         /*
   463          * Reduces main pane rect if it intersects with toolbar's rect
   464          * @param aBoundingRect the rect to reduce
   465          */
   466         void ReduceRect( TRect& aBoundingRect ) const; 
   467 
   468         /**
   469          * Sets the resource id for toolbar softkeys. If cba allready exists 
   470          * then changes the existing softkeys and redraws toolbar cba.  
   471          * @param aSoftkeyResourceId ID of the resource structure specifying 
   472          * the command buttons.
   473          * @since S60 3.2
   474          */
   475         IMPORT_C void SetSoftkeyResourceIdL( TInt aSoftkeyResourceId ); 
   476 
   477         /**
   478          * Extension notifies of its events using this method
   479          * aCommandId command id of the button
   480          */
   481         void ExtensionEventL( TInt aCommandId ); 
   482 
   483         /**
   484          * Returns the index of the toolbar item inside of the iVisibleItems
   485          * array.
   486          *
   487          * @param aControl The control which index is needed.
   488          * @return Index of the toolbar item.
   489          */
   490         TInt ToolbarVisibleIndexByControl( const CCoeControl* aControl ) const;
   491 
   492         /**
   493          * Returns pointer to toolbar extension if available
   494          * @return toolbar extension or NULL
   495          */
   496         IMPORT_C CAknToolbarExtension* ToolbarExtension() const;  		
   497 
   498         /**
   499          * Calls DynInitToolbar with extensions commmand id
   500          * 
   501          */
   502         void DynInitExtensionL( CCoeControl* aControl ); 
   503 
   504         /**
   505          * Callback for sliding toolbar.
   506          */
   507         static TInt ReadyToSlide( TAny* aThis ); 
   508 
   509         /**
   510          * Slide toolbar
   511          */
   512         void SlideWithIdle(); 
   513 
   514         /**
   515          * Hides/Unhides toolbar items temporarily. When called with ETrue 
   516          * toolbar draws just background in landscape and is hidden in portrait. 
   517          * Calling with EFalse returns the situation to normal, so drawing the 
   518          * items normally in portrait and landscape. Use this method only with
   519          * fixed toolbar! 
   520          *  
   521          * @param aHide ETrue if hiding items, EFalse if unhiding.  
   522          */
   523         IMPORT_C void HideItemsAndDrawOnlyBackground( TBool aHide ); 
   524 
   525         /**
   526          * Hides/Unhides toolbar items temporarily. When called with ETrue
   527          * toolbar draws just background in landscape and is hidden in portrait. 
   528          * Toolbar window priority is changed to priority passed in parameter.
   529          * Priority should be one of the window priority values defined in 
   530          * TCoeWinPriority. Default priority is ECoeWinPriorityLow.
   531          * Note that if toolbar is already hidden, the toolbar window priority
   532          * is still changed to priority passed in parameter.
   533          * Calling the function HideItemsAndDrawOnlyBackground with EFalse returns
   534          * the situation to normal, so drawing the items normally in portrait 
   535          * and landscape. Use this method only with fixed toolbar! 
   536          *  
   537          * @param aHide ETrue if hiding items, EFalse if unhiding.
   538          * @param aPriority Ordinal priority of toolbar window.  
   539          */
   540         IMPORT_C void HideItemsAndDrawOnlyBackground( TBool aHide, TInt aPriority ); 
   541 
   542 
   543     protected: // From base class
   544 
   545         /**
   546          * From CCoeControl.
   547          * Responds to size changes to sets the size and position of 
   548          * the contents of this control.
   549          */
   550         IMPORT_C void SizeChanged();
   551 
   552         /**
   553          * From CCoeControl.
   554          * This function is called whenever a control gains or loses focus.
   555          *
   556          * @param aDrawNow Contains the value that was passed to it by SetFocus().
   557          */
   558         IMPORT_C void FocusChanged( TDrawNow aDrawNow );
   559 
   560         /**
   561          * From CAknControl.
   562          * For future extensions.
   563          *
   564          * @param aInterface The ID for the extension interface.
   565          */
   566         IMPORT_C void* ExtensionInterface( TUid aInterface );
   567 
   568         /**
   569          * From CCoeControl.
   570          * Retrieves an object of the same type as that encapsulated in aId.
   571          *
   572          * @param aId An encapsulated object type ID.
   573          * @return Encapsulated pointer to the object provided. 
   574          *      Note that the encapsulated pointer may be NULL.
   575          */
   576         IMPORT_C TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
   577 
   578     private: // Constructors
   579 
   580         /**
   581          * C++ default constructor.
   582          */
   583         CAknToolbar();
   584 
   585         /**
   586          * Symbian 2nd phase constructor.
   587          */
   588         void ConstructL();
   589 
   590     private: // From base class
   591 
   592         /**
   593          * From CCoeControl.
   594          * Constructs controls from a resource file.
   595          * Hides the one defined in base class.
   596          *
   597          * @param aReader The resource reader with which to access
   598          *      the control's resource values.
   599          */
   600         IMPORT_C void ConstructFromResourceL( TResourceReader& aReader );
   601 
   602         /**
   603          * From CCoeControl.
   604          * Draw a control called by window server.
   605          *
   606          * @param aRect The region of the control to be redrawn. 
   607          *      Co-ordinates are relative to the control's origin (top left corner).
   608          */
   609         IMPORT_C void Draw( const TRect& aRect ) const;
   610 
   611     private: // New functions
   612 
   613         /**
   614          * Constructs controls from a resource file.
   615          *
   616          * @param aResourceId The ID for this component's resource.
   617          */
   618         void ConstructFromResourceL( const TInt aResourceId );
   619 
   620         /**
   621          * Constructs one of the toolbar items.
   622          *
   623          * @param aReader The resource reader with which to access the control's
   624          *      resource values.
   625          * @return Constructed toolbar item.
   626          */
   627         CAknToolbarItem* ConstructControlLC( TResourceReader& aReader );
   628 
   629         /**
   630          * Calculates size and position of the toolbar depending on the
   631          * number and size of the toolbar items.
   632          *
   633          * @return Toolbar rectangular.
   634          */
   635         TRect CalculateSizeAndPosition();
   636 
   637         /**
   638          * Calculates rects that are used in calculating the size
   639          * and position of the toolbar items
   640          *
   641          * @param aMainPaneRect main pane rect
   642          * @param aToolbarRect rect for toolbar
   643          * @param aGridPaneRect rect for grid pane
   644          * @param aCellPaneRect rect for cell pane
   645          */
   646         void CalculateRects( TRect& aMainPaneRect, TRect& aToolbarRect,
   647             TRect& aGridPaneRect, TRect& aCellPaneRect );
   648 
   649         /**
   650          * Calculates the position and size of the control rect
   651          * 
   652          * @param aCurrentCellPaneRect current cell pane rect is needed to 
   653          * get correct control rect from layout data. 
   654          * @return control rect for the toolbar item
   655          */
   656         TRect CalculateControlRect( TRect& aCurrentCellPaneRect ); 
   657 
   658         /**
   659          * Checks the number of visible items, and if too few the toolbar CBA is
   660          * deleted. If last time there were too few items then toolbar CBA is 
   661          * created again. Also the ordinal position of the toolbar is set if 
   662          * there are changes to previous situation. 
   663          * 
   664          * @return ETrue if too few items are visible, EFalse if not 
   665          */
   666         TBool TooFewItemsVisible(); 
   667 
   668         /**
   669          * Returns toolbar item object for the specified control.
   670          *
   671          * @param aControl Pointer to the control.
   672          * @return Pointer to the toolbar item.
   673          */
   674         CAknToolbarItem* ToolbarItemByControl( const CCoeControl* aControl ) const;
   675 
   676         /**
   677          * Returns toolbar item object for the specified command ID.
   678          *
   679          * @param aId The command ID of the item.
   680          * @return Pointer to the toolbar item.
   681          */
   682         CAknToolbarItem* ToolbarItemById( const TInt aId ) const;
   683 
   684         /**
   685          * Returns the index of the toolbar item inside of the iItems array.
   686          *
   687          * @param aId The command ID of the item
   688          * @return Index of the toolbar item.
   689          */
   690         TInt ToolbarItemIndexById( const TInt aId ) const;
   691 
   692         /**
   693          * Returns the index of the toolbar item inside of the iItems array.
   694          *
   695          * @param aControl The control which index is needed.
   696          * @return Index of the toolbar item.
   697          */
   698         TInt ToolbarItemIndexByControl( const CCoeControl* aControl ) const;
   699 
   700         /**
   701          * Returns the index of the toolbar item inside of the iVisibleItems
   702          * array.
   703          *
   704          * @param aId The command ID of the item.
   705          * @return Index of the toolbar item.
   706          */
   707         TInt ToolbarVisibleIndexById( const TInt aId ) const;  
   708 
   709         /**
   710          * Draws toolbar with sliding effect.
   711          *
   712          * @param aEndPos The position of the top left corner of toolbar at 
   713          * the end of animation.
   714          */
   715         void SlideToolbar( const TPoint& aEndPos );
   716 
   717         /**
   718          * Changes CBA text if all items are dimmed.
   719          */
   720         void SetRightCbaTextL();
   721 
   722         /**
   723          * Returns next non-dimmed and non-hidden control index.
   724          *
   725          * @param aStartIndex The index of the item from which the search
   726          *      should be started.
   727          * @param aMoveForward ETrue if search is done from lower index to
   728          *      the higher one.
   729          * @return The index of next non-dimmed and non-hidden item.
   730          */
   731         TInt GetNextSelectableItemIndex( TInt aStartIndex,
   732                                         TBool aMoveForward );
   733 
   734         /**
   735          * Moves highlight from one item to another. It also will change 
   736          * softkey text for the focused toolbar.
   737          *
   738          * @param aItemIndex The index for the newly focused item.
   739          * @param aDrawNow Specifies whether the item should be redrawn.
   740          * @param aMoveForward Specifies whether the next item in the array
   741          *      should be selected when the item with aItemIndex is dimmed.
   742          * @param aPrepareControl Specifies whether PrepareForFocusLossL() or
   743          *      PrepareForFocusGainL() functions should be called.
   744          */
   745         void MoveHighlightL( TInt aItemIndex,
   746                               const TBool aDrawNow,
   747                               const TBool aMoveForward = ETrue,
   748                               const TBool aPrepareControl = ETrue );
   749 
   750         /**
   751          * Makes toolbar visible and activates it. Position of the top left 
   752          * corner should be set in advance. Also use SetFocus() to specify
   753          * whether toolbar gets key events or not.
   754          */
   755         void ShowToolbarL();
   756 
   757         /**
   758          * Hides toolbar.
   759          */
   760         void HideToolbarL();
   761 
   762         /**
   763          * Sets the focus to the middle or the first item, depending on the
   764          * toolbar flags.
   765          *
   766          * @param aDrawNow if the newly focused item should be redrawn.
   767          */
   768         void InitFocusedItemL( const TBool aDrawNow );
   769 
   770         /**
   771          * Sets the flag to be on or off and also calls
   772          * CCoeControl::MakeVisible().
   773          */
   774         void SetShown( const TBool aShown );
   775 
   776         /**
   777          * Selects/deselects the toolbar item at given index.
   778          */
   779         void SelectItemL( const TInt aIndex, const TBool aSelect );
   780 
   781         /**
   782          * Gets rect from layout data.
   783          */
   784         TRect RectFromLayout( const TRect& aParent,
   785             const TAknWindowComponentLayout& aComponentLayout ) const;
   786         
   787         /**
   788          * Callback to get notified when ready to show toolbar again
   789          */
   790         static TInt WaitForScreenSwitch(TAny* aThis); 
   791 
   792         /**
   793          * Hides toolbar so that screen capture can be taken from the 
   794          * background in order to update it. 
   795          */
   796         void HideToolbarForBackgroundUpdate(); 
   797         
   798         /**
   799          * Updates control positions so that tooltips are positioned correctly
   800          */
   801         void UpdateControlPositions();
   802 
   803         /**
   804         * Shows toolbar via CIdle. As a result, toolbar's window priority is 
   805         * setted after the application's container window. This places toolbar
   806         * to the right place in the window tree.
   807         */
   808         void ShowViaIdle();
   809         
   810         /**
   811         * Callback for delayed toolbar showing.
   812         */
   813         static TInt ShowDelayedToolbar( TAny* aThis );
   814 
   815         /**
   816          * Modifies highlight bitmap that is 50% transparent to use when drawing 
   817          * highlight for small transparent toolbar. 
   818          */
   819         void ModifyHighlightMaskL( TBool aCreateBitmaps );
   820 
   821         /**
   822          * Fades behind toolbar
   823          * @param aFade if ETrue then fade
   824          */
   825         void FadeBehindPopup( TBool aFade ); 
   826 
   827         /**
   828          * Sets buttons to check their touchable areas when tapped 
   829          */
   830         void CheckHitAreas( ); 
   831 
   832         /**
   833          * Counts buttons of fixed tool bar and adds button(s) if needed
   834          * There has to bee at leas three buttons in fixed toolbar.
   835          */
   836         void CheckFixedToolbarButtonsL();
   837 
   838         /**
   839          * Draws backgrounds of fixed toolbar
   840          * @param aGc Graphics context used for drawing.
   841          * @param aControl The control being drawn (may be a child of the drawer).
   842          * @param aRect The area to be drawn.
   843          */
   844         void DrawFixedBackgroundL( CWindowGc& aGc, 
   845                                    const CCoeControl& aControl, 
   846                                    const TRect& aRect ) const;
   847                                    
   848         /**
   849         * Adjusts button's properties depending on the toolbar's features.
   850         */                                   
   851         void AdjustButton( CAknButton& aButton );
   852         
   853         /**
   854         * Adjusts all buttons' properties depending on the toolbar's features.
   855         */
   856         void AdjustAllButtons();
   857         
   858         /**
   859         * Adjusts toolbar's and overlying dialog's window positions so that
   860         * dialog is displayed on top of the toolbar.
   861         */
   862         void SetOrdinalPositions() const;
   863 
   864         /**
   865         * Updates control visibility based on toolbar visibility and 
   866         * buttons visibility inside toolbar.
   867         */
   868         void UpdateControlVisibility();
   869 	
   870     private: // Member variables
   871 
   872         // Array for toolbar items
   873         RPointerArray<CAknToolbarItem> iItems;
   874 
   875         // Array for visible toolbar items
   876         RPointerArray<CAknToolbarItem> iVisibleItems;
   877 
   878         // Toolbar flags
   879         TInt iFlags;
   880 
   881         // Observer to report toolbar item events, not owned
   882         MAknToolbarObserver* iToolbarObserver;
   883 
   884         // Index of focused item, used with focusable toolbar
   885         TInt iFocusedItem;
   886 
   887         // Index of selected item, used with focusable and non-focusable toolbar
   888         TInt iSelectedItem;
   889 
   890         // Toolbar cba, used with focusable toolbar
   891         // own
   892         CEikButtonGroupContainer* iToolbarCba;
   893 
   894         // Resource id for toolbar
   895         TInt iToolbarResourceId;
   896 
   897         // The default focused item
   898         TInt iInitialFocusedItem;
   899 
   900         // Last focused item before focus was lost
   901         TInt iLastFocusedItem;
   902 
   903         // Toolbar frame context
   904         // own
   905         CAknsFrameBackgroundControlContext* iFrameContext;
   906 
   907         // Toolbar background context
   908         // own
   909         CAknsBasicBackgroundControlContext* iBgContext;
   910         
   911         // Toolbar orientation
   912         TAknOrientation iOrientation;
   913         
   914         // Transparency bitmap
   915         // own
   916         CFbsBitmap* iBgBitmap;
   917 
   918         // This is used to call ShowToolbarForBackgroundChange after toolbar has
   919         // been hidden 
   920         // own
   921         CIdle* iIdle;
   922         
   923         // Highlight bitmap
   924         CFbsBitmap* iHighlightBitmap; 
   925 
   926         // Highlight mask 
   927         CFbsBitmap* iHighlightMask; 
   928         
   929         // event modifiers
   930         TInt iEventModifiers; 
   931 	
   932 	    // Background fader
   933         TAknPopupFader iFader;
   934 	    
   935 	    // Softkey resource
   936         TInt iSoftkeyResource; 
   937 	    
   938         // Used to store previous item that had pointerevents
   939         TInt iPreviousItem;
   940 
   941 	    // Step for toolbar sliding
   942 	    TInt iStep; 
   943 
   944 	    // End position for toolbar sliding 
   945 	    TInt iEndPos;
   946 	    
   947 	    // Internal flags used to store toolbar's properties
   948 	    TBitFlags iInternalFlags;
   949 	    
   950 	    // Background area to be drawn when not enough visible items
   951 	    // to cover the toolbar area
   952 	    TRect iBgRect;
   953 
   954         // Toolbar window priority if set in HideItemsAndDrawOnlyBackground
   955 	    TInt iDrawingPriority;
   956 
   957     };
   958 
   959 #endif // __AKNTOOLBAR_H__
   960 
   961 // End of File