| williamr@2 |      1 | /*
 | 
| williamr@2 |      2 | * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
 | 
| williamr@2 |      3 | * All rights reserved.
 | 
| williamr@2 |      4 | * This component and the accompanying materials are made available
 | 
| williamr@4 |      5 | * under the terms of "Eclipse Public License v1.0"
 | 
| williamr@2 |      6 | * which accompanies this distribution, and is available
 | 
| williamr@4 |      7 | * at the URL "http://www.eclipse.org/legal/epl-v10.html".
 | 
| williamr@2 |      8 | *
 | 
| williamr@2 |      9 | * Initial Contributors:
 | 
| williamr@2 |     10 | * Nokia Corporation - initial contribution.
 | 
| williamr@2 |     11 | *
 | 
| williamr@2 |     12 | * Contributors:
 | 
| williamr@2 |     13 | *
 | 
| williamr@2 |     14 | * Description: 
 | 
| williamr@2 |     15 | *
 | 
| williamr@2 |     16 | */
 | 
| williamr@2 |     17 | 
 | 
| williamr@2 |     18 | 
 | 
| williamr@2 |     19 | // INCLUDES
 | 
| williamr@2 |     20 | #ifndef __AKNINFRM_H__
 | 
| williamr@2 |     21 | #define __AKNINFRM_H__
 | 
| williamr@2 |     22 | 
 | 
| williamr@2 |     23 | 
 | 
| williamr@2 |     24 | #include <eikdef.h>
 | 
| williamr@2 |     25 | #include <eikbctrl.h>
 | 
| williamr@2 |     26 | #include <gulicon.h>
 | 
| williamr@2 |     27 | #include <eiklabel.h>
 | 
| williamr@4 |     28 | #include <AknUtils.h>
 | 
| williamr@2 |     29 | #include <avkon.rsg>
 | 
| williamr@2 |     30 | 
 | 
| williamr@2 |     31 | class CAknsFrameBackgroundControlContext;
 | 
| williamr@2 |     32 | class CAknsBasicBackgroundControlContext;
 | 
| williamr@2 |     33 | // CLASS DECLARATION
 | 
| williamr@2 |     34 | /**
 | 
| williamr@2 |     35 | * Implements an input frame which can contain any @c CCoeControl.
 | 
| williamr@2 |     36 | * The input frame can have additional icon and/or info text.
 | 
| williamr@2 |     37 | * @since Series60 0.9
 | 
| williamr@2 |     38 | */
 | 
| williamr@2 |     39 | NONSHARABLE_CLASS(CAknInputFrame) : public CEikBorderedControl, public MCoeControlObserver
 | 
| williamr@2 |     40 |     {
 | 
| williamr@2 |     41 | public:
 | 
| williamr@2 |     42 |     
 | 
| williamr@2 |     43 |     /**
 | 
| williamr@2 |     44 |     * Default C++ constructor.
 | 
| williamr@2 |     45 |     */
 | 
| williamr@2 |     46 |     CAknInputFrame();
 | 
| williamr@2 |     47 |     
 | 
| williamr@2 |     48 |     /**
 | 
| williamr@2 |     49 |     * Destructor. Frees all resources owned by the object prior to its
 | 
| williamr@2 |     50 |     * destruction.
 | 
| williamr@2 |     51 |     */
 | 
| williamr@2 |     52 |     IMPORT_C ~CAknInputFrame();
 | 
| williamr@2 |     53 |         
 | 
| williamr@2 |     54 |     /**
 | 
| williamr@2 |     55 |     * Two-phased constructor.
 | 
| williamr@2 |     56 |     * @param aField Control which will be located inside the input frame
 | 
| williamr@2 |     57 |     * @param aComponentOwner Defines whether the ownership of the control will
 | 
| williamr@2 |     58 |     * be transferred or not.
 | 
| williamr@2 |     59 |     * @param aBitmapfile Bitmap file name and path.
 | 
| williamr@2 |     60 |     * @param aBitmapId Bitmap Id.
 | 
| williamr@2 |     61 |     * @param aMaskId Bitmap Mask Id.
 | 
| williamr@2 |     62 |     * @param aFlags Flags.
 | 
| williamr@2 |     63 |     * @return a Pointer to the new @c CAknInputFrame object.
 | 
| williamr@2 |     64 |     */
 | 
| williamr@2 |     65 |     IMPORT_C static CAknInputFrame* NewL(CCoeControl* aField,TBool aComponentOwner,
 | 
| williamr@2 |     66 |                                          const TDesC& aBitmapfile, TInt aBitmapId, TInt aMaskId,
 | 
| williamr@2 |     67 |                                          TUint32 aFlags = 0 );
 | 
| williamr@2 |     68 |     /**
 | 
| williamr@2 |     69 |     * Two-phased constructor.
 | 
| williamr@2 |     70 |     * @param aField Control which will be located inside the input frame
 | 
| williamr@2 |     71 |     * @param aComponentOwner Defines whether the ownership of the control is
 | 
| williamr@2 |     72 |     * transferred or not.
 | 
| williamr@2 |     73 |     * @param aIcon Bitmap file name and path.
 | 
| williamr@2 |     74 |     * @param aFlags Flags.
 | 
| williamr@2 |     75 |     * @return a Pointer to the new @c CAknInputFrame object.
 | 
| williamr@2 |     76 |     */
 | 
| williamr@2 |     77 |     IMPORT_C static CAknInputFrame* NewL(CCoeControl* aField,TBool aComponentOwner,
 | 
| williamr@2 |     78 |                                          CGulIcon* aIcon, TUint32 aFlags = 0 );
 | 
| williamr@2 |     79 |     /**
 | 
| williamr@2 |     80 |     * Returns apointer to field.
 | 
| williamr@2 |     81 |     * @return a Pointer to the control, which is located inside the input frame. 
 | 
| williamr@2 |     82 |     */
 | 
| williamr@2 |     83 |     IMPORT_C CCoeControl* Field() const;
 | 
| williamr@2 |     84 |         
 | 
| williamr@2 |     85 |     /**
 | 
| williamr@2 |     86 |     * Sets additional info text to input frame.
 | 
| williamr@2 |     87 |     * @param aText Info text to be added in the input frame.
 | 
| williamr@2 |     88 |     * @deprecated
 | 
| williamr@2 |     89 |     */
 | 
| williamr@2 |     90 |     IMPORT_C void SetInfoTextL(const TDesC& aText);
 | 
| williamr@2 |     91 |         
 | 
| williamr@2 |     92 |     /**
 | 
| williamr@2 |     93 |     * Sets the lines visible or invisible.
 | 
| williamr@2 |     94 |     * @param aText @c ETrue to make the line visible, @c EFalse to make it
 | 
| williamr@2 |     95 |     * invisible.
 | 
| williamr@2 |     96 |     */
 | 
| williamr@2 |     97 |     IMPORT_C void SetLineState(TBool aLineVisible);
 | 
| williamr@2 |     98 |         
 | 
| williamr@2 |     99 |     /**
 | 
| williamr@2 |    100 |     * Sets new icon to input frame.
 | 
| williamr@2 |    101 |     * @param aIcon a Pointer to the new icon. Ownership is transffered which 
 | 
| williamr@2 |    102 |     * means that object is deleted in @c CAknInputFrame::~CAknInputFrame().
 | 
| williamr@2 |    103 |     */
 | 
| williamr@2 |    104 |     void SetIcon(CGulIcon* aIcon);
 | 
| williamr@2 |    105 | 
 | 
| williamr@2 |    106 |     /**
 | 
| williamr@2 |    107 |      * Get flags of current input frame.
 | 
| williamr@2 |    108 |      * @return flags.
 | 
| williamr@2 |    109 |      * @since Series 60 5.0
 | 
| williamr@2 |    110 |      */
 | 
| williamr@2 |    111 |     TUint Flags() const;
 | 
| williamr@2 |    112 | 
 | 
| williamr@2 |    113 |     /**
 | 
| williamr@2 |    114 |      * Set new flags to current input frame.
 | 
| williamr@2 |    115 |      * @param aNewFlags is new flag.
 | 
| williamr@2 |    116 |      * @since Series 60 5.0
 | 
| williamr@2 |    117 |      */
 | 
| williamr@2 |    118 |     void SetFlags( TUint aNewFlags );
 | 
| williamr@2 |    119 | 
 | 
| williamr@2 |    120 | public: //from MCoeControlObserver
 | 
| williamr@2 |    121 | 
 | 
| williamr@2 |    122 |     /**
 | 
| williamr@2 |    123 |     * Handles focus changes. This is called by the UI Control Framework to 
 | 
| williamr@2 |    124 |     * notify that an event occured in observed input frame.
 | 
| williamr@2 |    125 |     * @param aControl The control where event has happened.
 | 
| williamr@2 |    126 |     * @param aEventType a Type of the event.
 | 
| williamr@2 |    127 |     */
 | 
| williamr@2 |    128 |     IMPORT_C void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
 | 
| williamr@2 |    129 | 
 | 
| williamr@2 |    130 | public: //from CCoeControl
 | 
| williamr@2 |    131 | 
 | 
| williamr@2 |    132 |     /**
 | 
| williamr@2 |    133 |     * Handles key events.
 | 
| williamr@2 |    134 |     * @param aKeyEvent The key event.
 | 
| williamr@2 |    135 |     * @param aType The type of the event: @c EEventKey, @c EEventKeyUp or 
 | 
| williamr@2 |    136 |     * @c EEventKeyDown.
 | 
| williamr@2 |    137 |     * @return Indicates whether or not the key event was used by this control. 
 | 
| williamr@2 |    138 |     */
 | 
| williamr@2 |    139 |     IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
 | 
| williamr@2 |    140 |         
 | 
| williamr@2 |    141 |     /**
 | 
| williamr@2 |    142 |     * Tells the minimum size of the control.
 | 
| williamr@2 |    143 |     * @return The minimum size of the control.
 | 
| williamr@2 |    144 |     */
 | 
| williamr@2 |    145 |     IMPORT_C TSize MinimumSize();
 | 
| williamr@2 |    146 |         
 | 
| williamr@2 |    147 |     /**
 | 
| williamr@2 |    148 |     * The second phase constructor: constructs input frame from resources.
 | 
| williamr@2 |    149 |     * @param The resource reader.
 | 
| williamr@2 |    150 |     */
 | 
| williamr@2 |    151 |     IMPORT_C void ConstructFromResourceL(TResourceReader& aReader); 
 | 
| williamr@2 |    152 |         
 | 
| williamr@2 |    153 |     /**
 | 
| williamr@2 |    154 |     * Sets the implementation of this control context in this input frame.
 | 
| williamr@2 |    155 |     * It is a layout background of the frame item. 
 | 
| williamr@2 |    156 |     * @since Series 60 2.1
 | 
| williamr@2 |    157 |     * @param Pointer to the context.
 | 
| williamr@2 |    158 |     */
 | 
| williamr@2 |    159 |     IMPORT_C void SetInputContext(CAknsFrameBackgroundControlContext* aContext);
 | 
| williamr@2 |    160 | 
 | 
| williamr@2 |    161 |   	/**
 | 
| williamr@2 |    162 |    	* From CCoeControl. Handles a change to the control's resources.
 | 
| williamr@2 |    163 |    	* @param aType A message UID value.
 | 
| williamr@2 |    164 |    	*/
 | 
| williamr@2 |    165 |    	void HandleResourceChange( TInt aType );
 | 
| williamr@2 |    166 | 
 | 
| williamr@2 |    167 | private: // From CCoeControl
 | 
| williamr@2 |    168 |     void SizeChanged();
 | 
| williamr@2 |    169 |     void FocusChanged(TDrawNow aDrawNow); 
 | 
| williamr@2 |    170 |     void Draw(const TRect& aRect) const;
 | 
| williamr@2 |    171 |     void PrepareForFocusLossL();
 | 
| williamr@2 |    172 | 
 | 
| williamr@2 |    173 | private:
 | 
| williamr@2 |    174 |     void BaseConstructL(CCoeControl* aField, TBool aOwner, TUint32 aFlags);
 | 
| williamr@2 |    175 |     void ConstructL(CCoeControl* aField, TBool aOwner, const TDesC& aFileName, TInt aBitmapId, TInt aMaskId, TUint32 aFlags);
 | 
| williamr@2 |    176 |     void ConstructL(CCoeControl* aField, TBool aOwner, CGulIcon* aIcon, TUint32 aFlags);
 | 
| williamr@2 |    177 |     void CreateIconL();
 | 
| williamr@2 |    178 | 
 | 
| williamr@2 |    179 | public:
 | 
| williamr@2 |    180 |     /** Enumeration flags for different layouts.        */
 | 
| williamr@2 |    181 |     enum TInputFrameFlags
 | 
| williamr@2 |    182 |         {
 | 
| williamr@2 |    183 |         /** a Standard layout. */
 | 
| williamr@2 |    184 |         EOwnsField=0x40,
 | 
| williamr@2 |    185 |         /** a Popup layoyt. */
 | 
| williamr@2 |    186 |         EPopupLayout=0x80,
 | 
| williamr@2 |    187 |         /** a Pinboard layout. */
 | 
| williamr@2 |    188 |         EPinbLayout=0x100,
 | 
| williamr@2 |    189 |         /** a ClockAppLayout. */
 | 
| williamr@2 |    190 |         EClockAppLayout=0x200,
 | 
| williamr@2 |    191 |         /** a Layout without lines. */
 | 
| williamr@2 |    192 |         EFixedFindWithoutLine   = 0x400,
 | 
| williamr@2 |    193 |         /** a Layout that shows indicator.*/
 | 
| williamr@2 |    194 |         EShowIndicators         = 0x800,
 | 
| williamr@2 |    195 |         /** A layout used by list query. */
 | 
| williamr@4 |    196 |         EPopupWindowLayout=0x1000,
 | 
| williamr@4 |    197 |         /** A List query with embedded softkeys. */
 | 
| williamr@4 |    198 |         EPopupWindowEmbeddedSoftkeys = 0x4000
 | 
| williamr@2 |    199 |         };
 | 
| williamr@2 |    200 |     
 | 
| williamr@2 |    201 | private:
 | 
| williamr@2 |    202 |     enum TInfrmPrivateFlags
 | 
| williamr@2 |    203 |         {
 | 
| williamr@2 |    204 |         EOwnsInputContext = 0x2000
 | 
| williamr@2 |    205 |         };
 | 
| williamr@2 |    206 | 
 | 
| williamr@2 |    207 |     CGulIcon*               iIcon;
 | 
| williamr@2 |    208 |     TUint32                 iFlags;
 | 
| williamr@2 |    209 |     TAknLayoutRect          iMagnIconPos;  // position of the looking glass icon
 | 
| williamr@2 |    210 |     // sizeof(Taknlayoutrect)=20 sizeof(TRect)=16 sizeof(CCoeControl*)=4 sizeof TAknsItemID=8 
 | 
| williamr@2 |    211 |     TRect                   iOutlineRect; // was first 16 bytes of TAknLayoutRect  iOutlineRect;
 | 
| williamr@2 |    212 | 
 | 
| williamr@2 |    213 |     CCoeControl             *iField;                           // bytes 0..3   of TAknLayoutRect iUnused7;
 | 
| williamr@2 |    214 |     CAknsFrameBackgroundControlContext *iPopupFindCC;          // bytes 4..7   of TAknLayoutRect iUnused7;
 | 
| williamr@2 |    215 |     CAknsFrameBackgroundControlContext *iInputContext;         // bytes 8..11  of TAknLayoutRect iUnused7;
 | 
| williamr@2 |    216 |     TAknsItemID             iIconSkinID;                       // bytes 12..19 of TAknLayoutRect iUnused7;
 | 
| williamr@2 |    217 |     CAknsBasicBackgroundControlContext *iPopupListCC;          // was TAny*   iExtension; // not used
 | 
| williamr@2 |    218 | 
 | 
| williamr@2 |    219 | 
 | 
| williamr@2 |    220 |     // these are unused
 | 
| williamr@2 |    221 |     TAknLayoutRect          iUnUsed1;
 | 
| williamr@2 |    222 |     TAknLayoutRect          iUnUsed2;
 | 
| williamr@2 |    223 |     TAknLayoutRect          iUnused3;
 | 
| williamr@2 |    224 |     TAknLayoutRect          iUnused4;
 | 
| williamr@2 |    225 |     TAknLayoutRect          iUnused5;
 | 
| williamr@2 |    226 |     TAknLayoutRect          iUnused6;
 | 
| williamr@2 |    227 | 
 | 
| williamr@2 |    228 |     TAny*                   iSpare;     // WAS CEikLabel* iInfoText;
 | 
| williamr@2 |    229 |     TAny*                   iSpare2;    // was last 4 bytes of TAknLayoutRect  iOutlineRect;
 | 
| williamr@2 |    230 |     
 | 
| williamr@2 |    231 |     HBufC*		            iFileName; 
 | 
| williamr@2 |    232 |     TInt                    iBitmapId;
 | 
| williamr@2 |    233 |     TInt                    iMaskId;
 | 
| williamr@2 |    234 | 
 | 
| williamr@2 |    235 |     };
 | 
| williamr@2 |    236 | 
 | 
| williamr@2 |    237 | 
 | 
| williamr@2 |    238 | #endif
 | 
| williamr@2 |    239 | 
 | 
| williamr@2 |    240 | 
 | 
| williamr@2 |    241 | 
 |