mmuifw_plat/mul_widget_api/inc/mul/imulwidget.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 all Multimedia widgets.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef I_MULWIDGET_H
       
    20 #define I_MULWIDGET_H
       
    21 
       
    22 #include <alf/alftypes.h>
       
    23 #include <alf/ialfwidgeteventhandler.h>
       
    24 #include <alf/ialfinterfacebase.h>
       
    25 #include <alf/ialfwidget.h> 
       
    26 #include <alf/alflayout.h> 
       
    27 #include <mul/mulvisualitem.h>
       
    28 #include <e32base.h>
       
    29 #include <gdi.h>
       
    30 #include <osn/ustring.h>
       
    31 
       
    32 using namespace osncore;
       
    33 
       
    34 // Include widget observer 
       
    35 
       
    36 namespace Alf
       
    37 	{
       
    38 	class IMulModelAccessor;
       
    39 
       
    40 	namespace mulwidget
       
    41 		{
       
    42 		static const IfId Ident=
       
    43 			{
       
    44 					0, "mulwidget"
       
    45 			};
       
    46 			
       
    47 		enum TLogicalTemplate
       
    48 			{
       
    49 			KTemplateUnknown = 0,
       
    50 			KTemplate1 ,
       
    51 			KTemplate2,
       
    52 			KTemplate3,
       
    53 			KTemplate4,
       
    54 			KTemplate5,
       
    55 			KTemplate6,
       
    56 			KTemplate7,
       
    57 			KTemplate8,
       
    58 			KTemplate9,
       
    59 			KTemplate10,
       
    60 			KTemplate11,
       
    61 			KTemplate12,
       
    62 			KTemplate13,
       
    63 			KTemplate14
       
    64 			};
       
    65 		/*
       
    66 		static const char* const KTemplate1 = "logical_template_1";
       
    67 		static const char* const KTemplate2 = "logical_template_2";
       
    68 		static const char* const KTemplate3 = "logical_template_3";
       
    69 		static const char* const KTemplate4 = "logical_template_4";
       
    70 		static const char* const KTemplate5 = "logical_template_5";
       
    71 		static const char* const KTemplate6 = "logical_template_6";
       
    72 		static const char* const KTemplate7 = "logical_template_7";
       
    73 		static const char* const KTemplate8 = "logical_template_8";
       
    74 		static const char* const KTemplate9 = "logical_template_9";
       
    75 		static const char* const KTemplate10 = "logical_template_10";
       
    76 		static const char* const KTemplate11 = "logical_template_11";
       
    77 		static const char* const KTemplate12 = "logical_template_12";
       
    78 		static const char* const KTemplate13 = "logical_template_13";
       
    79 		static const char* const KTemplate14 = "logical_template_14";
       
    80 		*/
       
    81 		}
       
    82 
       
    83 	/**
       
    84 	 *  An interface for all Multimedia widgets.
       
    85 	 *  Widgets consist of control and visualization elements.
       
    86 	 *  Model owned by the application.
       
    87 	 * 	
       
    88 	 *	Interface paradigm would be used in a restrictive way.
       
    89 	 *  Controls are owned by Alfred environment.
       
    90 	 *  Widgets can be constructed using the widget factory.
       
    91 	 *  Widgets are owned and accessed using the Alfred
       
    92 	 *  environment.
       
    93 	 */
       
    94 	class IMulWidget : public IAlfWidget // base class 
       
    95 		{
       
    96 	public:
       
    97 	
       
    98 		/*! @enum TMulVisualEffect
       
    99 		 * This enumeration defines Visual effect that widget support
       
   100 		 * 
       
   101 		 */
       
   102 		enum TMulVisualEffect
       
   103 		    {
       
   104 			EHighlightTransition = 1    /*!< Highlight transition effect.*/
       
   105 	    	};
       
   106 
       
   107     	enum TMulVisualType
       
   108 			{
       
   109 			ETextVisual = 1,    /*!< Color of the text in the widgets.*/
       
   110 			ECoverflowCounterVisual,     /*!< Color of the Counter text in the Coverflow Widget.*/
       
   111 			EItemBackgroundBrush,         /*!< Color of the Item brush in the Widget.*/  
       
   112 			EThumbnailBackgroundBrush		/*!< Color for the background of the thumbnail image. Currently used in list widget only.*/
       
   113 			};
       
   114 			
       
   115 		/*! @enum TMulRotation
       
   116 		 * This enumeration defines Rotation effect that widget supports
       
   117 		 * 
       
   118 		 */		
       
   119 		enum TMulRotation
       
   120 			{
       
   121 			ERotateLeft = 1, /*!< For left rotation*/
       
   122 			ERotateRight	/*!< For right rotation*/
       
   123 			};	
       
   124     	
       
   125 		/**
       
   126 		 * Getter for the type identifier of this interface.
       
   127 		 *
       
   128 		 * @return A descriptor to identify the type of this interface.
       
   129 		 **/
       
   130 		static inline const IfId& Type()
       
   131 			{
       
   132 			return mulwidget::Ident;
       
   133 			}
       
   134 
       
   135 		/**
       
   136 		 * Set the data model for this widget.  Widget uses the data model via 
       
   137 		 * IMulModelAccessor interface. Does not take ownership of the accessor
       
   138 		 * and there can be only one accessor to the widget at any point. This 
       
   139 		 * will remove the binding to previous accessor, if any. Before 
       
   140 		 * deleting the accessor application should remove the binding to 
       
   141 		 * widget by calling the api by passing NULL.
       
   142 		 *
       
   143 		 * @param aAccessor  model to be set for widget
       
   144 		 */
       
   145 		virtual void SetModel(IMulModelAccessor* aAccessor , bool aFlag = true) = 0;
       
   146 
       
   147 		/**
       
   148 		 * Set the size and position of the widget.All parameter values are in pixels and are relevant 
       
   149 		 * to the parent of the widget.
       
   150 		 *
       
   151 		 * @param aLeftMargin  margin for the left border (top left x co-ordinate value)
       
   152 		 * @param aTopmargin   margin for the top border (top left y co-ordinate value)
       
   153 		 * @param aHeight      height of widget
       
   154 		 * @param aWidth       width of widget
       
   155 		 * @param aTransitionTime       Transition Time in MilliSeconds
       
   156 		 */
       
   157 		virtual void SetRect(int aLeftMargin, int aTopmargin, int aHeight,
       
   158 				int aWidth, int aTransitionTime =0) = 0;
       
   159 
       
   160 		/**
       
   161 		 * To hide and unhide Widget.
       
   162 		 *
       
   163 		 * @param aShow                 value to hide/unhide the Widget 
       
   164 		 * @param aTransitionTime       Transition Time in MilliSeconds
       
   165 		 */
       
   166 		virtual void ShowWidget(bool aShow, int aTransitionTime =0) = 0;
       
   167 		
       
   168 		/**
       
   169 		 * Get the icon size from the template
       
   170 		 *
       
   171 		 * @param atemplateId           Logical Template Id 
       
   172 		 * @param aAttribute            Attribute name of the Icon
       
   173 		 * @param aHeight               Height of the Icon
       
   174 		 * @param aWidth                Width of the Icon
       
   175 		 */
       
   176 		virtual void GetIconSize( mulwidget::TLogicalTemplate aTemplateId, 
       
   177 		    mulvisualitem::TVisualAttribute aAttribute, int& aHeight, int& aWidth) = 0;
       
   178 
       
   179 		/**
       
   180 		 * Get the icon size from the template
       
   181 		 *
       
   182 		 * @param aAttribute            Attribute name of the Icon
       
   183 		 * @param aHeight               Height of the Icon
       
   184 		 * @param aWidth                Width of the Icon
       
   185 		 */
       
   186 		virtual void GetIconSize( 
       
   187 		    mulvisualitem::TVisualAttribute aAttribute, int& aHeight, int& aWidth) = 0;
       
   188 		    	
       
   189 		    	
       
   190 		    /**
       
   191 		 * Add an observer to widget inorder to get event notifications
       
   192 		 * from the widget. Widget can have multiple observersers.
       
   193 		 *
       
   194 		 * @param aObserver Observer of widget.
       
   195 		 **/
       
   196 		virtual void AddEventHandler( IAlfWidgetEventHandler& aObserver) = 0;
       
   197 
       
   198 		/**
       
   199 		 * Remove an observer to widget
       
   200 		 *
       
   201 		 * @param aObserver Observer of widget.
       
   202 		 */
       
   203 		virtual void RemoveEventHandler( IAlfWidgetEventHandler& aObserver) = 0;  
       
   204 		
       
   205 		/**
       
   206 		* Get the Container Layout for widget.
       
   207 		*
       
   208 		* @return Container layout of the widget. This can be used to set the position of widget.
       
   209 		*/
       
   210 		virtual const CAlfLayout& ContainerLayout() = 0;
       
   211 		
       
   212 		
       
   213 		/**
       
   214 		 * Set Transaction/Animation time for variaous visual effect.
       
   215 		 *
       
   216 		 * @param aVisualEffect         Visual effect to which animation time/transation time to set
       
   217 		 * @param aTransitionTime       Transition Time in MilliSeconds
       
   218 		 *
       
   219 		 * <B>Examples:</b>
       
   220 		 * @code
       
   221 		 * Set the animation time.
       
   222 		 *
       
   223 		 *      mListWidget->SetAnimationTime( TMulVisualEffect::EHighlightTransition, 1000 );
       
   224 		 * @endcode
       
   225 		 */
       
   226 		virtual void SetAnimationTime( TMulVisualEffect aVisualEffect, int aTransitionTime = 0 ) = 0;
       
   227 		 
       
   228 		/**
       
   229 		 * Set the color and opacity of the visual for various visuals as per the widget.
       
   230 		 *  Also used to set the background transparent.
       
   231 		 *
       
   232 		 * @param aVisualType visual to which color is to be applied.
       
   233 		 * @param aColor RGB color
       
   234 		 *
       
   235 		 * NOTE: TRgb with the alpha is mandatory .,if application doesnt sets the alpha results in the 0-opacity-Transparent.
       
   236 		 *        so applications always should use TRgb with alpha constructor: like- TRgb(TUint32 color,TInt alpha);
       
   237 		 * 
       
   238 		 * <B>Examples: To Set the color and opacity of the thumbnail background </b>
       
   239 		 * @code
       
   240 		 * Set the color and alpha of the visual.0x008090 and 0 respectively.
       
   241 		 *
       
   242 		 * iMyWidget->SetVisualColor( TMulVisualColor::EThumbnailBackgroundColor, TRgb(0x008090,0) );
       
   243 		 * Here 0(zero) implies opacity - 1. 
       
   244 		 * @endcode
       
   245 		 * 
       
   246          * <B>Examples: To make the background Transparent </b>
       
   247          * @code
       
   248          * Set the color and alpha of the visual.0x008090 and 255 respectively.
       
   249          *
       
   250          * iMyWidget->SetVisualColor( TMulVisualColor::EThumbnailBackgroundColor, TRgb(0x008090,255) );
       
   251          * Here 255 alpha implies Transparent Background.No matter what the color is.
       
   252          * @endcode
       
   253 		 * 		 
       
   254 		 */
       
   255 		virtual void SetVisualColor( TMulVisualType aVisualType , const TRgb& aColor ) = 0;
       
   256  
       
   257 		    
       
   258 		/** 
       
   259 		 *
       
   260 		 Virtual destructor. 
       
   261 		 **/
       
   262 		virtual ~IMulWidget()
       
   263 			{
       
   264 			}
       
   265 
       
   266 		};
       
   267 
       
   268 	} // namespace Alf
       
   269 
       
   270 #endif // I_MULWIDGET_H
       
   271