application/inc/PodcastListView.h
changeset 2 29cda98b007e
child 13 f58e3c482bd9
equal deleted inserted replaced
1:5f8e5adbbed9 2:29cda98b007e
       
     1 /*
       
     2 * Copyright (c) 2007-2010 Sebastian Brannstrom, Lars Persson, EmbedDev AB
       
     3 *
       
     4 * All rights reserved.
       
     5 * This component and the accompanying materials are made available
       
     6 * under the terms of the License "Eclipse Public License v1.0"
       
     7 * which accompanies this distribution, and is available
       
     8 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     9 *
       
    10 * Initial Contributors:
       
    11 * EmbedDev AB - initial contribution.
       
    12 *
       
    13 * Contributors:
       
    14 *
       
    15 * Description:
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef PODCASTLISTVIEWH
       
    20 #define PODCASTLISTVIEWH 
       
    21 
       
    22 #include <aknview.h>
       
    23 #include <aknlists.h> 
       
    24 #include <eiklbo.h>
       
    25 #include <aknsbasicbackgroundcontrolcontext.h>
       
    26 #include <AknToolbarObserver.h>
       
    27 #include <AknToolbar.h>
       
    28 #include <aknlongtapdetector.h>
       
    29 #include <aknstyluspopupmenu.h>
       
    30 #include <aknprogressdialog.h> 
       
    31 #include <aknwaitdialog.h> 
       
    32 #include "PodcastModel.h"
       
    33 
       
    34 class CAknDoubleLargeStyleListBox;
       
    35 class CEikFormattedCellListBox;
       
    36 
       
    37 
       
    38 class MKeyEventListener {
       
    39 public:
       
    40 virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) = 0;
       
    41 };
       
    42 
       
    43 class MPointerListener {
       
    44 public:
       
    45 virtual void PointerEventL(const TPointerEvent& aPointerEvent) = 0;
       
    46 };
       
    47 
       
    48 class CPodcastListContainer : public CCoeControl
       
    49     {
       
    50     public: 
       
    51 		CPodcastListContainer();
       
    52 		~CPodcastListContainer();
       
    53 		void ConstructL( const TRect& aRect, TInt aListboxFlags );
       
    54 		void SizeChanged();
       
    55         TInt CountComponentControls() const;
       
    56         CCoeControl* ComponentControl( TInt aIndex ) const;
       
    57 		void HandleResourceChange(TInt aType);
       
    58 		virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
       
    59 		void SetKeyEventListener(MKeyEventListener *aKeyEventListener);
       
    60 		void SetPointerListener(MPointerListener *aPointerListener);
       
    61 		
       
    62 		CEikFormattedCellListBox* Listbox();
       
    63 		void ScrollToVisible();
       
    64     	void Draw(const TRect& aRect) const;
       
    65 		CEikFormattedCellListBox * iListbox;		
       
    66 
       
    67 	protected:
       
    68 		TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
       
    69 		virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
    70 
       
    71 	private:
       
    72 		MKeyEventListener* iKeyEventListener;
       
    73 		MPointerListener* iPointerListener;
       
    74         CAknsBasicBackgroundControlContext* iBgContext;
       
    75 	};
       
    76 
       
    77 
       
    78 class CPodcastListView : public CAknView, public MAknToolbarObserver,
       
    79 public MPointerListener, public MAknLongTapDetectorCallBack, 
       
    80 public MProgressDialogCallback, public MKeyEventListener
       
    81     {
       
    82     public: 
       
    83         ~CPodcastListView();
       
    84 	protected:
       
    85 	    void ConstructL();
       
    86 		CPodcastListView();	
       
    87 
       
    88 		/** 
       
    89 		 * Handles a view activation and passes the message of type 
       
    90 		 * @c aCustomMessageId. This function is intended for overriding by 
       
    91 		 * sub classes. This function is called by @c AknViewActivatedL().
       
    92 		 * @param aPrevViewId Specifies the view previously active.
       
    93 		 * @param aCustomMessageId Specifies the message type.
       
    94 		 * @param aCustomMessage The activation message.
       
    95 		 */
       
    96 		void DoActivateL(const TVwsViewId& aPrevViewId,
       
    97 	                                  TUid aCustomMessageId,
       
    98 	                                  const TDesC8& aCustomMessage);
       
    99 
       
   100 	    /** 
       
   101 		 * View deactivation function intended for overriding by sub classes. 
       
   102 		 * This function is called by @c AknViewDeactivated().
       
   103 		 */
       
   104 		void DoDeactivate();
       
   105 
       
   106 		void HandleViewRectChange();
       
   107 		
       
   108 		/** 
       
   109 		* Event handler for status pane size changes.
       
   110 		* @c CAknView provides an empty implementation for sub classes that do 
       
   111 		* not want to handle this event.
       
   112 		*/
       
   113 		void HandleStatusPaneSizeChange();
       
   114 				
       
   115 		/** 
       
   116 		* Command handling function intended for overriding by sub classes. 
       
   117 		* Default implementation is empty.  
       
   118 		* @param aCommand ID of the command to respond to. 
       
   119 		*/
       
   120 		void HandleCommandL(TInt aCommand);
       
   121 
       
   122 		void OfferToolbarEventL(TInt aCommand);
       
   123 		void DynInitToolbarL (TInt aResourceId, CAknToolbar *aToolbar);
       
   124 
       
   125 		virtual void UpdateListboxItemsL() = 0;
       
   126 		
       
   127         void RunAboutDialogL();
       
   128         void SetEmptyTextL(TInt aResourceId);
       
   129         void ShowOkMessage(TDesC &aText);
       
   130         void ShowErrorMessage(TDesC &aText);
       
   131         TInt ShowQueryMessage(TDesC &aText);
       
   132 		void CloseToolbarExtension();
       
   133 		void ShowWaitDialogL(TDesC &aWaitText);
       
   134 		void CloseWaitDialog();
       
   135 
       
   136 		// From MAknLongTapDetectorCallBack
       
   137 		virtual void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation );
       
   138 		 
       
   139 		// from MProgressDialogCallback		
       
   140 		void DialogDismissedL(TInt /*aButtonId*/) {}
       
   141 
       
   142 		// from MKeyEventListener
       
   143 		virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
       
   144 
       
   145 		// from MPointerListener
       
   146 		void PointerEventL(const TPointerEvent& aPointerEvent);
       
   147 
       
   148 		virtual void UpdateToolbar() = 0;
       
   149 	protected:
       
   150 		 CPodcastListContainer* iListContainer;
       
   151 		 /** Previous activated view */
       
   152 		 TVwsViewId iPreviousView;
       
   153 
       
   154 		 /** Listbox flags which the listbox is created with*/
       
   155 		 TInt iListboxFlags;
       
   156 		 
       
   157 		 CDesCArray* iItemArray;
       
   158 		 RArray<TUint> iItemIdArray;
       
   159 		 
       
   160 		 TBuf<1024> iListboxFormatbuffer;
       
   161 		 
       
   162 		 CAknToolbar *iToolbar;
       
   163 		 CAknStylusPopUpMenu* iStylusPopupMenu;
       
   164 		 CAknLongTapDetector* iLongTapDetector;
       
   165 		 CAknWaitDialog *iWaitDialog;
       
   166 
       
   167     };
       
   168 #endif // PODCASTBASEVIEWH
       
   169