epoc32/include/mw/eiklbbut.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     1 /*
     2 * Copyright (c) 2000-2006 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:  Uikon legacy labelled button control
    15 *
    16 */
    17 
    18 #if !defined (__EIKLBBUT_H__)
    19 #define __EIKLBBUT_H__
    20 
    21 #if !defined(__COECNTRL_H__)
    22 #include <coecntrl.h>
    23 #endif
    24 
    25 #if !defined(__COECOBS_H__)
    26 #include <coecobs.h>
    27 #endif
    28 
    29 #include <akncontrol.h>
    30 
    31 class CEikCommandButtonBase;
    32 class CEikLabel;
    33 
    34 /**
    35  *  This class combines a command button with a label and a hotkey binding.  
    36  *
    37  *  The label is used to display a text describing a hotkey.  The hotkey is set via API or resource, as the ASCII code 
    38  *  of the key that is combined with CTRL to form the hotkey combination. E.g. setting the hotkey to decimal 65 
    39  *  will bind CTRL+'A' as the hotkey. "CTRL+A" will be displayed in the label.
    40  *
    41  *  This class does not implement S60 look-and-feel and is not skinned.
    42  *
    43  *  @lib eikcoctl
    44  *  @since S60 1.0
    45  */
    46  class CEikLabeledButton : public CAknControl, private MCoeControlObserver
    47     {
    48 public:
    49     /**
    50     * Options for display of the hotkey shortcut
    51     */
    52     enum TFlags
    53         {
    54         EShowHotKey = 0x01,   // Hot keys are displayed
    55         EPlainHotKey = 0x02    // Hot keys are displayed plain
    56         };
    57 public:
    58 
    59     /**
    60     * Constructor
    61     */
    62     IMPORT_C CEikLabeledButton();
    63 
    64     /**
    65     * C++ Destructor
    66     */
    67     IMPORT_C ~CEikLabeledButton();
    68 
    69     /**
    70     * 2nd Stage constructor
    71     *
    72     * @param aButton    Sets the button to use as the active part of the CEikLabeledButton
    73     */
    74     IMPORT_C void ConstructL(CEikCommandButtonBase* aButton,TInt aHotKeyCode,TInt aFlags);
    75 
    76     /**
    77     * Access to the button component of the labeled button
    78     *
    79     * @return   Pointer to the button component. No ownership is transferred.
    80     */
    81     IMPORT_C CEikCommandButtonBase* Button() const;
    82 
    83     /**
    84     * Access to the label component of the labeled button
    85     *
    86     * @return   Pointer to the CEikLabel component. No ownership is transferred.
    87     */
    88     IMPORT_C CEikLabel* Label() const;
    89 
    90     /**
    91     * Access the hotkey code
    92     *
    93     * @return   The hot key code
    94     */
    95     IMPORT_C TInt HotKeyCode() const;
    96 
    97     /**
    98     * Access to hot key setting
    99     *
   100     * @return   EFase iff ShowsHotKeys is not set
   101     */
   102     IMPORT_C TBool ShowsHotKey() const;
   103 
   104     /**
   105     * Access the key display mode
   106     *
   107     * @return EFalse if the key mode is not set to Plain
   108     */
   109     IMPORT_C TBool PlainHotKey() const;
   110 
   111     /**
   112     * Cause the button to animate and to generate its command ID
   113     */
   114     IMPORT_C void Animate();
   115 
   116     /**
   117     * Change the hot key binding
   118     *
   119     * @param aKeyCode   Key to use (along with pressing CTRL) as the hotkey
   120     */
   121     IMPORT_C void UpdateHotKey(TInt aKeyCode,TFlags aFlags);
   122 
   123 // from CCoeControl    
   124 public:
   125     /**
   126     * From CCoeControl
   127     *
   128     * CONE framework is requesting that the passed-in key be handled.
   129     *
   130     *  @param aKeyEvent     Wserv event type
   131     *  @param aKeyCode      Key code
   132     */ 
   133     IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
   134     
   135     /**
   136     * From CCoeControl
   137     *
   138     * Construct the object from resource
   139     * 
   140     * @param aReader  Fully constructed resource reader
   141     */
   142     IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
   143     
   144     /**
   145     * From CCoeControl
   146     *
   147     * Reports to the caller the minimum size that the control can be, given its contents.
   148     *
   149     *  @return  The minimum size
   150     */    
   151     IMPORT_C TSize MinimumSize();
   152     
   153     /**
   154     * From CCoeControl
   155     *
   156     * Sets the control whose window is to be used as a container for this control
   157     *
   158     *  @param aContainer control
   159     */
   160     IMPORT_C void SetContainerWindowL(const CCoeControl& aContainer);
   161     
   162     /**
   163     * From CCoeControl
   164     *
   165     * Sets the button to be inactive. The button is drawn with a dimmed effect. 
   166     *
   167     *  @param aDimmed   If not EFalse, set the state to dimmed. Otherwise set to non-dimmed
   168     */
   169     IMPORT_C void SetDimmed(TBool aDimmed);
   170     
   171     /**
   172     * From CCoeControl
   173     *
   174     * Obtain the list of colors to be used by this control
   175     *
   176     *  @param aColorUseList
   177     */
   178     IMPORT_C void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const; // not available before Release 005u
   179 
   180     /**
   181     * From CCoeControl
   182     *
   183     * This is called when resource or layout or other display-affecting setting has changed.
   184     * Change the internals of the control so that it is ready for a subsequent SizeChanged call.
   185     *
   186     *  @param aType  Type of resource or setting that has changed
   187     */    
   188     IMPORT_C void HandleResourceChange(TInt aType);			// not available before Release 005u
   189     
   190     /**
   191     * From CCoeControl
   192     *
   193     * Report the input capabilities of the control
   194     * 
   195     * @return   A copy of the object holding the capabilities of this control
   196     */
   197     IMPORT_C TCoeInputCapabilities InputCapabilities() const; // not available before Release 006
   198 
   199     /**
   200     * From CCoeControl
   201     *
   202     * Handle a pointer event coming from the CONE framework
   203     * 
   204     * @param aPointerEvent  Event to handle
   205     */
   206     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
   207 
   208 protected: 
   209     /**
   210     * From CCoeControl
   211     *
   212     * Serialize the state of the control
   213     *
   214     * @param aWriteStream   Output stream for the serialization
   215     */
   216     IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
   217     
   218 private:
   219     /**
   220     * From CCoeControl
   221     *
   222     * Returns the number of component controls
   223     *
   224     *  @return  Number of component controls
   225     */
   226     TInt CountComponentControls() const;
   227     
   228     /**
   229     * From CCoeControl
   230     *
   231     * Return a pointer to the component control at the give index.
   232     *
   233     *  @return  Pointer to the conponent control. No ownership is transferred
   234     */
   235     CCoeControl* ComponentControl(TInt aIndex) const;
   236     
   237     void SizeChanged();
   238 
   239     void Reserved_2();
   240     
   241 private:
   242     /**
   243     * From CAknControl
   244     */
   245     IMPORT_C void* ExtensionInterface( TUid aInterface );
   246 private: 
   247     /**
   248     * from MCoeControlObserver
   249     */
   250     void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
   251 private:
   252     void CreateLabelL();
   253     void UpdateHotKeyL();
   254 private:
   255     /**
   256     * Contained command button object. 
   257     * Owned
   258     */ 
   259     CEikCommandButtonBase* iButton;
   260     
   261     /** 
   262     * Contained label to implement the text
   263     * Owned
   264     */
   265     CEikLabel* iLabel; // Owned
   266     
   267     TInt iHotKeyCode;
   268     TInt iLButFlags;
   269 
   270     TInt iSpare[2];
   271     };
   272 
   273 #endif