00001 /* 00002 * ============================================================================ 00003 * Name : AknSfld.h 00004 * Part of : Avkon 00005 * 00006 * Description: 00007 * Search Field support. 00008 * 00009 * Version: 00010 * 00011 * Copyright © 2002 Nokia Corporation. 00012 * This material, including documentation and any related 00013 * computer programs, is protected by copyright controlled by 00014 * Nokia Corporation. All rights are reserved. Copying, 00015 * including reproducing, storing, adapting or translating, any 00016 * or all of this material requires the prior written consent of 00017 * Nokia Corporation. This material also contains confidential 00018 * information which may not be disclosed to others without the 00019 * prior written consent of Nokia Corporation. 00020 * ============================================================================ 00021 */ 00022 00023 #ifndef __AKNSFLD_H__ 00024 #define __AKNSFLD_H__ 00025 00026 // INCLUDES 00027 #include <AknControl.h> 00028 #include <gulicon.h> 00029 #include <eikgted.h> 00030 00031 // FORWARD DECLARATIONS 00032 class CEikEdwin; 00033 class CGlobalText; 00034 class CAknInputFrame; 00035 class CAknSearchFieldIndicator; 00036 class CAknsListBoxBackgroundControlContext; 00037 class CAknsFrameBackgroundControlContext; 00038 class CEikListBox; 00039 00040 00041 // CLASS DECLARATION 00042 00049 NONSHARABLE_CLASS(CAknSearchField) : public CAknControl, 00050 public MCoeControlObserver, 00051 public MEikCommandObserver 00052 { 00053 public: 00054 00058 enum TSearchFieldStyle 00059 { 00061 ESearch, 00063 EInput, 00065 EUrl, 00067 EPhone, 00069 EPlain, 00071 EPopup, 00073 EPinb, 00075 EClockApp, 00077 EFixed, 00079 ESearchWithoutLine, 00081 EPopupWindow 00082 }; 00083 public: 00084 00088 IMPORT_C ~CAknSearchField(); 00089 00099 IMPORT_C static CAknSearchField* NewL(const CCoeControl& aParent, TSearchFieldStyle aFieldStyle, CGulIcon* aIcon, TInt aTextLimit); 00100 00101 public: // for search string manipulation 00106 IMPORT_C TInt TextLength() const; 00107 00115 IMPORT_C void GetSearchText(TDes& aSearchTxt) const; 00116 00121 IMPORT_C void SetSearchTextL(const TDesC& aSearchTxt); 00122 00126 IMPORT_C void SelectSearchTextL(); 00127 00131 IMPORT_C void ResetL(); 00132 00137 IMPORT_C void SetInfoTextL(const TDesC& aText); 00138 00143 IMPORT_C void ClipboardL(CEikEdwin::TClipboardFunc aClipboardFunc); 00144 00145 public: // new methods for Avkon Skins support 00146 00153 IMPORT_C void SetSkinEnabledL( const TBool aEnabled ); 00154 00155 public: // from MCoeControlObserver 00156 00165 void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); 00166 00167 public: // From CCoeControl 00168 00175 IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); 00176 00182 IMPORT_C TSize MinimumSize(); 00183 00184 public: 00185 00191 IMPORT_C void SetLinePos(TInt aLinePos); 00192 00198 IMPORT_C CEikEdwin& Editor() const; 00199 00200 private: // from MObjectProvider 00201 TTypeUid::Ptr MopSupplyObject(TTypeUid aId); 00202 private: 00203 TInt CountComponentControls() const; 00204 CCoeControl* ComponentControl(TInt aIndex) const; 00205 void SizeChanged(); 00206 void FocusChanged(TDrawNow aDrawNow); 00207 private: 00208 void ConstructL(const CCoeControl& aParent, TSearchFieldStyle aFieldStyle, CGulIcon* aIcon, TInt aTextLimit); 00209 CAknSearchField(); 00210 private: 00211 void ZoomEditorL(); 00212 private: // from MEikCommandObserver 00213 IMPORT_C void ProcessCommandL(TInt aCommandId); 00214 00215 private: 00216 void UpdatePopupCBAL(); 00217 void RestorePopupCBA(); 00218 void SetupSkinContextL(); 00219 public: 00220 00226 void SetListbox(CEikListBox* aListBox); 00227 00233 void SetParentCtrl(CCoeControl* aParent); 00234 00240 TBool IsPopup(); 00241 00242 #start_since SINCE_3_1_SDK 00243 00250 void SetOldItemIndex( TInt aOldItemIndex ); 00251 #end_since SINCE_3_1_SDK 00252 #start_since SINCE_3_1_SDK 00253 00260 TInt OldItemIndex(); 00261 #end_since SINCE_3_1_SDK 00262 00263 private: 00264 CEikEdwin* iEditor; 00265 CGlobalText* iGlobalText; 00266 CAknInputFrame* iInputFrame; 00267 CAknSearchFieldIndicator* iIndicator; 00268 CAknsListBoxBackgroundControlContext* iSkinContext; 00269 TInt iFlags; // was TBool iUseSkinContext; 00270 TInt iLinePos; 00271 CAknsFrameBackgroundControlContext* iInputContext; 00272 TBool iIsPopup; 00273 TBool iCBAObserverUpdated; 00274 CEikListBox *iListBox; // not owned 00275 CCoeControl *iParent; // not owned 00276 CEikButtonGroupContainer *iCba; // this is only for checking whether cba changed while we're storing modifications in it. 00277 TInt iOldItemIndex; 00278 }; 00279 00280 #endif 00281 00282