williamr@2: /*
williamr@2: * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
williamr@2: * All rights reserved.
williamr@2: * This component and the accompanying materials are made available
williamr@2: * 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
williamr@2: * which accompanies this distribution, and is available
williamr@2: * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2: *
williamr@2: * Initial Contributors:
williamr@2: * Nokia Corporation - initial contribution.
williamr@2: *
williamr@2: * Contributors:
williamr@2: *
williamr@2: * Description: 
williamr@2: *
williamr@2: */
williamr@2: 
williamr@2: 
williamr@2: // INCLUDES
williamr@2: #ifndef __AKNINFRM_H__
williamr@2: #define __AKNINFRM_H__
williamr@2: 
williamr@2: 
williamr@2: #include <eikdef.h>
williamr@2: #include <eikbctrl.h>
williamr@2: #include <gulicon.h>
williamr@2: #include <eiklabel.h>
williamr@2: #include <aknutils.h>
williamr@2: #include <avkon.rsg>
williamr@2: 
williamr@2: class CAknsFrameBackgroundControlContext;
williamr@2: class CAknsBasicBackgroundControlContext;
williamr@2: // CLASS DECLARATION
williamr@2: /**
williamr@2: * Implements an input frame which can contain any @c CCoeControl.
williamr@2: * The input frame can have additional icon and/or info text.
williamr@2: * @since Series60 0.9
williamr@2: */
williamr@2: NONSHARABLE_CLASS(CAknInputFrame) : public CEikBorderedControl, public MCoeControlObserver
williamr@2:     {
williamr@2: public:
williamr@2:     
williamr@2:     /**
williamr@2:     * Default C++ constructor.
williamr@2:     */
williamr@2:     CAknInputFrame();
williamr@2:     
williamr@2:     /**
williamr@2:     * Destructor. Frees all resources owned by the object prior to its
williamr@2:     * destruction.
williamr@2:     */
williamr@2:     IMPORT_C ~CAknInputFrame();
williamr@2:         
williamr@2:     /**
williamr@2:     * Two-phased constructor.
williamr@2:     * @param aField Control which will be located inside the input frame
williamr@2:     * @param aComponentOwner Defines whether the ownership of the control will
williamr@2:     * be transferred or not.
williamr@2:     * @param aBitmapfile Bitmap file name and path.
williamr@2:     * @param aBitmapId Bitmap Id.
williamr@2:     * @param aMaskId Bitmap Mask Id.
williamr@2:     * @param aFlags Flags.
williamr@2:     * @return a Pointer to the new @c CAknInputFrame object.
williamr@2:     */
williamr@2:     IMPORT_C static CAknInputFrame* NewL(CCoeControl* aField,TBool aComponentOwner,
williamr@2:                                          const TDesC& aBitmapfile, TInt aBitmapId, TInt aMaskId,
williamr@2:                                          TUint32 aFlags = 0 );
williamr@2:     /**
williamr@2:     * Two-phased constructor.
williamr@2:     * @param aField Control which will be located inside the input frame
williamr@2:     * @param aComponentOwner Defines whether the ownership of the control is
williamr@2:     * transferred or not.
williamr@2:     * @param aIcon Bitmap file name and path.
williamr@2:     * @param aFlags Flags.
williamr@2:     * @return a Pointer to the new @c CAknInputFrame object.
williamr@2:     */
williamr@2:     IMPORT_C static CAknInputFrame* NewL(CCoeControl* aField,TBool aComponentOwner,
williamr@2:                                          CGulIcon* aIcon, TUint32 aFlags = 0 );
williamr@2:     /**
williamr@2:     * Returns apointer to field.
williamr@2:     * @return a Pointer to the control, which is located inside the input frame. 
williamr@2:     */
williamr@2:     IMPORT_C CCoeControl* Field() const;
williamr@2:         
williamr@2:     /**
williamr@2:     * Sets additional info text to input frame.
williamr@2:     * @param aText Info text to be added in the input frame.
williamr@2:     * @deprecated
williamr@2:     */
williamr@2:     IMPORT_C void SetInfoTextL(const TDesC& aText);
williamr@2:         
williamr@2:     /**
williamr@2:     * Sets the lines visible or invisible.
williamr@2:     * @param aText @c ETrue to make the line visible, @c EFalse to make it
williamr@2:     * invisible.
williamr@2:     */
williamr@2:     IMPORT_C void SetLineState(TBool aLineVisible);
williamr@2:         
williamr@2:     /**
williamr@2:     * Sets new icon to input frame.
williamr@2:     * @param aIcon a Pointer to the new icon. Ownership is transffered which 
williamr@2:     * means that object is deleted in @c CAknInputFrame::~CAknInputFrame().
williamr@2:     */
williamr@2:     void SetIcon(CGulIcon* aIcon);
williamr@2: 
williamr@2:     /**
williamr@2:      * Get flags of current input frame.
williamr@2:      * @return flags.
williamr@2:      * @since Series 60 5.0
williamr@2:      */
williamr@2:     TUint Flags() const;
williamr@2: 
williamr@2:     /**
williamr@2:      * Set new flags to current input frame.
williamr@2:      * @param aNewFlags is new flag.
williamr@2:      * @since Series 60 5.0
williamr@2:      */
williamr@2:     void SetFlags( TUint aNewFlags );
williamr@2: 
williamr@2: public: //from MCoeControlObserver
williamr@2: 
williamr@2:     /**
williamr@2:     * Handles focus changes. This is called by the UI Control Framework to 
williamr@2:     * notify that an event occured in observed input frame.
williamr@2:     * @param aControl The control where event has happened.
williamr@2:     * @param aEventType a Type of the event.
williamr@2:     */
williamr@2:     IMPORT_C void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
williamr@2: 
williamr@2: public: //from CCoeControl
williamr@2: 
williamr@2:     /**
williamr@2:     * Handles key events.
williamr@2:     * @param aKeyEvent The key event.
williamr@2:     * @param aType The type of the event: @c EEventKey, @c EEventKeyUp or 
williamr@2:     * @c EEventKeyDown.
williamr@2:     * @return Indicates whether or not the key event was used by this control. 
williamr@2:     */
williamr@2:     IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
williamr@2:         
williamr@2:     /**
williamr@2:     * Tells the minimum size of the control.
williamr@2:     * @return The minimum size of the control.
williamr@2:     */
williamr@2:     IMPORT_C TSize MinimumSize();
williamr@2:         
williamr@2:     /**
williamr@2:     * The second phase constructor: constructs input frame from resources.
williamr@2:     * @param The resource reader.
williamr@2:     */
williamr@2:     IMPORT_C void ConstructFromResourceL(TResourceReader& aReader); 
williamr@2:         
williamr@2:     /**
williamr@2:     * Sets the implementation of this control context in this input frame.
williamr@2:     * It is a layout background of the frame item. 
williamr@2:     * @since Series 60 2.1
williamr@2:     * @param Pointer to the context.
williamr@2:     */
williamr@2:     IMPORT_C void SetInputContext(CAknsFrameBackgroundControlContext* aContext);
williamr@2: 
williamr@2:   	/**
williamr@2:    	* From CCoeControl. Handles a change to the control's resources.
williamr@2:    	* @param aType A message UID value.
williamr@2:    	*/
williamr@2:    	void HandleResourceChange( TInt aType );
williamr@2: 
williamr@2: private: // From CCoeControl
williamr@2:     void SizeChanged();
williamr@2:     void FocusChanged(TDrawNow aDrawNow); 
williamr@2:     void Draw(const TRect& aRect) const;
williamr@2:     void PrepareForFocusLossL();
williamr@2: 
williamr@2: private:
williamr@2:     void BaseConstructL(CCoeControl* aField, TBool aOwner, TUint32 aFlags);
williamr@2:     void ConstructL(CCoeControl* aField, TBool aOwner, const TDesC& aFileName, TInt aBitmapId, TInt aMaskId, TUint32 aFlags);
williamr@2:     void ConstructL(CCoeControl* aField, TBool aOwner, CGulIcon* aIcon, TUint32 aFlags);
williamr@2:     void CreateIconL();
williamr@2: 
williamr@2: public:
williamr@2:     /** Enumeration flags for different layouts.        */
williamr@2:     enum TInputFrameFlags
williamr@2:         {
williamr@2:         /** a Standard layout. */
williamr@2:         EOwnsField=0x40,
williamr@2:         /** a Popup layoyt. */
williamr@2:         EPopupLayout=0x80,
williamr@2:         /** a Pinboard layout. */
williamr@2:         EPinbLayout=0x100,
williamr@2:         /** a ClockAppLayout. */
williamr@2:         EClockAppLayout=0x200,
williamr@2:         /** a Layout without lines. */
williamr@2:         EFixedFindWithoutLine   = 0x400,
williamr@2:         /** a Layout that shows indicator.*/
williamr@2:         EShowIndicators         = 0x800,
williamr@2:         /** A layout used by list query. */
williamr@2:         EPopupWindowLayout=0x1000
williamr@2:         };
williamr@2:     
williamr@2: private:
williamr@2:     enum TInfrmPrivateFlags
williamr@2:         {
williamr@2:         EOwnsInputContext = 0x2000
williamr@2:         };
williamr@2: 
williamr@2:     CGulIcon*               iIcon;
williamr@2:     TUint32                 iFlags;
williamr@2:     TAknLayoutRect          iMagnIconPos;  // position of the looking glass icon
williamr@2:     // sizeof(Taknlayoutrect)=20 sizeof(TRect)=16 sizeof(CCoeControl*)=4 sizeof TAknsItemID=8 
williamr@2:     TRect                   iOutlineRect; // was first 16 bytes of TAknLayoutRect  iOutlineRect;
williamr@2: 
williamr@2:     CCoeControl             *iField;                           // bytes 0..3   of TAknLayoutRect iUnused7;
williamr@2:     CAknsFrameBackgroundControlContext *iPopupFindCC;          // bytes 4..7   of TAknLayoutRect iUnused7;
williamr@2:     CAknsFrameBackgroundControlContext *iInputContext;         // bytes 8..11  of TAknLayoutRect iUnused7;
williamr@2:     TAknsItemID             iIconSkinID;                       // bytes 12..19 of TAknLayoutRect iUnused7;
williamr@2:     CAknsBasicBackgroundControlContext *iPopupListCC;          // was TAny*   iExtension; // not used
williamr@2: 
williamr@2: 
williamr@2:     // these are unused
williamr@2:     TAknLayoutRect          iUnUsed1;
williamr@2:     TAknLayoutRect          iUnUsed2;
williamr@2:     TAknLayoutRect          iUnused3;
williamr@2:     TAknLayoutRect          iUnused4;
williamr@2:     TAknLayoutRect          iUnused5;
williamr@2:     TAknLayoutRect          iUnused6;
williamr@2: 
williamr@2:     TAny*                   iSpare;     // WAS CEikLabel* iInfoText;
williamr@2:     TAny*                   iSpare2;    // was last 4 bytes of TAknLayoutRect  iOutlineRect;
williamr@2:     
williamr@2:     HBufC*		            iFileName; 
williamr@2:     TInt                    iBitmapId;
williamr@2:     TInt                    iMaskId;
williamr@2: 
williamr@2:     };
williamr@2: 
williamr@2: 
williamr@2: #endif
williamr@2: 
williamr@2: 
williamr@2: