aknquerycontrol.h

Go to the documentation of this file.
00001 /*
00002 * ============================================================================
00003 *  Name     : CAknQueryControl.h
00004 *  Part of  : Avkon
00005 *
00006 *  Description:
00007 *   Implementation of Query control and List query control.
00008 *  Version:
00009 *
00010 *  Copyright © 2002 Nokia Corporation.
00011 *  This material, including documentation and any related 
00012 *  computer programs, is protected by copyright controlled by 
00013 *  Nokia Corporation. All rights are reserved. Copying, 
00014 *  including reproducing, storing,  adapting or translating, any 
00015 *  or all of this material requires the prior written consent of 
00016 *  Nokia Corporation. This material also contains confidential 
00017 *  information which may not be disclosed to others without the 
00018 *  prior written consent of Nokia Corporation.
00019 * ============================================================================
00020 */
00021    
00022 #ifndef AKNQUERYCONTROL_H
00023 #define AKNQUERYCONTROL_H
00024 
00025 //  INCLUDES
00026 #include <AknControl.h>
00027 #include <gulbordr.h>
00028 
00029 #include <eikedwin.h>
00030 #include <eikseced.h>
00031 #include <eikmfne.h>
00032 #include <aknnumseced.h>
00033 #include <aknnumedwin.h>
00034 #include <eikfpne.h>
00035 
00036 #include <eikimage.h>   
00037 #include <eikedwob.h>
00038 
00039 #include <aknutils.h>
00040 #include <aknPanic.h>
00041 
00042 #include <aknipfed.h>
00043 #include <lbsposition.h>
00044 
00045 //  FORWARD DECLARATIONS
00046 class CAknQueryControl;
00047 class TAknQueryEcsObserver;
00048 class CAknEcsDetector;
00049 class CAknBitmapAnimation;
00050 class CAknTextControl;
00051 class CAknQueryEditIndicator;
00052 class MLAFIndex;
00053 class MAknEditingStateIndicator;
00054 class TInetAddr;
00055 class CAknQueryExtension;
00056 class TAknWindowLineLayout;
00057 class CAknButton;
00058 class CAknQueryControlExtension;
00059 class CAknLocationEditor;
00064 class MAknQueryControlObserver
00065     {
00066 public:
00070     enum TQueryControlEvent
00071         {
00072         EQueryControltSizeChanging,
00073         EQueryControlEditorStateChanging,
00074         EEmergencyCallAttempted
00075         };
00076 
00080     enum TQueryValidationStatus
00081         {
00082         EEditorValueValid = KErrNone,
00083         EEditorValueTooSmall,
00084         EEditorValueTooLarge,
00085         EEditorValueNotParsed,
00086         EEditorEmpty
00087         };
00088 
00089 public:
00093     virtual TBool HandleQueryEditorSizeEventL(CAknQueryControl* aQueryControl, TQueryControlEvent aEventType)=0;
00097     virtual TBool HandleQueryEditorStateEventL(CAknQueryControl* aQueryControl, TQueryControlEvent aEventType, TQueryValidationStatus aStatus)=0;
00098     };
00099 
00108 class CAknQueryControl : public CAknControl , public MEikEdwinObserver , public MEikEdwinSizeObserver , public MCoeControlObserver
00109     {
00110 public:
00111 
00112         DECLARE_TYPE_ID(0x10283143)    
00113     
00114     public:
00121         enum TQueryControlFlagBitIndices
00122             {
00123             EEmergencyCallsEnabledByAPI,
00124             EEmergencyCallsDisabledByAPI,
00125             EPredictiveTextEntryPermitted,
00126             EEditorIndicatorOff
00127             };
00128 
00134         enum TLayoutMethod 
00135             {
00136             EConfQueryLayoutM,             
00137             EDataQueryLayoutM,             
00138             ECodeQueryLayoutM,             
00139             ETimeQueryLayoutM,             
00140             EDateQueryLayoutM,             
00141             ECombinedCodeDataQueryLayoutM  
00142             };
00143 
00144     public:  // Constructors and destructor
00145 
00149         IMPORT_C CAknQueryControl();
00150 
00154         IMPORT_C virtual ~CAknQueryControl();
00155 
00162         IMPORT_C void ConstructFromResourceL(TResourceReader& aRes);
00163 
00164     public: // New functions
00165 
00171         IMPORT_C void SetQueryControlObserver(MAknQueryControlObserver* aQueryControlObserver);
00172 
00178         IMPORT_C virtual void ReadPromptL(TResourceReader& aRes);
00179 
00185         IMPORT_C virtual void SetPromptL(const TDesC& aDesC);
00186 
00192         IMPORT_C void GetText(TDes& aDes) const;
00193 
00199         IMPORT_C TTime GetTime() const;
00200 
00206         IMPORT_C TInt GetNumber() const;
00207 
00213         IMPORT_C TReal GetFloatingPointNumberL() const;
00214 
00220         IMPORT_C TTimeIntervalSeconds GetDuration() const;
00221 
00222 
00229             IMPORT_C void GetLocation(TPosition &aLocation) const;
00230 
00236         IMPORT_C void SetTextL(const TDesC& aDesC);
00237 
00243         IMPORT_C void SetTime(TTime& aTime);
00244 
00250         IMPORT_C void SetDuration(TTimeIntervalSeconds& aDuration);
00251 
00257         IMPORT_C void SetNumberL(TInt aNumber);
00258 
00264         IMPORT_C void SetFloatingPointNumberL(const TReal* aNumber);
00265 
00277                 IMPORT_C void SetLocation(const TPosition &aLocation);
00278 
00284         IMPORT_C void SetTextEntryLength(TInt aLength);
00285 
00290         IMPORT_C TInt GetTextEntryLength() const;
00291 
00298         IMPORT_C void SetMinimumAndMaximum(const TTime& aMinimum, const TTime& aMaximum);
00299 
00305         IMPORT_C void SetMinimumAndMaximum(const TTimeIntervalSeconds& aMinimumDuration, const TTimeIntervalSeconds& aMaximumDuration);
00306 
00312         IMPORT_C void SetMinimumAndMaximum(TInt aMinimumValue, TInt aMaximumValue);
00313 
00314 
00318         IMPORT_C TBool CheckNumber();
00319         
00325         IMPORT_C void SetNumberOfEditorLines(TInt aNum);
00326 
00332         IMPORT_C void SetMinimumAndMaximum(const TReal& aMinimumValue, const TReal& aMaximumValue);
00338         IMPORT_C TInt GetTextLength() const;
00339 
00346         IMPORT_C TInt NbrOfEditorLines() const;
00347 
00348 
00354         IMPORT_C TInt NbrOfPromptLines() const;
00355 
00365         IMPORT_C virtual CCoeControl* ControlByLayoutOrNull(TInt aLayout);
00366 
00371         IMPORT_C void SetImageL(CEikImage* aImage);
00372 
00376         IMPORT_C void SetImageL(const TDesC& aImageFile,
00377                                 TInt aBmpId, TInt aBmpMaskId);
00382         IMPORT_C void SetAnimationL(TInt aResource);
00383 
00388         IMPORT_C void StartAnimationL();
00389 
00395         IMPORT_C TInt CancelAnimation();
00396 
00401         void CancelQueryL();
00402 
00406         TBool EditorContentIsValidL() const;
00407 
00415         void SetAndUseFlagsL( TBitFlags16 aFlags );
00416 
00417     public: // Functions from CCoeControl
00418     
00427         IMPORT_C TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType);
00428 
00434         IMPORT_C TSize MinimumSize();
00435 
00441         void PrepareForFocusLossL();
00442 
00448         void FocusChanged(TDrawNow aDrawNow);
00449         
00456         IMPORT_C void HandleEdwinEventL(CEikEdwin* aEdwin,TEdwinEvent aEventType);
00457 
00458     public:// Functions from MEikEdwinSizeObserver
00459 
00467         IMPORT_C TBool HandleEdwinSizeEventL(CEikEdwin* aEdwin, TEdwinSizeEvent aEventType, TSize aDesirableEdwinSize);
00468 
00469     public:// Functions from MCoeControlObserver
00470 
00476         IMPORT_C void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
00477 
00478     public:
00488         inline TInt QueryType() const { return iQueryType; } 
00489 
00494         virtual void WindowLayout( TAknWindowLineLayout& aLayout ) const;
00495     
00496     public:// Functions from CCoeControl
00502         TInt CountComponentControls() const;
00503 
00510         CCoeControl* ComponentControl(TInt anIndex) const;
00511 
00516         IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00517         
00518         IMPORT_C void HandleResourceChange(TInt aType); 
00519 
00520     public:
00524         class TIndex 
00525         {   
00526         public:     
00527             TIndex(TInt aNumberOfPromptLines);  
00528         
00529         public: 
00530             TInt PromptLine() const;    
00531             
00532         public: 
00533             TInt DQPWindowTextsLine2(TInt aLineNum) const;  
00534             TInt PNWindow() const;  
00535             TInt PQDWindow(TInt aLineNum) const;    
00536             TInt PQCWindow() const;
00537             
00538         private:    
00539             void SelfTest() const;  
00540 
00541         private:    
00542             TInt  iNumberOfPromptLines; 
00543         };  
00544 
00545     protected:
00551         void SizeChanged();
00552 
00558         void Draw(const TRect& aRect) const;
00559 
00563         TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
00564 
00569         void Layout();
00570 
00571     protected:
00575         virtual void SetLineWidthsL();
00576 
00583         virtual void ConstructQueryL(TResourceReader& aRes);
00584 
00588         virtual TRect LayoutRect();
00589 
00595         TRect DialogRect() const;
00596 
00601         TSize DialogSize() const;
00602         
00608         void DialogSizeChanged();
00609 
00610     protected:
00614         virtual void LayoutPrompt(const TLayoutMethod& aLayoutM);
00615 
00619         virtual void LayoutImageOrAnim(const TLayoutMethod& aLayoutM);
00620         
00624         virtual void LayoutEditor(const TLayoutMethod& aLayoutM);
00625 
00629         virtual void LayoutEditorFrame(const TLayoutMethod& aLayoutM);
00630 
00634         virtual void LayoutEditorIndicator(const TLayoutMethod& aLayoutM);
00635 
00636     protected:
00637 
00641         CAknQueryExtension* QueryExtension() const;
00642 
00646         void DrawEditorFrame(CWindowGc& aGc,TRect& aRect) const;
00647     
00648     private:        
00649 
00656         void SetFlags( TBitFlags16 aFlags );
00657 
00662         void DeployFlagsL();
00663 
00668         void DoSetPromptL();
00669 
00670         static TInt StaticPictographCallBack( TAny* aPtr );
00671         void PictographCallBack();
00672 
00673     private:
00677         IMPORT_C void* ExtensionInterface( TUid aInterface );
00678         protected:
00679                 CAknLocationEditor *&LocationEd();
00680                 CAknLocationEditor *LocationEd() const;
00681     protected:
00683         CAknTextControl*  iPrompt;
00685         CAknQueryEditIndicator*  iEditIndicator;
00687         CEikEdwin*               iEdwin;
00689         CEikDateEditor*          iDateEdwin;
00691         CEikTimeEditor*          iTimeEdwin;
00693         CEikDurationEditor*      iDurationEdwin;
00695         CEikSecretEditor*        iSecretEd;
00697         CAknIntegerEdwin*        iNumberEdwin; 
00699         CAknNumericSecretEditor* iPinEdwin;
00700         // Floating point editor
00701         CEikFloatingPointEditor* iFloatingPointEditor;
00702         // Image
00703         CEikImage*               iImage;
00705         TInt                     iControl;
00706         // Layoutrect for Mfne
00707         TAknLayoutRect           iLayoutMfne;
00708         // Emergency call detector
00709         CAknEcsDetector*         iEcsDetector;
00710         // Emergency call observer
00711         TAknQueryEcsObserver*    iEcsObserver;
00712         // Flags for emergency call support and other things
00713         TBitFlags16              iFlags;
00714         TUint16                  iSpare_1; // padding
00715         // Animation
00716         CAknBitmapAnimation*     iAnimation;
00717         // Pointer to query control observer
00718         MAknQueryControlObserver* iQueryControlObserver;
00719         // Query type
00720         TInt                      iQueryType;
00721         // Layout rect for editor's vertical shadow
00722         TAknLayoutRect            iEditorVerShadow;
00723         // Layout rect for editor's horizontal shadow
00724         TAknLayoutRect            iEditorHorShadow;
00725         // Layout rect for editor's frame
00726         TAknLayoutRect            iEditorFrame;
00727     
00728         TInt       iNumberOfEditorLines; 
00729 
00730         TBool      iHasEditor;   //False for confirmation queries (default), 
00731                                  //true for all other queries 
00732 
00733         CArrayFixFlat<TInt>* iLineWidths; 
00734         
00735         CAknButton* iIncreaseValueButton;  //Reserved for plus button for MFNE editors
00736         CAknButton* iDecreaseValueButton;  //Reserved for minus button for MFNE editors
00737 
00738         TSize iDialogSize;                 // Dialog size
00739         private:
00740                 CAknQueryControlExtension *iExtension;
00741     private:
00742         TInt iSpare[1];
00743     };
00744 
00745 
00746 
00758 class CAknExtQueryControl : public CAknQueryControl
00759     {
00760     
00761     public:  // Constructors and destructor
00762 
00766         IMPORT_C CAknExtQueryControl();
00767 
00771         IMPORT_C virtual ~CAknExtQueryControl();      
00772 
00773     public: //New functions
00774 
00780         IMPORT_C TInetAddr GetInetAddress() const;
00781 
00787         IMPORT_C void SetInetAddress(TInetAddr& aInetAddress);
00788 
00794         IMPORT_C TInt GetFixedPointNumber() const;
00795 
00801         IMPORT_C void SetFixedPointNumberL(const TInt* aNumber);
00802 
00803 
00804     public: // from CAknQueryControl
00805 
00812         IMPORT_C void SetMinimumAndMaximum(const TInetAddr& aMinimumAddress, const TInetAddr& aMaximumAddress);
00813 
00819         IMPORT_C void SetMinimumAndMaximum(TInt aMinimumValue, TInt aMaximumValue);
00820 
00821 
00831         IMPORT_C virtual CCoeControl* ControlByLayoutOrNull(TInt aLayout);
00832 
00836         TBool EditorContentIsValidL() const;
00837 
00845         void SetAndUseFlagsL( TBitFlags16 aFlags );
00846 
00847     public: // Functions from CCoeControl
00848 
00854         void PrepareForFocusLossL();
00855 
00861         void FocusChanged(TDrawNow aDrawNow);
00862         
00863 
00864     public:// Functions from MCoeControlObserver
00865 
00871         IMPORT_C void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
00872 
00873     
00874     public:// Functions from CCoeControl
00880         TInt CountComponentControls() const;
00881 
00888         CCoeControl* ComponentControl(TInt anIndex) const;
00889 
00894         IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);    
00895 
00896     public:
00900         class TIndex 
00901         {   
00902         public:     
00903             TIndex(TInt aNumberOfPromptLines);  
00904         
00905         public: 
00906             TInt PromptLine() const;    
00907             
00908         public: 
00909             TInt DQPWindowTextsLine2(TInt aLineNum) const;  
00910             TInt PNWindow() const;  
00911             TInt PQDWindow(TInt aLineNum) const;    
00912             
00913         private:    
00914             void SelfTest() const;  
00915 
00916         private:    
00917             TInt  iNumberOfPromptLines; 
00918         };  
00919 
00920 
00921     protected:
00922         
00929         virtual void ConstructQueryL(TResourceReader& aRes);
00930 
00931     protected:
00932                 
00936         virtual void LayoutEditor(const TLayoutMethod& aLayoutM);
00937 
00938     private:
00939 
00943         IMPORT_C void* ExtensionInterface( TUid aInterface );        
00944 
00945     private:
00946 
00953         void SetFlags( TBitFlags16 aFlags );
00954 
00959         void DeployFlagsL();
00960 
00961         static TInt StaticPictographCallBack( TAny* aPtr );
00962         void PictographCallBack();
00963 
00964     protected:
00965         // editors
00966         CAknIpFieldEditor*      iIpEditor;
00967         CEikFixedPointEditor*   iFixedPointEditor;
00968     private:
00969 
00970         TAny*                   iSpare_1;
00971         TAny*                   iSpare_2;
00972     };
00973 
00974 
00975 #endif

Copyright © Nokia Corporation 2001-2008
Back to top