classicui_pub/input_frame_api/inc/akninfrm.h
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002 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 "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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDES
       
    20 #ifndef __AKNINFRM_H__
       
    21 #define __AKNINFRM_H__
       
    22 
       
    23 
       
    24 #include <eikdef.h>
       
    25 #include <eikbctrl.h>
       
    26 #include <gulicon.h>
       
    27 #include <eiklabel.h>
       
    28 #include <AknUtils.h>
       
    29 #include <avkon.rsg>
       
    30 
       
    31 class CAknsFrameBackgroundControlContext;
       
    32 class CAknsBasicBackgroundControlContext;
       
    33 // CLASS DECLARATION
       
    34 /**
       
    35 * Implements an input frame which can contain any @c CCoeControl.
       
    36 * The input frame can have additional icon and/or info text.
       
    37 * @since Series60 0.9
       
    38 */
       
    39 NONSHARABLE_CLASS(CAknInputFrame) : public CEikBorderedControl, public MCoeControlObserver
       
    40     {
       
    41 public:
       
    42     
       
    43     /**
       
    44     * Default C++ constructor.
       
    45     */
       
    46     CAknInputFrame();
       
    47     
       
    48     /**
       
    49     * Destructor. Frees all resources owned by the object prior to its
       
    50     * destruction.
       
    51     */
       
    52     IMPORT_C ~CAknInputFrame();
       
    53         
       
    54     /**
       
    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.
       
    64     */
       
    65     IMPORT_C static CAknInputFrame* NewL(CCoeControl* aField,TBool aComponentOwner,
       
    66                                          const TDesC& aBitmapfile, TInt aBitmapId, TInt aMaskId,
       
    67                                          TUint32 aFlags = 0 );
       
    68     /**
       
    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
       
    72     * transferred or not.
       
    73     * @param aIcon Bitmap file name and path.
       
    74     * @param aFlags Flags.
       
    75     * @return a Pointer to the new @c CAknInputFrame object.
       
    76     */
       
    77     IMPORT_C static CAknInputFrame* NewL(CCoeControl* aField,TBool aComponentOwner,
       
    78                                          CGulIcon* aIcon, TUint32 aFlags = 0 );
       
    79     /**
       
    80     * Returns apointer to field.
       
    81     * @return a Pointer to the control, which is located inside the input frame. 
       
    82     */
       
    83     IMPORT_C CCoeControl* Field() const;
       
    84         
       
    85     /**
       
    86     * Sets additional info text to input frame.
       
    87     * @param aText Info text to be added in the input frame.
       
    88     * @deprecated
       
    89     */
       
    90     IMPORT_C void SetInfoTextL(const TDesC& aText);
       
    91         
       
    92     /**
       
    93     * Sets the lines visible or invisible.
       
    94     * @param aText @c ETrue to make the line visible, @c EFalse to make it
       
    95     * invisible.
       
    96     */
       
    97     IMPORT_C void SetLineState(TBool aLineVisible);
       
    98         
       
    99     /**
       
   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().
       
   103     */
       
   104     void SetIcon(CGulIcon* aIcon);
       
   105 
       
   106     /**
       
   107      * Get flags of current input frame.
       
   108      * @return flags.
       
   109      * @since Series 60 5.0
       
   110      */
       
   111     TUint Flags() const;
       
   112 
       
   113     /**
       
   114      * Set new flags to current input frame.
       
   115      * @param aNewFlags is new flag.
       
   116      * @since Series 60 5.0
       
   117      */
       
   118     void SetFlags( TUint aNewFlags );
       
   119 
       
   120 public: //from MCoeControlObserver
       
   121 
       
   122     /**
       
   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.
       
   127     */
       
   128     IMPORT_C void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
       
   129 
       
   130 public: //from CCoeControl
       
   131 
       
   132     /**
       
   133     * Handles key events.
       
   134     * @param aKeyEvent The key event.
       
   135     * @param aType The type of the event: @c EEventKey, @c EEventKeyUp or 
       
   136     * @c EEventKeyDown.
       
   137     * @return Indicates whether or not the key event was used by this control. 
       
   138     */
       
   139     IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
       
   140         
       
   141     /**
       
   142     * Tells the minimum size of the control.
       
   143     * @return The minimum size of the control.
       
   144     */
       
   145     IMPORT_C TSize MinimumSize();
       
   146         
       
   147     /**
       
   148     * The second phase constructor: constructs input frame from resources.
       
   149     * @param The resource reader.
       
   150     */
       
   151     IMPORT_C void ConstructFromResourceL(TResourceReader& aReader); 
       
   152         
       
   153     /**
       
   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.
       
   158     */
       
   159     IMPORT_C void SetInputContext(CAknsFrameBackgroundControlContext* aContext);
       
   160 
       
   161   	/**
       
   162    	* From CCoeControl. Handles a change to the control's resources.
       
   163    	* @param aType A message UID value.
       
   164    	*/
       
   165    	void HandleResourceChange( TInt aType );
       
   166 
       
   167 private: // From CCoeControl
       
   168     void SizeChanged();
       
   169     void FocusChanged(TDrawNow aDrawNow); 
       
   170     void Draw(const TRect& aRect) const;
       
   171     void PrepareForFocusLossL();
       
   172 
       
   173 private:
       
   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);
       
   177     void CreateIconL();
       
   178 
       
   179 public:
       
   180     /** Enumeration flags for different layouts.        */
       
   181     enum TInputFrameFlags
       
   182         {
       
   183         /** a Standard layout. */
       
   184         EOwnsField=0x40,
       
   185         /** a Popup layoyt. */
       
   186         EPopupLayout=0x80,
       
   187         /** a Pinboard layout. */
       
   188         EPinbLayout=0x100,
       
   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
       
   199         };
       
   200     
       
   201 private:
       
   202     enum TInfrmPrivateFlags
       
   203         {
       
   204         EOwnsInputContext = 0x2000
       
   205         };
       
   206 
       
   207     CGulIcon*               iIcon;
       
   208     TUint32                 iFlags;
       
   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;
       
   212 
       
   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
       
   218 
       
   219 
       
   220     // these are unused
       
   221     TAknLayoutRect          iUnUsed1;
       
   222     TAknLayoutRect          iUnUsed2;
       
   223     TAknLayoutRect          iUnused3;
       
   224     TAknLayoutRect          iUnused4;
       
   225     TAknLayoutRect          iUnused5;
       
   226     TAknLayoutRect          iUnused6;
       
   227 
       
   228     TAny*                   iSpare;     // WAS CEikLabel* iInfoText;
       
   229     TAny*                   iSpare2;    // was last 4 bytes of TAknLayoutRect  iOutlineRect;
       
   230     
       
   231     HBufC*		            iFileName; 
       
   232     TInt                    iBitmapId;
       
   233     TInt                    iMaskId;
       
   234 
       
   235     };
       
   236 
       
   237 
       
   238 #endif
       
   239 
       
   240 
       
   241