examples/sfexamples/Wikipedia/inc/SearchContainer.h

00001 // 
00002 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
00003 // All rights reserved.
00004 // This component and the accompanying materials are made available
00005 // under the terms of the License "Eclipse Public License v1.0"
00006 // which accompanies this distribution, and is available
00007 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
00008 // 
00009 // Initial Contributors:
00010 // Nokia Corporation - initial contribution.
00011 // 
00012 // Contributors:
00013 // 
00014 // Description:
00015 // 
00016 
00017 
00018 
00019 #ifndef __SEARCH_CONTAINER_H__
00020 #define __SEARCH_CONTAINER_H__
00021 
00022 
00023 
00024 // INCLUDES
00025 #include <aknview.h>
00026 #include <akndef.h>
00027 #include "WikiDb.h"
00028 
00029 // FORWARD DECLARATION
00030 class CAknSingleStyleListBox;
00031 class CAknSearchField;
00032 class CAknNavigationDecorator;
00033 class CAknNavigationControlContainer;
00034 class CSearchView;
00035 class CRecCountContainer;
00036 class CWikiDb;
00037 
00038 // CLASS DECLARATION
00039 
00045 class CSearchContainer : public CCoeControl, public MCoeControlObserver, public MWikiCountObserver
00046     {
00047     public: // Constructors and destructor
00048 
00056         static CSearchContainer* NewL( const TRect& aRect, CSearchView& aView, CRecCountContainer& aRecContainer );
00057 
00065         static CSearchContainer* NewLC( const TRect& aRect, CSearchView& aView, CRecCountContainer& aRecContainer );
00066 
00072         void ConstructL( const TRect& aRect );
00073                 
00078         ~CSearchContainer();
00079 
00080     private: // Constructor
00081     
00086         CSearchContainer( CSearchView& aView, CRecCountContainer& aRecContainer );    
00087         
00088     public: // from CoeControl
00089 
00094         TInt CountComponentControls() const;
00095 
00101         CCoeControl* ComponentControl( TInt aIndex ) const;
00102         
00106         void SizeChanged();
00107          
00111         void HandleResourceChange( TInt aType );        
00112 
00121         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
00122              TEventCode aType );
00123         
00124     public: // From MCoeControlObserver
00125 
00132             void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
00133         
00134     public: // from MWikiCountObserver
00135 
00136                 void CountUpdatedL( TInt aError );          
00137             
00138     public: // New functions
00139     
00140                 void RefreshL( TBool aResetNaviPane = EFalse );
00141 
00142                 TBool ZeroItemsInList() { return iItemArray->MdcaCount() == 0; };
00143 
00144         void HandleSelectCommandL();
00145                 
00146     private: // New functions
00147     
00148         void CreateListBoxL();
00149         void CreateFindBoxL();  
00150 
00155         void SetNaviPaneTextL( const TDesC& aText, TBool aShowLeft, TBool aShowRight );
00156         void UpdateListBoxL();
00157         void PopulateItemArrayL();
00158 
00159         TBool CanScrollPrev();
00160         TBool CanScrollNext();          
00161         void GotoPrevPageL();
00162         void GotoNextPageL();
00163 
00164         HBufC* GetSearchTextLC();       
00165         void AppendItemToListL( CDesCArray& aList, const TDesC& aItem );
00166         HBufC* FormatListItemLC( const TDesC& aItem );
00167         TPtrC DeFormatListItem( const TDesC& aFormattedItem );
00168         TBool IsSearchTextPresent() { return ( iSearchText->Length() > 0 ); } ;
00169         void SetRecCountAndDrawL( const TInt aRecCount );       
00170         
00171     private: // Member data
00172 
00176         CSearchView& iView;
00177         
00181         CRecCountContainer& iRecContainer;
00182         
00186         CWikiDb& iWikiEngine;
00187         
00191         CAknSingleStyleListBox* iListBox;
00192         
00196         CAknSearchField* iFindBox;
00197 
00201         CAknNavigationDecorator* iNaviDecorator;
00202 
00206         CAknNavigationControlContainer* iNaviPane;
00207         
00211         CDesCArray* iItemArray;         
00212         
00216         HBufC* iSearchText;
00217     };
00218 
00219 #endif // __SEARCH_CONTAINER_H__
00220 
00221 
00222 // End of File

Generated by  doxygen 1.6.2