AknQueryControl.h

Go to the documentation of this file.
00001 /*
00002 * ============================================================================
00003 *  Name        : AknQueryControl.h
00004 *  Part of     : UI Framework Core / AVKON
00005 *  Description : Implementation of Query control and List query control.
00006 *  Version     : %version: tr1s60#29.1.1 %
00007 *
00008 *  Copyright © 2002-2008 Nokia.  All rights reserved.
00009 *  This material, including documentation and any related computer
00010 *  programs, is protected by copyright controlled by Nokia.  All
00011 *  rights are reserved.  Copying, including reproducing, storing,
00012 *  adapting or translating, any or all of this material requires the
00013 *  prior written consent of Nokia.  This material also contains
00014 *  confidential information which may not be disclosed to others
00015 *  without the prior written consent of Nokia.
00016 * ============================================================================
00017 */
00018 
00019 #ifndef AKNQUERYCONTROL_H
00020 #define AKNQUERYCONTROL_H
00021 
00022 //  INCLUDES
00023 #include <akncontrol.h>
00024 #include <gulbordr.h>
00025 
00026 #include <eikedwin.h>
00027 #include <eikseced.h>
00028 #include <eikmfne.h>
00029 #include <aknnumseced.h>
00030 #include <aknnumedwin.h>
00031 #include <eikfpne.h>
00032 
00033 #include <eikimage.h>   
00034 #include <eikedwob.h>
00035 
00036 #include <aknutils.h>
00037 #include <aknpanic.h>
00038 
00039 #include <aknipfed.h>
00040 #include <lbsposition.h>
00041 
00042 //  FORWARD DECLARATIONS
00043 class CAknQueryControl;
00044 class TAknQueryEcsObserver;
00045 class CAknEcsDetector;
00046 class CAknBitmapAnimation;
00047 class CAknTextControl;
00048 class CAknQueryEditIndicator;
00049 class MLAFIndex;
00050 class MAknEditingStateIndicator;
00051 class TInetAddr;
00052 class CAknQueryExtension;
00053 class TAknWindowLineLayout;
00054 class CAknButton;
00055 class CAknQueryControlExtension;
00056 class CAknLocationEditor;
00061 class MAknQueryControlObserver
00062     {
00063 public:
00067     enum TQueryControlEvent
00068         {
00069         EQueryControltSizeChanging,
00070         EQueryControlEditorStateChanging,
00071         EEmergencyCallAttempted
00072         };
00073 
00077     enum TQueryValidationStatus
00078         {
00079         EEditorValueValid = KErrNone,
00080         EEditorValueTooSmall,
00081         EEditorValueTooLarge,
00082         EEditorValueNotParsed,
00083         EEditorEmpty
00084         };
00085 
00086 public:
00090     virtual TBool HandleQueryEditorSizeEventL(CAknQueryControl* aQueryControl, TQueryControlEvent aEventType)=0;
00094     virtual TBool HandleQueryEditorStateEventL(CAknQueryControl* aQueryControl, TQueryControlEvent aEventType, TQueryValidationStatus aStatus)=0;
00095     };
00096 
00105 class CAknQueryControl : public CAknControl , public MEikEdwinObserver , public MEikEdwinSizeObserver , public MCoeControlObserver
00106     {
00107 public:
00108 
00109         DECLARE_TYPE_ID(0x10283143)    
00110     
00111     public:
00118         enum TQueryControlFlagBitIndices
00119             {
00122             EEmergencyCallsEnabledByAPI,
00125             EEmergencyCallsDisabledByAPI,
00128             EPredictiveTextEntryPermitted,
00131             EEditorIndicatorOff,
00136             EEmergencyCallsCBASupport
00137             };
00138 
00144         enum TLayoutMethod 
00145             {
00146             EConfQueryLayoutM,             
00147             EDataQueryLayoutM,             
00148             ECodeQueryLayoutM,             
00149             ETimeQueryLayoutM,             
00150             EDateQueryLayoutM,             
00151             ECombinedCodeDataQueryLayoutM  
00152             };
00153 
00154     public:  // Constructors and destructor
00155 
00159         IMPORT_C CAknQueryControl();
00160 
00164         IMPORT_C virtual ~CAknQueryControl();
00165 
00172         IMPORT_C void ConstructFromResourceL(TResourceReader& aRes);
00173 
00174     public: // New functions
00175 
00181         IMPORT_C void SetQueryControlObserver(MAknQueryControlObserver* aQueryControlObserver);
00182 
00188         IMPORT_C virtual void ReadPromptL(TResourceReader& aRes);
00189 
00195         IMPORT_C virtual void SetPromptL(const TDesC& aDesC);
00196 
00202         IMPORT_C void GetText(TDes& aDes) const;
00203 
00209         IMPORT_C TTime GetTime() const;
00210 
00216         IMPORT_C TInt GetNumber() const;
00217 
00223         IMPORT_C TReal GetFloatingPointNumberL() const;
00224 
00230         IMPORT_C TTimeIntervalSeconds GetDuration() const;
00231 
00232 
00239             IMPORT_C void GetLocation(TPosition &aLocation) const;
00240 
00246         IMPORT_C void SetTextL(const TDesC& aDesC);
00247 
00253         IMPORT_C void SetTime(TTime& aTime);
00254 
00260         IMPORT_C void SetDuration(TTimeIntervalSeconds& aDuration);
00261 
00267         IMPORT_C void SetNumberL(TInt aNumber);
00268 
00274         IMPORT_C void SetFloatingPointNumberL(const TReal* aNumber);
00275 
00287                 IMPORT_C void SetLocation(const TPosition &aLocation);
00288 
00294         IMPORT_C void SetTextEntryLength(TInt aLength);
00295 
00300         IMPORT_C TInt GetTextEntryLength() const;
00301 
00308         IMPORT_C void SetMinimumAndMaximum(const TTime& aMinimum, const TTime& aMaximum);
00309 
00315         IMPORT_C void SetMinimumAndMaximum(const TTimeIntervalSeconds& aMinimumDuration, const TTimeIntervalSeconds& aMaximumDuration);
00316 
00322         IMPORT_C void SetMinimumAndMaximum(TInt aMinimumValue, TInt aMaximumValue);
00323 
00324 
00328         IMPORT_C TBool CheckNumber();
00329         
00335         IMPORT_C void SetNumberOfEditorLines(TInt aNum);
00336 
00342         IMPORT_C void SetMinimumAndMaximum(const TReal& aMinimumValue, const TReal& aMaximumValue);
00348         IMPORT_C TInt GetTextLength() const;
00349 
00356         IMPORT_C TInt NbrOfEditorLines() const;
00357 
00358 
00364         IMPORT_C TInt NbrOfPromptLines() const;
00365 
00375         IMPORT_C virtual CCoeControl* ControlByLayoutOrNull(TInt aLayout);
00376 
00381         IMPORT_C void SetImageL(CEikImage* aImage);
00382 
00386         IMPORT_C void SetImageL(const TDesC& aImageFile,
00387                                 TInt aBmpId, TInt aBmpMaskId);
00392         IMPORT_C void SetAnimationL(TInt aResource);
00393 
00398         IMPORT_C void StartAnimationL();
00399 
00405         IMPORT_C TInt CancelAnimation();
00406 
00411         void CancelQueryL();
00412 
00416         TBool EditorContentIsValidL() const;
00417 
00425         void SetAndUseFlagsL( TBitFlags16 aFlags );
00426 
00427     public: // Functions from CCoeControl
00428     
00437         IMPORT_C TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType);
00438 
00444         IMPORT_C TSize MinimumSize();
00445 
00451         void PrepareForFocusLossL();
00452 
00458         void FocusChanged(TDrawNow aDrawNow);
00459         
00466         IMPORT_C void HandleEdwinEventL(CEikEdwin* aEdwin,TEdwinEvent aEventType);
00467 
00468     public:// Functions from MEikEdwinSizeObserver
00469 
00477         IMPORT_C TBool HandleEdwinSizeEventL(CEikEdwin* aEdwin, TEdwinSizeEvent aEventType, TSize aDesirableEdwinSize);
00478 
00479     public:// Functions from MCoeControlObserver
00480 
00486         IMPORT_C void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
00487 
00488     public:
00498         inline TInt QueryType() const { return iQueryType; } 
00499 
00504         virtual void WindowLayout( TAknWindowLineLayout& aLayout ) const;
00505     
00506     public:// Functions from CCoeControl
00512         TInt CountComponentControls() const;
00513 
00520         CCoeControl* ComponentControl(TInt anIndex) const;
00521 
00526         IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00527         
00528         IMPORT_C void HandleResourceChange(TInt aType); 
00529 
00530     public:
00534         class TIndex 
00535         {   
00536         public:     
00537             TIndex(TInt aNumberOfPromptLines);  
00538         
00539         public: 
00540             TInt PromptLine() const;    
00541             
00542         public: 
00543             TInt DQPWindowTextsLine2(TInt aLineNum) const;  
00544             TInt PNWindow() const;  
00545             TInt PQDWindow(TInt aLineNum) const;    
00546             TInt PQCWindow() const;
00547             
00548         private:    
00549             void SelfTest() const;  
00550 
00551         private:    
00552             TInt  iNumberOfPromptLines; 
00553         };  
00554 
00555     protected:
00561         void SizeChanged();
00562 
00568         void Draw(const TRect& aRect) const;
00569 
00573         TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
00574 
00579         void Layout();
00580 
00581     protected:
00585         virtual void SetLineWidthsL();
00586 
00593         virtual void ConstructQueryL(TResourceReader& aRes);
00594 
00598         virtual TRect LayoutRect();
00599 
00605         TRect DialogRect() const;
00606 
00611         TSize DialogSize() const;
00612         
00618         void DialogSizeChanged();
00619 
00620     protected:
00624         virtual void LayoutPrompt(const TLayoutMethod& aLayoutM);
00625 
00629         virtual void LayoutImageOrAnim(const TLayoutMethod& aLayoutM);
00630         
00634         virtual void LayoutEditor(const TLayoutMethod& aLayoutM);
00635 
00639         virtual void LayoutEditorFrame(const TLayoutMethod& aLayoutM);
00640 
00644         virtual void LayoutEditorIndicator(const TLayoutMethod& aLayoutM);
00645 
00646     protected:
00647 
00651         CAknQueryExtension* QueryExtension() const;
00652 
00656         void DrawEditorFrame(CWindowGc& aGc,TRect& aRect) const;
00657     
00658     private:        
00659 
00666         void SetFlags( TBitFlags16 aFlags );
00667 
00672         void DeployFlagsL();
00673 
00678         void DoSetPromptL();
00679 
00680         static TInt StaticPictographCallBack( TAny* aPtr );
00681         void PictographCallBack();
00682         
00688         TBool EmbeddedVirtualInput() const;
00689         
00695         CEikDialog* Dialog() const;
00696         
00701         void CreateIncAndDecButtonsL();
00702         
00707         void CreateBackspaceButtonL();
00708         
00713         void LayoutEditorForFullScreen( const TLayoutMethod& /*aLayoutM*/ );
00714         
00719         void LayoutPromptForFullScreen();
00720 
00721 
00722 
00723 
00724     private:
00728         IMPORT_C void* ExtensionInterface( TUid aInterface );
00729         protected:
00730                 CAknLocationEditor *&LocationEd();
00731                 CAknLocationEditor *LocationEd() const;
00732     
00733     public:       
00737         void GetCaption( TDes& aCaption ) const;
00738         
00745         void SetEcsCbaVisibleL( TBool aVisible );
00746         
00751         void AttemptEmergencyCallL();
00752         
00753     protected:
00755         CAknTextControl*  iPrompt;
00757         CAknQueryEditIndicator*  iEditIndicator;
00759         CEikEdwin*               iEdwin;
00761         CEikDateEditor*          iDateEdwin;
00763         CEikTimeEditor*          iTimeEdwin;
00765         CEikDurationEditor*      iDurationEdwin;
00767         CEikSecretEditor*        iSecretEd;
00769         CAknIntegerEdwin*        iNumberEdwin; 
00771         CAknNumericSecretEditor* iPinEdwin;
00772         // Floating point editor
00773         CEikFloatingPointEditor* iFloatingPointEditor;
00774         // Image
00775         CEikImage*               iImage;
00777         TInt                     iControl;
00778         // Layoutrect for Mfne
00779         TAknLayoutRect           iLayoutMfne;
00780         // Emergency call detector
00781         CAknEcsDetector*         iEcsDetector;
00782         // Emergency call observer
00783         TAknQueryEcsObserver*    iEcsObserver;
00784         // Flags for emergency call support and other things
00785         TBitFlags16              iFlags;
00786         TUint16                  iSpare_1; // padding
00787         // Animation
00788         CAknBitmapAnimation*     iAnimation;
00789         // Pointer to query control observer
00790         MAknQueryControlObserver* iQueryControlObserver;
00791         // Query type
00792         TInt                      iQueryType;
00793         // Layout rect for editor's vertical shadow
00794         TAknLayoutRect            iEditorVerShadow;
00795         // Layout rect for editor's horizontal shadow
00796         TAknLayoutRect            iEditorHorShadow;
00797         // Layout rect for editor's frame
00798         TAknLayoutRect            iEditorFrame;
00799     
00800         TInt       iNumberOfEditorLines; 
00801 
00802         TBool      iHasEditor;   //False for confirmation queries (default), 
00803                                  //true for all other queries 
00804 
00805         CArrayFixFlat<TInt>* iLineWidths; 
00806         
00807         CAknButton* iIncreaseValueButton;  //Reserved for plus button for MFNE editors
00808         CAknButton* iDecreaseValueButton;  //Reserved for minus button for MFNE editors
00809 
00810         TSize iDialogSize;                 // Dialog size
00811         private:
00812                 CAknQueryControlExtension *iExtension;
00813     private:
00814         TInt iSpare[1];
00815     };
00816 
00817 
00818 
00830 class CAknExtQueryControl : public CAknQueryControl
00831     {
00832     
00833     public:  // Constructors and destructor
00834 
00838         IMPORT_C CAknExtQueryControl();
00839 
00843         IMPORT_C virtual ~CAknExtQueryControl();      
00844 
00845     public: //New functions
00846 
00852         IMPORT_C TInetAddr GetInetAddress() const;
00853 
00859         IMPORT_C void SetInetAddress(TInetAddr& aInetAddress);
00860 
00866         IMPORT_C TInt GetFixedPointNumber() const;
00867 
00873         IMPORT_C void SetFixedPointNumberL(const TInt* aNumber);
00874 
00875 
00876     public: // from CAknQueryControl
00877 
00884         IMPORT_C void SetMinimumAndMaximum(const TInetAddr& aMinimumAddress, const TInetAddr& aMaximumAddress);
00885 
00891         IMPORT_C void SetMinimumAndMaximum(TInt aMinimumValue, TInt aMaximumValue);
00892 
00893 
00903         IMPORT_C virtual CCoeControl* ControlByLayoutOrNull(TInt aLayout);
00904 
00908         TBool EditorContentIsValidL() const;
00909 
00917         void SetAndUseFlagsL( TBitFlags16 aFlags );
00918 
00919     public: // Functions from CCoeControl
00920 
00926         void PrepareForFocusLossL();
00927 
00933         void FocusChanged(TDrawNow aDrawNow);
00934         
00935 
00936     public:// Functions from MCoeControlObserver
00937 
00943         IMPORT_C void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
00944 
00945     
00946     public:// Functions from CCoeControl
00952         TInt CountComponentControls() const;
00953 
00960         CCoeControl* ComponentControl(TInt anIndex) const;
00961 
00966         IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);    
00967 
00968     public:
00972         class TIndex 
00973         {   
00974         public:     
00975             TIndex(TInt aNumberOfPromptLines);  
00976         
00977         public: 
00978             TInt PromptLine() const;    
00979             
00980         public: 
00981             TInt DQPWindowTextsLine2(TInt aLineNum) const;  
00982             TInt PNWindow() const;  
00983             TInt PQDWindow(TInt aLineNum) const;    
00984             
00985         private:    
00986             void SelfTest() const;  
00987 
00988         private:    
00989             TInt  iNumberOfPromptLines; 
00990         };  
00991 
00992 
00993     protected:
00994         
01001         virtual void ConstructQueryL(TResourceReader& aRes);
01002 
01003     protected:
01004                 
01008         virtual void LayoutEditor(const TLayoutMethod& aLayoutM);
01009 
01010     private:
01011 
01015         IMPORT_C void* ExtensionInterface( TUid aInterface );        
01016 
01017     private:
01018 
01025         void SetFlags( TBitFlags16 aFlags );
01026 
01031         void DeployFlagsL();
01032 
01033         static TInt StaticPictographCallBack( TAny* aPtr );
01034         void PictographCallBack();
01035 
01036     protected:
01037         // editors
01038         CAknIpFieldEditor*      iIpEditor;
01039         CEikFixedPointEditor*   iFixedPointEditor;
01040     private:
01041 
01042         TAny*                   iSpare_1;
01043         TAny*                   iSpare_2;
01044     };
01045 
01046 
01047 #endif  

Copyright © Nokia Corporation 2001-2007
Back to top