logsui/AppSrc/CLogsBaseControlContainer.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002 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 "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: 
       
    15 *     Logs Application view control container superclass
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef     __Logs_App_CLogsBaseControlContainer_H__
       
    21 #define     __Logs_App_CLogsBaseControlContainer_H__
       
    22 
       
    23 //  INCLUDES
       
    24 
       
    25 #include <coecntrl.h>	// CCoeControl
       
    26 #include <aknlists.h>	// iListBox's format
       
    27 
       
    28 #include "LogsConsts.h"
       
    29 #include "Logs.hrh"
       
    30 
       
    31 //#include <aknlongtapdetector.h>
       
    32 
       
    33 
       
    34 // CONSTANTS
       
    35 
       
    36 // MACROS
       
    37 
       
    38 // DATA TYPES
       
    39 
       
    40 // FUNCTION PROTOTYPES
       
    41 
       
    42 // FORWARD DECLARATIONS
       
    43 class CAknIconArray;
       
    44 class CGulIcon;
       
    45 class CEikListBox;
       
    46 class CEikStatusPane;
       
    47 class MLogsKeyProcessor;
       
    48 class CAknNavigationDecorator;
       
    49 class CAknNavigationControlContainer;
       
    50 class MLogsNaviDecoratorWrapper;
       
    51 
       
    52 // CLASS DECLARATION
       
    53 
       
    54 /**
       
    55  * Logs Application view control container superclass.
       
    56  * Provides functionality common to all control containers. Derive specialized 
       
    57  * control containers from this class to use the common functionality.
       
    58  * The control container encapsulates and creates the actual controls 
       
    59  * implementing the view. It also receives view's keyboard events and maps them
       
    60  * to application commands or forwards the events to child controls for 
       
    61  * processing.
       
    62  * If derived control container class contains more than 1 component
       
    63  * functions:
       
    64  * - SetFocus
       
    65  * - OfferKeyEventL
       
    66  * - CountComponentControls must be rewritten
       
    67  * The application view creates and owns the control container.
       
    68 */
       
    69 
       
    70 class CLogsBaseControlContainer
       
    71 	: public CCoeControl
       
    72 	, public MCoeControlObserver				
       
    73 	//, public MAknLongTapDetectorCallBack    // For long tap event callback handling
       
    74 	{
       
    75 	protected: // construction
       
    76 		/**
       
    77 		 * C++ Constructor
       
    78 		 *   
       
    79 		 * @param aKeyProcessor pointer to keyprocessor view
       
    80 		 */
       
    81 		CLogsBaseControlContainer( MLogsKeyProcessor* aKeyProcessor );
       
    82  
       
    83 		/**
       
    84 		 * C++ Destructor
       
    85 		 * Needed to delete the iLongTapDetector object
       
    86 		 */
       
    87 		~CLogsBaseControlContainer(); 
       
    88 
       
    89 		/**
       
    90 		 * Second phase base class constructor
       
    91 		 */
       
    92         void BaseConstructL();
       
    93 
       
    94 private: 
       
    95 		/**
       
    96 		 * C++ Constructor
       
    97 		 */
       
    98 		CLogsBaseControlContainer();
       
    99 
       
   100 
       
   101 	protected:  // Generic operations
       
   102 		/**
       
   103 		 * Make title
       
   104 		 * @param aResourceText resource to create title
       
   105 		 */
       
   106 		void MakeTitleL( TInt aResourceText );
       
   107 
       
   108 		/**
       
   109 		 * Make title
       
   110 		 * @param aText title text
       
   111 		 */
       
   112 		void MakeTitleL( const TDesC& aText );
       
   113 
       
   114 		/**
       
   115 		 * Appui's status pane getter
       
   116 		 * @return Statuspane pointer
       
   117 		 */
       
   118 		CEikStatusPane* StatusPane();
       
   119 
       
   120 		/**
       
   121 		 * Navi pane getter
       
   122 		 * @return navipane pointer
       
   123 		 */
       
   124 		CAknNavigationControlContainer* NaviPaneL();
       
   125 
       
   126 		/**
       
   127 		 * Navigation decorator tabulator getter
       
   128 		 *
       
   129 		 * @param aResource navigation bar resource id
       
   130 		 * @param interface for singleton wrapper CLogsNaviDecoratorWrapper
       
   131 		 *        (passed as an interface to hide it from Logs Plugin)
       
   132 		 * @return navigation decorator
       
   133 		 */
       
   134 		CAknNavigationDecorator* NavigationTabGroupL( TInt aResource, 
       
   135 		                                              MLogsNaviDecoratorWrapper*  aNaviDecoratorWrapper );
       
   136 
       
   137        /**
       
   138 		 *  Append a color icon to icon array. CAknIconArray owns icons so it is 
       
   139 		 *  easier to it leave safely.
       
   140 		 *
       
   141 		 *  @param aIcons                 Icon array
       
   142 		 *  @param aIconFile              Icon file name without path
       
   143 		 *  @param aIconGraphicsIndex     Picture index.
       
   144 		 *  @param aIconGraphicsMaskIndex Mask index.
       
   145 		 */
       
   146         void AddColorIconL
       
   147                 (	CAknIconArray* aIcons
       
   148 				,	const TDesC& aIconFile
       
   149                 ,   TAknsItemID aSkinnedIcon
       
   150 				,	TInt aIconGraphicsIndex
       
   151 				,	TInt aIconGraphicsMaskIndex
       
   152 				);
       
   153             
       
   154 		/**
       
   155 		 *  Append icon to icon array. CAknIconArray owns icons so it is 
       
   156 		 *  easier to it leave safely.
       
   157 		 *
       
   158 		 *  @param aIcons                 Icon array
       
   159 		 *  @param aIconFile              Icon file name without path
       
   160 		 *  @param aIconGraphicsIndex     Picture index.
       
   161 		 *  @param aIconGraphicsMaskIndex Mask index.
       
   162 		 */
       
   163 		void AddIconL
       
   164 				(	CAknIconArray* aIcons
       
   165 				,	const TDesC& aIconFile
       
   166                 ,   TAknsItemID aSkinnedIcon
       
   167 				,	TInt aIconGraphicsIndex
       
   168 				,	TInt aIconGraphicsMaskIndex
       
   169 				);
       
   170 
       
   171 		/**
       
   172 		 *  Append icon to icon array. CAknIconArray owns icons so it is 
       
   173 		 *  easier to it leave safely.
       
   174 		 *
       
   175 		 *  @param aIcons                 Icon array
       
   176 		 *  @param aIconFile              Icon file name with full path
       
   177 		 *  @param aIconGraphicsIndex     Picture index.
       
   178 		 *  @param aIconGraphicsMaskIndex Mask index.
       
   179 		 */
       
   180         void AddIconWithPathL
       
   181                 ( CAknIconArray* aIcons
       
   182                 ,  const TDesC& aIconFileWithPath   //File name with full path
       
   183                 ,  TAknsItemID aSkinnedIcon
       
   184                 ,  TInt aIconGraphicsIndex
       
   185                 ,  TInt aIconGraphicsMaskIndex 
       
   186                 );
       
   187 
       
   188 		/**
       
   189 		 *  Makes view's one line with the given information
       
   190 		 *
       
   191 		 *  @param  aItems          Array where to put the line information
       
   192 		 *  @param  aText           Icon index and tabulator
       
   193 		 *  @param  aResourceText   The resource index of text to be shown
       
   194 		 *  @param  aSecondLineText Second line text. Defaul is one space
       
   195 		 */
       
   196 		void MakeListBoxLineL
       
   197 				(	CDesCArrayFlat* aItems
       
   198 				,	const TDesC& aText
       
   199 				,	TInt aResourceText
       
   200 				,	const TDesC& aSecondLineText = KSpace
       
   201 				);
       
   202 
       
   203 		/**
       
   204 		 *  Make the empty listbox text from the given resource text
       
   205 		 *
       
   206 		 *  @param  aListBox    The listbox pointer on where to make the text
       
   207 		 *  @param  aResourceText   The resource text
       
   208 		 */
       
   209 		void MakeEmptyTextListBoxL
       
   210 				(	CEikListBox* aListBox
       
   211 				,	TInt aResourceText
       
   212 				);
       
   213 				
       
   214 	    /**
       
   215 		 *  Contstruct a "Logging not enabled" informative text
       
   216 		 *  to be shown in an empty listbox
       
   217 		 *
       
   218 		 *  @return  The text buffer
       
   219 		 */		
       
   220 		HBufC* MakeNoLogTextLC();			
       
   221 
       
   222 	public:
       
   223 		/**
       
   224 		 *  Makes the scroll up/down arrows visible
       
   225 		 *
       
   226 		 *  @param  aListBox    The listbox where to point
       
   227 		 */
       
   228 		void MakeScrollArrowsL( CEikListBox* aListBox );
       
   229 
       
   230 		/**
       
   231 		* From CCoeControl
       
   232 		*/
       
   233 		void HandleResourceChange( TInt aType );
       
   234 
       
   235 		/**
       
   236 		 *  Restore original Logs icon to Context Pane
       
   237 		 */
       
   238         void SetContextPanePictureToDefaultL();
       
   239         
       
   240        /**
       
   241         *  Restore original Logs title pane text according to current view
       
   242         *  
       
   243         *  @param  aViewId  the current logs view id
       
   244         */
       
   245         void SetTitlePaneTextToDefaultL(TLogsViewIds aViewId);
       
   246 
       
   247 	protected:  // from CCoeControl
       
   248 		/**
       
   249 		 * Focus update
       
   250 		 * @param aFocus, 
       
   251 		 * @param aDrawNow, 
       
   252 		 */
       
   253 		void SetFocus( TBool aFocus, TDrawNow aDrawNow = ENoDrawNow );
       
   254 
       
   255 		/**
       
   256 		 * Receives keyboard events for the view. Called by the CONE subsystem.
       
   257 		 *  
       
   258 		 * @return EKeyWasConsumed if the keyboard event was consumed.
       
   259 		 * @return EKeyWasNotConsumed if the keyboard was not consumed.
       
   260 		 */
       
   261 		virtual TKeyResponse OfferKeyEventL
       
   262 								(	const TKeyEvent& aKeyEvent
       
   263 								,	TEventCode aType
       
   264 								);
       
   265 		
       
   266 		// --------- currently not needed ------------------------------
       
   267 		//  			
       
   268 	    /**
       
   269 	     * Called by the framework when a (touch ui) pointer event happens
       
   270 		 *
       
   271 		 * @param aPointerEvent 	The pointer event
       
   272 		 */
       
   273 	    //void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
   274 	    
       
   275 	    /**
       
   276 	     * Default callback function for CAknLongTapDetector member object.
       
   277 	     * Base class implementation does nothing
       
   278 	     * 
       
   279 		 * @param aPenEventLocation Long tap event location relative to parent control.
       
   280          * @param aPenEventScreenLocation Long tap event location relative to screen.
       
   281 		 */
       
   282 	    //void HandleLongTapEventL( const TPoint& aPenEventLocation, 
       
   283         //                      	const TPoint& aPenEventScreenLocation );
       
   284         //
       
   285         // --------------------------------------------------------------	
       
   286         
       
   287         /**
       
   288          * Virtual getter for the containers ListBox instance.
       
   289          * Called from the HandlePointerEventL cause we need to pass the 
       
   290          * pointer event to the ListBox.
       
   291          *
       
   292          * @return 	Pointer to the list box 
       
   293          */                    	  
       
   294         virtual CEikListBox* ListBox();
       
   295 
       
   296 		/**
       
   297 		 *  Returns the count of child controls.
       
   298 		 *
       
   299 		 *  @return Count of the sub controls.
       
   300 		 */
       
   301 		TInt CountComponentControls() const;
       
   302 
       
   303 		/**
       
   304 		 *  Called from HandleResourceChange. Base class version has no
       
   305 		 *  implementation.
       
   306 		 *
       
   307 		 */
       
   308 		virtual void AddControlContainerIconsL();
       
   309 
       
   310 	protected:  // MCoeControlObserver
       
   311 		/**
       
   312 		 * Handles event from observed control.
       
   313 		 *
       
   314 		 * @param aControl   The control that sent the event.
       
   315 		 * @param aEventType The event type.
       
   316 		 */
       
   317 		void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
       
   318 
       
   319 	protected:
       
   320         /// Ref: keyprocessor
       
   321         MLogsKeyProcessor*		iKeyProcessor;
       
   322         
       
   323         //CAknLongTapDetector* 	iLongTapDetector; 
       
   324 	};
       
   325 
       
   326 #endif  // __Logs_App_CLogsBaseControlContainer_H__
       
   327 
       
   328 
       
   329 // End of File
       
   330