epoc32/include/mw/aknquerycontrol.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     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 "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:  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          * Callback for pin code timeouts for producing a tacticons.
   723          *
   724          * @param aThis Pointer to this object, which is used to 
   725          * play tacticon.
   726          */
   727         static TInt PinCodeTimeoutCallback( TAny* aThis );
   728         
   729         /**
   730          * Plays a tacticon. Used by the timeout callback.
   731          */
   732         void PlayPinCodeTacticon();
   733 
   734         /**
   735          * Resets the timer for pincode query tacticon playback.
   736          */
   737         void ResetPinCodeTacticonTimer();
   738 
   739         /**
   740          * Stops/removes the timer for pincode query tacticon playback.
   741          */
   742         void StopPinCodeTacticonTimer();
   743 
   744     private:
   745         /**
   746         * From CAknControl
   747         */
   748         IMPORT_C void* ExtensionInterface( TUid aInterface );
   749 	protected:
   750 		CAknLocationEditor *&LocationEd();
   751 		CAknLocationEditor *LocationEd() const;
   752     
   753     public:       
   754         /**
   755         *   Return prompt needed by FEP to query dialog
   756         */
   757         void GetCaption( TDes& aCaption ) const;
   758         
   759         /**
   760         * Sets the ECS CBA visibility in the query.
   761         * 
   762         * TBool  aVisible  @c ETrue if an ECS number is entered to the
   763         *                  query, @c EFalse otherwise.
   764         */ 
   765         void SetEcsCbaVisibleL( TBool aVisible );
   766         
   767         /**
   768         * Attempts to make an emergency call if a valid emergency
   769         * number has been entered to the query.
   770         */
   771         void AttemptEmergencyCallL();
   772         
   773     protected:
   774         /// Control for prompt text
   775         CAknTextControl*  iPrompt;
   776         /// Editor indicator icons 
   777         CAknQueryEditIndicator*  iEditIndicator;
   778         /// Edwin editor
   779         CEikEdwin*               iEdwin;
   780         /// Date editor
   781         CEikDateEditor*          iDateEdwin;
   782         /// Time editor
   783         CEikTimeEditor*          iTimeEdwin;
   784         /// Duration editor
   785         CEikDurationEditor*      iDurationEdwin;
   786         /// Secret editor
   787         CEikSecretEditor*        iSecretEd;
   788         /// Integer editor
   789         CAknIntegerEdwin*        iNumberEdwin; 
   790         /// Numeric secret editor
   791         CAknNumericSecretEditor* iPinEdwin;
   792         // Floating point editor
   793         CEikFloatingPointEditor* iFloatingPointEditor;
   794         // Image
   795         CEikImage*               iImage;
   796         /// Control id
   797         TInt                     iControl;
   798         // Layoutrect for Mfne
   799         TAknLayoutRect           iLayoutMfne;
   800         // Emergency call detector
   801         CAknEcsDetector*         iEcsDetector;
   802         // Emergency call observer
   803         TAknQueryEcsObserver*    iEcsObserver;
   804         // Flags for emergency call support and other things
   805         TBitFlags16              iFlags;
   806         TUint16                  iSpare_1; // padding
   807         // Animation
   808         CAknBitmapAnimation*     iAnimation;
   809         // Pointer to query control observer
   810         MAknQueryControlObserver* iQueryControlObserver;
   811         // Query type
   812         TInt                      iQueryType;
   813         // Layout rect for editor's vertical shadow
   814         TAknLayoutRect            iEditorVerShadow;
   815         // Layout rect for editor's horizontal shadow
   816         TAknLayoutRect            iEditorHorShadow;
   817         // Layout rect for editor's frame
   818         TAknLayoutRect            iEditorFrame;
   819     
   820         TInt       iNumberOfEditorLines; ///Maximum number of lines in the editor
   821 
   822         TBool      iHasEditor;   //False for confirmation queries (default), 
   823                                  //true for all other queries 
   824 
   825         CArrayFixFlat<TInt>* iLineWidths; ///Widths of prompt lines (in pixels)
   826         
   827         CAknButton* iIncreaseValueButton;  //Reserved for plus button for MFNE editors
   828         CAknButton* iDecreaseValueButton;  //Reserved for minus button for MFNE editors
   829 
   830         TSize iDialogSize;                 // Dialog size
   831 	private:
   832 		CAknQueryControlExtension *iExtension;
   833     private:
   834         TInt iSpare[1];
   835     };
   836 
   837 
   838 
   839 /**
   840  * The extended control for a query dialog.
   841  * ip and fixed point editors
   842  *
   843  * Manage layout of elements in a query dialog:- the text, the image 
   844  * and the editors.
   845  *
   846  * @see CAknQueryDialog, CAknText
   847  * @since 2.1
   848  */ 
   849 
   850 class CAknExtQueryControl : public CAknQueryControl
   851     {
   852     
   853     public:  // Constructors and destructor
   854 
   855         /**
   856          * C++ Constructor.
   857          */
   858         IMPORT_C CAknExtQueryControl();
   859 
   860         /**
   861          * C++ Destructor.
   862          */
   863         IMPORT_C virtual ~CAknExtQueryControl();      
   864 
   865     public: //New functions
   866 
   867         /**
   868         * Get ip address from ip editor.
   869         * 
   870         * @return Returns data from editor
   871         */
   872         IMPORT_C TInetAddr GetInetAddress() const;
   873 
   874         /**
   875         * Set ip address to editor
   876         * 
   877         * @param aInetAddress to editor.
   878         */
   879         IMPORT_C void SetInetAddress(TInetAddr& aInetAddress);
   880 
   881         /**
   882         * Get number from fixed point editor.
   883         * 
   884         * @return Returns number from editor
   885         */
   886         IMPORT_C TInt GetFixedPointNumber() const;
   887 
   888          /**
   889         * Set number to fixed point editor
   890         * @param aNumber    Number to editor
   891         *
   892         */
   893         IMPORT_C void SetFixedPointNumberL(const TInt* aNumber);
   894 
   895 
   896     public: // from CAknQueryControl
   897 
   898         /**
   899         * Set minimum and maximum ip address to editor
   900         * @param aMinimum   Minimum value 
   901         * @param aMaximum   Maximum value
   902         * 
   903         */
   904         IMPORT_C void SetMinimumAndMaximum(const TInetAddr& aMinimumAddress, const TInetAddr& aMaximumAddress);
   905 
   906         /**
   907         * Set minimum and maximum fixed point number to editor
   908         * @param aMinimumValue   Minimum value
   909         * @param aMaximumValue   Maximum value
   910         */
   911         IMPORT_C void SetMinimumAndMaximum(TInt aMinimumValue, TInt aMaximumValue);
   912 
   913 
   914         /**
   915         * Get pointer to query controls control (editor)
   916         *
   917         * @param aLayout    Controls layout (for one line queries use
   918         *                   EDataLayout, ECodeLayout... and for
   919         *                   multiline queries use
   920         *                   EMultiDataFirstEdwin, EMultiDataSecondEdwin...)
   921         * @return           Pointer to control, NULL if not found 
   922         */
   923         IMPORT_C virtual CCoeControl* ControlByLayoutOrNull(TInt aLayout);
   924 
   925         /**
   926         *   @return true if the content of the editor is valid, false otherwise
   927         */
   928         TBool EditorContentIsValidL() const;
   929 
   930         /**
   931         * This transfers CAknQueryControl's flags set by the dialog and then uses them.
   932         * The method must be called after all the contained controls are constructed;
   933         * Inside PreLayoutDynamicInitL is recommended.
   934         * 
   935         * @param flag pattern to set and then act on.
   936         */
   937         void SetAndUseFlagsL( TBitFlags16 aFlags );
   938 
   939     public: // Functions from CCoeControl
   940 
   941         /**
   942         * From CCoeControl  Added to pass-through focus-loss warnings.
   943         *                   if not ready, this will leave.
   944         * @return           Indicates whether or not the key event was used by this control.
   945         */
   946         void PrepareForFocusLossL();
   947 
   948         /**
   949         * From CCoeControl  Added to pass-through focus-loss warnings.
   950         *                   if not ready, this will leave.
   951         * @return           Indicates whether or not the key event was used by this control.
   952         */
   953         void FocusChanged(TDrawNow aDrawNow);
   954         
   955 
   956     public:// Functions from MCoeControlObserver
   957 
   958         /**
   959         * From MCoeControlObserver
   960         * @param aControl   Control who caused the event
   961         * @param aEventType Type of the event
   962         */
   963         IMPORT_C void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
   964 
   965     
   966     public:// Functions from CCoeControl
   967         /**
   968         * From CCoeControl  Count number of controls contained in a compound control.  
   969         *  
   970         * @return           The number of component controls contained by this control.           
   971         */
   972         TInt CountComponentControls() const;
   973 
   974         /**
   975         * From CCoeControl  Get the components of a compound control.
   976         *                   It returns one of the control's component controls, identified by aIndex.
   977         * @param anIndex    The index of the control to get.        
   978         * @return           The component control with an index of aIndex.
   979         */
   980         CCoeControl* ComponentControl(TInt anIndex) const;
   981 
   982     	/**
   983     	* From CCoeControl. Handles pointer event.
   984     	* @param aPointerEvent Pointer event to be handled.
   985     	*/
   986     	IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);    
   987 
   988     public:
   989         /**
   990          * Manage indexes into LAF tables
   991          */
   992         class TIndex 
   993         {   
   994         public:     
   995             TIndex(TInt aNumberOfPromptLines);  
   996         
   997         public: 
   998             TInt PromptLine() const;    
   999             
  1000         public: 
  1001             TInt DQPWindowTextsLine2(TInt aLineNum) const;  
  1002             TInt PNWindow() const;  
  1003             TInt PQDWindow(TInt aLineNum) const;    
  1004             
  1005         private:    
  1006             void SelfTest() const;  
  1007 
  1008         private:    
  1009             TInt  iNumberOfPromptLines; 
  1010         };  
  1011 
  1012 
  1013     protected:
  1014         
  1015         /**
  1016          * After having read the query type from resource. This method is
  1017          * called in CostructFromResourceL()
  1018          *
  1019          * @see ConstructFromResourceL()
  1020          */
  1021         virtual void ConstructQueryL(TResourceReader& aRes);
  1022 
  1023     protected:
  1024                 
  1025         /**
  1026          * Layout the text editor
  1027          */
  1028         virtual void LayoutEditor(const TLayoutMethod& aLayoutM);
  1029 
  1030     private:
  1031 
  1032         /**
  1033         * From CAknControl
  1034         */
  1035         IMPORT_C void* ExtensionInterface( TUid aInterface );        
  1036 
  1037     private:
  1038 
  1039         /**
  1040         * This transfers CAknQueryControl's flags set by the dialog
  1041         * 
  1042         * @param flag pattern to set 
  1043         *
  1044         */
  1045         void SetFlags( TBitFlags16 aFlags );
  1046 
  1047         /** 
  1048         * This acts on the Query control flags that are set from CAknQueryDialog
  1049         *
  1050         */
  1051         void DeployFlagsL();
  1052 
  1053         static TInt StaticPictographCallBack( TAny* aPtr );
  1054         void PictographCallBack();
  1055 
  1056     protected:
  1057         // editors
  1058         CAknIpFieldEditor*      iIpEditor;
  1059         CEikFixedPointEditor*   iFixedPointEditor;
  1060     private:
  1061 
  1062         TAny*                   iSpare_1;
  1063         TAny*                   iSpare_2;
  1064     };
  1065 
  1066 
  1067 #endif