epoc32/include/mw/aknquerycontrol.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 aknquerycontrol.h
     1 /*
       
     2 * Copyright (c) 2002-2008 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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation of Query control and List query control.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef AKNQUERYCONTROL_H
       
    20 #define AKNQUERYCONTROL_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <akncontrol.h>
       
    24 #include <gulbordr.h>
       
    25 
       
    26 #include <eikedwin.h>
       
    27 #include <eikseced.h>
       
    28 #include <eikmfne.h>
       
    29 #include <aknnumseced.h>
       
    30 #include <aknnumedwin.h>
       
    31 #include <eikfpne.h>
       
    32 
       
    33 #include <eikimage.h>   
       
    34 #include <eikedwob.h>
       
    35 
       
    36 #include <aknutils.h>
       
    37 #include <aknpanic.h>
       
    38 
       
    39 #include <aknipfed.h>
       
    40 #include <lbsposition.h>
       
    41 
       
    42 //  FORWARD DECLARATIONS
       
    43 class CAknQueryControl;
       
    44 class TAknQueryEcsObserver;
       
    45 class CAknEcsDetector;
       
    46 class CAknBitmapAnimation;
       
    47 class CAknTextControl;
       
    48 class CAknQueryEditIndicator;
       
    49 class MLAFIndex;
       
    50 class MAknEditingStateIndicator;
       
    51 class TInetAddr;
       
    52 class CAknQueryExtension;
       
    53 class TAknWindowLineLayout;
       
    54 class CAknButton;
       
    55 class CAknQueryControlExtension;
       
    56 class CAknLocationEditor;
       
    57 /**
       
    58 * MAknQueryControlObserver
       
    59 *   Callback class for CAknQueryDialog
       
    60 */
       
    61 class MAknQueryControlObserver
       
    62     {
       
    63 public:
       
    64     /**
       
    65     * Enumeration for query control events
       
    66     */
       
    67     enum TQueryControlEvent
       
    68         {
       
    69         EQueryControltSizeChanging,
       
    70         EQueryControlEditorStateChanging,
       
    71         EEmergencyCallAttempted
       
    72         };
       
    73 
       
    74     /**
       
    75     * Enumeration for editor validation status
       
    76     */
       
    77     enum TQueryValidationStatus
       
    78         {
       
    79         EEditorValueValid = KErrNone,
       
    80         EEditorValueTooSmall,
       
    81         EEditorValueTooLarge,
       
    82         EEditorValueNotParsed,
       
    83         EEditorEmpty
       
    84         };
       
    85 
       
    86 public:
       
    87     /**
       
    88     * Gets called when editor sends size event
       
    89     */
       
    90     virtual TBool HandleQueryEditorSizeEventL(CAknQueryControl* aQueryControl, TQueryControlEvent aEventType)=0;
       
    91     /**
       
    92     * Gets called when editor sends state event
       
    93     */
       
    94     virtual TBool HandleQueryEditorStateEventL(CAknQueryControl* aQueryControl, TQueryControlEvent aEventType, TQueryValidationStatus aStatus)=0;
       
    95     };
       
    96 
       
    97 /**
       
    98  * The control for a query dialog.
       
    99  *
       
   100  * Manage layout of elements in a query dialog:- the text, the image 
       
   101  * and the editors.
       
   102  *
       
   103  * @see CAknQueryDialog, CAknText
       
   104  */
       
   105 class CAknQueryControl : public CAknControl , public MEikEdwinObserver , public MEikEdwinSizeObserver , public MCoeControlObserver
       
   106     {
       
   107 public:
       
   108 
       
   109 	DECLARE_TYPE_ID(0x10283143)    
       
   110     
       
   111     public:
       
   112         /**
       
   113         * Enumeration for indexing into control flags, which
       
   114         * determine the control behaviour relative to a number
       
   115         * of things, e.g. emergency control handling, displaying of 
       
   116         * edit indicator, enabling of predictive text, etc
       
   117         */
       
   118         enum TQueryControlFlagBitIndices
       
   119             {
       
   120             /** Query supports emergency calls.
       
   121             */
       
   122             EEmergencyCallsEnabledByAPI,
       
   123             /** Query doesn't support emergency calls.
       
   124             */
       
   125             EEmergencyCallsDisabledByAPI,
       
   126             /** Predictive text input is allowed in the query.
       
   127             */
       
   128             EPredictiveTextEntryPermitted,
       
   129             /** Editor indicators are not shown in the query.
       
   130             */
       
   131             EEditorIndicatorOff,
       
   132             /** Additional support to ECS for CBA label change.
       
   133             *   Must be enabled for touch full screen query for the
       
   134             *   ECS to function properly.
       
   135             */
       
   136             EEmergencyCallsCBASupport
       
   137             };
       
   138 
       
   139         /**
       
   140          * Layout for queries can be done
       
   141          * using the following methods. Each
       
   142          * method is specified in a LAF section
       
   143          */
       
   144         enum TLayoutMethod 
       
   145             {
       
   146             EConfQueryLayoutM,             ///LAYOUT according to LAF specs for conf queries
       
   147             EDataQueryLayoutM,             ///LAYOUT according to LAF specs for data queries
       
   148             ECodeQueryLayoutM,             ///LAYOUT accoridng to LAF specs for code queries
       
   149             ETimeQueryLayoutM,             ///LAYOUT according to LAF specs for time queries
       
   150             EDateQueryLayoutM,             ///LAYOUT according to LAF specs for date queries
       
   151             ECombinedCodeDataQueryLayoutM  ///LAYOUT according to LAF specs for combined code and data queries
       
   152             };
       
   153 
       
   154     public:  // Constructors and destructor
       
   155 
       
   156         /**
       
   157          * C++ Constructor.
       
   158          */
       
   159         IMPORT_C CAknQueryControl();
       
   160 
       
   161         /**
       
   162          * C++ Destructor.
       
   163          */
       
   164         IMPORT_C virtual ~CAknQueryControl();
       
   165 
       
   166         /**
       
   167          * Second phase constructor: loads contents of array from resources.
       
   168          *
       
   169          * @param aRea      resource reader pointed to a 
       
   170          *                  query resource.
       
   171          */
       
   172         IMPORT_C void ConstructFromResourceL(TResourceReader& aRes);
       
   173 
       
   174     public: // New functions
       
   175 
       
   176         /**
       
   177         * Set observer for query control.
       
   178         *
       
   179         * @param aQueryControlObserver  Pointer to oberver class 
       
   180         */
       
   181         IMPORT_C void SetQueryControlObserver(MAknQueryControlObserver* aQueryControlObserver);
       
   182 
       
   183         /**
       
   184         * Read prompt text from resource and call SetPrompt if there was text for prompt.
       
   185         *
       
   186         * @param aRes   resource reader pointed to a query resource
       
   187         */
       
   188         IMPORT_C virtual void ReadPromptL(TResourceReader& aRes);
       
   189 
       
   190         /**
       
   191         * Set prompt text for query. This call WrapToStringL.
       
   192         *
       
   193         * @param aDesC  Text for prompt
       
   194         */
       
   195         IMPORT_C virtual void SetPromptL(const TDesC& aDesC);
       
   196 
       
   197         /**
       
   198         * Get text from text, secret text, numeric secret text snd phonenumber editor.
       
   199         * 
       
   200         * @param aDes   Address of variable where text returned.
       
   201         */
       
   202         IMPORT_C void GetText(TDes& aDes) const;
       
   203 
       
   204         /**
       
   205         * Get time from date or time editors
       
   206         * 
       
   207         * @return Returns data from editor.
       
   208         */
       
   209         IMPORT_C TTime GetTime() const;
       
   210 
       
   211         /**
       
   212         * Get number from number editor.
       
   213         * 
       
   214         * @return Returns number from editor
       
   215         */
       
   216         IMPORT_C TInt GetNumber() const;
       
   217 
       
   218         /**
       
   219         * Get number from floating point editor.
       
   220         * 
       
   221         * @return Returns number from editor
       
   222         */
       
   223         IMPORT_C TReal GetFloatingPointNumberL() const;
       
   224 
       
   225         /**
       
   226         * Get duration from duration editor
       
   227         * 
       
   228         * @return Return duration from editor.
       
   229         */
       
   230         IMPORT_C TTimeIntervalSeconds GetDuration() const;
       
   231 
       
   232 
       
   233 		/**
       
   234 		 * Get location from location editor
       
   235 		 *
       
   236 		 * Modifies aLocation in such way that either
       
   237 		 * longitude or latitude will change.
       
   238 		 */
       
   239   	    IMPORT_C void GetLocation(TPosition &aLocation) const;
       
   240 
       
   241         /**
       
   242         * Set text to text and phonenumber editor.
       
   243         * 
       
   244         * @param aDesC Text for editor
       
   245         */
       
   246         IMPORT_C void SetTextL(const TDesC& aDesC);
       
   247 
       
   248         /**
       
   249         * Set date of time to editor
       
   250         * 
       
   251         * @param aTime Time or date to editor.
       
   252         */
       
   253         IMPORT_C void SetTime(TTime& aTime);
       
   254 
       
   255         /**
       
   256         * Set duration to duration editor
       
   257         * 
       
   258         * @param aDuration  Duration to editor
       
   259         */
       
   260         IMPORT_C void SetDuration(TTimeIntervalSeconds& aDuration);
       
   261 
       
   262         /**
       
   263         * Set number to number editor
       
   264         * @param aNumber    Number to editor
       
   265         *
       
   266         */
       
   267         IMPORT_C void SetNumberL(TInt aNumber);
       
   268 
       
   269          /**
       
   270         * Set number to floating point editor
       
   271         * @param aNumber    Number to editor
       
   272         *
       
   273         */
       
   274         IMPORT_C void SetFloatingPointNumberL(const TReal* aNumber);
       
   275 
       
   276 		/**
       
   277 		* Set location to location editor
       
   278         *
       
   279 		* Modifies editor in such way that it'll start
       
   280 		* showing either longitude or latitude from
       
   281 		* the given location. It depends on resource file
       
   282 		* flags of the location editor which is used.
       
   283 		*
       
   284 		* @param aLocation Location to editor
       
   285 		*
       
   286 		*/
       
   287 		IMPORT_C void SetLocation(const TPosition &aLocation);
       
   288 
       
   289         /**
       
   290         * Set max length of text to text editor. This will override length from resource
       
   291         * @param aLength    Max length of text in editor
       
   292         * 
       
   293         */
       
   294         IMPORT_C void SetTextEntryLength(TInt aLength);
       
   295 
       
   296         /**
       
   297         * Return the max length of the text in the text editor
       
   298         * @return max text length
       
   299         */
       
   300         IMPORT_C TInt GetTextEntryLength() const;
       
   301 
       
   302         /**
       
   303         * Set minimum and maximum time or date to editor
       
   304         * @param aMinimum   Minimum value 
       
   305         * @param aMaximum   Maximum value
       
   306         * 
       
   307         */
       
   308         IMPORT_C void SetMinimumAndMaximum(const TTime& aMinimum, const TTime& aMaximum);
       
   309 
       
   310         /**
       
   311         * Set minimum and maximum duration to editor
       
   312         * @param aMinimumDuration   Minimum value
       
   313         * @param aMaximumDuration   Maximum value
       
   314         */
       
   315         IMPORT_C void SetMinimumAndMaximum(const TTimeIntervalSeconds& aMinimumDuration, const TTimeIntervalSeconds& aMaximumDuration);
       
   316 
       
   317         /**
       
   318         * Set minimum and maximum number to editor
       
   319         * @param aMinimumValue   Minimum value
       
   320         * @param aMaximumValue   Maximum value
       
   321         */
       
   322         IMPORT_C void SetMinimumAndMaximum(TInt aMinimumValue, TInt aMaximumValue);
       
   323 
       
   324 
       
   325         /**
       
   326         * Checks if the given number in the editor is within the maximum and minimum values.
       
   327         */
       
   328         IMPORT_C TBool CheckNumber();
       
   329         
       
   330         /**
       
   331         * Set the number of lines in the editor.
       
   332         *
       
   333         * @param aNum Number of lines in the editor
       
   334         */
       
   335         IMPORT_C void SetNumberOfEditorLines(TInt aNum);
       
   336 
       
   337         /**
       
   338         * Set minimum and maximum number to floating point editor
       
   339         * @param aMinimumValue   Minimum value
       
   340         * @param aMaximumValue   Maximum value
       
   341         */
       
   342         IMPORT_C void SetMinimumAndMaximum(const TReal& aMinimumValue, const TReal& aMaximumValue);
       
   343         /**
       
   344         * Get text length from editor.
       
   345         * 
       
   346         * @return Length of text from editor
       
   347         */
       
   348         IMPORT_C TInt GetTextLength() const;
       
   349 
       
   350         /**
       
   351         * Return number of editor lines
       
   352         *
       
   353         * @return Number lines in the editor
       
   354         */
       
   355 
       
   356         IMPORT_C TInt NbrOfEditorLines() const;
       
   357 
       
   358 
       
   359         /**
       
   360         * Return number of prompt lines
       
   361         * 
       
   362         * @return Number of lines in the prompt
       
   363         */
       
   364         IMPORT_C TInt NbrOfPromptLines() const;
       
   365 
       
   366         /**
       
   367         * Get pointer to query controls control (editor)
       
   368         *
       
   369         * @param aLayout    Controls layout (for one line queries use
       
   370         *                   EDataLayout, ECodeLayout... and for
       
   371         *                   multiline queries use
       
   372         *                   EMultiDataFirstEdwin, EMultiDataSecondEdwin...)
       
   373         * @return           Pointer to control, NULL if not found 
       
   374         */
       
   375         IMPORT_C virtual CCoeControl* ControlByLayoutOrNull(TInt aLayout);
       
   376 
       
   377         /**
       
   378         * Sets and overrides other image or animation
       
   379         * Takes ownership of aImage
       
   380         */
       
   381         IMPORT_C void SetImageL(CEikImage* aImage);
       
   382 
       
   383         /**
       
   384         * Sets and overrides other image or animation
       
   385         */
       
   386         IMPORT_C void SetImageL(const TDesC& aImageFile,
       
   387                                 TInt aBmpId, TInt aBmpMaskId);
       
   388         /**
       
   389         * Sets and overrides other animation
       
   390         * 
       
   391         */
       
   392         IMPORT_C void SetAnimationL(TInt aResource);
       
   393 
       
   394         /**
       
   395         * starts animation if one present
       
   396         * 
       
   397         */
       
   398         IMPORT_C void StartAnimationL();
       
   399 
       
   400         /**
       
   401         * stops animation if one present
       
   402         * 
       
   403         * @return error code
       
   404         */
       
   405         IMPORT_C TInt CancelAnimation();
       
   406 
       
   407         /**
       
   408         * This cancels the query.  Used when the query control has to get abandon the query
       
   409         * for some reason
       
   410         */
       
   411         void CancelQueryL();
       
   412 
       
   413         /**
       
   414         *   @return true if the content of the editor is valid, false otherwise
       
   415         */
       
   416         TBool EditorContentIsValidL() const;
       
   417 
       
   418         /**
       
   419         * This transfers CAknQueryControl's flags set by the dialog and then uses them.
       
   420         * The method must be called after all the contained controls are constructed;
       
   421         * Inside PreLayoutDynamicInitL is recommended.
       
   422         * 
       
   423         * @param flag pattern to set and then act on.
       
   424         */
       
   425         void SetAndUseFlagsL( TBitFlags16 aFlags );
       
   426 
       
   427     public: // Functions from CCoeControl
       
   428     
       
   429         /**
       
   430         * From CCoeControl  Handle key events. When a key event occurs, 
       
   431         *                   CONE calls this function for each control on the control stack, 
       
   432         *                   until one of them returns EKeyWasConsumed to indicate that it processed the key event.  
       
   433         * @param aKeyEvent  The key event.
       
   434         * @param aType      The type of the event: EEventKey, EEventKeyUp or EEventKeyDown.
       
   435         * @return           Indicates whether or not the key event was used by this control.
       
   436         */
       
   437         IMPORT_C TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType);
       
   438 
       
   439         /**
       
   440         * From CCoeControl  Give the control a mimimum size. 
       
   441         * 
       
   442         * @return           The minimum size required by the control.
       
   443         */
       
   444         IMPORT_C TSize MinimumSize();
       
   445 
       
   446         /**
       
   447         * From CCoeControl  Added to pass-through focus-loss warnings.
       
   448         *                   if not ready, this will leave.
       
   449         * @return           Indicates whether or not the key event was used by this control.
       
   450         */
       
   451         void PrepareForFocusLossL();
       
   452 
       
   453         /**
       
   454         * From CCoeControl  Added to pass-through focus-loss warnings.
       
   455         *                   if not ready, this will leave.
       
   456         * @return           Indicates whether or not the key event was used by this control.
       
   457         */
       
   458         void FocusChanged(TDrawNow aDrawNow);
       
   459         
       
   460         /**
       
   461         * From MEikEdwinObserver
       
   462         *
       
   463         * @param aEdwin     Editor who sent the event
       
   464         * @param aEventType Type of the event
       
   465         */
       
   466         IMPORT_C void HandleEdwinEventL(CEikEdwin* aEdwin,TEdwinEvent aEventType);
       
   467 
       
   468     public:// Functions from MEikEdwinSizeObserver
       
   469 
       
   470         /**
       
   471         * From MEikEdwinObserver
       
   472         *
       
   473         * @param aEdwin                 Editor who's size has changed
       
   474         * @param aEventType             Type of the size event
       
   475         * @param aDesirableEdwinSize    Desirable size of the edwin
       
   476         */
       
   477         IMPORT_C TBool HandleEdwinSizeEventL(CEikEdwin* aEdwin, TEdwinSizeEvent aEventType, TSize aDesirableEdwinSize);
       
   478 
       
   479     public:// Functions from MCoeControlObserver
       
   480 
       
   481         /**
       
   482         * From MCoeControlObserver
       
   483         * @param aControl   Control who caused the event
       
   484         * @param aEventType Type of the event
       
   485         */
       
   486         IMPORT_C void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
       
   487 
       
   488     public:
       
   489         /**
       
   490         * @return Layout indication
       
   491         *
       
   492         * At the moment the layout is a good indication of the query type (PIN,number,etc)
       
   493         * The query dialog uses this information to determine query type in order to
       
   494         * process key events in a way dependent on the query type. These key events
       
   495         * can't be processes by the control directly because they involve actions only
       
   496         * the dialog can perform
       
   497         */
       
   498         inline TInt QueryType() const { return iQueryType; } 
       
   499 
       
   500         /**
       
   501         * Return window layout depending on Layout 
       
   502         * Window layout is done by the dialog
       
   503         */
       
   504         virtual void WindowLayout( TAknWindowLineLayout& aLayout ) const;
       
   505     
       
   506     public:// Functions from CCoeControl
       
   507         /**
       
   508         * From CCoeControl  Count number of controls contained in a compound control.  
       
   509         *  
       
   510         * @return           The number of component controls contained by this control.           
       
   511         */
       
   512         TInt CountComponentControls() const;
       
   513 
       
   514         /**
       
   515         * From CCoeControl  Get the components of a compound control.
       
   516         *                   It returns one of the control's component controls, identified by aIndex.
       
   517         * @param anIndex    The index of the control to get.        
       
   518         * @return           The component control with an index of aIndex.
       
   519         */
       
   520         CCoeControl* ComponentControl(TInt anIndex) const;
       
   521 
       
   522         /**
       
   523         * From CCoeControl.     
       
   524         * Handles pointer events
       
   525         */
       
   526     	IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
   527     	
       
   528     	IMPORT_C void HandleResourceChange(TInt aType); 
       
   529 
       
   530     public:
       
   531         /**
       
   532          * Manage indexes into LAF tables
       
   533          */
       
   534         class TIndex 
       
   535         {   
       
   536         public:     
       
   537             TIndex(TInt aNumberOfPromptLines);  
       
   538         
       
   539         public: 
       
   540             TInt PromptLine() const;    
       
   541             
       
   542         public: 
       
   543             TInt DQPWindowTextsLine2(TInt aLineNum) const;  
       
   544             TInt PNWindow() const;  
       
   545             TInt PQDWindow(TInt aLineNum) const;    
       
   546             TInt PQCWindow() const;
       
   547             
       
   548         private:    
       
   549             void SelfTest() const;  
       
   550 
       
   551         private:    
       
   552             TInt  iNumberOfPromptLines; 
       
   553         };  
       
   554 
       
   555     protected:
       
   556         /**
       
   557         * From CCoeControl  Respond to size changed. This function is called by CONE whenever SetExtentL(), 
       
   558         *                   SetSizeL(), SetRectL(), SetCornerAndSizeL(), or SetExtentToWholeScreenL() 
       
   559         *                   are called on the control.   
       
   560         */
       
   561         void SizeChanged();
       
   562 
       
   563         /**
       
   564         * From CCoeControl  Draw a control.  
       
   565         *
       
   566         * @param aRect      The region of the control to be redrawn.   
       
   567         */
       
   568         void Draw(const TRect& aRect) const;
       
   569 
       
   570         /**
       
   571         * From MObjectProvider
       
   572         */
       
   573         TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
       
   574 
       
   575         /**
       
   576         * Perform layout by calling SizeChanged 
       
   577         *   
       
   578         */
       
   579         void Layout();
       
   580 
       
   581     protected:
       
   582         /**
       
   583          * Determine the line widths for the prompt, depends on layout
       
   584          */
       
   585         virtual void SetLineWidthsL();
       
   586 
       
   587         /**
       
   588          * After having read the query type from resource. This method is
       
   589          * called in CostructFromResourceL()
       
   590          *
       
   591          * @see ConstructFromResourceL()
       
   592          */
       
   593         virtual void ConstructQueryL(TResourceReader& aRes);
       
   594 
       
   595         /**
       
   596          * Layout rectangle (shift up and left by margins)
       
   597          */
       
   598         virtual TRect LayoutRect();
       
   599 
       
   600         /**
       
   601          * Return the rect that is used by the dialog for layout
       
   602          * This can be determined using LAF values and is equal to 
       
   603          * TPoint(0,0) plus the control size plus the margins
       
   604          */
       
   605         TRect DialogRect() const;
       
   606 
       
   607         /**
       
   608          * Return the size of the dialog. This equals to the control 
       
   609          * size plus the margins.
       
   610          */
       
   611         TSize DialogSize() const;
       
   612         
       
   613         /**
       
   614          * Calculates the size of the dialog. This can be determined
       
   615          * using LAF values and is equal to the control size plus
       
   616          * the margins.
       
   617          */
       
   618         void DialogSizeChanged();
       
   619 
       
   620     protected:
       
   621         /**
       
   622          * Layout the query prompt
       
   623          */
       
   624         virtual void LayoutPrompt(const TLayoutMethod& aLayoutM);
       
   625 
       
   626         /**
       
   627          * Layout the image or the animation
       
   628          */
       
   629         virtual void LayoutImageOrAnim(const TLayoutMethod& aLayoutM);
       
   630         
       
   631         /**
       
   632          * Layout the text editor
       
   633          */
       
   634         virtual void LayoutEditor(const TLayoutMethod& aLayoutM);
       
   635 
       
   636         /**
       
   637          * Layout the editor frame
       
   638          */
       
   639         virtual void LayoutEditorFrame(const TLayoutMethod& aLayoutM);
       
   640 
       
   641         /**
       
   642          * Layout the editor state indicator icons
       
   643          */
       
   644         virtual void LayoutEditorIndicator(const TLayoutMethod& aLayoutM);
       
   645 
       
   646     protected:
       
   647 
       
   648         /**
       
   649         * Get the extension object instance, if any exists.
       
   650         */
       
   651         CAknQueryExtension* QueryExtension() const;
       
   652 
       
   653         /**
       
   654         * Draw editor frame and shadows
       
   655         */
       
   656         void DrawEditorFrame(CWindowGc& aGc,TRect& aRect) const;
       
   657     
       
   658     private:        
       
   659 
       
   660         /**
       
   661         * This transfers CAknQueryControl's flags set by the dialog
       
   662         * 
       
   663         * @param flag pattern to set 
       
   664         *
       
   665         */
       
   666         void SetFlags( TBitFlags16 aFlags );
       
   667 
       
   668         /** 
       
   669         * This acts on the Query control flags that are set from CAknQueryDialog
       
   670         *
       
   671         */
       
   672         void DeployFlagsL();
       
   673 
       
   674         /**
       
   675         * Call CAknTextControl::ParseTextL
       
   676         *
       
   677         */
       
   678         void DoSetPromptL();
       
   679 
       
   680         static TInt StaticPictographCallBack( TAny* aPtr );
       
   681         void PictographCallBack();
       
   682         
       
   683         /**
       
   684         * Checks if this query control should contain embedded virtual keypad.
       
   685         *
       
   686         * @return ETrue if embedded virtual keypad should be used.
       
   687         */
       
   688         TBool EmbeddedVirtualInput() const;
       
   689         
       
   690         /**
       
   691         * Returns pointer to dialog.
       
   692         *
       
   693         * @return Pointer to dialog if it exists.
       
   694         */
       
   695         CEikDialog* Dialog() const;
       
   696         
       
   697         /**
       
   698         * Creates increment and decrement buttons.
       
   699         *
       
   700         */
       
   701         void CreateIncAndDecButtonsL();
       
   702         
       
   703         /**
       
   704         * Creates backspace button.
       
   705         *
       
   706         */
       
   707         void CreateBackspaceButtonL();
       
   708         
       
   709         /**
       
   710         * Layouts the query prompt in case of Full Screen Query.
       
   711         *
       
   712         */
       
   713         void LayoutEditorForFullScreen( const TLayoutMethod& /*aLayoutM*/ );
       
   714         
       
   715         /**
       
   716         * Layout the text editor in case of Full Screen Query.
       
   717         *
       
   718         */
       
   719         void LayoutPromptForFullScreen();
       
   720 
       
   721 
       
   722 
       
   723 
       
   724     private:
       
   725         /**
       
   726         * From CAknControl
       
   727         */
       
   728         IMPORT_C void* ExtensionInterface( TUid aInterface );
       
   729 	protected:
       
   730 		CAknLocationEditor *&LocationEd();
       
   731 		CAknLocationEditor *LocationEd() const;
       
   732     
       
   733     public:       
       
   734         /**
       
   735         *   Return prompt needed by FEP to query dialog
       
   736         */
       
   737         void GetCaption( TDes& aCaption ) const;
       
   738         
       
   739         /**
       
   740         * Sets the ECS CBA visibility in the query.
       
   741         * 
       
   742         * TBool  aVisible  @c ETrue if an ECS number is entered to the
       
   743         *                  query, @c EFalse otherwise.
       
   744         */ 
       
   745         void SetEcsCbaVisibleL( TBool aVisible );
       
   746         
       
   747         /**
       
   748         * Attempts to make an emergency call if a valid emergency
       
   749         * number has been entered to the query.
       
   750         */
       
   751         void AttemptEmergencyCallL();
       
   752         
       
   753     protected:
       
   754         /// Control for prompt text
       
   755         CAknTextControl*  iPrompt;
       
   756         /// Editor indicator icons 
       
   757         CAknQueryEditIndicator*  iEditIndicator;
       
   758         /// Edwin editor
       
   759         CEikEdwin*               iEdwin;
       
   760         /// Date editor
       
   761         CEikDateEditor*          iDateEdwin;
       
   762         /// Time editor
       
   763         CEikTimeEditor*          iTimeEdwin;
       
   764         /// Duration editor
       
   765         CEikDurationEditor*      iDurationEdwin;
       
   766         /// Secret editor
       
   767         CEikSecretEditor*        iSecretEd;
       
   768         /// Integer editor
       
   769         CAknIntegerEdwin*        iNumberEdwin; 
       
   770         /// Numeric secret editor
       
   771         CAknNumericSecretEditor* iPinEdwin;
       
   772         // Floating point editor
       
   773         CEikFloatingPointEditor* iFloatingPointEditor;
       
   774         // Image
       
   775         CEikImage*               iImage;
       
   776         /// Control id
       
   777         TInt                     iControl;
       
   778         // Layoutrect for Mfne
       
   779         TAknLayoutRect           iLayoutMfne;
       
   780         // Emergency call detector
       
   781         CAknEcsDetector*         iEcsDetector;
       
   782         // Emergency call observer
       
   783         TAknQueryEcsObserver*    iEcsObserver;
       
   784         // Flags for emergency call support and other things
       
   785         TBitFlags16              iFlags;
       
   786         TUint16                  iSpare_1; // padding
       
   787         // Animation
       
   788         CAknBitmapAnimation*     iAnimation;
       
   789         // Pointer to query control observer
       
   790         MAknQueryControlObserver* iQueryControlObserver;
       
   791         // Query type
       
   792         TInt                      iQueryType;
       
   793         // Layout rect for editor's vertical shadow
       
   794         TAknLayoutRect            iEditorVerShadow;
       
   795         // Layout rect for editor's horizontal shadow
       
   796         TAknLayoutRect            iEditorHorShadow;
       
   797         // Layout rect for editor's frame
       
   798         TAknLayoutRect            iEditorFrame;
       
   799     
       
   800         TInt       iNumberOfEditorLines; ///Maximum number of lines in the editor
       
   801 
       
   802         TBool      iHasEditor;   //False for confirmation queries (default), 
       
   803                                  //true for all other queries 
       
   804 
       
   805         CArrayFixFlat<TInt>* iLineWidths; ///Widths of prompt lines (in pixels)
       
   806         
       
   807         CAknButton* iIncreaseValueButton;  //Reserved for plus button for MFNE editors
       
   808         CAknButton* iDecreaseValueButton;  //Reserved for minus button for MFNE editors
       
   809 
       
   810         TSize iDialogSize;                 // Dialog size
       
   811 	private:
       
   812 		CAknQueryControlExtension *iExtension;
       
   813     private:
       
   814         TInt iSpare[1];
       
   815     };
       
   816 
       
   817 
       
   818 
       
   819 /**
       
   820  * The extended control for a query dialog.
       
   821  * ip and fixed point editors
       
   822  *
       
   823  * Manage layout of elements in a query dialog:- the text, the image 
       
   824  * and the editors.
       
   825  *
       
   826  * @see CAknQueryDialog, CAknText
       
   827  * @since 2.1
       
   828  */ 
       
   829 
       
   830 class CAknExtQueryControl : public CAknQueryControl
       
   831     {
       
   832     
       
   833     public:  // Constructors and destructor
       
   834 
       
   835         /**
       
   836          * C++ Constructor.
       
   837          */
       
   838         IMPORT_C CAknExtQueryControl();
       
   839 
       
   840         /**
       
   841          * C++ Destructor.
       
   842          */
       
   843         IMPORT_C virtual ~CAknExtQueryControl();      
       
   844 
       
   845     public: //New functions
       
   846 
       
   847         /**
       
   848         * Get ip address from ip editor.
       
   849         * 
       
   850         * @return Returns data from editor
       
   851         */
       
   852         IMPORT_C TInetAddr GetInetAddress() const;
       
   853 
       
   854         /**
       
   855         * Set ip address to editor
       
   856         * 
       
   857         * @param aInetAddress to editor.
       
   858         */
       
   859         IMPORT_C void SetInetAddress(TInetAddr& aInetAddress);
       
   860 
       
   861         /**
       
   862         * Get number from fixed point editor.
       
   863         * 
       
   864         * @return Returns number from editor
       
   865         */
       
   866         IMPORT_C TInt GetFixedPointNumber() const;
       
   867 
       
   868          /**
       
   869         * Set number to fixed point editor
       
   870         * @param aNumber    Number to editor
       
   871         *
       
   872         */
       
   873         IMPORT_C void SetFixedPointNumberL(const TInt* aNumber);
       
   874 
       
   875 
       
   876     public: // from CAknQueryControl
       
   877 
       
   878         /**
       
   879         * Set minimum and maximum ip address to editor
       
   880         * @param aMinimum   Minimum value 
       
   881         * @param aMaximum   Maximum value
       
   882         * 
       
   883         */
       
   884         IMPORT_C void SetMinimumAndMaximum(const TInetAddr& aMinimumAddress, const TInetAddr& aMaximumAddress);
       
   885 
       
   886         /**
       
   887         * Set minimum and maximum fixed point number to editor
       
   888         * @param aMinimumValue   Minimum value
       
   889         * @param aMaximumValue   Maximum value
       
   890         */
       
   891         IMPORT_C void SetMinimumAndMaximum(TInt aMinimumValue, TInt aMaximumValue);
       
   892 
       
   893 
       
   894         /**
       
   895         * Get pointer to query controls control (editor)
       
   896         *
       
   897         * @param aLayout    Controls layout (for one line queries use
       
   898         *                   EDataLayout, ECodeLayout... and for
       
   899         *                   multiline queries use
       
   900         *                   EMultiDataFirstEdwin, EMultiDataSecondEdwin...)
       
   901         * @return           Pointer to control, NULL if not found 
       
   902         */
       
   903         IMPORT_C virtual CCoeControl* ControlByLayoutOrNull(TInt aLayout);
       
   904 
       
   905         /**
       
   906         *   @return true if the content of the editor is valid, false otherwise
       
   907         */
       
   908         TBool EditorContentIsValidL() const;
       
   909 
       
   910         /**
       
   911         * This transfers CAknQueryControl's flags set by the dialog and then uses them.
       
   912         * The method must be called after all the contained controls are constructed;
       
   913         * Inside PreLayoutDynamicInitL is recommended.
       
   914         * 
       
   915         * @param flag pattern to set and then act on.
       
   916         */
       
   917         void SetAndUseFlagsL( TBitFlags16 aFlags );
       
   918 
       
   919     public: // Functions from CCoeControl
       
   920 
       
   921         /**
       
   922         * From CCoeControl  Added to pass-through focus-loss warnings.
       
   923         *                   if not ready, this will leave.
       
   924         * @return           Indicates whether or not the key event was used by this control.
       
   925         */
       
   926         void PrepareForFocusLossL();
       
   927 
       
   928         /**
       
   929         * From CCoeControl  Added to pass-through focus-loss warnings.
       
   930         *                   if not ready, this will leave.
       
   931         * @return           Indicates whether or not the key event was used by this control.
       
   932         */
       
   933         void FocusChanged(TDrawNow aDrawNow);
       
   934         
       
   935 
       
   936     public:// Functions from MCoeControlObserver
       
   937 
       
   938         /**
       
   939         * From MCoeControlObserver
       
   940         * @param aControl   Control who caused the event
       
   941         * @param aEventType Type of the event
       
   942         */
       
   943         IMPORT_C void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
       
   944 
       
   945     
       
   946     public:// Functions from CCoeControl
       
   947         /**
       
   948         * From CCoeControl  Count number of controls contained in a compound control.  
       
   949         *  
       
   950         * @return           The number of component controls contained by this control.           
       
   951         */
       
   952         TInt CountComponentControls() const;
       
   953 
       
   954         /**
       
   955         * From CCoeControl  Get the components of a compound control.
       
   956         *                   It returns one of the control's component controls, identified by aIndex.
       
   957         * @param anIndex    The index of the control to get.        
       
   958         * @return           The component control with an index of aIndex.
       
   959         */
       
   960         CCoeControl* ComponentControl(TInt anIndex) const;
       
   961 
       
   962     	/**
       
   963     	* From CCoeControl. Handles pointer event.
       
   964     	* @param aPointerEvent Pointer event to be handled.
       
   965     	*/
       
   966     	IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);    
       
   967 
       
   968     public:
       
   969         /**
       
   970          * Manage indexes into LAF tables
       
   971          */
       
   972         class TIndex 
       
   973         {   
       
   974         public:     
       
   975             TIndex(TInt aNumberOfPromptLines);  
       
   976         
       
   977         public: 
       
   978             TInt PromptLine() const;    
       
   979             
       
   980         public: 
       
   981             TInt DQPWindowTextsLine2(TInt aLineNum) const;  
       
   982             TInt PNWindow() const;  
       
   983             TInt PQDWindow(TInt aLineNum) const;    
       
   984             
       
   985         private:    
       
   986             void SelfTest() const;  
       
   987 
       
   988         private:    
       
   989             TInt  iNumberOfPromptLines; 
       
   990         };  
       
   991 
       
   992 
       
   993     protected:
       
   994         
       
   995         /**
       
   996          * After having read the query type from resource. This method is
       
   997          * called in CostructFromResourceL()
       
   998          *
       
   999          * @see ConstructFromResourceL()
       
  1000          */
       
  1001         virtual void ConstructQueryL(TResourceReader& aRes);
       
  1002 
       
  1003     protected:
       
  1004                 
       
  1005         /**
       
  1006          * Layout the text editor
       
  1007          */
       
  1008         virtual void LayoutEditor(const TLayoutMethod& aLayoutM);
       
  1009 
       
  1010     private:
       
  1011 
       
  1012         /**
       
  1013         * From CAknControl
       
  1014         */
       
  1015         IMPORT_C void* ExtensionInterface( TUid aInterface );        
       
  1016 
       
  1017     private:
       
  1018 
       
  1019         /**
       
  1020         * This transfers CAknQueryControl's flags set by the dialog
       
  1021         * 
       
  1022         * @param flag pattern to set 
       
  1023         *
       
  1024         */
       
  1025         void SetFlags( TBitFlags16 aFlags );
       
  1026 
       
  1027         /** 
       
  1028         * This acts on the Query control flags that are set from CAknQueryDialog
       
  1029         *
       
  1030         */
       
  1031         void DeployFlagsL();
       
  1032 
       
  1033         static TInt StaticPictographCallBack( TAny* aPtr );
       
  1034         void PictographCallBack();
       
  1035 
       
  1036     protected:
       
  1037         // editors
       
  1038         CAknIpFieldEditor*      iIpEditor;
       
  1039         CEikFixedPointEditor*   iFixedPointEditor;
       
  1040     private:
       
  1041 
       
  1042         TAny*                   iSpare_1;
       
  1043         TAny*                   iSpare_2;
       
  1044     };
       
  1045 
       
  1046 
       
  1047 #endif