mmuifw_plat/mul_widget_api/inc/mul/imulmultiitemwidget.h
changeset 17 3eca7e70b1b8
parent 3 4526337fb576
equal deleted inserted replaced
3:4526337fb576 17:3eca7e70b1b8
     1 /*
       
     2 * Copyright (c) 2007 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:  The base class for Multimedia multi-item widgets.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef I_MULMULTIITEMWIDGET_H
       
    20 #define I_MULMULTIITEMWIDGET_H
       
    21 
       
    22 // Includes
       
    23 #include <mul/imulwidget.h>
       
    24 
       
    25 // Namespaces used
       
    26 using namespace osncore;
       
    27 
       
    28 namespace Alf
       
    29 	{
       
    30 	    
       
    31     // Forward declaration
       
    32 	class IMulModelAccessor;
       
    33 	
       
    34 	namespace mulmultiitemwidget
       
    35 		{
       
    36 		static const IfId Ident=
       
    37 			{
       
    38 			0, "mulmultiitemwidget"
       
    39 			};
       
    40 		}
       
    41 
       
    42 	/*! @class IMulMultiItemWidget
       
    43 	 *  @brief An interface for all Multimedia multi-item widgets.
       
    44 	 */
       
    45 	class IMulMultiItemWidget : public IMulWidget
       
    46 		{
       
    47 	public:
       
    48 
       
    49 		/*! @enum TMulWidgetPropertiesFlag
       
    50 		 * This enumeration defines some properties for the widgets. These can
       
    51 		 * be enabled or disabled for individual widget instances.
       
    52 		 */
       
    53 		enum TMulWidgetPropertiesFlag
       
    54 			{
       
    55 			EMulWidgetFlagFastScroll = 0x0001, /*!< Enable fast scroll.*/ 
       
    56             EMulWidgetFlagCyclic = 0x0002, /*!< Enable cyclic/looping effect on widget.*/
       
    57             EMulWidgetFlagNaviScroll = 0x0004,  /*!< Enable navi scroll support.*/
       
    58             EMulWidgetFlagCenterFocus = 0x0008, /*!<Deprecated.*/
       
    59             EMulWidgetFlagMultiSelect = 0x0010, /*!< Enable multiple marking/selection in widget. EMulWidgetMarkingMode must be enabled*/
       
    60             EMulWidgetFlagVisible = 0x0020,  /*!< Attribute is of type String.*/
       
    61             EMulWidgetMarkingMode = 0x0040, /*!< Enable marking/selection in widget.Only one item can be marked with this flag*/
       
    62             EMulWidgetFlagDrag = 0x0080, /*!< Enable draging support.*/
       
    63             EMulWidgetImageScaleMode = 0x0100, /*!< Deprecated.*/
       
    64             EMulWidgetFlagSwap = 0x0200, /*!< Applicable only for grid widget for swaping item instead of reorder.*/
       
    65             EMulWidgetFlagSingleTap = 0x0800, /*!< Enable single tap item selection.*/
       
    66             EMulWidgetTitleMarqueeOn = 0x1000, /*!< Enable title marquee for list widget.*/
       
    67             EMulWidgetDoubleTap = 0x0400/*!< Enable double tap .*/ 
       
    68 			};
       
    69 			
       
    70 		/*! @enum TMulAttributeDataType
       
    71 	     * This enumeration defines the attribute data types
       
    72 	     * 
       
    73 	     */
       
    74 		enum TMulAttributeDataType
       
    75 	    	{
       
    76 			EString = 1,    /*!< Attribute is of type String.*/
       
    77 			EDate,          /*!< Attribute is of type Date.*/
       
    78 			ENumeric        /*!< Attribute is of type Numeric.*/
       
    79     		};
       
    80     	/*! @enum TMulReOrderMode
       
    81     	 *
       
    82     	 *	This enumeration defines the Reorder mode
       
    83     	 */
       
    84     	enum TMulReOrderMode
       
    85     	    {
       
    86     	    EReorderShiftOn =1,   /*!< Switch On the Reorder Mode, and Type will be Shift */
       
    87     	    EReorderSwapOn,		  /*!< Switch On the Reorder Mode, and Type will be Swap */
       
    88   	  		EReorderDone,       /*!< Switch Off the Reorder Mode after committing  the reorder changes.*/
       
    89     	    EReorderCancel        /*!< Switch Off the Reorder Mode, with Last Operation Cancel*/    		    		
       
    90           };	
       
    91     		
       
    92 		/**
       
    93 		 * Returns the type identifier of this interface.
       
    94 		 *
       
    95 		 * @return A descriptor to identify the type of this interface.
       
    96 		 */
       
    97 		static inline const IfId& Type()
       
    98 			{
       
    99 			return mulmultiitemwidget::Ident;
       
   100 		}
       
   101 
       
   102 		/**
       
   103 		 * Set a property or a group of properties. Properties not specified are not changed.
       
   104 		 *
       
   105 		 * @param aAnyFlag Property flag(s) to be set. To set more than one property,  
       
   106 		 *                  flags can be ORed.
       
   107 		 * @throw Invalid argument, if unknown/undefined flag is passed.
       
   108 		 * @throw Invalid argument, if the property is not supported by the widget.
       
   109 		 *
       
   110 		 * <B>Examples:</b>
       
   111 		 * @code
       
   112 		 * Set the flag for selection.
       
   113 		 *
       
   114 		 *      mListWidget->SetFlags( IMulMultiItemWidget::EMulWidgetFlagMultiSelect );
       
   115 		 * @endcode
       
   116 		 */
       
   117 		virtual void SetFlags(unsigned int aAnyFlag) = 0;
       
   118 
       
   119 		/**
       
   120 		 * Clear a property or a group of properties. Properties not specified are not changed.
       
   121 		 *
       
   122 		 * @param aAnyFlag  Property flag(s) to be cleared. To clear more than one property,
       
   123 		 *                  the flags can be ORed.
       
   124 		 * @throw Invalid argument, if unknown/undefined flag is passed.
       
   125 		 * @throw Invalid argument, if the property is not supported by the widget.
       
   126 		 *
       
   127 		 * <B>Examples:</b>
       
   128 		 * @code
       
   129 		 * Clear the flag for selection.
       
   130 		 *
       
   131 		 *  	mListWidget->ClearFlags( IMulMultiItemWidget::EMulWidgetFlagMultiSelect );
       
   132 		 * @endcode		 
       
   133 		 */
       
   134 		virtual void ClearFlags(unsigned int aAnyFlag) = 0;
       
   135 
       
   136 		/**
       
   137 		 * Return the status of all the flags. The flags that are set have the 
       
   138 		 * corresponding bit ON.
       
   139 		 *
       
   140 		 * @return All enabled flag(s). The corresponding bit for enabled flag(s) are set to 1.
       
   141 		 *
       
   142 		 * <B>Examples:</b>
       
   143 		 * @code
       
   144 		 * Get all flags status.
       
   145 		 *
       
   146 		 *  	int allFlags = mListWidget->GetFlags();
       
   147 		 * @endcode		 
       
   148 		 */
       
   149 		virtual unsigned int GetFlags() const = 0;
       
   150 
       
   151 		/**
       
   152 		 * Returns the property state, whether flag is on or off for widget.
       
   153 		 *
       
   154 		 * @param aAnyFlag  Flag to be cross-checked
       
   155 		 * @return True if set, False if not set
       
   156 		 *
       
   157 		 * <B>Examples:</b>
       
   158 		 * @code
       
   159 		 * Check if the cyclic flag is set
       
   160 		 *  
       
   161 		 *      if( mListWidget->IsFlagSet( IMulMultiItemWidget::EMulWidgetFlagCyclic ) )
       
   162 		 *          {
       
   163 		 *          ...
       
   164 		 *          }
       
   165 		 * @endcode		 
       
   166 		 */
       
   167 		virtual bool IsFlagSet(TMulWidgetPropertiesFlag aAnyFlag) const = 0;
       
   168 		
       
   169         /**
       
   170 		 * Provide an empty text for the widget. This text is shown if there is no
       
   171 		 * data to be displayed in the widget. Widget makes a copy of the variable
       
   172 		 * and it is safe to call it many times.
       
   173 		 *
       
   174 		 * @param aDefaultText Text to be displayed in empty widget
       
   175 		 *
       
   176 		 * <B>Examples:</b>
       
   177 		 * @code
       
   178 		 * Set the empty text to "No Images"
       
   179 		 *
       
   180 		 *      mListWidget->SetEmptyText( UString("No Images") );
       
   181 		 * @endcode
       
   182 		 */
       
   183 		virtual void SetEmptyText( const UString& aDefaultText ) = 0;
       
   184 
       
   185 		/**
       
   186 		 * Set the data model for this widget. Widget uses the data model via 
       
   187 		 * IMulModelBase interface because it needs to know only limited functionality 
       
   188 		 * about the data model.
       
   189 		 *
       
   190 		 * @param aModel  Model to be set for widget.
       
   191 		 * @param aOwnership Flag which conveys the widget whether it should take 
       
   192 		 * the ownersip of the model or not.
       
   193 		 * @throw Logic error, if same accessor object passed again.
       
   194 		 *
       
   195 		 * <B>Examples:</b>
       
   196 		 * @code
       
   197 		 * Create the data model using widget factory and assign it to a widget.
       
   198 		 *
       
   199 		 *      mWidgetModel = widgetFactory.createModel<IMulModel> (KLoadNameModel);
       
   200 		 *
       
   201          * Set the default visualization for the list items. If the visualization is not 
       
   202          * specified there will be a panic when the model is assigned to the widget.
       
   203          *
       
   204 	     *      mWidgetModel->SetTemplate( UString ( mulwidget::KTemplate6));
       
   205 	     *
       
   206 	     * Setting the data model to the widget. 
       
   207          * 
       
   208 	     *      AddItems(10);
       
   209 	     *      mListWidget->SetModel( mWidgetModel);
       
   210 		 * @endcode
       
   211 		 */
       
   212 	//	virtual void SetModel(IMulModelBase* aModel, bool aOwnership) = 0;		
       
   213 		
       
   214     	/**
       
   215     	 * Set the state of the mark mode.
       
   216     	 *
       
   217     	 * @param aFlag True means mode is On, False means mode is Off.
       
   218     	 *
       
   219 		 * <B>Examples:</b>
       
   220 		 * @code
       
   221 		 * Switch on the mark mode.
       
   222 		 *
       
   223 		 *      mListWidget->SetMarkMode(true);
       
   224 		 * @endcode
       
   225     	 */
       
   226         virtual void SetMarkMode(bool aFlag) = 0;
       
   227     
       
   228         /**
       
   229     	 * Returns the state of the mark mode.
       
   230     	 *
       
   231     	 * @return  Status of the mark mode.
       
   232     	 *
       
   233 		 * <B>Examples:</b>
       
   234 		 * @code
       
   235 		 * Check if the mark mode is On.
       
   236 		 *
       
   237 		 *      if( mListWidget->IsMarkMode() )
       
   238 		 *          {
       
   239 		 *          ...
       
   240 		 *          }
       
   241 		 * @endcode
       
   242     	 */
       
   243     	virtual bool IsMarkMode()const = 0;
       
   244 
       
   245         /**
       
   246     	 * Set the state of the reorder mode.
       
   247     	 *
       
   248     	 * @param aFlag EReorderShiftOn    : Switch on reorder mode in type shift.
       
   249     	 *				EReorderSwapOn     : Switch on reorder mode in type swap.
       
   250     	 *			      EReorderDone       : Switch Off the reorder with operatoin done
       
   251     	 *              EReorderCancel     : Switch off the reorder mode with cancel last operation.
       
   252     	 *
       
   253 		 * <B>Examples:</b>
       
   254 		 * @code
       
   255 		 * Switch on the reorder mode.
       
   256 		 *
       
   257 		 *      mListWidget->SetReorderMode(IMulMultiItemWidget::EReorderShiftOn);
       
   258 		 * @endcode
       
   259     	 */    	
       
   260     	virtual void SetReorderMode(IMulMultiItemWidget::TMulReOrderMode aReorderMode ) = 0;
       
   261 		
       
   262 		
       
   263 		/**
       
   264 		 * Returns whether reorder mode on/off.
       
   265 		 *
       
   266 		 * @return  Reorder Mode On/Off Status.
       
   267 		 *
       
   268 		 * <B>Examples:</b>
       
   269 		 * @code
       
   270 		 * Check if the reorder mode is On.
       
   271 		 *
       
   272 		 *      if( mListWidget->IsReorderModeOn() )
       
   273 		 *          {
       
   274 		 *          ...
       
   275 		 *          }
       
   276 		 * @endcode
       
   277 		 */    	 
       
   278     	virtual bool IsReorderModeOn()const = 0 ;
       
   279     	
       
   280     		
       
   281     	/**
       
   282     	 * During fast scroll mode, the widget displays an overlay with more info.
       
   283     	 * Setter API for the overlay strip.
       
   284     	 *
       
   285     	 * @param aType Attribute data type
       
   286     	 * @param aAttribute Attribute whose value will be shown in the overlay
       
   287     	 * @param aFormat Format string for formatting the value of the attribute
       
   288     	 *
       
   289     	 * <B>Examples:</b>
       
   290 		 * @code
       
   291 		 * Set the overlay to display (Month, Year) as more info.
       
   292 		 *
       
   293 		 *      mListWidget->SetOverlay( IMulMultiItemWidget::EDate, 
       
   294 		 *          UString(mulvisualitem::KMulDetail),
       
   295 		 *          UString("") );
       
   296 		 * @endcode
       
   297     	 */
       
   298     	virtual void SetOverlay(TMulAttributeDataType aType, const UString& aAttribute, const UString& aFormat) = 0 ;
       
   299     	
       
   300 		/**
       
   301 		 * Sets the default image of the widget.
       
   302 		 * This image will be shown when the actual image data is not available
       
   303 		 *
       
   304 		 * @param aTextureId texture id to be used for default image.
       
   305 		 *
       
   306 		 * <B>Examples:</b>
       
   307 		 * @code
       
   308 		 * Set default image in coverflow widget. 
       
   309 		 *
       
   310 		 *     mCoverFlowWidget->SetDefaultImage( 1000 );
       
   311 		 * 
       
   312 		 * @endcode
       
   313 		 */
       
   314        virtual  void SetDefaultImage(int aTextureId) = 0;          	
       
   315 	
       
   316 		/** 
       
   317 		 * Virtual destructor. 
       
   318 		 */
       
   319 		virtual ~IMulMultiItemWidget()
       
   320 			{
       
   321 			}
       
   322 
       
   323 		};
       
   324 
       
   325 	} // namespace Alf
       
   326 
       
   327 #endif // I_MULMULTIITEMWIDGET_H
       
   328