williamr@2: /* williamr@2: * Copyright (c) 2000-2006 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: Uikon legacy labelled button control williamr@2: * williamr@2: */ williamr@2: williamr@2: #if !defined (__EIKLBBUT_H__) williamr@2: #define __EIKLBBUT_H__ williamr@2: williamr@2: #if !defined(__COECNTRL_H__) williamr@2: #include williamr@2: #endif williamr@2: williamr@2: #if !defined(__COECOBS_H__) williamr@2: #include williamr@2: #endif williamr@2: williamr@4: #include williamr@2: williamr@2: class CEikCommandButtonBase; williamr@2: class CEikLabel; williamr@2: williamr@2: /** williamr@2: * This class combines a command button with a label and a hotkey binding. williamr@2: * williamr@2: * The label is used to display a text describing a hotkey. The hotkey is set via API or resource, as the ASCII code williamr@2: * of the key that is combined with CTRL to form the hotkey combination. E.g. setting the hotkey to decimal 65 williamr@2: * will bind CTRL+'A' as the hotkey. "CTRL+A" will be displayed in the label. williamr@2: * williamr@2: * This class does not implement S60 look-and-feel and is not skinned. williamr@2: * williamr@2: * @lib eikcoctl williamr@2: * @since S60 1.0 williamr@2: */ williamr@2: class CEikLabeledButton : public CAknControl, private MCoeControlObserver williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * Options for display of the hotkey shortcut williamr@2: */ williamr@2: enum TFlags williamr@2: { williamr@2: EShowHotKey = 0x01, // Hot keys are displayed williamr@2: EPlainHotKey = 0x02 // Hot keys are displayed plain williamr@2: }; williamr@2: public: williamr@2: williamr@2: /** williamr@2: * Constructor williamr@2: */ williamr@2: IMPORT_C CEikLabeledButton(); williamr@2: williamr@2: /** williamr@2: * C++ Destructor williamr@2: */ williamr@2: IMPORT_C ~CEikLabeledButton(); williamr@2: williamr@2: /** williamr@2: * 2nd Stage constructor williamr@2: * williamr@2: * @param aButton Sets the button to use as the active part of the CEikLabeledButton williamr@2: */ williamr@2: IMPORT_C void ConstructL(CEikCommandButtonBase* aButton,TInt aHotKeyCode,TInt aFlags); williamr@2: williamr@2: /** williamr@2: * Access to the button component of the labeled button williamr@2: * williamr@2: * @return Pointer to the button component. No ownership is transferred. williamr@2: */ williamr@2: IMPORT_C CEikCommandButtonBase* Button() const; williamr@2: williamr@2: /** williamr@2: * Access to the label component of the labeled button williamr@2: * williamr@2: * @return Pointer to the CEikLabel component. No ownership is transferred. williamr@2: */ williamr@2: IMPORT_C CEikLabel* Label() const; williamr@2: williamr@2: /** williamr@2: * Access the hotkey code williamr@2: * williamr@2: * @return The hot key code williamr@2: */ williamr@2: IMPORT_C TInt HotKeyCode() const; williamr@2: williamr@2: /** williamr@2: * Access to hot key setting williamr@2: * williamr@2: * @return EFase iff ShowsHotKeys is not set williamr@2: */ williamr@2: IMPORT_C TBool ShowsHotKey() const; williamr@2: williamr@2: /** williamr@2: * Access the key display mode williamr@2: * williamr@2: * @return EFalse if the key mode is not set to Plain williamr@2: */ williamr@2: IMPORT_C TBool PlainHotKey() const; williamr@2: williamr@2: /** williamr@2: * Cause the button to animate and to generate its command ID williamr@2: */ williamr@2: IMPORT_C void Animate(); williamr@2: williamr@2: /** williamr@2: * Change the hot key binding williamr@2: * williamr@2: * @param aKeyCode Key to use (along with pressing CTRL) as the hotkey williamr@2: */ williamr@2: IMPORT_C void UpdateHotKey(TInt aKeyCode,TFlags aFlags); williamr@2: williamr@2: // from CCoeControl williamr@2: public: williamr@2: /** williamr@2: * From CCoeControl williamr@2: * williamr@2: * CONE framework is requesting that the passed-in key be handled. williamr@2: * williamr@2: * @param aKeyEvent Wserv event type williamr@2: * @param aKeyCode Key code williamr@2: */ williamr@2: IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); williamr@2: williamr@2: /** williamr@2: * From CCoeControl williamr@2: * williamr@2: * Construct the object from resource williamr@2: * williamr@2: * @param aReader Fully constructed resource reader williamr@2: */ williamr@2: IMPORT_C void ConstructFromResourceL(TResourceReader& aReader); williamr@2: williamr@2: /** williamr@2: * From CCoeControl williamr@2: * williamr@2: * Reports to the caller the minimum size that the control can be, given its contents. williamr@2: * williamr@2: * @return The minimum size williamr@2: */ williamr@2: IMPORT_C TSize MinimumSize(); williamr@2: williamr@2: /** williamr@2: * From CCoeControl williamr@2: * williamr@2: * Sets the control whose window is to be used as a container for this control williamr@2: * williamr@2: * @param aContainer control williamr@2: */ williamr@2: IMPORT_C void SetContainerWindowL(const CCoeControl& aContainer); williamr@2: williamr@2: /** williamr@2: * From CCoeControl williamr@2: * williamr@2: * Sets the button to be inactive. The button is drawn with a dimmed effect. williamr@2: * williamr@2: * @param aDimmed If not EFalse, set the state to dimmed. Otherwise set to non-dimmed williamr@2: */ williamr@2: IMPORT_C void SetDimmed(TBool aDimmed); williamr@2: williamr@2: /** williamr@2: * From CCoeControl williamr@2: * williamr@2: * Obtain the list of colors to be used by this control williamr@2: * williamr@2: * @param aColorUseList williamr@2: */ williamr@2: IMPORT_C void GetColorUseListL(CArrayFix& aColorUseList) const; // not available before Release 005u williamr@2: williamr@2: /** williamr@2: * From CCoeControl williamr@2: * williamr@2: * This is called when resource or layout or other display-affecting setting has changed. williamr@2: * Change the internals of the control so that it is ready for a subsequent SizeChanged call. williamr@2: * williamr@2: * @param aType Type of resource or setting that has changed williamr@2: */ williamr@2: IMPORT_C void HandleResourceChange(TInt aType); // not available before Release 005u williamr@2: williamr@2: /** williamr@2: * From CCoeControl williamr@2: * williamr@2: * Report the input capabilities of the control williamr@2: * williamr@2: * @return A copy of the object holding the capabilities of this control williamr@2: */ williamr@2: IMPORT_C TCoeInputCapabilities InputCapabilities() const; // not available before Release 006 williamr@2: williamr@2: /** williamr@2: * From CCoeControl williamr@2: * williamr@2: * Handle a pointer event coming from the CONE framework williamr@2: * williamr@2: * @param aPointerEvent Event to handle williamr@2: */ williamr@2: IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); williamr@2: williamr@2: protected: williamr@2: /** williamr@2: * From CCoeControl williamr@2: * williamr@2: * Serialize the state of the control williamr@2: * williamr@2: * @param aWriteStream Output stream for the serialization williamr@2: */ williamr@2: IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const; williamr@2: williamr@2: private: williamr@2: /** williamr@2: * From CCoeControl williamr@2: * williamr@2: * Returns the number of component controls williamr@2: * williamr@2: * @return Number of component controls williamr@2: */ williamr@2: TInt CountComponentControls() const; williamr@2: williamr@2: /** williamr@2: * From CCoeControl williamr@2: * williamr@2: * Return a pointer to the component control at the give index. williamr@2: * williamr@2: * @return Pointer to the conponent control. No ownership is transferred williamr@2: */ williamr@2: CCoeControl* ComponentControl(TInt aIndex) const; williamr@2: williamr@2: void SizeChanged(); williamr@2: williamr@2: void Reserved_2(); williamr@2: williamr@2: private: williamr@2: /** williamr@2: * From CAknControl williamr@2: */ williamr@2: IMPORT_C void* ExtensionInterface( TUid aInterface ); williamr@2: private: williamr@2: /** williamr@2: * from MCoeControlObserver williamr@2: */ williamr@2: void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); williamr@2: private: williamr@2: void CreateLabelL(); williamr@2: void UpdateHotKeyL(); williamr@2: private: williamr@2: /** williamr@2: * Contained command button object. williamr@2: * Owned williamr@2: */ williamr@2: CEikCommandButtonBase* iButton; williamr@2: williamr@2: /** williamr@2: * Contained label to implement the text williamr@2: * Owned williamr@2: */ williamr@2: CEikLabel* iLabel; // Owned williamr@2: williamr@2: TInt iHotKeyCode; williamr@2: TInt iLButFlags; williamr@2: williamr@2: TInt iSpare[2]; williamr@2: }; williamr@2: williamr@2: #endif