browserui/browser/FavouritesInc/BrowserAdaptiveListPopup.h
changeset 51 48e827313edd
parent 37 481242ead638
child 53 f427d27b98d8
equal deleted inserted replaced
37:481242ead638 51:48e827313edd
     1 /*
       
     2 * Copyright (c) 2006 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 the License "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:  Header file for CBrowserPopupList and CBrowserAdaptiveListPopup
       
    15 *
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef BROWSERADAPTIVELISTPOPUP_H
       
    20 #define BROWSERADAPTIVELISTPOPUP_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <aknpopuplayout.h>
       
    24 #include <AknLists.h>
       
    25 
       
    26 //for testing purposes you can define fake ahle engine
       
    27 //wich will provide random results
       
    28 // CONSTANTS
       
    29 // UID of view
       
    30 const TUid KViewId = {1};
       
    31 
       
    32 enum TParentType
       
    33     {
       
    34     EGotoPane,
       
    35     EBookmarksGotoPane
       
    36     };
       
    37 
       
    38 class CRecentUrlStore;
       
    39 
       
    40 
       
    41 class CAknsListBoxBackgroundControlContext;
       
    42 
       
    43 // CLASS DECLARATION
       
    44 class CBrowserPopupList : public CAknSingleGraphicPopupMenuStyleListBox
       
    45 {
       
    46 public :
       
    47 	CBrowserPopupList(TParentType aParentType);
       
    48     ~CBrowserPopupList();
       
    49 	
       
    50 	void SetHighLight(TBool aHighLight);
       
    51 
       
    52 	TBool HighLightEnabled();
       
    53 			
       
    54 	void ConstructL(const CCoeControl* aParent, TInt aFlags);
       
    55 
       
    56     void SizeChanged();   
       
    57     void Draw(const TRect& /*aRect*/) const;
       
    58 
       
    59 protected :
       
    60     TParentType iParentType;
       
    61     TBool iOnePartFrameBitmapUsed;
       
    62 };
       
    63 
       
    64 
       
    65 
       
    66 /**
       
    67 *  CBrowserAdaptiveListPopup view class.
       
    68 * 
       
    69 */
       
    70 class CBrowserAdaptiveListPopup : 
       
    71 	public CCoeControl, 
       
    72 	public MCoeControlObserver, public MEikListBoxObserver
       
    73 
       
    74     {
       
    75     public: // Constructors and destructor
       
    76 
       
    77         /**
       
    78 		*C++ Constructor
       
    79 		*/
       
    80 		CBrowserAdaptiveListPopup( CEikEdwin* aGotoPaneEdit, 
       
    81 		        CCoeControl* aParent, 
       
    82 		        TParentType aParentType,
       
    83 		        TBool aSearchFeature  = EFalse );
       
    84 			
       
    85 		/**
       
    86         * default constructor.
       
    87         */
       
    88         void ConstructL();
       
    89 
       
    90         /**
       
    91         * Destructor.
       
    92         */
       
    93         virtual ~CBrowserAdaptiveListPopup();
       
    94 
       
    95 
       
    96     public: // Functions from base classes
       
    97 
       
    98 		TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
    99 
       
   100 		void HidePopupL();
       
   101 
       
   102 		TBool IsInDirectoryMode();
       
   103 
       
   104 		void SetDirectoryModeL(TBool aDirMode);
       
   105 
       
   106         TBool IsOpenDirToShow();
       
   107 
       
   108         TBool IsPoppedUp();	
       
   109 		
       
   110 		void HandleResourceChange( TInt aType );
       
   111 
       
   112         void HandleResourceChangeL( TInt aType );
       
   113 
       
   114         void SetUrlSuffixList(HBufC* urlSuffixList);
       
   115 
       
   116 		void SetMaxRecentUrls (TInt maxRecentUrls);
       
   117 		
       
   118         /**
       
   119         * Sets the OrdinalPosition of GotoPane
       
   120         * @param aPos The OrdinalPosition
       
   121         */
       
   122         void SetOrdinalPosition( TInt aPos );
       
   123         /**
       
   124          * From CCoeControl.     
       
   125          * Handles pointer events
       
   126          */
       
   127         void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
   128         void HandleListBoxEventL(CEikListBox* aListBox,TListBoxEvent aEventType);
       
   129 	private: // Functions from base classes	
       
   130         
       
   131 		void HandleControlEventL(CCoeControl* aControl,enum MCoeControlObserver::TCoeEvent aEventType);		
       
   132 		
       
   133 		TInt CountComponentControls() const;
       
   134 		
       
   135 		CCoeControl* ComponentControl( TInt aIndex ) const;
       
   136 		
       
   137 		void SetIconsL();
       
   138 
       
   139 		void CreateURLCompletionListL();
       
   140 		
       
   141 	private:
       
   142 	
       
   143 	    /**
       
   144         * ShowPopupList handles displaying the adaptive list box
       
   145 		* @since 
       
   146 		* @param aRelayout Whether or not this popup list is being displayed as the result
       
   147 		* 	of a layout changed event (in which case we need to make sure that the popup 
       
   148 		*   is redrawn in the correct position) Set to EFalse by default.
       
   149         * @return void
       
   150         */
       
   151         void ShowPopupListL(TBool aRelayout = EFalse);
       
   152         void UpdateScrollBarPositionL(const TInt aPosition);
       
   153 		void HandleItemClickedL(CEikListBox* aListBox );
       
   154 
       
   155 		
       
   156 
       
   157 
       
   158     private: // from CCoeControl
       
   159 		
       
   160 		HBufC* iPrevGotoContent;//to compare if there were really any changes!   
       
   161 		
       
   162     private: // private members
       
   163 				
       
   164 		CBrowserPopupList* iList;//owned
       
   165 		CDesCArrayFlat* iItems;//owned
       
   166 		CDesCArrayFlat* iItemNames;//owned
       
   167 		CDesCArrayFlat* iItemNamesToShow;//owned
       
   168 		CEikEdwin* iEditor;//Editor of the GotoPane
       
   169 		TInt iItemNo;
       
   170 		TInt iPrevItem;
       
   171 		TBool iPoppedUp;//it shows wheter it is popped up
       
   172 		TAknPopupWindowLayoutDef iLayout;
       
   173 		HBufC* iFirstGotoContent;
       
   174 		CRecentUrlStore*	iRecentUrlStore; // not owned
       
   175 		TBool iDirectoryMode;//this shows wheter it is in a directory
       
   176         TBool iOpenCBA;//this shows whether Open directory shuold be showed
       
   177         CCoeControl *iParent;
       
   178         TAknLayoutRect iCover, iShadow, iOutline, iInside;
       
   179         CFormattedCellListBoxItemDrawer *iItemDrawer;
       
   180         TParentType iParentType;
       
   181         TBool iUrlCompletionMode;
       
   182         HBufC* iUrlSuffixBuf;
       
   183         TBool iTouchSupported;
       
   184         TInt iMaxRecentUrlsToShow;
       
   185         // shows whether search feature is enabled or not.
       
   186         TBool iSearchFeature; 
       
   187     };
       
   188 
       
   189 #endif  // BROWSERADAPTIVELISTPOPUP_H
       
   190 
       
   191 // End of File