uifw/EikStd/coctlinc/akntoolbaritem.h
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 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 "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:  toolbar item
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CAKNTOOLBARITEM_H
       
    20 #define CAKNTOOLBARITEM_H
       
    21 
       
    22 #include <e32def.h>
       
    23 #include <e32base.h>
       
    24 #include <coecntrl.h>
       
    25 
       
    26 /**
       
    27  *  Class that contains information about toolbar items
       
    28  *
       
    29  *  @lib eikcoctl.lib
       
    30  *  @since S60 v5.0
       
    31  */
       
    32 
       
    33 NONSHARABLE_CLASS( CAknToolbarItem ) : public CBase
       
    34     {
       
    35 
       
    36 public:
       
    37     /**
       
    38      * Constructor
       
    39      */
       
    40     CAknToolbarItem();
       
    41 
       
    42     /**
       
    43      * Constructor
       
    44      */
       
    45     CAknToolbarItem( CCoeControl* aControl, TInt aType, TInt aId, TInt aFlags );
       
    46 
       
    47     /**
       
    48      * Destructor
       
    49      */
       
    50     ~CAknToolbarItem();
       
    51 
       
    52     /**
       
    53      * Constructs toolbar item from resources
       
    54      * @param aReader resource reader
       
    55      */
       
    56     void ConstructFromResourceL( TResourceReader& aReader );
       
    57 
       
    58     /**
       
    59      * CCoeControl that the item contains 
       
    60      * @return control of this toolbar item
       
    61      */
       
    62     CCoeControl* Control() const;
       
    63 
       
    64     /**
       
    65      * ControlType of the toolbar item
       
    66      * @return controltype defined in avkon.hrh
       
    67      */
       
    68     TInt ControlType() const;
       
    69 
       
    70     /**
       
    71      * Command id of the toolbar item
       
    72      * @return command id
       
    73      */
       
    74     TInt CommandId() const;
       
    75 
       
    76     /**
       
    77      * Flags of toolbar item
       
    78      * @return flags
       
    79      */
       
    80     TInt Flags() const;
       
    81 
       
    82     /**
       
    83      * Is used for quering if item is selected
       
    84      * @return boolean to indicate if selected
       
    85      */
       
    86     TBool IsSelected() const;
       
    87 
       
    88     /**
       
    89      * @param aIsSelected if item should be selected or not. 
       
    90      * @return boolean to indicate if item was succesfully selected
       
    91      */
       
    92     TBool SetIsSelectedL( TBool aIsSelected );
       
    93 
       
    94     /**
       
    95      * Sets buttons to close on command 
       
    96      * @param boolean to indicate if closing on command or not
       
    97      */
       
    98     void SetCloseOnCommand( const TBool aCloseOnCommand );
       
    99 
       
   100     /**
       
   101      * Sets highlightrect for toolbar items
       
   102      * @param aRect highlightrect
       
   103      */
       
   104     void SetHighlightRect( const TRect& aRect );
       
   105 
       
   106 
       
   107     /**
       
   108      * Returns highlightrect
       
   109      * @return highlightrect
       
   110      */
       
   111     TRect HighlightRect() const;
       
   112 
       
   113     /**
       
   114      * Sets toolbar item focused, used only with buttons
       
   115      * @param aFocus if to give focus or to take it away
       
   116      * @param aPrepareControl to tell if PrepareForFocusLossL and 
       
   117      * PrepareForFocusGailL are called on the control
       
   118      * @param aDrawNow if to draw again or not
       
   119      * @param aParent item parent
       
   120      */
       
   121     void SetFocusL( TBool aFocus, TBool aPrepareControl, TDrawNow aDrawNow,
       
   122                     const CCoeControl* aParent );
       
   123 
       
   124     /**
       
   125      * Registers parent positions
       
   126      * @param aParentPosition position of parent
       
   127      */
       
   128     void RegisterPosition( const TPoint& aParentPosition ) const;
       
   129 
       
   130     /**
       
   131      * returns boolean to inform if hidden
       
   132      * @return boolean to indicate if hidden or not
       
   133      */
       
   134     TBool IsHidden() const; 
       
   135 
       
   136     /**
       
   137      * Sets item hidden or unhidden
       
   138      * @param boolean to indicate if item should be hidden or not
       
   139      */
       
   140     void SetHidden( TBool aHidden ); 
       
   141 
       
   142     /**
       
   143      * Indicates if item refuses key events
       
   144      * @return ETrue if refuses key events 
       
   145      */
       
   146     TBool RefusesKeys() const;
       
   147 
       
   148 private:
       
   149 
       
   150     /**
       
   151      * Sets item(editors) to refuse key events
       
   152      */
       
   153     void SetKeyRefuse();
       
   154         
       
   155 private: // data
       
   156     // The control of the item
       
   157     // own
       
   158     CCoeControl* iControl;
       
   159 
       
   160     // type of the control to keep a track on whether this item is supported 
       
   161     // by a toolbar component
       
   162     TInt iControlType; 
       
   163 
       
   164     // command ID of this toolbar item 
       
   165     TInt iCommandId;    
       
   166 
       
   167     // item flags
       
   168     TInt iFlags;
       
   169 
       
   170     // if ETrue, all key events will go to it.  
       
   171     TBool iIsSelected;  
       
   172 
       
   173     // Highligh rect for toolbar item
       
   174     TRect iHighlightRect;
       
   175 
       
   176     // If ETrue, this item is hidden
       
   177     TBool iHidden; 
       
   178         
       
   179     // ETrue if key events are not redirected for the control
       
   180     TBool iRefusesKeys;
       
   181     };
       
   182 #endif //CAKNTOOLBARITEM_H