2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
20 #ifndef __AKNINFRM_H__
21 #define __AKNINFRM_H__
31 class CAknsFrameBackgroundControlContext;
32 class CAknsBasicBackgroundControlContext;
35 * Implements an input frame which can contain any @c CCoeControl.
36 * The input frame can have additional icon and/or info text.
39 NONSHARABLE_CLASS(CAknInputFrame) : public CEikBorderedControl, public MCoeControlObserver
44 * Default C++ constructor.
49 * Destructor. Frees all resources owned by the object prior to its
52 IMPORT_C ~CAknInputFrame();
55 * Two-phased constructor.
56 * @param aField Control which will be located inside the input frame
57 * @param aComponentOwner Defines whether the ownership of the control will
58 * be transferred or not.
59 * @param aBitmapfile Bitmap file name and path.
60 * @param aBitmapId Bitmap Id.
61 * @param aMaskId Bitmap Mask Id.
62 * @param aFlags Flags.
63 * @return a Pointer to the new @c CAknInputFrame object.
65 IMPORT_C static CAknInputFrame* NewL(CCoeControl* aField,TBool aComponentOwner,
66 const TDesC& aBitmapfile, TInt aBitmapId, TInt aMaskId,
69 * Two-phased constructor.
70 * @param aField Control which will be located inside the input frame
71 * @param aComponentOwner Defines whether the ownership of the control is
73 * @param aIcon Bitmap file name and path.
74 * @param aFlags Flags.
75 * @return a Pointer to the new @c CAknInputFrame object.
77 IMPORT_C static CAknInputFrame* NewL(CCoeControl* aField,TBool aComponentOwner,
78 CGulIcon* aIcon, TUint32 aFlags = 0 );
80 * Returns apointer to field.
81 * @return a Pointer to the control, which is located inside the input frame.
83 IMPORT_C CCoeControl* Field() const;
86 * Sets additional info text to input frame.
87 * @param aText Info text to be added in the input frame.
90 IMPORT_C void SetInfoTextL(const TDesC& aText);
93 * Sets the lines visible or invisible.
94 * @param aText @c ETrue to make the line visible, @c EFalse to make it
97 IMPORT_C void SetLineState(TBool aLineVisible);
100 * Sets new icon to input frame.
101 * @param aIcon a Pointer to the new icon. Ownership is transffered which
102 * means that object is deleted in @c CAknInputFrame::~CAknInputFrame().
104 void SetIcon(CGulIcon* aIcon);
107 * Get flags of current input frame.
109 * @since Series 60 5.0
114 * Set new flags to current input frame.
115 * @param aNewFlags is new flag.
116 * @since Series 60 5.0
118 void SetFlags( TUint aNewFlags );
120 public: //from MCoeControlObserver
123 * Handles focus changes. This is called by the UI Control Framework to
124 * notify that an event occured in observed input frame.
125 * @param aControl The control where event has happened.
126 * @param aEventType a Type of the event.
128 IMPORT_C void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
130 public: //from CCoeControl
133 * Handles key events.
134 * @param aKeyEvent The key event.
135 * @param aType The type of the event: @c EEventKey, @c EEventKeyUp or
137 * @return Indicates whether or not the key event was used by this control.
139 IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
142 * Tells the minimum size of the control.
143 * @return The minimum size of the control.
145 IMPORT_C TSize MinimumSize();
148 * The second phase constructor: constructs input frame from resources.
149 * @param The resource reader.
151 IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
154 * Sets the implementation of this control context in this input frame.
155 * It is a layout background of the frame item.
156 * @since Series 60 2.1
157 * @param Pointer to the context.
159 IMPORT_C void SetInputContext(CAknsFrameBackgroundControlContext* aContext);
162 * From CCoeControl. Handles a change to the control's resources.
163 * @param aType A message UID value.
165 void HandleResourceChange( TInt aType );
167 private: // From CCoeControl
169 void FocusChanged(TDrawNow aDrawNow);
170 void Draw(const TRect& aRect) const;
171 void PrepareForFocusLossL();
174 void BaseConstructL(CCoeControl* aField, TBool aOwner, TUint32 aFlags);
175 void ConstructL(CCoeControl* aField, TBool aOwner, const TDesC& aFileName, TInt aBitmapId, TInt aMaskId, TUint32 aFlags);
176 void ConstructL(CCoeControl* aField, TBool aOwner, CGulIcon* aIcon, TUint32 aFlags);
180 /** Enumeration flags for different layouts. */
181 enum TInputFrameFlags
183 /** a Standard layout. */
185 /** a Popup layoyt. */
187 /** a Pinboard layout. */
189 /** a ClockAppLayout. */
190 EClockAppLayout=0x200,
191 /** a Layout without lines. */
192 EFixedFindWithoutLine = 0x400,
193 /** a Layout that shows indicator.*/
194 EShowIndicators = 0x800,
195 /** A layout used by list query. */
196 EPopupWindowLayout=0x1000,
197 /** A List query with embedded softkeys. */
198 EPopupWindowEmbeddedSoftkeys = 0x4000
202 enum TInfrmPrivateFlags
204 EOwnsInputContext = 0x2000
209 TAknLayoutRect iMagnIconPos; // position of the looking glass icon
210 // sizeof(Taknlayoutrect)=20 sizeof(TRect)=16 sizeof(CCoeControl*)=4 sizeof TAknsItemID=8
211 TRect iOutlineRect; // was first 16 bytes of TAknLayoutRect iOutlineRect;
213 CCoeControl *iField; // bytes 0..3 of TAknLayoutRect iUnused7;
214 CAknsFrameBackgroundControlContext *iPopupFindCC; // bytes 4..7 of TAknLayoutRect iUnused7;
215 CAknsFrameBackgroundControlContext *iInputContext; // bytes 8..11 of TAknLayoutRect iUnused7;
216 TAknsItemID iIconSkinID; // bytes 12..19 of TAknLayoutRect iUnused7;
217 CAknsBasicBackgroundControlContext *iPopupListCC; // was TAny* iExtension; // not used
221 TAknLayoutRect iUnUsed1;
222 TAknLayoutRect iUnUsed2;
223 TAknLayoutRect iUnused3;
224 TAknLayoutRect iUnused4;
225 TAknLayoutRect iUnused5;
226 TAknLayoutRect iUnused6;
228 TAny* iSpare; // WAS CEikLabel* iInfoText;
229 TAny* iSpare2; // was last 4 bytes of TAknLayoutRect iOutlineRect;