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 #start_since SINCE_3_1_SDK 00044 #include <lbsposition.h> 00045 #end_since SINCE_3_1_SDK 00046 00047 // FORWARD DECLARATIONS 00048 class CAknQueryControl; 00049 class TAknQueryEcsObserver; 00050 class CAknEcsDetector; 00051 class CAknBitmapAnimation; 00052 class CAknTextControl; 00053 class CAknQueryEditIndicator; 00054 class MLAFIndex; 00055 class MAknEditingStateIndicator; 00056 class TInetAddr; 00057 class CAknQueryExtension; 00058 class TAknWindowLineLayout; 00059 class CAknButton; 00060 #start_since SINCE_3_1_SDK 00061 class CAknQueryControlExtension; 00062 class CAknLocationEditor; 00063 #end_since SINCE_3_1_SDK 00064 00068 class MAknQueryControlObserver 00069 { 00070 public: 00074 enum TQueryControlEvent 00075 { 00076 EQueryControltSizeChanging, 00077 EQueryControlEditorStateChanging, 00078 EEmergencyCallAttempted 00079 }; 00080 00084 enum TQueryValidationStatus 00085 { 00086 EEditorValueValid = KErrNone, 00087 EEditorValueTooSmall, 00088 EEditorValueTooLarge, 00089 EEditorValueNotParsed, 00090 EEditorEmpty 00091 }; 00092 00093 public: 00097 virtual TBool HandleQueryEditorSizeEventL(CAknQueryControl* aQueryControl, TQueryControlEvent aEventType)=0; 00101 virtual TBool HandleQueryEditorStateEventL(CAknQueryControl* aQueryControl, TQueryControlEvent aEventType, TQueryValidationStatus aStatus)=0; 00102 }; 00103 00112 class CAknQueryControl : public CAknControl , public MEikEdwinObserver , public MEikEdwinSizeObserver , public MCoeControlObserver 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 #start_since SINCE_3_1_SDK 00223 00230 IMPORT_C void GetLocation(TPosition &aLocation) const; 00231 #end_since SINCE_3_1_SDK 00232 00238 IMPORT_C void SetTextL(const TDesC& aDesC); 00239 00245 IMPORT_C void SetTime(TTime& aTime); 00246 00252 IMPORT_C void SetDuration(TTimeIntervalSeconds& aDuration); 00253 00259 IMPORT_C void SetNumberL(TInt aNumber); 00260 00266 IMPORT_C void SetFloatingPointNumberL(const TReal* aNumber); 00267 00268 #start_since SINCE_3_1_SDK 00269 00281 IMPORT_C void SetLocation(const TPosition &aLocation); 00282 #end_since SINCE_3_1_SDK 00283 00289 IMPORT_C void SetTextEntryLength(TInt aLength); 00290 00295 IMPORT_C TInt GetTextEntryLength() const; 00296 00303 IMPORT_C void SetMinimumAndMaximum(const TTime& aMinimum, const TTime& aMaximum); 00304 00310 IMPORT_C void SetMinimumAndMaximum(const TTimeIntervalSeconds& aMinimumDuration, const TTimeIntervalSeconds& aMaximumDuration); 00311 00317 IMPORT_C void SetMinimumAndMaximum(TInt aMinimumValue, TInt aMaximumValue); 00318 00319 00323 IMPORT_C TBool CheckNumber(); 00324 00330 IMPORT_C void SetNumberOfEditorLines(TInt aNum); 00331 00337 IMPORT_C void SetMinimumAndMaximum(const TReal& aMinimumValue, const TReal& aMaximumValue); 00343 IMPORT_C TInt GetTextLength() const; 00344 00351 IMPORT_C TInt NbrOfEditorLines() const; 00352 00353 00359 IMPORT_C TInt NbrOfPromptLines() const; 00360 00370 IMPORT_C virtual CCoeControl* ControlByLayoutOrNull(TInt aLayout); 00371 00376 IMPORT_C void SetImageL(CEikImage* aImage); 00377 00381 IMPORT_C void SetImageL(const TDesC& aImageFile, 00382 TInt aBmpId, TInt aBmpMaskId); 00387 IMPORT_C void SetAnimationL(TInt aResource); 00388 00393 IMPORT_C void StartAnimationL(); 00394 00400 IMPORT_C TInt CancelAnimation(); 00401 00406 void CancelQueryL(); 00407 00411 TBool EditorContentIsValidL() const; 00412 00420 void SetAndUseFlagsL( TBitFlags16 aFlags ); 00421 00422 public: // Functions from CCoeControl 00423 00432 IMPORT_C TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType); 00433 00439 IMPORT_C TSize MinimumSize(); 00440 00446 void PrepareForFocusLossL(); 00447 00453 void FocusChanged(TDrawNow aDrawNow); 00454 00461 IMPORT_C void HandleEdwinEventL(CEikEdwin* aEdwin,TEdwinEvent aEventType); 00462 00463 public:// Functions from MEikEdwinSizeObserver 00464 00472 IMPORT_C TBool HandleEdwinSizeEventL(CEikEdwin* aEdwin, TEdwinSizeEvent aEventType, TSize aDesirableEdwinSize); 00473 00474 public:// Functions from MCoeControlObserver 00475 00481 IMPORT_C void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); 00482 00483 public: 00493 inline TInt QueryType() const { return iQueryType; } 00494 00499 virtual void WindowLayout( TAknWindowLineLayout& aLayout ) const; 00500 00501 public:// Functions from CCoeControl 00507 TInt CountComponentControls() const; 00508 00515 CCoeControl* ComponentControl(TInt anIndex) const; 00516 00521 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); 00522 00523 #start_since SINCE_3_1_SDK 00524 00527 IMPORT_C void HandleResourceChange(TInt aType); 00528 #end_since SINCE_3_1_SDK 00529 public: 00533 class TIndex 00534 { 00535 public: 00536 TIndex(TInt aNumberOfPromptLines); 00537 00538 public: 00539 TInt PromptLine() const; 00540 00541 public: 00542 TInt DQPWindowTextsLine2(TInt aLineNum) const; 00543 TInt PNWindow() const; 00544 TInt PQDWindow(TInt aLineNum) const; 00545 TInt PQCWindow() const; 00546 00547 private: 00548 void SelfTest() const; 00549 00550 private: 00551 TInt iNumberOfPromptLines; 00552 }; 00553 00554 protected: 00560 void SizeChanged(); 00561 00567 void Draw(const TRect& aRect) const; 00568 00572 TTypeUid::Ptr MopSupplyObject(TTypeUid aId); 00573 00578 void Layout(); 00579 00580 protected: 00584 virtual void SetLineWidthsL(); 00585 00592 virtual void ConstructQueryL(TResourceReader& aRes); 00593 00597 virtual TRect LayoutRect(); 00598 00604 TRect DialogRect() const; 00605 00610 TSize DialogSize() const; 00611 00612 #start_since SINCE_3_1_SDK 00613 00619 void DialogSizeChanged(); 00620 #end_since SINCE_3_1_SDK 00621 protected: 00625 virtual void LayoutPrompt(const TLayoutMethod& aLayoutM); 00626 00630 virtual void LayoutImageOrAnim(const TLayoutMethod& aLayoutM); 00631 00635 virtual void LayoutEditor(const TLayoutMethod& aLayoutM); 00636 00640 virtual void LayoutEditorFrame(const TLayoutMethod& aLayoutM); 00641 00645 virtual void LayoutEditorIndicator(const TLayoutMethod& aLayoutM); 00646 00647 protected: 00648 00652 CAknQueryExtension* QueryExtension() const; 00653 00654 #start_since SINCE_3_1_SDK 00655 00659 void DrawEditorFrame(CWindowGc& aGc,TRect& aRect) const; 00660 #end_since SINCE_3_1_SDK 00661 00662 private: 00663 00670 void SetFlags( TBitFlags16 aFlags ); 00671 00676 void DeployFlagsL(); 00677 00682 void DoSetPromptL(); 00683 00684 static TInt StaticPictographCallBack( TAny* aPtr ); 00685 void PictographCallBack(); 00686 00687 private: 00691 IMPORT_C void* ExtensionInterface( TUid aInterface ); 00692 protected: 00693 #start_since SINCE_3_1_SDK 00694 00697 CAknLocationEditor *&LocationEd(); 00701 CAknLocationEditor *LocationEd() const; 00702 #end_since SINCE_3_1_SDK 00703 protected: 00705 CAknTextControl* iPrompt; 00707 CAknQueryEditIndicator* iEditIndicator; 00709 CEikEdwin* iEdwin; 00711 CEikDateEditor* iDateEdwin; 00713 CEikTimeEditor* iTimeEdwin; 00715 CEikDurationEditor* iDurationEdwin; 00717 CEikSecretEditor* iSecretEd; 00719 CAknIntegerEdwin* iNumberEdwin; 00721 CAknNumericSecretEditor* iPinEdwin; 00722 // Floating point editor 00723 CEikFloatingPointEditor* iFloatingPointEditor; 00724 // Image 00725 CEikImage* iImage; 00727 TInt iControl; 00728 // Layoutrect for Mfne 00729 TAknLayoutRect iLayoutMfne; 00730 // Emergency call detector 00731 CAknEcsDetector* iEcsDetector; 00732 // Emergency call observer 00733 TAknQueryEcsObserver* iEcsObserver; 00734 // Flags for emergency call support and other things 00735 TBitFlags16 iFlags; 00736 TUint16 iSpare_1; // padding 00737 // Animation 00738 CAknBitmapAnimation* iAnimation; 00739 // Pointer to query control observer 00740 MAknQueryControlObserver* iQueryControlObserver; 00741 // Query type 00742 TInt iQueryType; 00743 // Layout rect for editor's vertical shadow 00744 TAknLayoutRect iEditorVerShadow; 00745 // Layout rect for editor's horizontal shadow 00746 TAknLayoutRect iEditorHorShadow; 00747 // Layout rect for editor's frame 00748 TAknLayoutRect iEditorFrame; 00749 00750 TInt iNumberOfEditorLines; 00751 00752 TBool iHasEditor; //False for confirmation queries (default), 00753 //true for all other queries 00754 00755 CArrayFixFlat<TInt>* iLineWidths; 00756 00757 CAknButton* iIncreaseValueButton; //Reserved for plus button for MFNE editors 00758 CAknButton* iDecreaseValueButton; //Reserved for minus button for MFNE editors 00759 00760 #start_since SINCE_3_1_SDK 00761 00764 TSize iDialogSize; // Dialog size 00765 #end_since SINCE_3_1_SDK 00766 private: 00767 CAknQueryControlExtension *iExtension; 00768 private: 00769 TInt iSpare[1]; 00770 }; 00771 00772 00773 00785 class CAknExtQueryControl : public CAknQueryControl 00786 { 00787 00788 public: // Constructors and destructor 00789 00793 IMPORT_C CAknExtQueryControl(); 00794 00798 IMPORT_C virtual ~CAknExtQueryControl(); 00799 00800 public: //New functions 00801 00807 IMPORT_C TInetAddr GetInetAddress() const; 00808 00814 IMPORT_C void SetInetAddress(TInetAddr& aInetAddress); 00815 00821 IMPORT_C TInt GetFixedPointNumber() const; 00822 00828 IMPORT_C void SetFixedPointNumberL(const TInt* aNumber); 00829 00830 00831 public: // from CAknQueryControl 00832 00839 IMPORT_C void SetMinimumAndMaximum(const TInetAddr& aMinimumAddress, const TInetAddr& aMaximumAddress); 00840 00846 IMPORT_C void SetMinimumAndMaximum(TInt aMinimumValue, TInt aMaximumValue); 00847 00848 00858 IMPORT_C virtual CCoeControl* ControlByLayoutOrNull(TInt aLayout); 00859 00863 TBool EditorContentIsValidL() const; 00864 00872 void SetAndUseFlagsL( TBitFlags16 aFlags ); 00873 00874 public: // Functions from CCoeControl 00875 00881 void PrepareForFocusLossL(); 00882 00888 void FocusChanged(TDrawNow aDrawNow); 00889 00890 00891 public:// Functions from MCoeControlObserver 00892 00898 IMPORT_C void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); 00899 00900 00901 public:// Functions from CCoeControl 00907 TInt CountComponentControls() const; 00908 00915 CCoeControl* ComponentControl(TInt anIndex) const; 00916 00921 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); 00922 00923 public: 00927 class TIndex 00928 { 00929 public: 00930 TIndex(TInt aNumberOfPromptLines); 00931 00932 public: 00933 TInt PromptLine() const; 00934 00935 public: 00936 TInt DQPWindowTextsLine2(TInt aLineNum) const; 00937 TInt PNWindow() const; 00938 TInt PQDWindow(TInt aLineNum) const; 00939 00940 private: 00941 void SelfTest() const; 00942 00943 private: 00944 TInt iNumberOfPromptLines; 00945 }; 00946 00947 00948 protected: 00949 00956 virtual void ConstructQueryL(TResourceReader& aRes); 00957 00958 protected: 00959 00963 virtual void LayoutEditor(const TLayoutMethod& aLayoutM); 00964 00965 private: 00966 00970 IMPORT_C void* ExtensionInterface( TUid aInterface ); 00971 00972 private: 00973 00980 void SetFlags( TBitFlags16 aFlags ); 00981 00986 void DeployFlagsL(); 00987 00992 void DoSetPromptL(); 00993 00994 static TInt StaticPictographCallBack( TAny* aPtr ); 00995 void PictographCallBack(); 00996 00997 protected: 00998 // editors 00999 CAknIpFieldEditor* iIpEditor; 01000 CEikFixedPointEditor* iFixedPointEditor; 01001 private: 01002 01003 TAny* iSpare_1; 01004 TAny* iSpare_2; 01005 }; 01006 01007 01008 #endif